diff --git a/packages/bruno-app/src/components/CodeEditor/index.js b/packages/bruno-app/src/components/CodeEditor/index.js index 742b93045..73fe15330 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, + 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); + this.editor.setOption('readOnly', this.props.readOnly); } this.ignoreChangeEvent = false; diff --git a/packages/bruno-app/src/components/MultiLineEditor/StyledWrapper.js b/packages/bruno-app/src/components/MultiLineEditor/StyledWrapper.js index e27beb1aa..fe532a6c1 100644 --- a/packages/bruno-app/src/components/MultiLineEditor/StyledWrapper.js +++ b/packages/bruno-app/src/components/MultiLineEditor/StyledWrapper.js @@ -9,14 +9,15 @@ const StyledWrapper = styled.div` &.read-only { .CodeMirror .CodeMirror-lines { cursor: not-allowed !important; - user-select: none !important; - -webkit-user-select: none !important; - -ms-user-select: none !important; } .CodeMirror-line { color: ${(props) => props.theme.colors.text.muted} !important; } + + .CodeMirror-cursor { + display: none !important; + } } .CodeMirror { diff --git a/packages/bruno-app/src/components/MultiLineEditor/index.js b/packages/bruno-app/src/components/MultiLineEditor/index.js index a8a78623b..19f2c3921 100644 --- a/packages/bruno-app/src/components/MultiLineEditor/index.js +++ b/packages/bruno-app/src/components/MultiLineEditor/index.js @@ -36,7 +36,7 @@ class MultiLineEditor extends Component { brunoVarInfo: { variables }, - readOnly: this.props.readOnly ? 'nocursor' : false, + readOnly: this.props.readOnly, tabindex: 0, extraKeys: { 'Ctrl-Enter': () => { @@ -132,7 +132,7 @@ class MultiLineEditor extends Component { this.editor.setOption('theme', this.props.theme === 'dark' ? 'monokai' : 'default'); } if (this.props.readOnly !== prevProps.readOnly && this.editor) { - this.editor.setOption('readOnly', this.props.readOnly ? 'nocursor' : false); + this.editor.setOption('readOnly', this.props.readOnly); } if (this.props.value !== prevProps.value && this.props.value !== this.cachedValue && this.editor) { this.cachedValue = String(this.props.value); diff --git a/packages/bruno-app/src/components/SingleLineEditor/StyledWrapper.js b/packages/bruno-app/src/components/SingleLineEditor/StyledWrapper.js index c19bd57a8..728cdeb25 100644 --- a/packages/bruno-app/src/components/SingleLineEditor/StyledWrapper.js +++ b/packages/bruno-app/src/components/SingleLineEditor/StyledWrapper.js @@ -7,12 +7,6 @@ const StyledWrapper = styled.div` overflow-x: hidden; &.read-only { - .CodeMirror .CodeMirror-lines { - user-select: none !important; - -webkit-user-select: none !important; - -ms-user-select: none !important; - } - .CodeMirror-cursor { display: none !important; } diff --git a/packages/bruno-app/src/components/SingleLineEditor/index.js b/packages/bruno-app/src/components/SingleLineEditor/index.js index 0026faba0..0bbb0bbde 100644 --- a/packages/bruno-app/src/components/SingleLineEditor/index.js +++ b/packages/bruno-app/src/components/SingleLineEditor/index.js @@ -53,7 +53,7 @@ class SingleLineEditor extends Component { }, scrollbarStyle: null, tabindex: 0, - readOnly: this.props.readOnly ? 'nocursor' : false, + readOnly: this.props.readOnly, extraKeys: { Enter: runHandler, 'Ctrl-Enter': runHandler, @@ -153,7 +153,7 @@ class SingleLineEditor extends Component { this.setState({ maskInput: this.props.isSecret }); } 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; }