Skip to content

Commit

Permalink
fix: request never created if image is pasted on content - EXO-76645. (
Browse files Browse the repository at this point in the history
…#420)

Before this change, when click on process to open request drawer and on request content paste an image, error message displayed and submit button load infinitely. To resolve this problem, add an event handler to detect paste actions and perform media cleanup in the pasted content before displaying it in the editor. After this change, no media content is possible to be pasted on request content.

(cherry picked from commit 785b49f)
  • Loading branch information
akhanfir authored and Jihed525 committed Jan 28, 2025
1 parent d2b30e2 commit ada900d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ export default {
blur: function (event) {
self.$emit('blur', event);
},
paste: function (event) {
const pastedData = (event.data && event.data.dataValue) || '';
const cleanedData = pastedData.replace(/<img[^>]*>|<video[^>]*>|<audio[^>]*>/g, '');
event.editor.insertHtml(cleanedData);
event.cancel();
},
destroy: function () {
self.inputVal = '';
self.editor = null;
Expand Down

0 comments on commit ada900d

Please sign in to comment.