♻️ 重构解析逻辑

This commit is contained in:
目棃
2024-09-02 15:37:59 +08:00
parent 49a9060212
commit babdb58d2f

View File

@@ -68,22 +68,10 @@ function getParsedData(data: TGApp.Plugins.Mys.SctPost.Base[]): TGApp.Plugins.My
check += child.length; check += child.length;
child = []; child = [];
} }
if (i === parsedText.length - 1 && check !== parsedText.length) {
if (child.length === 1) {
res.push(child[0]);
child = [];
continue;
}
cur = {
insert: "",
attributes: text.attributes,
children: child,
};
res.push(cur);
child = [];
}
} }
if (check !== parsedText.length - 1 && child.length > 1) res.push(...child);
} }
if (res.length === 0 && child.length > 0) res.push(...child);
return res; return res;
} }