Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Add props to configure CodeMirror #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/components/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
};
Expand Down
20 changes: 18 additions & 2 deletions src/components/playground.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down Expand Up @@ -68,6 +76,10 @@ class ReactPlayground extends Component {
propDescriptionMap,
scope,
selectedLines,
lineNumbers,
lineWrapping,
smartIndent,
tabSize,
theme } = this.props;

return (
Expand All @@ -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} />
</div>
{
Expand Down