@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.js
CHANGED
|
@@ -6515,6 +6515,14 @@ function isEmpty(value = "") {
|
|
|
6515
6515
|
pseudoElement.innerHTML = value;
|
|
6516
6516
|
return !pseudoElement.textContent?.length;
|
|
6517
6517
|
}
|
|
6518
|
+
function htmlToPlainText(html) {
|
|
6519
|
+
if (!html) {
|
|
6520
|
+
return "";
|
|
6521
|
+
}
|
|
6522
|
+
const normalizedHtml = html.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>\s*<p[^>]*>/gi, "\n");
|
|
6523
|
+
const doc = new DOMParser().parseFromString(normalizedHtml, "text/html");
|
|
6524
|
+
return doc.body.textContent ?? "";
|
|
6525
|
+
}
|
|
6518
6526
|
|
|
6519
6527
|
// src/components/inline-editor.tsx
|
|
6520
6528
|
var ITALIC_KEYBOARD_SHORTCUT = "i";
|
|
@@ -6611,7 +6619,7 @@ var InlineEditor = React100.forwardRef((props, ref) => {
|
|
|
6611
6619
|
attributes: {
|
|
6612
6620
|
...editorProps.attributes ?? {},
|
|
6613
6621
|
role: "textbox",
|
|
6614
|
-
...placeholder ? { "data-placeholder": placeholder } : {},
|
|
6622
|
+
...placeholder ? { "data-placeholder": htmlToPlainText(placeholder) } : {},
|
|
6615
6623
|
...value === null || value === "" ? { class: "is-empty" } : {}
|
|
6616
6624
|
}
|
|
6617
6625
|
},
|