Skip to content

Commit

Permalink
♻️ 重构解析逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Sep 2, 2024
1 parent 49a9060 commit babdb58
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/components/post/tp-parser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,10 @@ function getParsedData(data: TGApp.Plugins.Mys.SctPost.Base[]): TGApp.Plugins.My
check += child.length;
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;
}
Expand Down

0 comments on commit babdb58

Please sign in to comment.