mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-25 05:35:41 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user