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

View File

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