@elementor/editor-controls 4.1.0-747 → 4.1.0-748
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/inline-editor.tsx +2 -2
- package/src/utils/inline-editing.ts +11 -0
package/dist/index.mjs
CHANGED
|
@@ -6496,6 +6496,14 @@ function isEmpty(value = "") {
|
|
|
6496
6496
|
pseudoElement.innerHTML = value;
|
|
6497
6497
|
return !pseudoElement.textContent?.length;
|
|
6498
6498
|
}
|
|
6499
|
+
function htmlToPlainText(html) {
|
|
6500
|
+
if (!html) {
|
|
6501
|
+
return "";
|
|
6502
|
+
}
|
|
6503
|
+
const normalizedHtml = html.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>\s*<p[^>]*>/gi, "\n");
|
|
6504
|
+
const doc = new DOMParser().parseFromString(normalizedHtml, "text/html");
|
|
6505
|
+
return doc.body.textContent ?? "";
|
|
6506
|
+
}
|
|
6499
6507
|
|
|
6500
6508
|
// src/components/inline-editor.tsx
|
|
6501
6509
|
var ITALIC_KEYBOARD_SHORTCUT = "i";
|
|
@@ -6592,7 +6600,7 @@ var InlineEditor = React100.forwardRef((props, ref) => {
|
|
|
6592
6600
|
attributes: {
|
|
6593
6601
|
...editorProps.attributes ?? {},
|
|
6594
6602
|
role: "textbox",
|
|
6595
|
-
...placeholder ? { "data-placeholder": placeholder } : {},
|
|
6603
|
+
...placeholder ? { "data-placeholder": htmlToPlainText(placeholder) } : {},
|
|
6596
6604
|
...value === null || value === "" ? { class: "is-empty" } : {}
|
|
6597
6605
|
}
|
|
6598
6606
|
},
|