fix: fix a bug when configurating the same extension multiple times

This commit is contained in:
Philipp Kühn
2021-05-11 17:03:34 +02:00
parent 1646f6efc1
commit 655c5647f0
4 changed files with 34 additions and 3 deletions

View File

@@ -256,7 +256,9 @@ export class Extension<Options = any> {
configure(options: Partial<Options> = {}) {
this.options = mergeDeep(this.options, options) as Options
return this
// return a new instance so we can use the same extension
// with different calls of `configure`
return this.extend()
}
extend<ExtendedOptions = Options>(extendedConfig: Partial<ExtensionConfig<ExtendedOptions>> = {}) {

View File

@@ -353,7 +353,9 @@ export class Mark<Options = any> {
configure(options: Partial<Options> = {}) {
this.options = mergeDeep(this.options, options) as Options
return this
// return a new instance so we can use the same extension
// with different calls of `configure`
return this.extend()
}
extend<ExtendedOptions = Options>(extendedConfig: Partial<MarkConfig<ExtendedOptions>> = {}) {

View File

@@ -434,7 +434,9 @@ export class Node<Options = any> {
configure(options: Partial<Options> = {}) {
this.options = mergeDeep(this.options, options) as Options
return this
// return a new instance so we can use the same extension
// with different calls of `configure`
return this.extend()
}
extend<ExtendedOptions = Options>(extendedConfig: Partial<NodeConfig<ExtendedOptions>> = {}) {