flatten history plugin options
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user