From 6b171e48f7724f198125ea609d693078616a1c00 Mon Sep 17 00:00:00 2001 From: splincode Date: Wed, 18 Oct 2023 12:29:38 +0300 Subject: [PATCH] feat: reuse previous font color when change font size --- .../toolbar-tools/font-size/font-size.component.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/tui-editor/components/toolbar-tools/font-size/font-size.component.ts b/libs/tui-editor/components/toolbar-tools/font-size/font-size.component.ts index 93998e31d..e1cb69da9 100644 --- a/libs/tui-editor/components/toolbar-tools/font-size/font-size.component.ts +++ b/libs/tui-editor/components/toolbar-tools/font-size/font-size.component.ts @@ -12,6 +12,7 @@ import { } from '@tinkoff/tui-editor/tokens'; import {Observable} from 'rxjs'; import {map} from 'rxjs/operators'; +import {EDITOR_BLANK_COLOR} from '@tinkoff/tui-editor/constants'; @Component({ selector: 'tui-font-size', @@ -44,6 +45,8 @@ export class TuiFontSizeComponent { } setFontOption({headingLevel, px}: Partial): void { + const color = this.editor.getFontColor(); + this.clearPreviousTextStyles(); if (headingLevel) { @@ -57,6 +60,10 @@ export class TuiFontSizeComponent { } else { this.editor.setParagraph({fontSize: tuiPx(px || 0)}); } + + if (color !== EDITOR_BLANK_COLOR) { + this.editor.setFontColor(color); + } } private clearPreviousTextStyles(): void {