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
fix: fix an issue where border styles were lost when unmerging cells and then undo (#6558)
wpxp123456ca913c915f2d
diff --git a/packages/sheets/src/commands/commands/remove-worksheet-merge.command.ts b/packages/sheets/src/commands/commands/remove-worksheet-merge.command.tsindex 234d25f69d..33ae2b7176 100644--- a/packages/sheets/src/commands/commands/remove-worksheet-merge.command.ts+++ b/packages/sheets/src/commands/commands/remove-worksheet-merge.command.ts@@ -24,7 +24,7 @@ import { SelectionMoveType } from '../../services/selections';import { SheetsSelectionsService } from '../../services/selections/selection.service';import { AddWorksheetMergeMutation } from '../mutations/add-worksheet-merge.mutation';import { RemoveMergeUndoMutationFactory, RemoveWorksheetMergeMutation } from '../mutations/remove-worksheet-merge.mutation';-import { SetRangeValuesMutation } from '../mutations/set-range-values.mutation';+import { SetRangeValuesMutation, SetRangeValuesUndoMutationFactory } from '../mutations/set-range-values.mutation';import { getSheetCommandTarget } from './utils/target-util';interface IRemoveWorksheetMergeCommandParams extends ISheetCommandSharedParams {@@ -59,7 +59,7 @@ export const RemoveWorksheetMergeCommand: ICommand = {});if (!intersectsMerges.length) return false;- const undoredoMutationParams: IAddWorksheetMergeMutationParams = RemoveMergeUndoMutationFactory(+ const undoRedoMutationParams: IAddWorksheetMergeMutationParams = RemoveMergeUndoMutationFactory(accessor,removeMergeMutationParams);@@ -87,16 +87,15 @@ export const RemoveWorksheetMergeCommand: ICommand = {const redoSetRangeValueParams: ISetRangeValuesMutationParams = {unitId,subUnitId,- cellValue: getSetRangeValuesParams.redoParams.getMatrix(),- };- const undoSetRangeValueParams: ISetRangeValuesMutationParams = {- unitId,- subUnitId,- cellValue: getSetRangeValuesParams.undoParams.getMatrix(),+ cellValue: getSetRangeValuesParams.getMatrix(),};+ const undoSetRangeValueParams: ISetRangeValuesMutationParams = SetRangeValuesUndoMutationFactory(+ accessor,+ redoSetRangeValueParams+ );const redoMutations: IMutationInfo[] = [- { id: RemoveWorksheetMergeMutation.id, params: undoredoMutationParams },+ { id: RemoveWorksheetMergeMutation.id, params: undoRedoMutationParams },{ id: SetRangeValuesMutation.id, params: redoSetRangeValueParams },{id: SetSelectionsOperation.id,@@ -110,7 +109,7 @@ export const RemoveWorksheetMergeCommand: ICommand = {];const undoMutations: IMutationInfo[] = [- { id: AddWorksheetMergeMutation.id, params: undoredoMutationParams },+ { id: AddWorksheetMergeMutation.id, params: undoRedoMutationParams },{ id: SetRangeValuesMutation.id, params: undoSetRangeValueParams },{id: SetSelectionsOperation.id,@@ -139,7 +138,6 @@ export const RemoveWorksheetMergeCommand: ICommand = {function getSetRangeStyleParamsForRemoveMerge(worksheet: Worksheet, ranges: IRange[]) {const styleRedoMatrix = new ObjectMatrix<Nullable<ICellData>>();- const styleUndoMatrix = new ObjectMatrix<Nullable<ICellData>>();ranges.forEach((range) => {const { startRow, startColumn, endColumn, endRow } = range;@@ -149,15 +147,11 @@ function getSetRangeStyleParamsForRemoveMerge(worksheet: Worksheet, ranges: IRanfor (let j = startColumn; j <= endColumn; j++) {if (i !== startRow || j !== startColumn) {styleRedoMatrix.setValue(i, j, { s: cellValue.s });- styleUndoMatrix.setValue(i, j, null);}}}}});- return {- redoParams: styleRedoMatrix,- undoParams: styleUndoMatrix,- };+ return styleRedoMatrix;}