Skip to content

Commit

Permalink
fix: auto col only when dblclick, not trigger by set range value
Browse files Browse the repository at this point in the history
  • Loading branch information
lumixraku committed Oct 18, 2024
1 parent 74adc30 commit 55db84e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@ export class SpreadsheetSkeleton extends Skeleton {
continue;
}
const { w = defaultColumnWidth, aw, ia } = columnDataItem;
if ((ia === BooleanNumber.TRUE) && typeof aw === 'number') {
if (typeof aw === 'number') {
columnWidth = aw;
} else {
columnWidth = w;
Expand Down
15 changes: 0 additions & 15 deletions packages/sheets-ui/src/controllers/auto-width.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
import type { IColAutoWidthInfo, IRange, Workbook } from '@univerjs/core';
import type { RenderManagerService } from '@univerjs/engine-render';
import type {
ISetRangeValuesRangeMutationParams,
ISetStyleCommandParams,
ISetWorksheetColAutoWidthMutationParams,
ISetWorksheetColIsAutoWidthMutationParams,
} from '@univerjs/sheets';
import { Disposable, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { IRenderManagerService } from '@univerjs/engine-render';
import {
SetRangeValuesCommand,
SetStyleCommand,
SetWorksheetColAutoWidthMutation,
SetWorksheetColAutoWidthMutationFactory,
Expand Down Expand Up @@ -91,19 +89,6 @@ export class AutoWidthController extends Disposable {
private _initialize() {
const { _sheetInterceptorService: sheetInterceptorService, _selectionManagerService: selectionManagerService } =
this;
// for intercept'SetRangeValuesCommand' command.
this.disposeWithMe(sheetInterceptorService.interceptCommand({
getMutations: (command: { id: string; params: ISetRangeValuesRangeMutationParams }) => {
if (command.id !== SetRangeValuesCommand.id) {
return {
redos: [],
undos: [],
};
}

return this.getUndoRedoParamsOfColWidth(command.params.range);
},
}));

// for intercept 'sheet.command.set-col-is-auto-width' command.
this.disposeWithMe(sheetInterceptorService.interceptCommand({
Expand Down

0 comments on commit 55db84e

Please sign in to comment.