Fix AI Scribe overlay button display in iOS
The button was never displayed because the selectionchange event listener was loaded when the WebView was not entirely loaded so selectionchange event were never fired. Now we setup selection listener when the WebView is loaded instead of created.
This commit is contained in:
@@ -89,6 +89,10 @@ class _MobileEditorState extends State<MobileEditorWidget> with TextSelectionMix
|
|||||||
|
|
||||||
Future<void> _onWebViewCreated(HtmlEditorApi editorApi) async {
|
Future<void> _onWebViewCreated(HtmlEditorApi editorApi) async {
|
||||||
widget.onCreatedEditorAction.call(context, editorApi, widget.content);
|
widget.onCreatedEditorAction.call(context, editorApi, widget.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onWebViewCompleted(HtmlEditorApi editorApi, WebUri? webUri) async {
|
||||||
|
widget.onLoadCompletedEditorAction(editorApi, webUri);
|
||||||
try {
|
try {
|
||||||
await _setupSelectionListener(editorApi);
|
await _setupSelectionListener(editorApi);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -96,6 +100,7 @@ class _MobileEditorState extends State<MobileEditorWidget> with TextSelectionMix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return HtmlEditor(
|
return HtmlEditor(
|
||||||
@@ -109,7 +114,7 @@ class _MobileEditorState extends State<MobileEditorWidget> with TextSelectionMix
|
|||||||
useDefaultFontStyle: true,
|
useDefaultFontStyle: true,
|
||||||
),
|
),
|
||||||
onCreated: _onWebViewCreated,
|
onCreated: _onWebViewCreated,
|
||||||
onCompleted: widget.onLoadCompletedEditorAction,
|
onCompleted: _onWebViewCompleted,
|
||||||
onContentHeightChanged: PlatformInfo.isIOS ? widget.onEditorContentHeightChanged : null,
|
onContentHeightChanged: PlatformInfo.isIOS ? widget.onEditorContentHeightChanged : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user