components/Editor.jsx: Allow indentation on entering new line (#710)
indentUnit updated on settings->indentation amount change Fixes https://github.com/processing/p5.js-web-editor/issues/700
This commit is contained in:
parent
04191fbaab
commit
cf5cb1f6e9
1 changed files with 2 additions and 0 deletions
|
@ -136,6 +136,7 @@ class Editor extends React.Component {
|
||||||
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.isTabIndent);
|
||||||
this._cm.setOption('tabSize', this.props.indentationAmount);
|
this._cm.setOption('tabSize', this.props.indentationAmount);
|
||||||
|
this._cm.setOption('indentUnit', this.props.indentationAmount);
|
||||||
|
|
||||||
this.props.provideController({
|
this.props.provideController({
|
||||||
tidyCode: this.tidyCode,
|
tidyCode: this.tidyCode,
|
||||||
|
@ -171,6 +172,7 @@ 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);
|
||||||
|
this._cm.setOption('indentUnit', this.props.indentationAmount);
|
||||||
}
|
}
|
||||||
if (this.props.isTabIndent !== prevProps.isTabIndent) {
|
if (this.props.isTabIndent !== prevProps.isTabIndent) {
|
||||||
this._cm.setOption('indentWithTabs', this.props.isTabIndent);
|
this._cm.setOption('indentWithTabs', this.props.isTabIndent);
|
||||||
|
|
Loading…
Reference in a new issue