From b28dea732a08d3c8a8f8f2773f700d7e62b82ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Thu, 8 Jan 2026 11:35:06 +0100 Subject: [PATCH] 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. --- .../presentation/widgets/mobile/mobile_editor_widget.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/features/composer/presentation/widgets/mobile/mobile_editor_widget.dart b/lib/features/composer/presentation/widgets/mobile/mobile_editor_widget.dart index e4f3d9b49..640157555 100644 --- a/lib/features/composer/presentation/widgets/mobile/mobile_editor_widget.dart +++ b/lib/features/composer/presentation/widgets/mobile/mobile_editor_widget.dart @@ -89,6 +89,10 @@ class _MobileEditorState extends State with TextSelectionMix Future _onWebViewCreated(HtmlEditorApi editorApi) async { widget.onCreatedEditorAction.call(context, editorApi, widget.content); + } + + Future _onWebViewCompleted(HtmlEditorApi editorApi, WebUri? webUri) async { + widget.onLoadCompletedEditorAction(editorApi, webUri); try { await _setupSelectionListener(editorApi); } catch (e) { @@ -96,6 +100,7 @@ class _MobileEditorState extends State with TextSelectionMix } } + @override Widget build(BuildContext context) { return HtmlEditor( @@ -109,7 +114,7 @@ class _MobileEditorState extends State with TextSelectionMix useDefaultFontStyle: true, ), onCreated: _onWebViewCreated, - onCompleted: widget.onLoadCompletedEditorAction, + onCompleted: _onWebViewCompleted, onContentHeightChanged: PlatformInfo.isIOS ? widget.onEditorContentHeightChanged : null, ); }