Skip to content

Commit

Permalink
refactor(facade): refactor set font style
Browse files Browse the repository at this point in the history
  • Loading branch information
hexf00 committed Feb 6, 2024
1 parent 34ff3d8 commit 14c722e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/facade/src/apis/sheet/__tests__/f-range.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ describe('Test FRange', () => {
});

it('Range getCellData', () => {
const activeSheet = univerAPI.getActiveWorkbook()?.getActiveSheet();
const activeSheet = univerAPI.getActiveWorkbook()!.getActiveSheet();
activeSheet?.getRange(0, 0)?.setValue(1);
const range = activeSheet?.getRange(0, 0);
expect(range?.getCellData()?.v).toBe(1);
Expand Down
20 changes: 5 additions & 15 deletions packages/facade/src/apis/sheet/f-range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,21 +412,11 @@ export class FRange {
* @param color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
*/
setFontColor(color: string | null): this {
let style: IStyleTypeValue<IColorStyle | null>;

if (color === null) {
style = {
type: 'cl',
value: null,
};
} else {
style = {
type: 'cl',
value: {
rgb: color,
},
};
}
const value: IColorStyle | null = color === null ? null : { rgb: color };
const style: IStyleTypeValue<IColorStyle | null> = {
type: 'cl',
value,
};

const setStyleParams: ISetStyleCommandParams<IColorStyle | null> = {
unitId: this._workbook.getUnitId(),
Expand Down

0 comments on commit 14c722e

Please sign in to comment.