refactoring
This commit is contained in:
@@ -43,7 +43,7 @@ export default {
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive,
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),
|
||||
menu: this.menu,
|
||||
})
|
||||
},
|
||||
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive,
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive,
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),
|
||||
menu: this.menu,
|
||||
})
|
||||
},
|
||||
|
||||
@@ -280,23 +280,20 @@ export default class Editor {
|
||||
}
|
||||
}
|
||||
|
||||
markAttrs(type = null) {
|
||||
getMarkAttrs(type = null) {
|
||||
return this.activeMarkAttrs[type]
|
||||
}
|
||||
|
||||
get isActive() {
|
||||
const types = {
|
||||
...this.activeMarks,
|
||||
...this.activeNodes,
|
||||
}
|
||||
|
||||
Object
|
||||
.entries(types)
|
||||
.forEach(([name, value]) => {
|
||||
types[name] = (attrs = {}) => value(attrs)
|
||||
return Object
|
||||
.entries({
|
||||
...this.activeMarks,
|
||||
...this.activeNodes,
|
||||
})
|
||||
|
||||
return types
|
||||
.reduce((types, [name, value]) => ({
|
||||
...types,
|
||||
[name]: (attrs = {}) => value(attrs),
|
||||
}), {})
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
Reference in New Issue
Block a user