🐛 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')}
|
title={t('title')}
|
||||||
value={getDisplayContent()}
|
value={getDisplayContent()}
|
||||||
language={mapLanguage(output_format)}
|
language={mapLanguage(output_format)}
|
||||||
|
readOnly
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</SheetContent>
|
</SheetContent>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ export interface MonacoEditorProps {
|
|||||||
language?: string;
|
language?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
showLineNumbers?: boolean;
|
showLineNumbers?: boolean;
|
||||||
|
readOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@ -45,6 +46,7 @@ export function MonacoEditor({
|
|||||||
language = 'markdown',
|
language = 'markdown',
|
||||||
className,
|
className,
|
||||||
showLineNumbers = false,
|
showLineNumbers = false,
|
||||||
|
readOnly = false,
|
||||||
}: MonacoEditorProps) {
|
}: MonacoEditorProps) {
|
||||||
const [internalValue, setInternalValue] = useState<string | undefined>(propValue);
|
const [internalValue, setInternalValue] = useState<string | undefined>(propValue);
|
||||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||||
@ -146,7 +148,7 @@ export function MonacoEditor({
|
|||||||
},
|
},
|
||||||
tabSize: 2,
|
tabSize: 2,
|
||||||
wordWrap: 'off',
|
wordWrap: 'off',
|
||||||
readOnly: !onChange,
|
readOnly,
|
||||||
}}
|
}}
|
||||||
theme='transparentTheme'
|
theme='transparentTheme'
|
||||||
beforeMount={(monaco: Monaco) => {
|
beforeMount={(monaco: Monaco) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user