Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: refocus editor after selecting image on Android (#7983)
Lucasd93929a3b6fa
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_attachment_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_attachment_item.dartindex e31d9f68a6..ffe26ea39c 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_attachment_item.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_attachment_item.dart@@ -60,7 +60,9 @@ final addAttachmentItem = AppFlowyMobileToolbarItem();if (didAddAttachment != true) {- unawaited(editorState.updateSelectionWithReason(selection));+ WidgetsBinding.instance.addPostFrameCallback((_) {+ editorState.updateSelectionWithReason(selection);+ });}});},@@ -185,6 +187,11 @@ class _AddAttachmentMenu extends StatelessWidget {if (image != null && context.mounted) {await insertImage(context, image);+ } else {+ // refocus the editor+ WidgetsBinding.instance.addPostFrameCallback((_) {+ editorState.updateSelectionWithReason(selection);+ });}if (context.mounted) {diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/parsers/math_equation_node_parser.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/parsers/math_equation_node_parser.dartindex fed895c978..12b0f2e861 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/parsers/math_equation_node_parser.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/parsers/math_equation_node_parser.dart@@ -9,6 +9,6 @@ class MathEquationNodeParser extends NodeParser {@overrideString transform(Node node, DocumentMarkdownEncoder? encoder) {- return '\$\$${node.attributes[id]}\$\$';+ return '\$\$${node.attributes[MathEquationBlockKeys.formula]}\$\$';}}diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dartindex 9e93f80ce4..840897ff62 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart@@ -198,7 +198,7 @@ class _ToggleListBlockComponentWidgetStateleft: cachedLeft,top: padding.top,child: Container(- width: double.infinity,+ width: UniversalPlatform.isDesktop ? double.infinity : null,color: backgroundColor,),),diff --git a/frontend/appflowy_flutter/test/unit_test/editor/share_markdown_test.dart b/frontend/appflowy_flutter/test/unit_test/editor/share_markdown_test.dartindex d064e55ec7..e6cad13799 100644--- a/frontend/appflowy_flutter/test/unit_test/editor/share_markdown_test.dart+++ b/frontend/appflowy_flutter/test/unit_test/editor/share_markdown_test.dart@@ -15,7 +15,7 @@ void main() {{"type":"math_equation","data":{- "math_equation":"E = MC^2"+ "formula":"E = MC^2"}}]