From f2b1d1668b6e3bf78cadeb5da027d4ef1047b724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sat, 25 Aug 2018 16:43:23 +0200 Subject: [PATCH] add check in ComponentView for editable --- packages/tiptap/src/utils/ComponentView.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/tiptap/src/utils/ComponentView.js b/packages/tiptap/src/utils/ComponentView.js index 2809d266..f54b690b 100644 --- a/packages/tiptap/src/utils/ComponentView.js +++ b/packages/tiptap/src/utils/ComponentView.js @@ -36,6 +36,10 @@ export default class ComponentView { } updateAttrs(attrs) { + if (!this.editable) { + return + } + const transaction = this.view.state.tr.setNodeMarkup(this.getPos(), null, { ...this.node.attrs, ...attrs, @@ -44,6 +48,10 @@ export default class ComponentView { } updateContent(content) { + if (!this.editable) { + return + } + const transaction = this.view.state.tr.setNodeMarkup(this.getPos(), this.node.type, { content }) this.view.dispatch(transaction) }