Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(docs): paste content to univer (#3071)
Ran Luo97e19b3a083a
diff --git a/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.ts b/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.tsindex 700af37874..a106ef79f6 100644--- a/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.ts+++ b/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.ts@@ -122,12 +122,17 @@ export function extractNodeStyle(node: HTMLElement): ITextStyle {}case 'color': {- const color = new ColorKit(cssValue);+ try {+ const color = new ColorKit(cssValue);- if (color.isValid) {- docStyles.cl = {- rgb: color.toRgbString(),- };+ if (color.isValid) {+ docStyles.cl = {+ rgb: color.toRgbString(),+ };+ }+ // eslint-disable-next-line unused-imports/no-unused-vars+ } catch (_e) {+ // ignore}break;diff --git a/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.ts b/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.tsindex dc7006f67b..e667b02710 100644--- a/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.ts+++ b/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.ts@@ -76,6 +76,7 @@ function parseStyleByProperty(styles: CSSStyleDeclaration | Record<string, strin}}+// eslint-disable-next-line complexityfunction handleStyle(cssRule: string, cssValue: string, docStyles: ITextStyle) {switch (cssRule) {case 'font-family':@@ -115,9 +116,17 @@ function handleStyle(cssRule: string, cssValue: string, docStyles: ITextStyle) {break;}case 'color': {- const color = new ColorKit(cssValue);- if (color.isValid) {- docStyles.cl = { rgb: color.toRgbString() };+ try {+ const color = new ColorKit(cssValue);++ if (color.isValid) {+ docStyles.cl = {+ rgb: color.toRgbString(),+ };+ }+ // eslint-disable-next-line unused-imports/no-unused-vars+ } catch (_e) {+ // ignore}break;}