🐛 fix: Add readOnly prop to MonacoEditor and TemplatePreview components for improved content handling

This commit is contained in:
web 2025-09-15 03:50:15 -07:00
parent 15540bfe16
commit c4c4d5aea3
2 changed files with 4 additions and 1 deletions

View File

@ -93,6 +93,7 @@ export function TemplatePreview({ applicationId, output_format }: TemplatePrevie
title={t('title')}
value={getDisplayContent()}
language={mapLanguage(output_format)}
readOnly
/>
)}
</SheetContent>

View File

@ -21,6 +21,7 @@ export interface MonacoEditorProps {
language?: string;
className?: string;
showLineNumbers?: boolean;
readOnly?: boolean;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@ -45,6 +46,7 @@ export function MonacoEditor({
language = 'markdown',
className,
showLineNumbers = false,
readOnly = false,
}: MonacoEditorProps) {
const [internalValue, setInternalValue] = useState<string | undefined>(propValue);
const [isFullscreen, setIsFullscreen] = useState(false);
@ -146,7 +148,7 @@ export function MonacoEditor({
},
tabSize: 2,
wordWrap: 'off',
readOnly: !onChange,
readOnly,
}}
theme='transparentTheme'
beforeMount={(monaco: Monaco) => {