Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/nodes/ImageView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<NodeViewWrapper contenteditable="true">
<NodeViewWrapper :contenteditable="isEditable">
<figure class="image image-view"
data-component="image-view"
:class="{'icon-loading': !loaded, 'image-view--failed': failed}"
Expand Down Expand Up @@ -75,7 +75,7 @@
v-show="loaded"
class="image__caption"
:title="alt">
<figcaption v-if="!editable">
<figcaption v-if="!isEditable">
{{ alt }}
</figcaption>
<div v-else class="image__caption__wrapper">
Expand Down Expand Up @@ -120,7 +120,7 @@
<input ref="altInput"
type="text"
:value="alt"
:disabled="!editable"
:disabled="!isEditable"
@blur="updateAlt"
@keyup.enter="updateAlt">
</div>
Expand Down Expand Up @@ -204,17 +204,15 @@ export default {
showImageModal: false,
embeddedImagesList: [],
imageIndex: null,
isEditable: false,
}
},
computed: {
isMediaAttachment() {
return this.attachmentType === this.$attachmentResolver.ATTACHMENT_TYPE_MEDIA
},
editable() {
return this.editor.isEditable
},
showDeleteIcon() {
return this.editable && this.showIcons
return this.isEditable && this.showIcons
},
showImageDeleteIcon() {
return this.showDeleteIcon && !this.isMediaAttachment
Expand Down Expand Up @@ -272,6 +270,10 @@ export default {
},
},
beforeMount() {
this.isEditable = this.editor.isEditable
this.editor.on('update', ({ editor }) => {
this.isEditable = editor.isEditable
})
if (!this.isSupportedImage) {
// TODO check if hasPreview and render a file preview if available
this.failed = true
Expand Down