FIX: Make diffHTML handle external changes (#12821)

Changing the contents of the preview element between two uses of
diff.innerHTML did not apply the diff correctly.
This commit is contained in:
Bianca Nenciu 2021-04-26 14:28:08 +03:00 committed by GitHub
parent 765ba1ab2d
commit 2c417338ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -422,6 +422,9 @@ export default Component.extend({
);
loadScript("/javascripts/diffhtml.min.js").then(() => {
// changing the contents of the preview element between two uses of
// diff.innerHTML did not apply the diff correctly
window.diff.release(this.element.querySelector(".d-editor-preview"));
window.diff.innerHTML(
this.element.querySelector(".d-editor-preview"),
cookedElement.innerHTML,