diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx
index 58e84e4fc..9cb8e0df9 100644
--- a/client/homebrew/editor/editor.jsx
+++ b/client/homebrew/editor/editor.jsx
@@ -34,12 +34,14 @@ const Editor = createClass({
onMetaChange : ()=>{},
reportError : ()=>{},
- renderer : 'legacy'
+ editorTheme : 'default',
+ renderer : 'legacy'
};
},
getInitialState : function() {
return {
- view : 'text' //'text', 'style', 'meta'
+ editorTheme : this.props.editorTheme,
+ view : 'text' //'text', 'style', 'meta'
};
},
@@ -255,25 +257,38 @@ const Editor = createClass({
this.refs.codeEditor?.updateSize();
},
+ updateEditorTheme : function(newTheme){
+ this.setState({
+ editorTheme : newTheme
+ });
+ },
+
//Called by CodeEditor after document switch, so Snippetbar can refresh UndoHistory
rerenderParent : function (){
this.forceUpdate();
},
+ renderEditorCSSLink : function(){
+ return ;
+ },
+
renderEditor : function(){
if(this.isText()){
return <>
+ {this.renderEditorCSSLink()}
>;
}
if(this.isStyle()){
return <>
+ {this.renderEditorCSSLink()}
>;
}
@@ -323,7 +339,8 @@ const Editor = createClass({
theme={this.props.brew.theme}
undo={this.undo}
redo={this.redo}
- historySize={this.historySize()} />
+ historySize={this.historySize()}
+ updateEditorTheme={this.updateEditorTheme} />
{this.renderEditor()}
diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx
index cfd2d5e91..b8a09b906 100644
--- a/client/homebrew/editor/snippetbar/snippetbar.jsx
+++ b/client/homebrew/editor/snippetbar/snippetbar.jsx
@@ -24,16 +24,17 @@ const Snippetbar = createClass({
displayName : 'SnippetBar',
getDefaultProps : function() {
return {
- brew : {},
- view : 'text',
- onViewChange : ()=>{},
- onInject : ()=>{},
- onToggle : ()=>{},
- showEditButtons : true,
- renderer : 'legacy',
- undo : ()=>{},
- redo : ()=>{},
- historySize : ()=>{}
+ brew : {},
+ view : 'text',
+ onViewChange : ()=>{},
+ onInject : ()=>{},
+ onToggle : ()=>{},
+ showEditButtons : true,
+ renderer : 'legacy',
+ undo : ()=>{},
+ redo : ()=>{},
+ historySize : ()=>{},
+ updateEditorTheme : ()=>{}
};
},
@@ -94,6 +95,13 @@ const Snippetbar = createClass({
this.props.onInject(injectedText);
},
+ selectTheme : function(){
+ console.log('select theme');
+ const editorTheme = window.prompt('Enter theme name:', 'default');
+ if(!editorTheme) return;
+ this.props.updateEditorTheme(editorTheme);
+ },
+
renderSnippetGroups : function(){
const snippets = this.state.snippets.filter((snippetGroup)=>snippetGroup.view === this.props.view);
@@ -122,6 +130,10 @@ const Snippetbar = createClass({
+
+
+
this.props.onViewChange('text')}>
diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx
index 245317910..244784f8e 100644
--- a/shared/naturalcrit/codeEditor/codeEditor.jsx
+++ b/shared/naturalcrit/codeEditor/codeEditor.jsx
@@ -49,7 +49,8 @@ const CodeEditor = createClass({
value : '',
wrap : true,
onChange : ()=>{},
- enableFolding : true
+ enableFolding : true,
+ editorTheme : 'default'
};
},
@@ -91,6 +92,10 @@ const CodeEditor = createClass({
} else {
this.codeMirror.setOption('foldOptions', false);
}
+
+ if(prevProps.editorTheme !== this.props.editorTheme){
+ this.codeMirror.setOption('theme', this.props.editorTheme);
+ }
},
buildEditor : function() {
@@ -156,6 +161,7 @@ const CodeEditor = createClass({
autoCloseTags : true,
styleActiveLine : true,
showTrailingSpace : false,
+ theme : this.props.editorTheme
// specialChars : / /,
// specialCharPlaceholder : function(char) {
// const el = document.createElement('span');