flatten history plugin options

This commit is contained in:
Hans Pagel
2020-09-27 10:52:09 +02:00
parent 5d9b16c9f1
commit e536087cb2
2 changed files with 12 additions and 6 deletions

View File

@@ -13,13 +13,15 @@ declare module '@tiptap/core/src/Editor' {
}
export interface HistoryOptions {
historyPluginOptions: Record<string, unknown>,
depth: any,
newGroupDelay: any,
}
export default new Extension<HistoryOptions>()
.name('history')
.defaults({
historyPluginOptions: {},
depth: 100,
newGroupDelay: 500,
})
.commands(() => ({
undo: () => ({ state, dispatch }) => {
@@ -35,6 +37,9 @@ export default new Extension<HistoryOptions>()
'Shift-Mod-z': () => editor.redo(),
}))
.plugins(({ options }) => [
history(options.historyPluginOptions),
history({
...options.depth,
...options.newGroupDelay,
}),
])
.create()