Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/metal-parrots-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@example/ui-playground": patch
"@genseki/react": patch
---

feat: auto text color richtext
2 changes: 2 additions & 0 deletions examples/ui-playground/src/components/slot-before.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ToolbarSeparator,
} from '@genseki/react'
import {
AutoTextColorButton,
BackColorExtension,
CustomLinkExtension,
EditorBar,
Expand Down Expand Up @@ -43,6 +44,7 @@ export const EditorSlotBefore = () => {
<ToolbarSeparator className="h-auto" />
<EditorTextColorPicker />
<EditorBgColorPicker />
<AutoTextColorButton />
<ToolbarSeparator className="h-auto" />
<ToolbarGroup className="items-center">
<TextAlignButtonsGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use client'

import { DropSlashIcon } from '@phosphor-icons/react'
import { useCurrentEditor } from '@tiptap/react'

import { Button } from '../../../../components/primitives/button'

export const AutoTextColorButton = () => {
const { editor } = useCurrentEditor()

if (!editor) throw new Error('Editor provider is missing')

return (
<Button
size="md"
variant="ghost"
className="toolbar-item spaced"
onClick={() => {
editor.chain().focus().unsetColor().run()
}}
disabled={!editor.can().unsetColor()}
title="Reset text color"
>
<DropSlashIcon className="size-8" />
</Button>
)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './auto-text-color-button'
export * from './editor-bar'
export * from './editor-color-picker'
export * from './link-button'
Expand Down
Loading