@micromerce/formbuilder-react 1.0.948 → 1.0.954
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.
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps top-level inline content in <p> so Plate deserializes it into blocks.
|
|
3
|
+
*
|
|
4
|
+
* Plate's HTML deserializer maps inline markup (<b>, <i>, <br>, bare text …)
|
|
5
|
+
* to Slate TEXT nodes. When such markup sits at the top level of the value —
|
|
6
|
+
* e.g. content produced outside the editor:
|
|
7
|
+
* <b>Stage:</b> Planning<br><br><b>Tasks:</b><br> - Before you begin
|
|
8
|
+
* — the deserialized document consists of text nodes at the ROOT, which is an
|
|
9
|
+
* invalid Slate value (the root may only hold elements). slate-react then
|
|
10
|
+
* renders each root text node through its Element component and crashes in
|
|
11
|
+
* `splitDecorationsByChild` with "undefined is not iterable" (it reads
|
|
12
|
+
* `node.children`, which a text node does not have), taking the whole form
|
|
13
|
+
* down with it.
|
|
14
|
+
*
|
|
15
|
+
* This function groups every run of consecutive top-level inline nodes into a
|
|
16
|
+
* <p>, leaving block elements untouched:
|
|
17
|
+
* <b>A</b><br>B<p>C</p> -> <p><b>A</b><br>B</p><p>C</p>
|
|
18
|
+
*
|
|
19
|
+
* Runs consisting purely of whitespace (the newlines between block tags in
|
|
20
|
+
* pretty-printed HTML) are left alone so they don't become empty paragraphs.
|
|
21
|
+
*/
|
|
22
|
+
export declare const wrapInlineHtml: (html: string) => string;
|