add check in ComponentView for editable

This commit is contained in:
Philipp Kühn
2018-08-25 16:43:23 +02:00
parent 1cca2947ce
commit f2b1d1668b

View File

@@ -36,6 +36,10 @@ export default class ComponentView {
} }
updateAttrs(attrs) { updateAttrs(attrs) {
if (!this.editable) {
return
}
const transaction = this.view.state.tr.setNodeMarkup(this.getPos(), null, { const transaction = this.view.state.tr.setNodeMarkup(this.getPos(), null, {
...this.node.attrs, ...this.node.attrs,
...attrs, ...attrs,
@@ -44,6 +48,10 @@ export default class ComponentView {
} }
updateContent(content) { updateContent(content) {
if (!this.editable) {
return
}
const transaction = this.view.state.tr.setNodeMarkup(this.getPos(), this.node.type, { content }) const transaction = this.view.state.tr.setNodeMarkup(this.getPos(), this.node.type, { content })
this.view.dispatch(transaction) this.view.dispatch(transaction)
} }