diff options
-rw-r--r-- | src/nodes/ImageView.vue | 6 | ||||
-rw-r--r-- | src/services/ImageResolver.js | 21 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/nodes/ImageView.vue b/src/nodes/ImageView.vue index db5409ae5..afacbf5c2 100644 --- a/src/nodes/ImageView.vue +++ b/src/nodes/ImageView.vue @@ -167,7 +167,7 @@ export default { }, computed: { isMediaAttachment() { - return this.attachmentType !== 'image' + return this.attachmentType === this.$imageResolver.ATTACHMENT_TYPE_MEDIA }, canDisplayImage() { if (!this.isSupportedImage) { @@ -256,8 +256,7 @@ export default { this.imageLoaded = true this.loaded = true this.attachmentType = attachmentType - console.debug('SUCCESS type', attachmentType) - if (attachmentType === 'media') { + if (attachmentType === this.$imageResolver.ATTACHMENT_TYPE_MEDIA) { this.loadMediaMetadata(name) } resolve(imageUrl) @@ -270,7 +269,6 @@ export default { }, loadMediaMetadata(name) { this.$imageResolver.getMediaMetadata(name).then((response) => { - console.debug('GOTCHAAAAAA', response.data) this.attachmentMetadata = response.data }) }, diff --git a/src/services/ImageResolver.js b/src/services/ImageResolver.js index b3db6e3e0..0a356f343 100644 --- a/src/services/ImageResolver.js +++ b/src/services/ImageResolver.js @@ -32,6 +32,9 @@ export default class ImageResolver { #currentDirectory #attachmentDirectory + ATTACHMENT_TYPE_IMAGE = 'image' + ATTACHMENT_TYPE_MEDIA = 'media' + constructor({ session, user, shareToken, currentDirectory, fileId }) { this.#session = session this.#user = user @@ -52,7 +55,7 @@ export default class ImageResolver { if (this.#session && src.startsWith('text://')) { const imageFileName = getQueryVariable(src, 'imageFileName') return [{ - type: 'image', + type: this.ATTACHMENT_TYPE_IMAGE, url: this.#getImageAttachmentUrl(imageFileName), }] } @@ -61,11 +64,11 @@ export default class ImageResolver { const imageFileName = decodeURIComponent(src.replace(`.attachments.${this.#session?.documentId}/`, '').split('?')[0]) return [ { - type: 'image', + type: this.ATTACHMENT_TYPE_IMAGE, url: this.#getImageAttachmentUrl(imageFileName), }, { - type: 'media', + type: this.ATTACHMENT_TYPE_MEDIA, url: this.#getMediaPreviewUrl(imageFileName), name: imageFileName, }, @@ -74,14 +77,14 @@ export default class ImageResolver { if (isDirectUrl(src)) { return [{ - type: 'image', + type: this.ATTACHMENT_TYPE_IMAGE, url: src, }] } if (hasPreview(src)) { // && this.#mime !== 'image/gif') { return [{ - type: 'image', + type: this.ATTACHMENT_TYPE_IMAGE, url: this.#previewUrl(src), }] } @@ -93,15 +96,15 @@ export default class ImageResolver { // try the webdav url and attachment API if it fails return [ { - type: 'image', + type: this.ATTACHMENT_TYPE_IMAGE, url: this.#davUrl(src), }, { - type: 'image', + type: this.ATTACHMENT_TYPE_IMAGE, url: this.#getImageAttachmentUrl(imageFileName), }, { - type: 'media', + type: this.ATTACHMENT_TYPE_MEDIA, url: this.#getMediaPreviewUrl(imageFileName), name: imageFileName, }, @@ -109,7 +112,7 @@ export default class ImageResolver { } return [{ - type: 'image', + type: this.ATTACHMENT_TYPE_IMAGE, url: this.#davUrl(src), }] } |