fix link example
This commit is contained in:
@@ -26,6 +26,7 @@ export default {
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive.bind(this.editor),
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
}))
|
||||
}
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ export default {
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive.bind(this.editor),
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
}))
|
||||
}
|
||||
},
|
||||
|
||||
@@ -26,6 +26,7 @@ export default {
|
||||
focus: this.editor.focus,
|
||||
commands: this.editor.commands,
|
||||
isActive: this.editor.isActive.bind(this.editor),
|
||||
markAttrs: this.editor.markAttrs.bind(this.editor),
|
||||
}))
|
||||
}
|
||||
},
|
||||
|
||||
@@ -239,6 +239,13 @@ export default class Editor {
|
||||
[name]: (attrs = {}) => markIsActive(this.state, mark, attrs),
|
||||
}), {})
|
||||
|
||||
this.activeMarkAttrs = Object
|
||||
.entries(this.schema.marks)
|
||||
.reduce((marks, [name, mark]) => ({
|
||||
...marks,
|
||||
[name]: getMarkAttrs(this.state, mark),
|
||||
}), {})
|
||||
|
||||
this.activeNodes = Object
|
||||
.entries(this.schema.nodes)
|
||||
.reduce((nodes, [name, node]) => ({
|
||||
@@ -268,6 +275,10 @@ export default class Editor {
|
||||
}
|
||||
}
|
||||
|
||||
markAttrs(type = null) {
|
||||
return this.activeMarkAttrs[type]
|
||||
}
|
||||
|
||||
isActive(type = null, attrs = {}) {
|
||||
const types = {
|
||||
...this.activeMarks,
|
||||
|
||||
Reference in New Issue
Block a user