mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +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');
|
||||
const React = require('react');
|
||||
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(){
|
||||
this.highlightCustomMarkdown();
|
||||
return (
|
||||
@@ -211,6 +227,7 @@ const Editor = createClass({
|
||||
renderer={this.props.renderer} />
|
||||
|
||||
{this.renderEditor()}
|
||||
{!this.isMeta() && this.renderEditorToolbar()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -112,6 +112,12 @@ const CodeEditor = createClass({
|
||||
updateSize : function(){
|
||||
this.codeMirror.refresh();
|
||||
},
|
||||
redo : function(){
|
||||
this.codeMirror.redo();
|
||||
},
|
||||
undo : function(){
|
||||
this.codeMirror.undo();
|
||||
},
|
||||
//----------------------//
|
||||
|
||||
render : function(){
|
||||
|
||||
Reference in New Issue
Block a user