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): reserve the first remove text run (#3225)

Ran Luo01fdccad608c
diff --git a/packages/core/src/docs/data-model/text-x/apply-utils/common.ts b/packages/core/src/docs/data-model/text-x/apply-utils/common.ts
index 2633a2b438..07b6c9db05 100644
--- a/packages/core/src/docs/data-model/text-x/apply-utils/common.ts
+++ b/packages/core/src/docs/data-model/text-x/apply-utils/common.ts
@@ -548,7 +548,13 @@ export function deleteTextRuns(body: IDocumentBody, textLength: number, currentI
st: st - startIndex,
ed: ed - startIndex,
});
- continue;
+
+ // https://github.com/dream-num/univer-pro/issues/2044.
+ if (startIndex === st) {
+ textRun.ed = st;
+ } else {
+ continue;
+ }
} else if (st <= startIndex && ed >= endIndex) {
/**
* If the selection range is smaller than the current textRun,