Skip to content

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.

fix(docs): empty snapshot body arrays (#7067)

Univer986213a84bb8
diff --git a/packages/core/src/docs/data-model/__tests__/empty-snapshot.spec.ts b/packages/core/src/docs/data-model/__tests__/empty-snapshot.spec.ts
index 4639fe4e8f..0c80f2947a 100644
--- a/packages/core/src/docs/data-model/__tests__/empty-snapshot.spec.ts
+++ b/packages/core/src/docs/data-model/__tests__/empty-snapshot.spec.ts
@@ -25,4 +25,15 @@ describe('getEmptySnapshot', () => {
spaceBelow: { v: 12 },
});
});
+
+ it('initializes optional body arrays for structured doc features', () => {
+ expect(getEmptySnapshot().body).toMatchObject({
+ blockRanges: [],
+ customBlocks: [],
+ customDecorations: [],
+ customRanges: [],
+ tables: [],
+ textRuns: [],
+ });
+ });
});
diff --git a/packages/core/src/docs/data-model/empty-snapshot.ts b/packages/core/src/docs/data-model/empty-snapshot.ts
index 0e19d495a5..8b58aef906 100644
--- a/packages/core/src/docs/data-model/empty-snapshot.ts
+++ b/packages/core/src/docs/data-model/empty-snapshot.ts
@@ -40,6 +40,9 @@ export function getEmptySnapshot(
textRuns: [],
customBlocks: [],
tables: [],
+ blockRanges: [],
+ customRanges: [],
+ customDecorations: [],
paragraphs: [
{
startIndex: 0,