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: the selection range is wrong when format range across list (#572)

Ran Luo346476827f80
diff --git a/packages/base-docs/src/commands/commands/inline-format.command.ts b/packages/base-docs/src/commands/commands/inline-format.command.ts
index 7603005ed6..ade6742cd5 100644
--- a/packages/base-docs/src/commands/commands/inline-format.command.ts
+++ b/packages/base-docs/src/commands/commands/inline-format.command.ts
@@ -157,6 +157,7 @@ export const SetInlineFormatCommand: ICommand<ISetInlineFormatCommandParams> = {
};
const len = startOffset - memoryCursor.cursor;
+
if (len !== 0) {
doMutation.params!.mutations.push({
t: 'r',
diff --git a/packages/base-render/src/components/docs/doc-skeleton.ts b/packages/base-render/src/components/docs/doc-skeleton.ts
index 55b71127f6..25c42daaf6 100644
--- a/packages/base-render/src/components/docs/doc-skeleton.ts
+++ b/packages/base-render/src/components/docs/doc-skeleton.ts
@@ -182,7 +182,7 @@ export class DocumentSkeleton extends Skeleton {
const { span, divide, line, column, section, page } = nodes;
return {
- span: divide.spanGroup.indexOf(span),
+ span: divide.spanGroup.filter((span) => span.spanType !== SpanType.LIST).indexOf(span),
divide: line.divides.indexOf(divide),
line: column.lines.indexOf(line),
column: section.columns.indexOf(column),