feat: Added support for copying and pasting images in article editor (#10044)
This commit is contained in:
@@ -120,7 +120,6 @@ export default {
|
|||||||
if (fileUrl) {
|
if (fileUrl) {
|
||||||
this.onImageUploadStart(fileUrl);
|
this.onImageUploadStart(fileUrl);
|
||||||
}
|
}
|
||||||
useAlert(this.$t('HELP_CENTER.ARTICLE_EDITOR.IMAGE_UPLOAD.SUCCESS'));
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
useAlert(this.$t('HELP_CENTER.ARTICLE_EDITOR.IMAGE_UPLOAD.ERROR'));
|
useAlert(this.$t('HELP_CENTER.ARTICLE_EDITOR.IMAGE_UPLOAD.ERROR'));
|
||||||
}
|
}
|
||||||
@@ -173,6 +172,18 @@ export default {
|
|||||||
blur: () => {
|
blur: () => {
|
||||||
this.onBlur();
|
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();
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user