Is there any way to focus the text field with this module? I noticed that Quill has a .focus() method, but I don't know if I can use it or how to do it.
use the onEditorCreated output. you get the editor instance as parameter on which you can call
editor.focus()
<quill-editor (onEditorCreated)="setFocus(editor)"></quill-editor>
...
setFocus(editor) {
editor.focus()
}
TypeError: Cannot read property 'focus' of undefined
Dunno why
sorry my fault instead of editor use $event
<quill-editor (onEditorCreated)="setFocus($event)"></quill-editor>
I didn't thought about that, now I feel a bit idiot, anyway thanks 馃憤
I am using Angular 5 with the ngx-quill library and followed the steps above to get the editor to focus, it will focus the textbox for a second and then move the focus to the bold button (first button in toolbar)
`
[modules]="defaultModules"
[formats]="formats"
[theme]="'snow'"
[(ngModel)]="value"
[maxLength]="maxLength"
(onContentChanged)="bodyChanged($event)"
(onEditorCreated)="setFocus($event)"
`
setFocus(editor) {
editor.focus();
}
Angular 5
ngx-quill 3.3.0
Most helpful comment
I am using Angular 5 with the ngx-quill library and followed the steps above to get the editor to focus, it will focus the textbox for a second and then move the focus to the bold button (first button in toolbar)
`
*ngIf="dataLoaded"
[modules]="defaultModules"
[formats]="formats"
[theme]="'snow'"
[(ngModel)]="value"
[maxLength]="maxLength"
(onContentChanged)="bodyChanged($event)"
(onEditorCreated)="setFocus($event)"
setFocus(editor) { editor.focus(); }Angular 5
ngx-quill 3.3.0