diff --git a/packages/roosterjs-content-model-core/lib/command/createModelFromHtml/convertInlineCss.ts b/packages/roosterjs-content-model-core/lib/command/createModelFromHtml/convertInlineCss.ts index 2e70912a611..e26cae1c002 100644 --- a/packages/roosterjs-content-model-core/lib/command/createModelFromHtml/convertInlineCss.ts +++ b/packages/roosterjs-content-model-core/lib/command/createModelFromHtml/convertInlineCss.ts @@ -28,16 +28,18 @@ export function retrieveCssRules(doc: Document): CssRule[] { const result: CssRule[] = []; styles.forEach(styleNode => { - const sheet = styleNode.sheet as CSSStyleSheet; + const sheet = styleNode.sheet; - for (let ruleIndex = 0; ruleIndex < sheet.cssRules.length; ruleIndex++) { - const rule = sheet.cssRules[ruleIndex] as CSSStyleRule; + if (sheet) { + for (let ruleIndex = 0; ruleIndex < sheet.cssRules.length; ruleIndex++) { + const rule = sheet.cssRules[ruleIndex] as CSSStyleRule; - if (rule.type == CSSRule.STYLE_RULE && rule.selectorText) { - result.push({ - selectors: splitSelectors(rule.selectorText), - text: rule.style.cssText, - }); + if (rule.type == CSSRule.STYLE_RULE && rule.selectorText) { + result.push({ + selectors: splitSelectors(rule.selectorText), + text: rule.style.cssText, + }); + } } } diff --git a/versions.json b/versions.json index c4a78d6cd0d..51213f48705 100644 --- a/versions.json +++ b/versions.json @@ -1,5 +1,8 @@ { "react": "9.0.0", "main": "9.9.1", - "legacyAdapter": "8.62.1" + "legacyAdapter": "8.62.1", + "overrides": { + "roosterjs-content-model-core": "9.9.2" + } }