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: transform error for path
Vincent Chan9851b26f2250
diff --git a/frontend/app_flowy/packages/flowy_editor/lib/operation/operation.dart b/frontend/app_flowy/packages/flowy_editor/lib/operation/operation.dartindex 487844af14..eafa4a31da 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/operation/operation.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/operation/operation.dart@@ -128,6 +128,8 @@ Path transformPath(Path preInsertPath, Path b, [int delta = 1]) {final bAtIndex = b[preInsertPath.length - 1];if (preInsertLast <= bAtIndex) {prefix.add(bAtIndex + delta);+ } else {+ prefix.add(bAtIndex);}prefix.addAll(suffix);return prefix;diff --git a/frontend/app_flowy/packages/flowy_editor/test/operation_test.dart b/frontend/app_flowy/packages/flowy_editor/test/operation_test.dartindex 683b6df58e..176f00b734 100644--- a/frontend/app_flowy/packages/flowy_editor/test/operation_test.dart+++ b/frontend/app_flowy/packages/flowy_editor/test/operation_test.dart@@ -19,6 +19,7 @@ void main() {test("transform path not changed", () {expect(transformPath([0, 1, 2], [0, 0, 7, 8, 9]), [0, 0, 7, 8, 9]);expect(transformPath([0, 1, 2], [0, 1]), [0, 1]);+ expect(transformPath([1, 1], [1, 0]), [1, 0]);});test("transform path delta", () {expect(transformPath([0, 1], [0, 1], 5), [0, 6]);