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(sheet): find-replace replaceAll only effect on the active sheet (#2202)

siam0ed9f560ac7f
diff --git a/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts b/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts
index 49e9f21fbf..bd2cd049bc 100644
--- a/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts
+++ b/packages/sheets-find-replace/src/controllers/sheet-find-replace.controller.ts
@@ -434,8 +434,8 @@ export class SheetFindModel extends FindModel {
private _disposeHighlights(): void {
this._highlightShapes.forEach((shape) => {
- shape.dispose();
shape.getScene().makeDirty();
+ shape.dispose();
});
this._highlightShapes = [];
diff --git a/packages/sheets/src/commands/commands/set-range-values.command.ts b/packages/sheets/src/commands/commands/set-range-values.command.ts
index 513f73a4a2..e50363c26b 100644
--- a/packages/sheets/src/commands/commands/set-range-values.command.ts
+++ b/packages/sheets/src/commands/commands/set-range-values.command.ts
@@ -57,10 +57,16 @@ export const SetRangeValuesCommand: ICommand = {
const selectionManagerService = accessor.get(SelectionManagerService);
const sheetInterceptorService = accessor.get(SheetInterceptorService);
- const target = getSheetCommandTarget(univerInstanceService);
- if (!target) return false;
-
+ // use subUnitId and unitId from params first
+ const target = getSheetCommandTarget(univerInstanceService, {
+ subUnitId: params.subUnitId,
+ unitId: params.unitId,
+ });
+ if (!target) {
+ return false;
+ }
const { subUnitId, unitId } = target;
+
const { value, range } = params;
const currentSelections = range ? [range] : selectionManagerService.getSelectionRanges();
if (!currentSelections || !currentSelections.length) {