From cf5cb1f6e9eb860e2b51f955fffaa19da0173dc2 Mon Sep 17 00:00:00 2001 From: Bhawesh Bhansali Date: Thu, 4 Oct 2018 23:06:42 +0530 Subject: [PATCH] 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 --- client/modules/IDE/components/Editor.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index 74bd6ceb..5f056c50 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -136,6 +136,7 @@ class Editor extends React.Component { this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`; this._cm.setOption('indentWithTabs', this.props.isTabIndent); this._cm.setOption('tabSize', this.props.indentationAmount); + this._cm.setOption('indentUnit', this.props.indentationAmount); this.props.provideController({ tidyCode: this.tidyCode, @@ -171,6 +172,7 @@ class Editor extends React.Component { } if (this.props.indentationAmount !== prevProps.indentationAmount) { this._cm.setOption('tabSize', this.props.indentationAmount); + this._cm.setOption('indentUnit', this.props.indentationAmount); } if (this.props.isTabIndent !== prevProps.isTabIndent) { this._cm.setOption('indentWithTabs', this.props.isTabIndent);