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: apply mutation (#1423)

Ran Luoccd30dca3622
diff --git a/packages/docs/src/commands/mutations/core-editing.mutation.ts b/packages/docs/src/commands/mutations/core-editing.mutation.ts
index 0cc15aaeab..3490792bf5 100644
--- a/packages/docs/src/commands/mutations/core-editing.mutation.ts
+++ b/packages/docs/src/commands/mutations/core-editing.mutation.ts
@@ -76,7 +76,13 @@ export const RichTextEditingMutation: IMutation<IRichTextEditingMutationParams,
}
if (actions.length === 0) {
- throw new Error('Mutation\'s length should great than 0 when call RichTextEditingMutation');
+ // The actions' length maybe 0 when the mutation is from collaborative editing.
+ // The return result will not be used.
+ return {
+ unitId,
+ actions: [],
+ textRanges: serializedSelections,
+ };
}
// Step 1: Update Doc Data Model.