🐛 fix: Add readOnly prop to MonacoEditor and TemplatePreview components for improved content handling
This commit is contained in:
parent
15540bfe16
commit
c4c4d5aea3
@ -93,6 +93,7 @@ export function TemplatePreview({ applicationId, output_format }: TemplatePrevie
|
||||
title={t('title')}
|
||||
value={getDisplayContent()}
|
||||
language={mapLanguage(output_format)}
|
||||
readOnly
|
||||
/>
|
||||
)}
|
||||
</SheetContent>
|
||||
|
||||
@ -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) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user