check isEditable in node view renderer
This commit is contained in:
@@ -93,6 +93,7 @@ class VueNodeView implements NodeView {
|
|||||||
|
|
||||||
createNodeViewContent() {
|
createNodeViewContent() {
|
||||||
const { id } = this
|
const { id } = this
|
||||||
|
const { isEditable } = this.editor
|
||||||
|
|
||||||
return Vue.extend({
|
return Vue.extend({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
@@ -110,7 +111,7 @@ class VueNodeView implements NodeView {
|
|||||||
},
|
},
|
||||||
attrs: {
|
attrs: {
|
||||||
id,
|
id,
|
||||||
contenteditable: true,
|
contenteditable: isEditable,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -175,6 +176,7 @@ class VueNodeView implements NodeView {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { isEditable } = this.editor
|
||||||
const isDraggable = this.node.type.spec.draggable
|
const isDraggable = this.node.type.spec.draggable
|
||||||
const isCopyEvent = event.type === 'copy'
|
const isCopyEvent = event.type === 'copy'
|
||||||
const isPasteEvent = event.type === 'paste'
|
const isPasteEvent = event.type === 'paste'
|
||||||
@@ -187,7 +189,7 @@ class VueNodeView implements NodeView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we have to store that dragging started
|
// 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 dragHandle = target.closest('[data-drag-handle]')
|
||||||
const isValidDragHandle = dragHandle
|
const isValidDragHandle = dragHandle
|
||||||
&& (this.dom === dragHandle || (this.dom.contains(dragHandle)))
|
&& (this.dom === dragHandle || (this.dom.contains(dragHandle)))
|
||||||
|
|||||||
Reference in New Issue
Block a user