1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-28 17:20:13 +02:00

propagate prefs to codemirrors. fixes #307

This commit is contained in:
Kushagra Gour
2018-06-25 12:08:26 +05:30
parent a126338fc5
commit 4163b6c59f
2 changed files with 6 additions and 2 deletions

View File

@@ -46,7 +46,8 @@ export default class ContentWrap extends Component {
this.state.codeSplitSizes !== nextState.codeSplitSizes || this.state.codeSplitSizes !== nextState.codeSplitSizes ||
this.state.mainSplitSizes !== nextState.mainSplitSizes || this.state.mainSplitSizes !== nextState.mainSplitSizes ||
this.props.currentLayoutMode !== nextProps.currentLayoutMode || this.props.currentLayoutMode !== nextProps.currentLayoutMode ||
this.props.currentItem !== nextProps.currentItem this.props.currentItem !== nextProps.currentItem ||
this.props.prefs !== nextProps.prefs
); );
} }
componentDidUpdate() { componentDidUpdate() {
@@ -748,6 +749,7 @@ export default class ContentWrap extends Component {
matchTags: { bothTags: true }, matchTags: { bothTags: true },
emmet: true emmet: true
}} }}
prefs={this.props.prefs}
onChange={this.onHtmlCodeChange.bind(this)} onChange={this.onHtmlCodeChange.bind(this)}
onCreation={el => (this.cm.html = el)} onCreation={el => (this.cm.html = el)}
onFocus={this.editorFocusHandler.bind(this)} onFocus={this.editorFocusHandler.bind(this)}
@@ -813,6 +815,7 @@ export default class ContentWrap extends Component {
], ],
emmet: true emmet: true
}} }}
prefs={this.props.prefs}
onChange={this.onCssCodeChange.bind(this)} onChange={this.onCssCodeChange.bind(this)}
onCreation={el => (this.cm.css = el)} onCreation={el => (this.cm.css = el)}
onFocus={this.editorFocusHandler.bind(this)} onFocus={this.editorFocusHandler.bind(this)}
@@ -864,6 +867,7 @@ export default class ContentWrap extends Component {
'CodeMirror-foldgutter' 'CodeMirror-foldgutter'
] ]
}} }}
prefs={this.props.prefs}
autoComplete={this.props.prefs.autoComplete} autoComplete={this.props.prefs.autoComplete}
onChange={this.onJsCodeChange.bind(this)} onChange={this.onJsCodeChange.bind(this)}
onCreation={el => (this.cm.js = el)} onCreation={el => (this.cm.js = el)}

View File

@@ -114,7 +114,7 @@ export default class UserCodeMirror extends Component {
if (!options.noAutocomplete) { if (!options.noAutocomplete) {
this.cm.on('inputRead', (editor, input) => { this.cm.on('inputRead', (editor, input) => {
if ( if (
!this.props.autoComplete || !this.props.prefs.autoComplete ||
input.origin !== '+input' || input.origin !== '+input' ||
input.text[0] === ';' || input.text[0] === ';' ||
input.text[0] === ',' || input.text[0] === ',' ||