@flozy/editor 5.3.8 → 5.3.9
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.
@@ -17,10 +17,13 @@ const handleTableCell = (el, children) => {
|
|
17
17
|
overwriteChild: wrapChild
|
18
18
|
};
|
19
19
|
};
|
20
|
+
const PARA_WRAP = ["A"];
|
20
21
|
const paragraphType = el => {
|
21
|
-
const
|
22
|
-
|
23
|
-
|
22
|
+
const {
|
23
|
+
childNodes = []
|
24
|
+
} = el || {};
|
25
|
+
const isHavingText = childNodes?.length ? Array.from(childNodes)?.find(child => child?.nodeType === 3 || TEXT_TAGS[child?.nodeName] || PARA_WRAP.includes(child.nodeName)) : null;
|
26
|
+
return isHavingText ? {
|
24
27
|
type: "paragraph"
|
25
28
|
} : {};
|
26
29
|
};
|
@@ -118,6 +121,9 @@ const TEXT_TAGS = {
|
|
118
121
|
}),
|
119
122
|
U: () => ({
|
120
123
|
underline: true
|
124
|
+
}),
|
125
|
+
B: () => ({
|
126
|
+
bold: true
|
121
127
|
})
|
122
128
|
};
|
123
129
|
const deserialize = el => {
|
@@ -139,9 +145,12 @@ const deserialize = el => {
|
|
139
145
|
}
|
140
146
|
let children = Array.from(parent.childNodes).map(deserialize).flat();
|
141
147
|
if (children.length === 0) {
|
142
|
-
children =
|
143
|
-
|
144
|
-
|
148
|
+
children = {
|
149
|
+
type: "paragraph",
|
150
|
+
children: [{
|
151
|
+
text: ""
|
152
|
+
}]
|
153
|
+
};
|
145
154
|
}
|
146
155
|
if (el.nodeName === "BODY") {
|
147
156
|
return jsx("fragment", {}, children);
|