Skip to content

Commit 6872eb8

Browse files
committed
Lexical: Altered keyboard handling to indicant handled state
1 parent 662110c commit 6872eb8

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

resources/js/wysiwyg/services/keyboard-handling.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ function insertAfterSingleSelectedNode(editor: LexicalEditor, event: KeyboardEve
5858
return false;
5959
}
6060

61-
function handleInsetOnTab(editor: LexicalEditor, event: KeyboardEvent|null) {
61+
function handleInsetOnTab(editor: LexicalEditor, event: KeyboardEvent|null): boolean {
6262
const change = event?.shiftKey ? -40 : 40;
63-
editor.update(() => {
64-
const selection = $getSelection();
65-
const nodes = selection?.getNodes() || [];
66-
if (nodes.length > 1 || (nodes.length === 1 && $isCustomListItemNode(nodes[0].getParent()))) {
63+
const selection = $getSelection();
64+
const nodes = selection?.getNodes() || [];
65+
if (nodes.length > 1 || (nodes.length === 1 && $isCustomListItemNode(nodes[0].getParent()))) {
66+
editor.update(() => {
6767
$setInsetForSelection(editor, change);
68-
}
69-
});
68+
});
69+
event?.preventDefault();
70+
return true;
71+
}
72+
73+
return false;
7074
}
7175

7276
export function registerKeyboardHandling(context: EditorUiContext): () => void {

0 commit comments

Comments
 (0)