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: remove the unnecessary operation in enter keyhandler
Lucas.Xu4a48a2af5af4
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dartindex 44fe6d8587..41fbb88541 100644--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart@@ -153,11 +153,13 @@ ShortcutEventHandler enterWithoutShiftInTextNodesHandler =delta: textNode.delta.slice(selection.end.offset),),);- transaction.deleteText(- textNode,- selection.start.offset,- textNode.toPlainText().length - selection.start.offset,- );+ if (selection.end.offset != textNode.toPlainText().length) {+ transaction.deleteText(+ textNode,+ selection.start.offset,+ textNode.toPlainText().length - selection.start.offset,+ );+ }if (textNode.children.isNotEmpty) {final children = textNode.children.toList(growable: false);transaction.deleteNodes(children);diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dartindex 8501a16b41..38f4b9f8b3 100644--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dart+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dart@@ -78,10 +78,10 @@ class AppFlowyRenderPlugin extends AppFlowyRenderPluginService {node.key = key;return _autoUpdateNodeWidget(builder, context);} else {- assert(false,- 'Could not query the builder with this $name, or nodeValidator return false.');- // TODO: return a placeholder widget with tips.- return Container();+ // Returns a SizeBox with 0 height if no builder found.+ return const SizedBox(+ height: 0,+ );}}