Skip to content

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.

Merge remote-tracking branch 'origin/feat/flowy_editor' into feat/flowy_editor_input_service

Lucas.Xub913db2301c1
diff --cc frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart
index 9233a1b08a,e1d76c81fe..dd531d5d5e
--- a/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart
+++ b/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart
@@@ -29,14 -29,14 +29,18 @@@ class TransactionBuilder
}
insertNode(Path path, Node node) {
- beforeSelection = state.service.selectionService.currentSelection;
- add(InsertOperation(path: path, value: node));
+ insertNodes(path, [node]);
+ // FIXME: Not exactly correct, needs to be customized.
+ afterSelection = Selection.collapsed(
+ Position(path: path, offset: 0),
+ );
}
+ insertNodes(Path path, List<Node> nodes) {
- beforeSelection = state.cursorSelection;
++ beforeSelection = state.service.selectionService.currentSelection;
+ add(InsertOperation(path, nodes));
+ }
+
updateNode(Node node, Attributes attributes) {
beforeSelection = state.cursorSelection;
add(UpdateOperation(
diff --cc frontend/app_flowy/packages/flowy_editor/lib/service/internal_key_event_handlers/enter_in_edge_of_text_node_handler.dart
index 8b0c7c5423,d1e89d393e..b08dcb1f80
--- a/frontend/app_flowy/packages/flowy_editor/lib/service/internal_key_event_handlers/enter_in_edge_of_text_node_handler.dart
+++ b/frontend/app_flowy/packages/flowy_editor/lib/service/internal_key_event_handlers/enter_in_edge_of_text_node_handler.dart
@@@ -33,12 -28,7 +33,12 @@@ FlowyKeyEventHandler enterInEdgeOfTextN
TransactionBuilder(editorState)
..insertNode(
textNode.path.next,
- TextNode.empty(),
+ textNode.copyWith(
+ children: LinkedList(),
+ delta: Delta([TextInsert(' ')]),
+ attributes:
- needCopyAttributes ? {StyleKey.subtype: textNode.subtype} : null,
++ needCopyAttributes ? {StyleKey.subtype: textNode.subtype} : {},
+ ),
)
..commit();
return KeyEventResult.handled;