mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-26 14:15:52 +00:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user