Skip to content

Commit

Permalink
fix: cannot convert undefined or null to object at getOwnPropertyDesc…
Browse files Browse the repository at this point in the history
…riptors
  • Loading branch information
splincode committed Oct 20, 2023
1 parent 3e969e1 commit 2203aa7
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions libs/tui-editor/extensions/starter-kit/starter-kit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Extension} from '@tiptap/core';
import {Extension, KeyboardShortcutCommand} from '@tiptap/core';
import {Blockquote, BlockquoteOptions} from '@tiptap/extension-blockquote';
import {Bold, BoldOptions} from '@tiptap/extension-bold';
import {BulletList, BulletListOptions} from '@tiptap/extension-bullet-list';
Expand Down Expand Up @@ -86,7 +86,25 @@ export const StarterKit = Extension.create<TuiStarterKitOptions>({
}

if (options?.heading !== false) {
extensions.push(Heading.configure(options?.heading));
extensions.push(
Heading.configure({
levels: [1, 2, 3, 4, 5, 6],
...options?.heading,
}).extend({
addKeyboardShortcuts(): {
[key: string]: KeyboardShortcutCommand;
} {
return this.options.levels.reduce(
(items: any, level: any) => ({
...(items || {}),
[`Mod-Alt-${level}`]: () =>
this?.editor.commands.toggleHeading({level}),
}),
{},
);
},
}),
);
}

if (options?.history !== false) {
Expand Down

0 comments on commit 2203aa7

Please sign in to comment.