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:
parent
662110c269
commit
6872eb802c
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user