diff options
-rw-r--r-- | cypress/e2e/images.spec.js | 6 | ||||
-rw-r--r-- | src/components/Editor.provider.js | 2 | ||||
-rw-r--r-- | src/components/Menu/entries.js | 4 | ||||
-rw-r--r-- | src/nodes/ImageView.vue | 8 |
4 files changed, 11 insertions, 9 deletions
diff --git a/cypress/e2e/images.spec.js b/cypress/e2e/images.spec.js index df4e71674..f0676ee41 100644 --- a/cypress/e2e/images.spec.js +++ b/cypress/e2e/images.spec.js @@ -28,8 +28,8 @@ const randUser2 = randHash() let currentUser = randUser const attachmentFileNameToId = {} -const ACTION_UPLOAD_LOCAL_FILE = 'insert-image-upload' -const ACTION_INSERT_FROM_FILES = 'insert-image-insert' +const ACTION_UPLOAD_LOCAL_FILE = 'insert-attachment-upload' +const ACTION_INSERT_FROM_FILES = 'insert-attachment-insert' // const ACTION_INSERT_FROM_LINK = 3 /** @@ -61,7 +61,7 @@ function fixedEncodeURIComponent(str) { * @param {string} actionName position of the action to be clicked */ const clickOnImageAction = (actionName) => { - cy.getActionEntry('insert-image') + cy.getActionEntry('insert-attachment') .click() return cy.get('.v-popper__wrapper .open') diff --git a/src/components/Editor.provider.js b/src/components/Editor.provider.js index 132e1fd9d..97f9bfe46 100644 --- a/src/components/Editor.provider.js +++ b/src/components/Editor.provider.js @@ -84,7 +84,7 @@ export const useAttachmentResolver = { from: ATTACHMENT_RESOLVER, default: { resolve(src) { - console.warn('No image resolver provided. Some image sources cannot be resolved.') + console.warn('No attachment resolver provided. Some attachment sources cannot be resolved.') return [src] }, }, diff --git a/src/components/Menu/entries.js b/src/components/Menu/entries.js index 0d92f51e5..ac2cf1be6 100644 --- a/src/components/Menu/entries.js +++ b/src/components/Menu/entries.js @@ -319,8 +319,8 @@ export default [ priority: 4, }, { - key: 'insert-image', - label: t('text', 'Insert image'), + key: 'insert-attachment', + label: t('text', 'Insert attachment'), icon: Images, component: ActionAttachmentUpload, priority: 2, diff --git a/src/nodes/ImageView.vue b/src/nodes/ImageView.vue index 065482bfa..65d0a1790 100644 --- a/src/nodes/ImageView.vue +++ b/src/nodes/ImageView.vue @@ -251,13 +251,13 @@ export default { async loadImage(imageUrl, attachmentType, name = null) { return new Promise((resolve, reject) => { const img = new Image() - img.onload = () => { + img.onload = async () => { this.imageUrl = imageUrl this.imageLoaded = true this.loaded = true this.attachmentType = attachmentType if (attachmentType === this.$attachmentResolver.ATTACHMENT_TYPE_MEDIA) { - this.loadMediaMetadata(name) + await this.loadMediaMetadata(name) } resolve(imageUrl) } @@ -268,8 +268,10 @@ export default { }) }, loadMediaMetadata(name) { - this.$attachmentResolver.getMediaMetadata(name).then((response) => { + return this.$attachmentResolver.getMediaMetadata(name).then((response) => { this.attachmentMetadata = response.data + }).catch((error) => { + console.error(error) }) }, onImageLoadFailure(err) { |