sjdemartini / mui-tiptap

A Material UI (MUI) styled WYSIWYG rich text editor, using Tiptap
MIT License
319 stars 43 forks source link

Show separate color indicator bar in text & highlight buttons #139

Closed sjdemartini closed 1 year ago

sjdemartini commented 1 year ago

Changes:

mui-tiptap_color_indicator

cc @ericdwang since you mentioned you were interested in this.

ericdwang commented 1 year ago

Looks great! :tada:

I just noticed one tiny inconsistency when selecting both colored and non-colored text/highlights: the text color button shows the color but the highlight color button doesn't. Like in this example "no" has no colors and "colors" has a text and background color:

image

sjdemartini commented 1 year ago

@ericdwang Hm, yeah, so the way the Highlight button behaves is to check whether your selection is "active" for the highlight mark (see isActive, consistent with how Tiptap recommends showing button states in all of their examples, so the same as how we handle Bold, Italic, etc.). That means if you select something that has no highlighting on some portion of it, it shows as "not active" and does not show a current color.

By contrast, I don't have MenuButtonTextColor checking "is active", since it seemed moderately useful to show the "first" color of the selected text, but that's probably the wrong choice for the sake of consistency. I'll change it to show no color if there are multiple colors selected, the same as how Google Docs behaves (and other controls in mui-tiptap behave, like FontSize, etc.)

ericdwang commented 1 year ago

Ah I see, makes sense!