Update editor style for send button
This commit is contained in:
parent
adda267b5b
commit
f9ee5031fd
|
@ -50,7 +50,7 @@ export function useTextEditor(props: {
|
||||||
const editorClass = clsx(
|
const editorClass = clsx(
|
||||||
proseClass,
|
proseClass,
|
||||||
!simple && 'min-h-[6em]',
|
!simple && 'min-h-[6em]',
|
||||||
'resize-none outline-none border-none pt-3 px-4 focus:ring-0'
|
'outline-none pt-2 px-4'
|
||||||
)
|
)
|
||||||
|
|
||||||
const editor = useEditor(
|
const editor = useEditor(
|
||||||
|
@ -123,8 +123,9 @@ function isValidIframe(text: string) {
|
||||||
export function TextEditor(props: {
|
export function TextEditor(props: {
|
||||||
editor: Editor | null
|
editor: Editor | null
|
||||||
upload: ReturnType<typeof useUploadMutation>
|
upload: ReturnType<typeof useUploadMutation>
|
||||||
|
children?: React.ReactNode // additional toolbar buttons
|
||||||
}) {
|
}) {
|
||||||
const { editor, upload } = props
|
const { editor, upload, children } = props
|
||||||
const [iframeOpen, setIframeOpen] = useState(false)
|
const [iframeOpen, setIframeOpen] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -146,20 +147,10 @@ export function TextEditor(props: {
|
||||||
images!
|
images!
|
||||||
</FloatingMenu>
|
</FloatingMenu>
|
||||||
)}
|
)}
|
||||||
<div className="overflow-hidden rounded-lg border border-gray-300 shadow-sm focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500">
|
<div className="rounded-lg border border-gray-300 shadow-sm focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500">
|
||||||
<EditorContent editor={editor} />
|
<EditorContent editor={editor} />
|
||||||
{/* Spacer element to match the height of the toolbar */}
|
{/* Toolbar, with buttons for images and embeds */}
|
||||||
<div className="py-2" aria-hidden="true">
|
<div className="flex h-9 items-center gap-5 pl-4 pr-1">
|
||||||
{/* Matches height of button in toolbar (1px border + 36px content height) */}
|
|
||||||
<div className="py-px">
|
|
||||||
<div className="h-9" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Toolbar, with buttons for image and embeds */}
|
|
||||||
<div className="absolute inset-x-0 bottom-0 flex justify-between py-2 pl-3 pr-2">
|
|
||||||
<div className="flex items-center space-x-5">
|
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<FileUploadButton
|
<FileUploadButton
|
||||||
onFiles={upload.mutate}
|
onFiles={upload.mutate}
|
||||||
|
@ -184,6 +175,8 @@ export function TextEditor(props: {
|
||||||
<span className="sr-only">Embed an iframe</span>
|
<span className="sr-only">Embed an iframe</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="ml-auto" />
|
||||||
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -505,29 +505,23 @@ export function CommentInputTextArea(props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Row className="gap-1.5 text-gray-700">
|
<div>
|
||||||
<TextEditor editor={editor} upload={upload} />
|
<TextEditor editor={editor} upload={upload}>
|
||||||
<Col className={clsx('relative justify-end')}>
|
|
||||||
{user && !isSubmitting && (
|
{user && !isSubmitting && (
|
||||||
<button
|
<button
|
||||||
className={clsx(
|
className="btn btn-ghost btn-sm px-2 disabled:bg-inherit disabled:text-gray-300"
|
||||||
'btn btn-ghost btn-sm absolute right-2 bottom-2 flex-row pl-2 capitalize',
|
disabled={!editor || editor.isEmpty}
|
||||||
(!editor || editor.isEmpty) &&
|
|
||||||
'pointer-events-none text-gray-500'
|
|
||||||
)}
|
|
||||||
onClick={submit}
|
onClick={submit}
|
||||||
>
|
>
|
||||||
<PaperAirplaneIcon
|
<PaperAirplaneIcon className="m-0 h-[25px] min-w-[22px] rotate-90 p-0" />
|
||||||
className={'m-0 min-w-[22px] rotate-90 p-0 '}
|
|
||||||
height={25}
|
|
||||||
/>
|
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isSubmitting && (
|
{isSubmitting && (
|
||||||
<LoadingIndicator spinnerClassName={'border-gray-500'} />
|
<LoadingIndicator spinnerClassName={'border-gray-500'} />
|
||||||
)}
|
)}
|
||||||
</Col>
|
</TextEditor>
|
||||||
</Row>
|
</div>
|
||||||
<Row>
|
<Row>
|
||||||
{!user && (
|
{!user && (
|
||||||
<button
|
<button
|
||||||
|
|
Loading…
Reference in New Issue
Block a user