Skip to content

Commit

Permalink
fix: don't focus blank color, because it's default
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Nov 12, 2024
1 parent ce1af38 commit bb48542
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions projects/editor/components/toolbar-tools/text-color/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import type {OnInit} from '@angular/core';
import {ChangeDetectionStrategy, Component, inject, Input} from '@angular/core';
import {TuiButton, TuiDropdown, TuiHint} from '@taiga-ui/core';
import type {AbstractTuiEditor} from '@taiga-ui/editor/common';
import {TUI_EDITOR_OPTIONS, TUI_EDITOR_TOOLBAR_TEXTS} from '@taiga-ui/editor/common';
import {
EDITOR_BLANK_COLOR,
TUI_EDITOR_OPTIONS,
TUI_EDITOR_TOOLBAR_TEXTS,
} from '@taiga-ui/editor/common';
import {TuiTiptapEditorService} from '@taiga-ui/editor/directives';
import {TuiPaletteModule} from '@taiga-ui/legacy';
import type {Observable} from 'rxjs';
Expand Down Expand Up @@ -45,7 +49,11 @@ export class TuiTextColor implements OnInit {
private initStream(): void {
this.fontColor$ =
this.editor?.stateChange$.pipe(
map(() => this.editor?.getFontColor() ?? this.options.blankColor),
map(() => {
const color = this.editor?.getFontColor() ?? this.options.blankColor;

return color !== EDITOR_BLANK_COLOR ? color : '';
}),
distinctUntilChanged(),
) ?? null;
}
Expand Down

0 comments on commit bb48542

Please sign in to comment.