refactoring
This commit is contained in:
@@ -37,17 +37,17 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
const plugins = new ExtensionManager([
|
const allExtensions = new ExtensionManager([
|
||||||
...builtInNodes,
|
...builtInNodes,
|
||||||
...this.extensions,
|
...this.extensions,
|
||||||
])
|
])
|
||||||
const { nodes, marks, views } = plugins
|
const { nodes, marks, views } = allExtensions
|
||||||
|
|
||||||
return {
|
return {
|
||||||
state: null,
|
state: null,
|
||||||
view: null,
|
view: null,
|
||||||
extensionPlugins: [],
|
plugins: [],
|
||||||
plugins,
|
allExtensions,
|
||||||
schema: null,
|
schema: null,
|
||||||
nodes,
|
nodes,
|
||||||
marks,
|
marks,
|
||||||
@@ -94,7 +94,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
initEditor() {
|
initEditor() {
|
||||||
this.schema = this.createSchema()
|
this.schema = this.createSchema()
|
||||||
this.extensionPlugins = this.createPlugins()
|
this.plugins = this.createPlugins()
|
||||||
this.keymaps = this.createKeymaps()
|
this.keymaps = this.createKeymaps()
|
||||||
this.inputRules = this.createInputRules()
|
this.inputRules = this.createInputRules()
|
||||||
this.state = this.createState()
|
this.state = this.createState()
|
||||||
@@ -112,23 +112,23 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
createPlugins() {
|
createPlugins() {
|
||||||
return this.plugins.plugins
|
return this.allExtensions.plugins
|
||||||
},
|
},
|
||||||
|
|
||||||
createKeymaps() {
|
createKeymaps() {
|
||||||
return this.plugins.keymaps({
|
return this.allExtensions.keymaps({
|
||||||
schema: this.schema,
|
schema: this.schema,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
createInputRules() {
|
createInputRules() {
|
||||||
return this.plugins.inputRules({
|
return this.allExtensions.inputRules({
|
||||||
schema: this.schema,
|
schema: this.schema,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
createCommands() {
|
createCommands() {
|
||||||
return this.plugins.commands({
|
return this.allExtensions.commands({
|
||||||
schema: this.schema,
|
schema: this.schema,
|
||||||
view: this.view,
|
view: this.view,
|
||||||
})
|
})
|
||||||
@@ -139,7 +139,7 @@ export default {
|
|||||||
schema: this.schema,
|
schema: this.schema,
|
||||||
doc: this.getDocument(),
|
doc: this.getDocument(),
|
||||||
plugins: [
|
plugins: [
|
||||||
...this.extensionPlugins,
|
...this.plugins,
|
||||||
...this.getPlugins(),
|
...this.getPlugins(),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user