]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/services/keyboard-handling.ts
Perms: Fixed some issues made when adding transactions
[bookstack] / resources / js / wysiwyg / services / keyboard-handling.ts
index 39818acb09e167fccae454edccc27675298bf479..b4f546117bb9951959f7ea21e2f08b5ef5fd5bcf 100644 (file)
@@ -13,7 +13,7 @@ import {
 import {$isImageNode} from "@lexical/rich-text/LexicalImageNode";
 import {$isMediaNode} from "@lexical/rich-text/LexicalMediaNode";
 import {getLastSelection} from "../utils/selection";
-import {$getNearestNodeBlockParent, $getParentOfType} from "../utils/nodes";
+import {$getNearestNodeBlockParent, $getParentOfType, $selectOrCreateAdjacent} from "../utils/nodes";
 import {$setInsetForSelection} from "../utils/lists";
 import {$isListItemNode} from "@lexical/list";
 import {$isDetailsNode, DetailsNode} from "@lexical/rich-text/LexicalDetailsNode";
@@ -81,13 +81,8 @@ function focusAdjacentOrInsertForSingleSelectNode(editor: LexicalEditor, event:
 
     event?.preventDefault();
     const node = selectionNodes[0];
-
     editor.update(() => {
-        if (after) {
-            node.selectNext();
-        } else {
-            node.selectPrevious();
-        }
+        $selectOrCreateAdjacent(node, after);
     });
 
     return true;