Skip to content

Commit

Permalink
fix(docs-ui): don't refresh-selection after set list (#3780)
Browse files Browse the repository at this point in the history
  • Loading branch information
weird94 authored Oct 17, 2024
1 parent 4008c86 commit 924dee7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/docs-ui/src/commands/commands/list.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const ListOperationCommand: ICommand<IListOperationCommandParams> = {
unitId,
actions: [],
textRanges: docRanges,
isEditing: false,
},
};

Expand Down Expand Up @@ -149,6 +150,7 @@ export const ChangeListTypeCommand: ICommand<IChangeListTypeCommandParams> = {
unitId,
actions: [],
textRanges: selections,
isEditing: false,
},
};

Expand Down Expand Up @@ -214,6 +216,7 @@ export const ChangeListNestingLevelCommand: ICommand<IChangeListNestingLevelComm
unitId,
actions: [],
textRanges: selections,
isEditing: false,
},
};

Expand Down Expand Up @@ -305,6 +308,7 @@ export const ToggleCheckListCommand: ICommand<IToggleCheckListCommandParams> = {
actions: [],
textRanges: textRanges ?? [],
segmentId,
isEditing: false,
},
};

Expand Down Expand Up @@ -412,6 +416,7 @@ export const QuickListCommand: ICommand<IQuickListCommandParams> = {
endOffset: paragraphStart,
collapsed: true,
}],
isEditing: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface IRichTextEditingMutationParams extends IMutationCommonParams {
options?: { [key: string]: boolean };
// Whether this mutation is from a sync operation.
isSync?: boolean;
isEditing?: boolean;
}

const RichTextEditingMutationId = 'doc.mutation.rich-text-editing';
Expand All @@ -61,6 +62,7 @@ export const RichTextEditingMutation: IMutation<IRichTextEditingMutationParams,
isCompositionEnd,
noNeedSetTextRange,
debounce,
isEditing = true,
} = params;

const univerInstanceService = accessor.get(IUniverInstanceService);
Expand Down Expand Up @@ -98,7 +100,7 @@ export const RichTextEditingMutation: IMutation<IRichTextEditingMutationParams,
// Make sure update cursor & selection after doc skeleton is calculated.
if (!noNeedSetTextRange && textRanges && trigger != null) {
queueMicrotask(() => {
docSelectionManagerService.replaceTextRanges(textRanges, true, params.options);
docSelectionManagerService.replaceTextRanges(textRanges, isEditing, params.options);
});
}

Expand Down

0 comments on commit 924dee7

Please sign in to comment.