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 pull request #752 from LucasXu0/feat/flowy_editor_input_service

Nathan.fooo598a910c0c0c
diff --cc frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart
index ac7fd4353f,94b829519e..e1d76c81fe
--- a/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart
+++ b/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart
@@@ -54,23 -52,8 +54,23 @@@ class TransactionBuilder
nodes.forEach(deleteNode);
}
+ deleteNodesAtPath(Path path, [int length = 1]) {
+ if (path.isEmpty) {
+ return;
+ }
+ final nodes = <Node>[];
+ final prefix = path.sublist(0, path.length - 1);
+ final last = path.last;
+ for (var i = 0; i < length; i++) {
+ final node = state.document.nodeAtPath(prefix + [last + i])!;
+ nodes.add(node);
+ }
+
+ add(DeleteOperation(path, nodes));
+ }
+
textEdit(TextNode node, Delta Function() f) {
- beforeSelection = state.cursorSelection;
+ beforeSelection = state.service.selectionService.currentSelection;
final path = node.path;
final delta = f();