diff --git a/src/components/CodeEditor/CodeEditor.example.js b/src/components/CodeEditor/CodeEditor.example.js
index 4b9cb25b4b..5e86534be9 100644
--- a/src/components/CodeEditor/CodeEditor.example.js
+++ b/src/components/CodeEditor/CodeEditor.example.js
@@ -13,6 +13,6 @@ export const component = CodeEditor;
export const demos = [
{
name: 'Simple code editor (only JS support)',
- render: () => ,
+ render: () => ,
},
];
diff --git a/src/components/CodeEditor/CodeEditor.react.js b/src/components/CodeEditor/CodeEditor.react.js
index bf865041a9..e8554fe7e3 100644
--- a/src/components/CodeEditor/CodeEditor.react.js
+++ b/src/components/CodeEditor/CodeEditor.react.js
@@ -18,11 +18,13 @@ export default class CodeEditor extends React.Component {
constructor(props) {
super(props);
- this.state = { code: '' };
+ this.state = {
+ code: this.props.defaultValue || '',
+ };
}
get value() {
- return this.state.code || this.props.placeHolder;
+ return this.state.code;
}
set value(code) {
@@ -30,7 +32,7 @@ export default class CodeEditor extends React.Component {
}
render() {
- const { placeHolder, fontSize = 18 } = this.props;
+ const { fontSize = 18 } = this.props;
const { code } = this.state;
return (
@@ -43,7 +45,7 @@ export default class CodeEditor extends React.Component {
showGutter={true}
highlightActiveLine={true}
width="100%"
- value={code || placeHolder}
+ value={code}
enableBasicAutocompletion={true}
enableLiveAutocompletion={true}
enableSnippets={false}
@@ -56,5 +58,5 @@ export default class CodeEditor extends React.Component {
CodeEditor.propTypes = {
fontSize: PropTypes.number.describe('Font size of the editor'),
- placeHolder: PropTypes.string.describe('Code place holder'),
+ defaultValue: PropTypes.string.describe('Default Code'),
};
diff --git a/src/dashboard/Data/Playground/Playground.react.js b/src/dashboard/Data/Playground/Playground.react.js
index 08e830246a..b741d2dd7a 100644
--- a/src/dashboard/Data/Playground/Playground.react.js
+++ b/src/dashboard/Data/Playground/Playground.react.js
@@ -10,6 +10,11 @@ import { CurrentApp } from 'context/currentApp';
import styles from './Playground.scss';
+const DEFAULT_CODE_EDITOR_VALUE = `const myObj = new Parse.Object('MyClass');
+myObj.set('myField', 'Hello World!')
+await myObj.save();
+console.log(myObj);`;
+
export default class Playground extends Component {
static contextType = CurrentApp;
constructor() {
@@ -141,10 +146,7 @@ export default class Playground extends Component {
(this.editor = editor)}
/>