diff --git a/packages/core/src/Extension.ts b/packages/core/src/Extension.ts index 16ac342e..588ac3c1 100644 --- a/packages/core/src/Extension.ts +++ b/packages/core/src/Extension.ts @@ -4,14 +4,13 @@ export default abstract class Extension { constructor(options = {}) { this.options = { - ...this.defaultOptions, + ...this.defaultOptions(), ...options, } } editor!: Editor options: { [key: string]: any } = {} - defaultOptions: { [key: string]: any } = {} public abstract name: string @@ -23,6 +22,10 @@ export default abstract class Extension { this.editor = editor } + defaultOptions(): { [key: string]: any } { + return {} + } + update(): any { return () => {} } diff --git a/packages/extension-history/index.ts b/packages/extension-history/index.ts index 07eac3e4..489cb2cd 100644 --- a/packages/extension-history/index.ts +++ b/packages/extension-history/index.ts @@ -18,6 +18,12 @@ export default class History extends Extension { name = 'history' + defaultOptions() { + return { + historyPluginOptions: {}, + } + } + commands(): CommandSpec { return { undo: (next, { view }) => { @@ -41,7 +47,7 @@ export default class History extends Extension { plugins() { return [ - history() + history(this.options.historyPluginOptions) ] }