[WIKI-557] fix: keyboard navigation in tables (#7428)

This commit is contained in:
Aaryan Khandelwal 2025-07-17 15:15:18 +05:30 committed by GitHub
parent 3783e34ae8
commit 48f1999c95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,10 +219,12 @@ export const Table = Node.create<TableOptions>({
addKeyboardShortcuts() { addKeyboardShortcuts() {
return { return {
Tab: () => { Tab: () => {
if (this.editor.isActive(CORE_EXTENSIONS.TABLE)) { if (!this.editor.isActive(CORE_EXTENSIONS.TABLE)) return false;
if (this.editor.isActive(CORE_EXTENSIONS.LIST_ITEM) || this.editor.isActive(CORE_EXTENSIONS.TASK_ITEM)) { if (this.editor.isActive(CORE_EXTENSIONS.LIST_ITEM) || this.editor.isActive(CORE_EXTENSIONS.TASK_ITEM)) {
return false; return false;
} }
if (this.editor.commands.goToNextCell()) { if (this.editor.commands.goToNextCell()) {
return true; return true;
} }
@ -232,10 +234,16 @@ export const Table = Node.create<TableOptions>({
} }
return this.editor.chain().addRowAfter().goToNextCell().run(); return this.editor.chain().addRowAfter().goToNextCell().run();
}
return false;
}, },
"Shift-Tab": () => this.editor.commands.goToPreviousCell(), "Shift-Tab": () => {
if (!this.editor.isActive(CORE_EXTENSIONS.TABLE)) return false;
if (this.editor.isActive(CORE_EXTENSIONS.LIST_ITEM) || this.editor.isActive(CORE_EXTENSIONS.TASK_ITEM)) {
return false;
}
return this.editor.commands.goToPreviousCell();
},
Backspace: handleDeleteKeyOnTable, Backspace: handleDeleteKeyOnTable,
"Mod-Backspace": handleDeleteKeyOnTable, "Mod-Backspace": handleDeleteKeyOnTable,
Delete: handleDeleteKeyOnTable, Delete: handleDeleteKeyOnTable,