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: style error when input at the begining of paragraph (#402)
Ran Luo5fe1d8eb1bd6
diff --git a/packages/base-docs/src/commands/mutations/functions/common.ts b/packages/base-docs/src/commands/mutations/functions/common.tsindex 534bfde2e4..a94456e517 100644--- a/packages/base-docs/src/commands/mutations/functions/common.ts+++ b/packages/base-docs/src/commands/mutations/functions/common.ts@@ -37,7 +37,7 @@ export function insertTextRuns(const textRun = textRuns[i];const { st, ed } = textRun;- if (st >= currentIndex) {+ if (st > currentIndex) {textRun.st += textLength;textRun.ed += textLength;@@ -51,6 +51,7 @@ export function insertTextRuns(* So, it is necessary to set ed >= currentIndex - 1 to ensure that the new text is inserted while maintaining the style of the existing content.*/textRun.ed += textLength;+if (!Number.isFinite(insertIndex)) {insertIndex = i;}