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.

feat(auto-fill): edit operation will quit auto-fill mode (#3333)

YuHong9478a901300b
diff --git a/packages/sheets-drawing-ui/src/controllers/sheet-drawing-transform-affected.controller.ts b/packages/sheets-drawing-ui/src/controllers/sheet-drawing-transform-affected.controller.ts
index 599ad2f03f..fd8ae918b5 100644
--- a/packages/sheets-drawing-ui/src/controllers/sheet-drawing-transform-affected.controller.ts
+++ b/packages/sheets-drawing-ui/src/controllers/sheet-drawing-transform-affected.controller.ts
@@ -1121,6 +1121,9 @@ export class SheetDrawingTransformAffectedController extends Disposable implemen
Object.keys(drawingMap).forEach((unitId) => {
const subUnitMap = drawingMap[unitId];
+ if (subUnitMap == null) {
+ return;
+ }
Object.keys(subUnitMap).forEach((subUnitId) => {
const drawingData = subUnitMap[subUnitId].data;
if (drawingData == null) {
diff --git a/packages/sheets-ui/src/controllers/auto-fill.controller.ts b/packages/sheets-ui/src/controllers/auto-fill.controller.ts
index 185e6ca529..b4ab9c68e1 100644
--- a/packages/sheets-ui/src/controllers/auto-fill.controller.ts
+++ b/packages/sheets-ui/src/controllers/auto-fill.controller.ts
@@ -147,11 +147,19 @@ export class AutoFillController extends Disposable {
SetWorksheetColWidthMutation.id,
SetWorksheetRowHeightMutation.id,
];
+
this.disposeWithMe(this._commandService.onCommandExecuted((command: ICommandInfo, options?: IExecutionOptions) => {
const fromCollab = options?.fromCollab;
if (quitCommands.includes(command.id) && !fromCollab && (command.params as IMutationCommonParams).trigger !== AutoFillCommand.id) {
this._quit();
}
+
+ // any edit operation will quit auto fill, except auto fill command
+ if (command.id === SetRangeValuesMutation.id) {
+ if ((command.params as ISetRangeValuesMutationParams).trigger !== AutoFillCommand.id) {
+ this._quit();
+ }
+ }
if (command.id === RemoveSheetMutation.id) {
if ((command.params as IRemoveSheetMutationParams).unitId === this._currentLocation?.unitId &&
(command.params as IRemoveSheetMutationParams).subUnitId === this._currentLocation?.subUnitId) {