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(formula): fix where keyboard shortcuts incorrect when selecting formula range across worksheets (#6404)

wpxp123456522cb09e18cb
diff --git a/packages/sheets-formula-ui/src/views/formula-editor/hooks/use-sheet-selection-change.ts b/packages/sheets-formula-ui/src/views/formula-editor/hooks/use-sheet-selection-change.ts
index 689d609d0b..8cc8e71ba9 100644
--- a/packages/sheets-formula-ui/src/views/formula-editor/hooks/use-sheet-selection-change.ts
+++ b/packages/sheets-formula-ui/src/views/formula-editor/hooks/use-sheet-selection-change.ts
@@ -332,6 +332,8 @@ export const useSheetSelectionChange = (
range.startColumn = primary.startColumn;
range.endColumn = primary.startColumn;
}
+ range.unitId = params.unitId;
+ range.sheetId = params.subUnitId;
const isAdd = isSelectingRef.current === FormulaSelectingType.NEED_ADD;
const selections: IRange[] = (refSelectionsRenderService?.getSelectionDataWithStyle() ?? []).map((i) => i.rangeWithCoord);