Skip to content

Commit 04929ec

Browse files
committed
feat(code): disable editing in diff viewer
1 parent 01efafa commit 04929ec

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

apps/code/src/renderer/features/code-editor/components/CodeMirrorDiffEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function CodeMirrorDiffEditor({
3838
const toggleHideWhitespaceChanges = useDiffViewerStore(
3939
(s) => s.toggleHideWhitespaceChanges,
4040
);
41-
const extensions = useEditorExtensions(filePath, !onContentChange, true);
41+
const extensions = useEditorExtensions(filePath, true, true);
4242
const options = useMemo(
4343
() => ({
4444
original: originalContent,

apps/code/src/renderer/features/code-editor/hooks/useEditorExtensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function useEditorExtensions(
3939
theme,
4040
mergeViewTheme,
4141
EditorView.editable.of(!readOnly),
42-
...(readOnly ? [EditorState.readOnly.of(true)] : []),
42+
...(readOnly && !isDiff ? [EditorState.readOnly.of(true)] : []),
4343
...(languageExtension ? [languageExtension] : []),
4444
];
4545
}, [filePath, isDarkMode, readOnly, isDiff, wordWrap]);

0 commit comments

Comments
 (0)