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: prevent to copy the style in some cases when pressing the enter key in the front of the text
Lucas.Xuec97735e9472
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 a981470f6e..c31b8c3699 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@@ -117,12 +117,17 @@ ShortcutEventHandler enterWithoutShiftInTextNodesHandler =makeFollowingNodesIncremental(editorState, insertPath, afterSelection,beginNum: prevNumber);} else {+ bool needCopyAttributes = ![+ BuiltInAttributeKey.heading,+ BuiltInAttributeKey.quote,+ ].contains(subtype);TransactionBuilder(editorState)..insertNode(textNode.path,textNode.copyWith(children: LinkedList(),delta: Delta(),+ attributes: needCopyAttributes ? null : {},),)..afterSelection = afterSelection@@ -173,7 +178,9 @@ ShortcutEventHandler enterWithoutShiftInTextNodesHandler =Attributes _attributesFromPreviousLine(TextNode textNode) {final prevAttributes = textNode.attributes;final subType = textNode.subtype;- if (subType == null || subType == BuiltInAttributeKey.heading) {+ if (subType == null ||+ subType == BuiltInAttributeKey.heading ||+ subType == BuiltInAttributeKey.quote) {return {};}diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dartindex 5259872b95..d5154bc2b5 100644--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dart+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/keyboard_service.dart@@ -124,6 +124,8 @@ class _AppFlowyKeyboardState extends State<AppFlowyKeyboard>final result = shortcutEvent.handler(widget.editorState, event);if (result == KeyEventResult.handled) {return KeyEventResult.handled;+ } else if (result == KeyEventResult.skipRemainingHandlers) {+ return KeyEventResult.skipRemainingHandlers;}continue;}