This commit is contained in:
@@ -33,20 +33,28 @@ export function MDXEditorField({
|
||||
editorWrapperClassName = 'post-mdx-editor mt-2 overflow-hidden rounded-xl border',
|
||||
editorWrapperStyle,
|
||||
editorClassName = '',
|
||||
error
|
||||
error,
|
||||
}: Readonly<MDXEditorFieldProps>) {
|
||||
const resolvedEditorClassName = `${themeClassName} ${editorClassName}`.trim();
|
||||
const editorModeKey = disabled || readOnly ? 'read-only' : 'editable';
|
||||
const resolvedEditorWrapperClassName = `${editorWrapperClassName} ${disabled ? 'post-mdx-editor--disabled' : 'post-mdx-editor--enabled'}`.trim();
|
||||
const resolvedEditorWrapperClassName =
|
||||
`${editorWrapperClassName} ${disabled ? 'post-mdx-editor--disabled' : 'post-mdx-editor--enabled'}`.trim();
|
||||
const resolvedEditorWrapperStyle: CSSProperties = {
|
||||
backgroundColor: disabled ? 'var(--field-disabled-bg)' : 'var(--field-bg)',
|
||||
borderColor: disabled ? 'var(--field-disabled-border)' : 'var(--field-border)',
|
||||
...editorWrapperStyle
|
||||
...editorWrapperStyle,
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{label ? <Label variant="body" className={`font-medium ${disabled ? 'ui-label-disabled' : 'ui-label'}`}>{label}</Label> : null}
|
||||
{label ? (
|
||||
<Label
|
||||
variant="body"
|
||||
className={`font-medium ${disabled ? 'ui-label-disabled' : 'ui-label'}`}
|
||||
>
|
||||
{label}
|
||||
</Label>
|
||||
) : null}
|
||||
<div className={resolvedEditorWrapperClassName} style={resolvedEditorWrapperStyle}>
|
||||
<MDXEditor
|
||||
key={editorModeKey}
|
||||
@@ -59,7 +67,11 @@ export function MDXEditorField({
|
||||
plugins={plugins}
|
||||
/>
|
||||
</div>
|
||||
{error ? <Label variant="error" className="mt-2 ui-error">{error}</Label> : null}
|
||||
{error ? (
|
||||
<Label variant="error" className="mt-2 ui-error">
|
||||
{error}
|
||||
</Label>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user