Skip to content

Commit

Permalink
🐛 fix: cssRules error should not block parse
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Feb 16, 2023
1 parent b47dc73 commit 2257640
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/parser/inputText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ export const parseInputTextToText = (

if (!value) {
// 从样式表中拿到相应的 css 规则
Array.from(document.styleSheets).forEach(({ cssRules }) => {
Array.from(document.styleSheets).forEach((styleSheet) => {
let cssRules;
try {
cssRules = styleSheet.cssRules;
} catch (e) {
console.error(e);
return;
}
// 修正部分情况下(TODO:确认具体是什么情况)
// 没有cssRules 的解析报错
if (!cssRules) return;
Expand Down

0 comments on commit 2257640

Please sign in to comment.