move some functions
This commit is contained in:
@@ -21,7 +21,11 @@ import builtInNodes from '../Nodes'
|
|||||||
export default class Editor {
|
export default class Editor {
|
||||||
|
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
|
this.setOptions(options)
|
||||||
|
this.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
setOptions(options) {
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
editable: true,
|
editable: true,
|
||||||
content: '',
|
content: '',
|
||||||
@@ -30,13 +34,15 @@ export default class Editor {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
this.element = document.createElement('div')
|
|
||||||
this.bus = new Vue()
|
|
||||||
|
|
||||||
this.options = {
|
this.options = {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
...options,
|
...options,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.bus = new Vue()
|
||||||
|
this.element = document.createElement('div')
|
||||||
this.extensions = this.createExtensions()
|
this.extensions = this.createExtensions()
|
||||||
this.nodes = this.createNodes()
|
this.nodes = this.createNodes()
|
||||||
this.marks = this.createMarks()
|
this.marks = this.createMarks()
|
||||||
|
|||||||
Reference in New Issue
Block a user