diff --git a/shared/editor/packages/full.ts b/shared/editor/packages/full.ts index fc65cb070..398afa046 100644 --- a/shared/editor/packages/full.ts +++ b/shared/editor/packages/full.ts @@ -25,6 +25,7 @@ import TableHeadCell from "../nodes/TableHeadCell"; import TableRow from "../nodes/TableRow"; import BlockMenuTrigger from "../plugins/BlockMenuTrigger"; import Folding from "../plugins/Folding"; +import PreventTab from "../plugins/PreventTab"; import basicPackage from "./basic"; const fullPackage: (typeof Node | typeof Mark | typeof Extension)[] = [ @@ -53,6 +54,7 @@ const fullPackage: (typeof Node | typeof Mark | typeof Extension)[] = [ BlockMenuTrigger, Math, MathBlock, + PreventTab, ]; export default fullPackage; diff --git a/shared/editor/plugins/Keys.ts b/shared/editor/plugins/Keys.ts index 207af8cb3..589fd5aae 100644 --- a/shared/editor/plugins/Keys.ts +++ b/shared/editor/plugins/Keys.ts @@ -24,10 +24,6 @@ export default class Keys extends Extension { }; return { - // No-ops prevent Tab escaping the editor bounds - Tab: () => true, - "Shift-Tab": () => true, - // Shortcuts for when editor has separate edit mode "Mod-Escape": onCancel, "Shift-Escape": onCancel, diff --git a/shared/editor/plugins/PreventTab.ts b/shared/editor/plugins/PreventTab.ts new file mode 100644 index 000000000..86b9620fb --- /dev/null +++ b/shared/editor/plugins/PreventTab.ts @@ -0,0 +1,15 @@ +import Extension, { Command } from "../lib/Extension"; + +export default class PreventTab extends Extension { + get name() { + return "preventTab"; + } + + keys(): Record { + return { + // No-ops prevent Tab escaping the editor bounds + Tab: () => true, + "Shift-Tab": () => true, + }; + } +}