From 2deee117187c779798371d244c6d31875ccc9916 Mon Sep 17 00:00:00 2001 From: DrChiodo Date: Wed, 5 Nov 2025 14:47:20 +0100 Subject: [PATCH] fix: restore text selection and copy in read-only CodeEditor (#5983) Fixes #5982 Changed CodeMirror readOnly option from 'nocursor' to boolean true to allow text selection while maintaining read-only behavior. Removed CSS rules that prevented text selection (user-select: none) in read-only mode. This restores the ability to copy text from the Response panel using Ctrl+C or right-click context menu, which was broken in nightly builds after v2.13.2. --- .../bruno-app/src/components/CodeEditor/StyledWrapper.js | 6 ------ packages/bruno-app/src/components/CodeEditor/index.js | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js b/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js index 8d2586c8b..ab007c662 100644 --- a/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js +++ b/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js @@ -2,12 +2,6 @@ import styled from 'styled-components'; const StyledWrapper = styled.div` &.read-only { - div.CodeMirror .CodeMirror-lines { - user-select: none !important; - -webkit-user-select: none !important; - -ms-user-select: none !important; - } - div.CodeMirror .CodeMirror-cursor { display: none !important; } diff --git a/packages/bruno-app/src/components/CodeEditor/index.js b/packages/bruno-app/src/components/CodeEditor/index.js index 721f35b42..742b93045 100644 --- a/packages/bruno-app/src/components/CodeEditor/index.js +++ b/packages/bruno-app/src/components/CodeEditor/index.js @@ -63,7 +63,7 @@ export default class CodeEditor extends React.Component { foldGutter: true, gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter', 'CodeMirror-lint-markers'], lint: this.lintOptions, - readOnly: this.props.readOnly ? 'nocursor' : false, + readOnly: !!this.props.readOnly, scrollbarStyle: 'overlay', theme: this.props.theme === 'dark' ? 'monokai' : 'default', extraKeys: { @@ -246,7 +246,7 @@ export default class CodeEditor extends React.Component { } if (this.props.readOnly !== prevProps.readOnly && this.editor) { - this.editor.setOption('readOnly', this.props.readOnly ? 'nocursor' : false); + this.editor.setOption('readOnly', !!this.props.readOnly); } this.ignoreChangeEvent = false;