Don't auto-close brackets on one line editor (Fixes #1560)

This commit is contained in:
Gregory Schier 2019-11-26 15:48:17 -05:00
parent 60c623f0a4
commit ec972b4694
2 changed files with 20 additions and 13 deletions

View File

@ -457,27 +457,28 @@ class CodeEditor extends React.Component {
async _codemirrorSetOptions() {
const {
mode: rawMode,
readOnly,
hideLineNumbers,
keyMap,
lineWrapping,
getRenderContext,
autoCloseBrackets,
dynamicHeight,
getAutocompleteConstants,
getRenderContext,
hideGutters,
tabIndex,
placeholder,
noMatchBrackets,
noDragDrop,
hideLineNumbers,
hideScrollbars,
noStyleActiveLine,
noLint,
hintOptions,
indentSize,
indentWithTabs,
dynamicHeight,
hintOptions,
infoOptions,
jumpOptions,
keyMap,
lineWrapping,
lintOptions,
noDragDrop,
noLint,
noMatchBrackets,
noStyleActiveLine,
placeholder,
readOnly,
tabIndex,
} = this.props;
let mode;
@ -548,6 +549,10 @@ class CodeEditor extends React.Component {
options.lint = lintOptions;
}
if (typeof autoCloseBrackets === 'boolean') {
options.autoCloseBrackets = autoCloseBrackets;
}
if (!hideGutters && options.lint) {
// Don't really need this
// options.gutters.push('CodeMirror-lint-markers');
@ -975,6 +980,7 @@ CodeEditor.propTypes = {
singleLine: PropTypes.bool,
debounceMillis: PropTypes.number,
dynamicHeight: PropTypes.bool,
autoCloseBrackets: PropTypes.bool,
hintOptions: PropTypes.object,
lintOptions: PropTypes.object,
infoOptions: PropTypes.object,

View File

@ -322,6 +322,7 @@ class OneLineEditor extends PureComponent {
noStyleActiveLine
noLint
singleLine
autoCloseBrackets={false}
tabIndex={0}
id={id}
type={type}