check isEditable in node view renderer

This commit is contained in:
Philipp Kühn 2020-11-25 23:19:23 +01:00
parent b5ba3fd3eb
commit dbebb1ca9e

View File

@ -93,6 +93,7 @@ class VueNodeView implements NodeView {
createNodeViewContent() {
const { id } = this
const { isEditable } = this.editor
return Vue.extend({
inheritAttrs: false,
@ -110,7 +111,7 @@ class VueNodeView implements NodeView {
},
attrs: {
id,
contenteditable: true,
contenteditable: isEditable,
},
},
)
@ -175,6 +176,7 @@ class VueNodeView implements NodeView {
return false
}
const { isEditable } = this.editor
const isDraggable = this.node.type.spec.draggable
const isCopyEvent = event.type === 'copy'
const isPasteEvent = event.type === 'paste'
@ -187,7 +189,7 @@ class VueNodeView implements NodeView {
}
// we have to store that dragging started
if (isDraggable && !this.isDragging && event.type === 'mousedown') {
if (isDraggable && isEditable && !this.isDragging && event.type === 'mousedown') {
const dragHandle = target.closest('[data-drag-handle]')
const isValidDragHandle = dragHandle
&& (this.dom === dragHandle || (this.dom.contains(dragHandle)))