Skip to content

Commit

Permalink
fix : Enable post button after inserting draged or pasted image on th…
Browse files Browse the repository at this point in the history
…e news body - EXO-66290 (#931)

Before this change, after inserting an image by pasting it into the news content, the 'Post' button continued to display as disabled. This issue was due to the 'onchange' event listener, which updated the news body by setting it to an empty value because the inserted image hadn't been uploaded yet. The same situation occurred with dragged images, which were handled by the 'drag' event listener with a one-second timeout to wait for the upload to finish. However, this approach was not satisfactory when dealing with a slow network connection.

This change adds the 'afterInsertHtml' event listener, which is fired after data insertion. This ensures that the inserted image is uploaded and inserted into the editor, resolving the issue.
  • Loading branch information
sofyenne authored and exo-swf committed Sep 22, 2023
1 parent 0cfb541 commit 2bf7e60
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,10 @@ export default {
self.news.body = evt.editor.getData();
self.autoSave();
},
drop: function (evt) {
window.setTimeout(() => {
self.news.body = evt.editor.getData();
self.autoSave();
}, 1000);
}
afterInsertHtml: function (evt) {
self.news.body = evt.editor.getData();
self.autoSave();
},
}
});
},
Expand Down

0 comments on commit 2bf7e60

Please sign in to comment.