change isActive behavior
This commit is contained in:
@@ -42,7 +42,7 @@ export default {
|
||||
focused: this.editor.view.focused,
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive.bind(this.editor),
|
||||
isActive: this.editor.isActive,
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
menu: this.menu,
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
focused: this.editor.view.focused,
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive.bind(this.editor),
|
||||
isActive: this.editor.isActive,
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
})
|
||||
},
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
focused: this.editor.view.focused,
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive.bind(this.editor),
|
||||
isActive: this.editor.isActive,
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
menu: this.menu,
|
||||
})
|
||||
|
||||
@@ -284,17 +284,19 @@ export default class Editor {
|
||||
return this.activeMarkAttrs[type]
|
||||
}
|
||||
|
||||
isActive(type = null, attrs = {}) {
|
||||
get isActive() {
|
||||
const types = {
|
||||
...this.activeMarks,
|
||||
...this.activeNodes,
|
||||
}
|
||||
|
||||
if (!types[type]) {
|
||||
return false
|
||||
}
|
||||
Object
|
||||
.entries(types)
|
||||
.forEach(([name, value]) => {
|
||||
types[name] = (attrs = {}) => value(attrs)
|
||||
})
|
||||
|
||||
return types[type](attrs)
|
||||
return types
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
Reference in New Issue
Block a user