1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-29 23:22:34 +01:00

Lexical: Altered keyboard handling to indicant handled state

This commit is contained in:
Dan Brown 2024-09-13 16:05:55 +01:00
parent 662110c269
commit 6872eb802c
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -58,15 +58,19 @@ function insertAfterSingleSelectedNode(editor: LexicalEditor, event: KeyboardEve
return false;
}
function handleInsetOnTab(editor: LexicalEditor, event: KeyboardEvent|null) {
function handleInsetOnTab(editor: LexicalEditor, event: KeyboardEvent|null): boolean {
const change = event?.shiftKey ? -40 : 40;
editor.update(() => {
const selection = $getSelection();
const nodes = selection?.getNodes() || [];
if (nodes.length > 1 || (nodes.length === 1 && $isCustomListItemNode(nodes[0].getParent()))) {
const selection = $getSelection();
const nodes = selection?.getNodes() || [];
if (nodes.length > 1 || (nodes.length === 1 && $isCustomListItemNode(nodes[0].getParent()))) {
editor.update(() => {
$setInsetForSelection(editor, change);
}
});
});
event?.preventDefault();
return true;
}
return false;
}
export function registerKeyboardHandling(context: EditorUiContext): () => void {