There is no method for hide or show the toolbar after editor initializes. but with the help of css we able to hide and show the toolbar.
editor.component.html
<quill-editor [(ngModel)]="htmlText"
placeholder="Enter Text"
[modules]="quillConfig"
(onSelectionChanged)="onSelectionChanged($event)"></quill-editor>
editor.component.ts
onSelectionChanged = (event) =>{
if(event.oldRange == null){
this.onFocus(event);
}
if(event.range == null){
this.onBlur(event);
}
}
onFocus(event) {
event.editor.theme.modules.toolbar.container.style.visibility = "visible";
}
onBlur(event) {
event.editor.theme.modules.toolbar.container.style.visibility = "hidden";
}
editor.component.css
:host ::ng-deep .ql-toolbar{
visibility: hidden;
}
:host ::ng-deep .ql-container {
border-top: 1px solid #ccc
!important
;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…