Skip to content

Commit

Permalink
fix: no reuse border data when insert col
Browse files Browse the repository at this point in the history
  • Loading branch information
lumixraku committed Nov 23, 2024
1 parent 9c4bdd9 commit 54c6aa4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/sheets/worksheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ export class Worksheet {
return this._spanModel;
}

getStyleDataByHash(hash: string): Nullable<IStyleData> {
const data = this._styles.get(hash);
return { ...data };
}

setStyleData(style: IStyleData): Nullable<string> {
return this._styles.setValue(style);
}

/**
* Get the style of the column.
* @param {number} column The column index
Expand Down
13 changes: 13 additions & 0 deletions packages/sheets/src/commands/commands/utils/selection-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,19 @@ export function copyRangeStyles(
if (!cellValue[row]) {
cellValue[row] = {};
}

// univer-pro/issues/3016 insert row/column should not reuse border style
if (typeof cell.s === 'string') {
const styleData = worksheet.getStyleDataByHash(cell.s);
if (styleData) {
delete styleData.bd;
cell.s = worksheet.setStyleData(styleData);
}
} else {
const styleData = { ...cell.s };
delete styleData.bd;
cell.s = worksheet.setStyleData(styleData);
}
cellValue[row][column] = { s: cell.s };
}
}
Expand Down

0 comments on commit 54c6aa4

Please sign in to comment.