[WIKI-557] fix: keyboard navigation in tables (#7428)
This commit is contained in:
parent
3783e34ae8
commit
48f1999c95
1 changed files with 22 additions and 14 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue