add isTabIndent to componentchange

This commit is contained in:
mathuramg 2016-07-10 23:11:06 -04:00
parent 65bd8c2e63
commit 8746558fa8

View file

@ -17,9 +17,7 @@ class Editor extends React.Component {
this.props.updateFile('sketch.js', this._cm.getValue()); this.props.updateFile('sketch.js', this._cm.getValue());
}); });
this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`; this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`;
this._cm.setOption('indentWithTabs', this.props.isTabIndent);
this._cm.setOption('indentWithTabs', this.props.indentWithTab);
this._cm.setOption('tabSize', this.props.indentationAmount);
this._cm.setOption('indentUnit', this.props.indentationAmount); this._cm.setOption('indentUnit', this.props.indentationAmount);
} }
@ -34,6 +32,9 @@ class Editor extends React.Component {
if (this.props.indentationAmount !== prevProps.indentationAmount) { if (this.props.indentationAmount !== prevProps.indentationAmount) {
this._cm.setOption('tabSize', this.props.indentationAmount); this._cm.setOption('tabSize', this.props.indentationAmount);
} }
if (this.props.isTabIndent !== prevProps.isTabIndent) {
this._cm.setOption('indentWithTabs', this.props.isTabIndent);
}
} }
componentWillUnmount() { componentWillUnmount() {