Add spoiler button to format menu
This commit is contained in:
parent
d10a84806c
commit
93778762c1
|
@ -29,6 +29,7 @@ import { EmbedModal } from './editor/embed-modal'
|
|||
import {
|
||||
CheckIcon,
|
||||
CodeIcon,
|
||||
EyeOffIcon,
|
||||
PhotographIcon,
|
||||
PresentationChartLineIcon,
|
||||
TrashIcon,
|
||||
|
@ -170,6 +171,7 @@ function FloatingMenu(props: { editor: Editor | null }) {
|
|||
const isBold = editor.isActive('bold')
|
||||
const isItalic = editor.isActive('italic')
|
||||
const isLink = editor.isActive('link')
|
||||
const isSpoiler = editor.isActive('spoiler')
|
||||
|
||||
const setLink = () => {
|
||||
const href = url && getUrl(url)
|
||||
|
@ -198,6 +200,11 @@ function FloatingMenu(props: { editor: Editor | null }) {
|
|||
<button onClick={() => (isLink ? unsetLink() : setUrl(''))}>
|
||||
<LinkIcon className={clsx('h-5', isLink && 'text-indigo-200')} />
|
||||
</button>
|
||||
<button onClick={() => editor.chain().focus().toggleSpoiler().run()}>
|
||||
<EyeOffIcon
|
||||
className={clsx('h-5', isSpoiler && 'text-indigo-200')}
|
||||
/>
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue
Block a user