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(facade): insert empty text error (#4465)

zhangw88a0c8630046
diff --git a/packages/core/src/docs/data-model/rich-text-builder.ts b/packages/core/src/docs/data-model/rich-text-builder.ts
index b66975008a..d03a687182 100644
--- a/packages/core/src/docs/data-model/rich-text-builder.ts
+++ b/packages/core/src/docs/data-model/rich-text-builder.ts
@@ -1656,6 +1656,8 @@ export class RichTextBuilder extends RichTextValue {
} else {
insertStyle = style instanceof TextStyleBuilder ? style.build() : style;
}
+
+ if (!insertText) return this;
const newBody: IDocumentBody = {
dataStream: insertText,
textRuns: insertStyle