1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Accessibility: Improve note title focus handling (#10932)

This commit is contained in:
Henry Heino
2024-08-27 10:05:48 -07:00
committed by GitHub
parent 2afc2ca369
commit 74be949d33
14 changed files with 146 additions and 19 deletions

View File

@@ -31,6 +31,7 @@ import insertLineAfter from './editorCommands/insertLineAfter';
import handlePasteEvent from './utils/handlePasteEvent';
import biDirectionalTextExtension from './utils/biDirectionalTextExtension';
import searchExtension from './utils/searchExtension';
import isCursorAtBeginning from './utils/isCursorAtBeginning';
const createEditor = (
parentElement: HTMLElement, props: EditorProps,
@@ -176,12 +177,28 @@ const createEditor = (
return true;
}),
keyCommand('Tab', insertOrIncreaseIndent, true),
keyCommand('Shift-Tab', decreaseIndent, true),
keyCommand('Shift-Tab', (view) => {
// When at the beginning of the editor, allow shift-tab to act
// normally.
if (isCursorAtBeginning(view.state)) {
return false;
}
return decreaseIndent(view);
}, true),
keyCommand('Mod-Enter', (_: EditorView) => {
insertLineAfter(_);
return true;
}, true),
keyCommand('ArrowUp', (view: EditorView) => {
if (isCursorAtBeginning(view.state) && props.onSelectPastBeginning) {
props.onSelectPastBeginning();
return true;
}
return false;
}, true),
...standardKeymap, ...historyKeymap, ...searchKeymap,
]));