mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 16:22:42 +00:00
Initial pass at Editor Toolbar - Undo and Redo.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/
|
||||||
require('./editor.less');
|
require('./editor.less');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
@@ -198,6 +199,21 @@ const Editor = createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderEditorToolbar : function(){
|
||||||
|
return <div className='editorToolbar'>
|
||||||
|
<span className='undo'
|
||||||
|
onClick={this.refs.codeEditor?.undo}
|
||||||
|
title='Undo'>
|
||||||
|
<i className='fas fa-undo' />
|
||||||
|
</span>
|
||||||
|
<span className='redo'
|
||||||
|
onClick={this.refs.codeEditor?.redo}
|
||||||
|
title='Redo'>
|
||||||
|
<i className='fas fa-redo' />
|
||||||
|
</span>
|
||||||
|
</div>;
|
||||||
|
},
|
||||||
|
|
||||||
render : function(){
|
render : function(){
|
||||||
this.highlightCustomMarkdown();
|
this.highlightCustomMarkdown();
|
||||||
return (
|
return (
|
||||||
@@ -211,6 +227,7 @@ const Editor = createClass({
|
|||||||
renderer={this.props.renderer} />
|
renderer={this.props.renderer} />
|
||||||
|
|
||||||
{this.renderEditor()}
|
{this.renderEditor()}
|
||||||
|
{!this.isMeta() && this.renderEditorToolbar()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,4 +42,16 @@
|
|||||||
.tooltipLeft("Jump to brew page");
|
.tooltipLeft("Jump to brew page");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.editorToolbar{
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
left: 50%;
|
||||||
|
color: black;
|
||||||
|
font-size: 13px;
|
||||||
|
z-index: 9;
|
||||||
|
span {
|
||||||
|
padding: 2px 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ const CodeEditor = createClass({
|
|||||||
updateSize : function(){
|
updateSize : function(){
|
||||||
this.codeMirror.refresh();
|
this.codeMirror.refresh();
|
||||||
},
|
},
|
||||||
|
redo : function(){
|
||||||
|
this.codeMirror.redo();
|
||||||
|
},
|
||||||
|
undo : function(){
|
||||||
|
this.codeMirror.undo();
|
||||||
|
},
|
||||||
//----------------------//
|
//----------------------//
|
||||||
|
|
||||||
render : function(){
|
render : function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user