mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04: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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleInsetOnTab(editor: LexicalEditor, event: KeyboardEvent|null) {
|
function handleInsetOnTab(editor: LexicalEditor, event: KeyboardEvent|null): boolean {
|
||||||
const change = event?.shiftKey ? -40 : 40;
|
const change = event?.shiftKey ? -40 : 40;
|
||||||
editor.update(() => {
|
const selection = $getSelection();
|
||||||
const selection = $getSelection();
|
const nodes = selection?.getNodes() || [];
|
||||||
const nodes = selection?.getNodes() || [];
|
if (nodes.length > 1 || (nodes.length === 1 && $isCustomListItemNode(nodes[0].getParent()))) {
|
||||||
if (nodes.length > 1 || (nodes.length === 1 && $isCustomListItemNode(nodes[0].getParent()))) {
|
editor.update(() => {
|
||||||
$setInsetForSelection(editor, change);
|
$setInsetForSelection(editor, change);
|
||||||
}
|
});
|
||||||
});
|
event?.preventDefault();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function registerKeyboardHandling(context: EditorUiContext): () => void {
|
export function registerKeyboardHandling(context: EditorUiContext): () => void {
|
||||||
|
Loading…
Reference in New Issue
Block a user