fix: improve type definitions and formatting in MarkdownEditor component
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
type ComponentProps,
|
||||||
forwardRef,
|
forwardRef,
|
||||||
useId,
|
useId,
|
||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
@@ -35,6 +36,8 @@ type MarkdownEditorProps = {
|
|||||||
height: string
|
height: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MdEditorToolbars = NonNullable<ComponentProps<typeof MdEditor>["toolbars"]>
|
||||||
|
|
||||||
export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>(
|
export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>(
|
||||||
function MarkdownEditor(
|
function MarkdownEditor(
|
||||||
{
|
{
|
||||||
@@ -61,10 +64,10 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
|
|||||||
() => {
|
() => {
|
||||||
const fullscreenToolbar = (
|
const fullscreenToolbar = (
|
||||||
<NormalToolbar
|
<NormalToolbar
|
||||||
key="toggle-fullscreen"
|
key="toggle-fullscreen"
|
||||||
title={fullscreen ? t("editor.exitFullscreen") : t("editor.fullscreen")}
|
title={fullscreen ? t("editor.exitFullscreen") : t("editor.fullscreen")}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={onToggleFullscreen}
|
onClick={onToggleFullscreen}
|
||||||
>
|
>
|
||||||
{fullscreen ? (
|
{fullscreen ? (
|
||||||
<Minimize2Icon className="h-[16px] w-[16px]" />
|
<Minimize2Icon className="h-[16px] w-[16px]" />
|
||||||
@@ -112,10 +115,9 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
|
|||||||
"revoke",
|
"revoke",
|
||||||
"next",
|
"next",
|
||||||
showModeSwitch ? 1 : 0,
|
showModeSwitch ? 1 : 0,
|
||||||
"=",
|
|
||||||
"preview",
|
"preview",
|
||||||
"previewOnly",
|
"previewOnly",
|
||||||
],
|
] as MdEditorToolbars,
|
||||||
[showModeSwitch]
|
[showModeSwitch]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user