change theme, remove selection

This commit is contained in:
ido 2014-11-30 13:59:44 +02:00
parent 3a1a1840df
commit 5ae74e47f0
3 changed files with 8 additions and 4 deletions

View File

@ -33,13 +33,14 @@ var editor = React.createClass({
}, },
componentDidMount: function () { componentDidMount: function () {
this.editor = brace.edit(this.state.editorId); this.editor = brace.edit(this.state.editorId);
// this.editor.setTheme('ace/theme/monokai');
this.editor.setTheme('ace/theme/solarized_light');
if (this.props.mode !== 'html') { if (this.props.mode !== 'html') {
this.editor.getSession().setMode('ace/mode/javascript'); this.editor.getSession().setMode('ace/mode/javascript');
} else { } else {
this.editor.getSession().setMode('ace/mode/html'); this.editor.getSession().setMode('ace/mode/html');
} }
this.editor.getSession().setUseWorker(false); this.editor.getSession().setUseWorker(false);
this.editor.setTheme('ace/theme/monokai');
var value = this.props.valueLink ? this.props.valueLink() : this.props.value; var value = this.props.valueLink ? this.props.valueLink() : this.props.value;
this.editor.setValue(value, 0); this.editor.setValue(value, 0);
@ -55,6 +56,7 @@ var editor = React.createClass({
} }
}.bind(this)); }.bind(this));
} }
this.editor.clearSelection();
}, },
componentWillUnmount: function () { componentWillUnmount: function () {
this.editor.destroy(); this.editor.destroy();

View File

@ -68913,13 +68913,14 @@ var editor = React.createClass({
}, },
componentDidMount: function () { componentDidMount: function () {
this.editor = brace.edit(this.state.editorId); this.editor = brace.edit(this.state.editorId);
// this.editor.setTheme('ace/theme/monokai');
this.editor.setTheme('ace/theme/solarized_light');
if (this.props.mode !== 'html') { if (this.props.mode !== 'html') {
this.editor.getSession().setMode('ace/mode/javascript'); this.editor.getSession().setMode('ace/mode/javascript');
} else { } else {
this.editor.getSession().setMode('ace/mode/html'); this.editor.getSession().setMode('ace/mode/html');
} }
this.editor.getSession().setUseWorker(false); this.editor.getSession().setUseWorker(false);
this.editor.setTheme('ace/theme/monokai');
var value = this.props.valueLink ? this.props.valueLink() : this.props.value; var value = this.props.valueLink ? this.props.valueLink() : this.props.value;
this.editor.setValue(value, 0); this.editor.setValue(value, 0);
@ -68935,6 +68936,7 @@ var editor = React.createClass({
} }
}.bind(this)); }.bind(this));
} }
this.editor.clearSelection();
}, },
componentWillUnmount: function () { componentWillUnmount: function () {
this.editor.destroy(); this.editor.destroy();
@ -68955,7 +68957,7 @@ var _ = require('lodash');
var html = '<div>hello</div>'; var html = '<div>hello</div>';
var res = reactTemplates.convertTemplateToReact(html.trim()); var res = reactTemplates.convertTemplateToReact(html.trim());
console.log(res); //console.log(res);
function emptyFunc() { function emptyFunc() {
return null; return null;

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var html = '<div>hello</div>'; var html = '<div>hello</div>';
var res = reactTemplates.convertTemplateToReact(html.trim()); var res = reactTemplates.convertTemplateToReact(html.trim());
console.log(res); //console.log(res);
function emptyFunc() { function emptyFunc() {
return null; return null;