Skip to content

Commit fa28ab9

Browse files
authored
fix: response is unable to be copied (#5995)
* fix: response is unable to be copied * fix: enable selection of text on readonly * fix: no cursor when readonly
1 parent 60b437e commit fa28ab9

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

packages/bruno-app/src/components/CodeEditor/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default class CodeEditor extends React.Component {
6363
foldGutter: true,
6464
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter', 'CodeMirror-lint-markers'],
6565
lint: this.lintOptions,
66-
readOnly: !!this.props.readOnly,
66+
readOnly: this.props.readOnly,
6767
scrollbarStyle: 'overlay',
6868
theme: this.props.theme === 'dark' ? 'monokai' : 'default',
6969
extraKeys: {
@@ -246,7 +246,7 @@ export default class CodeEditor extends React.Component {
246246
}
247247

248248
if (this.props.readOnly !== prevProps.readOnly && this.editor) {
249-
this.editor.setOption('readOnly', !!this.props.readOnly);
249+
this.editor.setOption('readOnly', this.props.readOnly);
250250
}
251251

252252
this.ignoreChangeEvent = false;

packages/bruno-app/src/components/MultiLineEditor/StyledWrapper.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ const StyledWrapper = styled.div`
99
&.read-only {
1010
.CodeMirror .CodeMirror-lines {
1111
cursor: not-allowed !important;
12-
user-select: none !important;
13-
-webkit-user-select: none !important;
14-
-ms-user-select: none !important;
1512
}
1613
1714
.CodeMirror-line {
1815
color: ${(props) => props.theme.colors.text.muted} !important;
1916
}
17+
18+
.CodeMirror-cursor {
19+
display: none !important;
20+
}
2021
}
2122
2223
.CodeMirror {

packages/bruno-app/src/components/MultiLineEditor/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class MultiLineEditor extends Component {
3636
brunoVarInfo: {
3737
variables
3838
},
39-
readOnly: this.props.readOnly ? 'nocursor' : false,
39+
readOnly: this.props.readOnly,
4040
tabindex: 0,
4141
extraKeys: {
4242
'Ctrl-Enter': () => {
@@ -132,7 +132,7 @@ class MultiLineEditor extends Component {
132132
this.editor.setOption('theme', this.props.theme === 'dark' ? 'monokai' : 'default');
133133
}
134134
if (this.props.readOnly !== prevProps.readOnly && this.editor) {
135-
this.editor.setOption('readOnly', this.props.readOnly ? 'nocursor' : false);
135+
this.editor.setOption('readOnly', this.props.readOnly);
136136
}
137137
if (this.props.value !== prevProps.value && this.props.value !== this.cachedValue && this.editor) {
138138
this.cachedValue = String(this.props.value);

packages/bruno-app/src/components/SingleLineEditor/StyledWrapper.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ const StyledWrapper = styled.div`
77
overflow-x: hidden;
88
99
&.read-only {
10-
.CodeMirror .CodeMirror-lines {
11-
user-select: none !important;
12-
-webkit-user-select: none !important;
13-
-ms-user-select: none !important;
14-
}
15-
1610
.CodeMirror-cursor {
1711
display: none !important;
1812
}

packages/bruno-app/src/components/SingleLineEditor/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SingleLineEditor extends Component {
5353
},
5454
scrollbarStyle: null,
5555
tabindex: 0,
56-
readOnly: this.props.readOnly ? 'nocursor' : false,
56+
readOnly: this.props.readOnly,
5757
extraKeys: {
5858
Enter: runHandler,
5959
'Ctrl-Enter': runHandler,
@@ -153,7 +153,7 @@ class SingleLineEditor extends Component {
153153
this.setState({ maskInput: this.props.isSecret });
154154
}
155155
if (this.props.readOnly !== prevProps.readOnly && this.editor) {
156-
this.editor.setOption('readOnly', this.props.readOnly ? 'nocursor' : false);
156+
this.editor.setOption('readOnly', this.props.readOnly);
157157
}
158158
this.ignoreChangeEvent = false;
159159
}

0 commit comments

Comments
 (0)