diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx
index 20f084c28..82435cacb 100644
--- a/client/homebrew/editor/editor.jsx
+++ b/client/homebrew/editor/editor.jsx
@@ -1,3 +1,4 @@
+/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/
require('./editor.less');
const React = require('react');
const createClass = require('create-react-class');
@@ -198,6 +199,18 @@ const Editor = createClass({
}
},
+ redo : function(){
+ return this.refs.codeEditor?.redo();
+ },
+
+ historySize : function(){
+ return this.refs.codeEditor?.historySize();
+ },
+
+ undo : function(){
+ return this.refs.codeEditor?.undo();
+ },
+
render : function(){
this.highlightCustomMarkdown();
return (
@@ -208,7 +221,10 @@ const Editor = createClass({
onViewChange={this.handleViewChange}
onInject={this.handleInject}
showEditButtons={this.props.showEditButtons}
- renderer={this.props.renderer} />
+ renderer={this.props.renderer}
+ undo={this.undo}
+ redo={this.redo}
+ historySize={this.historySize} />
{this.renderEditor()}
diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less
index 0097ddbf6..8633e4eb3 100644
--- a/client/homebrew/editor/editor.less
+++ b/client/homebrew/editor/editor.less
@@ -50,4 +50,16 @@
.tooltipLeft("Jump to brew page");
}
+ .editorToolbar{
+ position: absolute;
+ top: 5px;
+ left: 50%;
+ color: black;
+ font-size: 13px;
+ z-index: 9;
+ span {
+ padding: 2px 5px;
+ }
+ }
+
}
diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx
index 9ea04695f..84888b3d0 100644
--- a/client/homebrew/editor/snippetbar/snippetbar.jsx
+++ b/client/homebrew/editor/snippetbar/snippetbar.jsx
@@ -22,7 +22,10 @@ const Snippetbar = createClass({
onInject : ()=>{},
onToggle : ()=>{},
showEditButtons : true,
- renderer : 'legacy'
+ renderer : 'legacy',
+ undo : ()=>{},
+ redo : ()=>{},
+ historySize : ()=>{}
};
},
@@ -60,6 +63,15 @@ const Snippetbar = createClass({
if(!this.props.showEditButtons) return;
return
+
+
+
+
+
+
+
this.props.onViewChange('text')}>
diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less
index ae8962501..371f51fda 100644
--- a/client/homebrew/editor/snippetbar/snippetbar.less
+++ b/client/homebrew/editor/snippetbar/snippetbar.less
@@ -10,7 +10,7 @@
top : 0px;
right : 0px;
height : @menuHeight;
- width : 90px;
+ width : 125px;
justify-content : space-between;
&>div{
height : @menuHeight;
@@ -30,6 +30,29 @@
&.meta{
.tooltipLeft('Properties');
}
+ &.undo{
+ .tooltipLeft('Undo');
+ font-size : 0.75em;
+ color : grey;
+ &.active{
+ color : black;
+ }
+ }
+ &.redo{
+ .tooltipLeft('Redo');
+ font-size : 0.75em;
+ color : grey;
+ &.active{
+ color : black;
+ }
+ }
+ &.divider {
+ background: linear-gradient(#000, #000) no-repeat center/1px 100%;
+ width: 5px;
+ &:hover{
+ background-color: inherit;
+ }
+ }
}
}
.snippetBarButton{
diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx
index 9707bde56..6fe189890 100644
--- a/shared/naturalcrit/codeEditor/codeEditor.jsx
+++ b/shared/naturalcrit/codeEditor/codeEditor.jsx
@@ -40,13 +40,14 @@ const CodeEditor = createClass({
buildEditor : function() {
this.codeMirror = CodeMirror(this.refs.editor, {
- value : this.props.value,
- lineNumbers : true,
- lineWrapping : this.props.wrap,
- mode : this.props.language, //TODO: CSS MODE DOESN'T SEEM TO LOAD PROPERLY
- indentWithTabs : true,
- tabSize : 2,
- extraKeys : {
+ value : this.props.value,
+ lineNumbers : true,
+ lineWrapping : this.props.wrap,
+ mode : this.props.language, //TODO: CSS MODE DOESN'T SEEM TO LOAD PROPERLY
+ indentWithTabs : true,
+ tabSize : 2,
+ historyEventDelay : 250,
+ extraKeys : {
'Ctrl-B' : this.makeBold,
'Cmd-B' : this.makeBold,
'Ctrl-I' : this.makeItalic,
@@ -112,6 +113,15 @@ const CodeEditor = createClass({
updateSize : function(){
this.codeMirror.refresh();
},
+ redo : function(){
+ return this.codeMirror.redo();
+ },
+ undo : function(){
+ return this.codeMirror.undo();
+ },
+ historySize : function(){
+ return this.codeMirror.doc.historySize();
+ },
//----------------------//
render : function(){