From 6dda1e8c8fc75d0b3729c86a4cbd2e668457f0c3 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Thu, 29 Aug 2024 18:50:52 +0530 Subject: [PATCH] feat: Added support for copying and pasting images in article editor (#10044) --- .../components/widgets/WootWriter/FullEditor.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue b/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue index ab4be9342..754182207 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue @@ -120,7 +120,6 @@ export default { if (fileUrl) { this.onImageUploadStart(fileUrl); } - useAlert(this.$t('HELP_CENTER.ARTICLE_EDITOR.IMAGE_UPLOAD.SUCCESS')); } catch (error) { useAlert(this.$t('HELP_CENTER.ARTICLE_EDITOR.IMAGE_UPLOAD.ERROR')); } @@ -173,6 +172,18 @@ export default { blur: () => { this.onBlur(); }, + paste: (view, event) => { + const data = event.clipboardData.files; + if (data.length > 0) { + data.forEach(file => { + // Check if the file is an image + if (file.type.includes('image')) { + this.uploadImageToStorage(file); + } + }); + event.preventDefault(); + } + }, }, }); },