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
refactor: remove the search logic for all workbooks (#5703)
wpxp123456b721bececd1a
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.tsindex ec8b63c56c..79e19613aa 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@@ -967,17 +967,16 @@ class SheetsFindReplaceProvider extends Disposable implements IFindReplaceProvidasync find(query: IFindQuery): Promise<SheetFindModel[]> {this._terminate();- const allWorkbooks = this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET);+ const workbook = this._univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET);+ if (!workbook) return [];+const parsedQuery = this._preprocessQuery(query);- const findModels = allWorkbooks.map((workbook) => {- const skeletonManagerService = this._renderManagerService.getRenderById(workbook.getUnitId())!.with(SheetSkeletonManagerService);- const sheetFind = this._injector.createInstance(SheetFindModel, workbook, skeletonManagerService);- this._findModelsByUnitId.set(workbook.getUnitId(), sheetFind);- sheetFind.start(parsedQuery);- return sheetFind;- });+ const skeletonManagerService = this._renderManagerService.getRenderById(workbook.getUnitId())!.with(SheetSkeletonManagerService);+ const sheetFind = this._injector.createInstance(SheetFindModel, workbook, skeletonManagerService);+ this._findModelsByUnitId.set(workbook.getUnitId(), sheetFind);+ sheetFind.start(parsedQuery);- return findModels;+ return [sheetFind];}terminate(): void {