From e171a4e34160f216bd8250fdbef851c67a1dee48 Mon Sep 17 00:00:00 2001 From: Jan Myler Date: Sun, 29 Jan 2017 14:58:54 +0100 Subject: [PATCH 1/2] Add props to configure CodeMirror --- src/components/editor.jsx | 15 ++++++++++++--- src/components/playground.jsx | 20 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/components/editor.jsx b/src/components/editor.jsx index 767730f..214c900 100644 --- a/src/components/editor.jsx +++ b/src/components/editor.jsx @@ -12,6 +12,10 @@ class Editor extends Component { theme: PropTypes.string, readOnly: PropTypes.bool, external: PropTypes.bool, + lineNumbers: PropTypes.bool, + smartIndent: PropTypes.bool, + lineWrapping: PropTypes.bool, + tabSize: PropTypes.number, codeText: PropTypes.string, selectedLines: PropTypes.array, onChange: PropTypes.func, @@ -44,15 +48,20 @@ class Editor extends Component { style, codeText, theme, + lineNumbers, + smartIndent, + lineWrapping, + tabSize, readOnly } = this.props; const options = { mode: "jsx", - lineNumbers: false, - lineWrapping: true, - smartIndent: false, matchBrackets: true, + lineWrapping, + smartIndent, + lineNumbers, + tabSize, theme, readOnly }; diff --git a/src/components/playground.jsx b/src/components/playground.jsx index b393503..19e454e 100644 --- a/src/components/playground.jsx +++ b/src/components/playground.jsx @@ -12,7 +12,11 @@ class ReactPlayground extends Component { theme: "monokai", noRender: true, context: {}, - initiallyExpanded: false + initiallyExpanded: false, + lineNumbers: false, + lineWrapping: true, + smartIndent: false, + tabSize: 4, }; static propTypes = { @@ -27,7 +31,11 @@ class ReactPlayground extends Component { es6Console: PropTypes.bool, context: PropTypes.object, initiallyExpanded: PropTypes.bool, - previewComponent: PropTypes.node + previewComponent: PropTypes.node, + lineNumbers: PropTypes.bool, + lineWrapping: PropTypes.bool, + smartIndent: PropTypes.bool, + tabSize: PropTypes.number }; state = { @@ -68,6 +76,10 @@ class ReactPlayground extends Component { propDescriptionMap, scope, selectedLines, + lineNumbers, + lineWrapping, + smartIndent, + tabSize, theme } = this.props; return ( @@ -85,6 +97,10 @@ class ReactPlayground extends Component { external={external} onChange={this._handleCodeChange} selectedLines={selectedLines} + lineNumbers={lineNumbers} + lineWrapping={lineWrapping} + smartIndent={smartIndent} + tabSize={tabSize} theme={theme} /> { From b43cbd245f0183682c372ee2b7becea0e26d0520 Mon Sep 17 00:00:00 2001 From: Jan Myler Date: Sun, 29 Jan 2017 15:03:55 +0100 Subject: [PATCH 2/2] Remove trailing comma --- src/components/playground.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/playground.jsx b/src/components/playground.jsx index 19e454e..81489c8 100644 --- a/src/components/playground.jsx +++ b/src/components/playground.jsx @@ -16,7 +16,7 @@ class ReactPlayground extends Component { lineNumbers: false, lineWrapping: true, smartIndent: false, - tabSize: 4, + tabSize: 4 }; static propTypes = {