|
|
|
@ -174,18 +174,29 @@ class QuillEditorState extends State<QuillEditor> |
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
widget.configurations.controller.editorFocusNode ??= widget.focusNode; |
|
|
|
|
_editorKey = configurations.editorKey ?? GlobalKey<EditorState>(); |
|
|
|
|
_selectionGestureDetectorBuilder = |
|
|
|
|
_QuillEditorSelectionGestureDetectorBuilder( |
|
|
|
|
this, |
|
|
|
|
configurations.detectWordBoundary, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
widget.configurations.controller.editorConfigurations ??= |
|
|
|
|
widget.configurations; |
|
|
|
|
|
|
|
|
|
final focusNode = |
|
|
|
|
widget.configurations.controller.editorFocusNode ??= widget.focusNode; |
|
|
|
|
|
|
|
|
|
if (configurations.autoFocus) { |
|
|
|
|
widget.configurations.controller.editorFocusNode?.requestFocus(); |
|
|
|
|
focusNode.requestFocus(); |
|
|
|
|
} |
|
|
|
|
_editorKey = configurations.editorKey ?? GlobalKey<EditorState>(); |
|
|
|
|
_selectionGestureDetectorBuilder = |
|
|
|
|
_QuillEditorSelectionGestureDetectorBuilder( |
|
|
|
|
this, |
|
|
|
|
configurations.detectWordBoundary, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Hide toolbar when the editor loses focus. |
|
|
|
|
focusNode.addListener(() { |
|
|
|
|
if (!focusNode.hasFocus) { |
|
|
|
|
_editorKey.currentState?.hideToolbar(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|