@pixui-dev/pixui-richtext-helper 0.2.4 → 0.2.5
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.
|
@@ -225,6 +225,16 @@ var RichTextCore = /** @class */ (function () {
|
|
|
225
225
|
if (htmlPart.trim())
|
|
226
226
|
segs.push(wrapNode($elem, htmlPart));
|
|
227
227
|
}
|
|
228
|
+
// 若无任何子片段且无内容,根据标签决定是否保留
|
|
229
|
+
if (segs.length === 0) {
|
|
230
|
+
if (tagName === "div" || tagName === "text") {
|
|
231
|
+
return []; // 丢弃空 div / text
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
// 其它空标签保留(img...)
|
|
235
|
+
return [wrapNode($elem, "")];
|
|
236
|
+
}
|
|
237
|
+
}
|
|
228
238
|
// 如果此节点本身为列表 (<ol>/<ul>),不再拆分内部以保持原逻辑
|
|
229
239
|
if (tagName === "ol" || tagName === "ul") {
|
|
230
240
|
// 直接返回整块 html,不再分片
|