Skip to content

Commit 54c6aa4

Browse files
committed
fix: no reuse border data when insert col
1 parent 9c4bdd9 commit 54c6aa4

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

packages/core/src/sheets/worksheet.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ export class Worksheet {
121121
return this._spanModel;
122122
}
123123

124+
getStyleDataByHash(hash: string): Nullable<IStyleData> {
125+
const data = this._styles.get(hash);
126+
return { ...data };
127+
}
128+
129+
setStyleData(style: IStyleData): Nullable<string> {
130+
return this._styles.setValue(style);
131+
}
132+
124133
/**
125134
* Get the style of the column.
126135
* @param {number} column The column index

packages/sheets/src/commands/commands/utils/selection-utils.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,19 @@ export function copyRangeStyles(
264264
if (!cellValue[row]) {
265265
cellValue[row] = {};
266266
}
267+
268+
// univer-pro/issues/3016 insert row/column should not reuse border style
269+
if (typeof cell.s === 'string') {
270+
const styleData = worksheet.getStyleDataByHash(cell.s);
271+
if (styleData) {
272+
delete styleData.bd;
273+
cell.s = worksheet.setStyleData(styleData);
274+
}
275+
} else {
276+
const styleData = { ...cell.s };
277+
delete styleData.bd;
278+
cell.s = worksheet.setStyleData(styleData);
279+
}
267280
cellValue[row][column] = { s: cell.s };
268281
}
269282
}

0 commit comments

Comments
 (0)