Add placeholder to party description

This commit is contained in:
Justin Edmund 2023-07-06 17:07:05 -07:00
parent 17113e2ad9
commit abd98d27c9
2 changed files with 18 additions and 1 deletions

View file

@ -36,6 +36,14 @@
outline: none; outline: none;
} }
p.empty:first-child::before {
color: var(--text-tertiary);
content: attr(data-placeholder);
float: left;
height: 0;
pointer-events: none;
}
&.bound { &.bound {
background-color: var(--input-bound-bg); background-color: var(--input-bound-bg);

View file

@ -1,9 +1,12 @@
import { ComponentProps, useCallback, useEffect } from 'react' import { ComponentProps, useCallback, useEffect } from 'react'
import { useRouter } from 'next/router'
import { useEditor, EditorContent } from '@tiptap/react' import { useEditor, EditorContent } from '@tiptap/react'
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'
import StarterKit from '@tiptap/starter-kit' import StarterKit from '@tiptap/starter-kit'
import Link from '@tiptap/extension-link' import Link from '@tiptap/extension-link'
import Highlight from '@tiptap/extension-highlight' import Highlight from '@tiptap/extension-highlight'
import Placeholder from '@tiptap/extension-placeholder'
import Typography from '@tiptap/extension-typography' import Typography from '@tiptap/extension-typography'
import Youtube from '@tiptap/extension-youtube' import Youtube from '@tiptap/extension-youtube'
import CustomMention from '~extensions/CustomMention' import CustomMention from '~extensions/CustomMention'
@ -45,6 +48,8 @@ const Editor = ({
const router = useRouter() const router = useRouter()
const locale = router.locale || 'en' const locale = router.locale || 'en'
const { t } = useTranslation('common')
useEffect(() => { useEffect(() => {
editor?.commands.setContent(formatContent(content)) editor?.commands.setContent(formatContent(content))
}, [content]) }, [content])
@ -72,6 +77,10 @@ const Editor = ({
}), }),
Link, Link,
Highlight, Highlight,
Placeholder.configure({
emptyEditorClass: styles.empty,
placeholder: t('modals.edit_team.placeholders.description'),
}),
Typography, Typography,
CustomMention.configure({ CustomMention.configure({
renderLabel({ options, node }) { renderLabel({ options, node }) {