File tree Expand file tree Collapse file tree
examples/ui-playground/src/components
legacies/react/v2/components/compound/editor/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @example/ui-playground " : patch
3+ " @genseki/react " : patch
4+ ---
5+
6+ feat: auto text color richtext
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 ToolbarSeparator ,
1515} from '@genseki/react'
1616import {
17+ AutoTextColorButton ,
1718 BackColorExtension ,
1819 CustomLinkExtension ,
1920 EditorBar ,
@@ -43,6 +44,7 @@ export const EditorSlotBefore = () => {
4344 < ToolbarSeparator className = "h-auto" />
4445 < EditorTextColorPicker />
4546 < EditorBgColorPicker />
47+ < AutoTextColorButton />
4648 < ToolbarSeparator className = "h-auto" />
4749 < ToolbarGroup className = "items-center" >
4850 < TextAlignButtonsGroup >
Original file line number Diff line number Diff line change 1+ 'use client'
2+
3+ import { DropSlashIcon } from '@phosphor-icons/react'
4+ import { useCurrentEditor } from '@tiptap/react'
5+
6+ import { Button } from '../../../../components/primitives/button'
7+
8+ export const AutoTextColorButton = ( ) => {
9+ const { editor } = useCurrentEditor ( )
10+
11+ if ( ! editor ) throw new Error ( 'Editor provider is missing' )
12+
13+ return (
14+ < Button
15+ size = "md"
16+ variant = "ghost"
17+ className = "toolbar-item spaced"
18+ onClick = { ( ) => {
19+ editor . chain ( ) . focus ( ) . unsetColor ( ) . run ( )
20+ } }
21+ disabled = { ! editor . can ( ) . unsetColor ( ) }
22+ title = "Reset text color"
23+ >
24+ < DropSlashIcon className = "size-8" />
25+ </ Button >
26+ )
27+ }
Original file line number Diff line number Diff line change 1+ export * from './auto-text-color-button'
12export * from './editor-bar'
23export * from './editor-color-picker'
34export * from './link-button'
You can’t perform that action at this time.
0 commit comments