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: fix open filter panel will trigger SheetEditEnded event (#5955)

wpxp123456a50385e2ac64
diff --git a/packages/sheets-filter-ui/src/commands/operations/sheets-filter.operation.ts b/packages/sheets-filter-ui/src/commands/operations/sheets-filter.operation.ts
index f7eaf15cca..1d2088d5ce 100644
--- a/packages/sheets-filter-ui/src/commands/operations/sheets-filter.operation.ts
+++ b/packages/sheets-filter-ui/src/commands/operations/sheets-filter.operation.ts
@@ -18,7 +18,7 @@ import type { IOperation } from '@univerjs/core';
import type { FilterBy } from '@univerjs/sheets-filter';
import { CommandType, ICommandService, IContextService, Quantity } from '@univerjs/core';
import { SheetsFilterService } from '@univerjs/sheets-filter';
-import { SetCellEditVisibleOperation } from '@univerjs/sheets-ui';
+import { IEditorBridgeService, SetCellEditVisibleOperation } from '@univerjs/sheets-ui';
import { ILayoutService } from '@univerjs/ui';
import { SheetsFilterPanelService } from '../../services/sheets-filter-panel.service';
@@ -44,7 +44,10 @@ export const OpenFilterPanelOperation: IOperation<IOpenFilterPanelOperationParam
const commandService = accessor.get(ICommandService);
// Close the cell edit if it is opened.
- commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, { visible: false });
+ const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
+ if (editorBridgeService?.isVisible().visible) {
+ commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, { visible: false });
+ }
const { unitId, subUnitId, col } = params;
const filterModel = sheetsFilterService.getFilterModel(unitId, subUnitId);