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(univer): fix from json error (#5258)
VicKun09c79d1aae90
diff --git a/packages/sheets/src/model/range-theme-model.ts b/packages/sheets/src/model/range-theme-model.tsindex 1b6f5afc8d..88193d8eaf 100644--- a/packages/sheets/src/model/range-theme-model.ts+++ b/packages/sheets/src/model/range-theme-model.ts@@ -261,17 +261,19 @@ export class SheetRangeThemeModel extends Disposable {fromJSON(unitId: string, json: ISheetRangeThemeModelJSON) {const { rangeThemeStyleRuleMap: rangeThemeStyleRuleMapJSON, rangeThemeStyleMapJson } = json;- Object.keys(rangeThemeStyleRuleMapJSON).forEach((key) => {- const ruleMap = rangeThemeStyleRuleMapJSON[key];- const { themeName, rangeInfo } = ruleMap;- // TODO Due to design issues, we will skip table-related theme registration.- // Here the table needs to have its own rangeTheme to be independent- if (!themeName.startsWith('table')) {- this.registerRangeThemeRule(themeName, rangeInfo);- const rTreeCollection = this._ensureRTreeCollection(rangeInfo.unitId);- rTreeCollection.insert({ unitId: key, sheetId: rangeInfo.subUnitId, range: rangeInfo.range, id: key });- }- });+ if (rangeThemeStyleRuleMapJSON) {+ Object.keys(rangeThemeStyleRuleMapJSON).forEach((key) => {+ const ruleMap = rangeThemeStyleRuleMapJSON[key];+ const { themeName, rangeInfo } = ruleMap;+ // TODO Due to design issues, we will skip table-related theme registration.+ // Here the table needs to have its own rangeTheme to be independent+ if (!themeName.startsWith('table')) {+ this.registerRangeThemeRule(themeName, rangeInfo);+ const rTreeCollection = this._ensureRTreeCollection(rangeInfo.unitId);+ rTreeCollection.insert({ unitId: key, sheetId: rangeInfo.subUnitId, range: rangeInfo.range, id: key });+ }+ });+ }if (rangeThemeStyleMapJson) {Object.keys(rangeThemeStyleMapJson).forEach((key) => {