Skip to content

Commit 594daf4

Browse files
authored
Merge branch 'develop' into PB-419
2 parents 5eac7d3 + 3c58e51 commit 594daf4

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/binding/live-edit.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/binding/live-edit.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ import {DataObject} from "../data-store";
1818
* @returns {string}
1919
*/
2020
function stripHtml(html: string) {
21-
const tempDiv = document.createElement("div");
21+
if (html) {
22+
const htmlDocument = new DOMParser().parseFromString(html, "text/html");
2223

23-
tempDiv.innerHTML = html;
24-
return tempDiv.textContent;
24+
return htmlDocument.body ? htmlDocument.body.textContent : "";
25+
}
26+
27+
return html;
2528
}
2629

2730
/**
@@ -171,7 +174,7 @@ ko.bindingHandlers.liveEdit = {
171174
_.defer(() => {
172175
const strippedValue = stripHtml(element.innerHTML);
173176
lastUpdateValue = strippedValue;
174-
element.innerHTML = strippedValue;
177+
element.textContent = strippedValue;
175178
/**
176179
* Calculate the position the caret should end up at, the difference in string length + the original
177180
* end offset position

0 commit comments

Comments
 (0)