From db9020b378d10740f119d07cbd74c51068ed0e54 Mon Sep 17 00:00:00 2001 From: Jay Cammarano <67079013+jaycammarano@users.noreply.github.com> Date: Tue, 24 Aug 2021 18:55:51 -0400 Subject: [PATCH] Display private images in WYSIWYG editor (#7583) * image is displaying in WYSIWYG * remove access token before deletion * remove token is being returned * preview image displaying correctly * added image token props handling * imageToken added as params correctly * refactor * Fix regex, fix life's problems * Remove eslint disable Co-authored-by: rijkvanzanten --- app/src/api.ts | 2 +- app/src/interfaces/file-image/file-image.vue | 2 -- .../input-rich-text-html.vue | 36 +++++++++++++++++-- .../input-rich-text-html/useImage.ts | 3 ++ 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/src/api.ts b/app/src/api.ts index 3a7e2f957e..375d5fbc61 100644 --- a/app/src/api.ts +++ b/app/src/api.ts @@ -95,7 +95,7 @@ api.interceptors.response.use(onResponse, onError); export default api; -function getToken() { +export function getToken() { return api.defaults.headers?.['Authorization']?.split(' ')[1] || null; } diff --git a/app/src/interfaces/file-image/file-image.vue b/app/src/interfaces/file-image/file-image.vue index 9d83455438..e97bbb328e 100644 --- a/app/src/interfaces/file-image/file-image.vue +++ b/app/src/interfaces/file-image/file-image.vue @@ -100,10 +100,8 @@ export default defineComponent({ if (image.value.type.includes('svg')) { return addTokenToURL(getRootPath() + `assets/${image.value.id}`); } - if (image.value.type.includes('image')) { const url = getRootPath() + `assets/${image.value.id}?key=system-large-cover&cache-buster=${cacheBuster.value}`; - return addTokenToURL(url); } diff --git a/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue b/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue index d2a6f7d159..2e6c514cfe 100644 --- a/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue +++ b/app/src/interfaces/input-rich-text-html/input-rich-text-html.vue @@ -59,7 +59,7 @@