mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
Move Undo/Redo to SnippetBar
This commit is contained in:
@@ -199,19 +199,16 @@ 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>;
|
||||
redo : function(){
|
||||
return this.refs.codeEditor?.redo();
|
||||
},
|
||||
|
||||
historySize : function(){
|
||||
return this.refs.codeEditor?.historySize();
|
||||
},
|
||||
|
||||
undo : function(){
|
||||
return this.refs.codeEditor?.undo();
|
||||
},
|
||||
|
||||
render : function(){
|
||||
@@ -224,10 +221,12 @@ 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()}
|
||||
{!this.isMeta() && this.renderEditorToolbar()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@ const Snippetbar = createClass({
|
||||
onInject : ()=>{},
|
||||
onToggle : ()=>{},
|
||||
showEditButtons : true,
|
||||
renderer : 'legacy'
|
||||
renderer : 'legacy',
|
||||
undo : ()=>{},
|
||||
redo : ()=>{}
|
||||
};
|
||||
},
|
||||
|
||||
@@ -60,6 +62,14 @@ const Snippetbar = createClass({
|
||||
if(!this.props.showEditButtons) return;
|
||||
|
||||
return <div className='editors'>
|
||||
<div className='editorTool undo'
|
||||
onClick={this.props.undo} >
|
||||
<i className='fas fa-undo' />
|
||||
</div>
|
||||
<div className='editorTool redo'
|
||||
onClick={this.props.redo} >
|
||||
<i className='fas fa-redo' />
|
||||
</div>
|
||||
<div className={cx('text', { selected: this.props.view === 'text' })}
|
||||
onClick={()=>this.props.onViewChange('text')}>
|
||||
<i className='fa fa-beer' />
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
top : 0px;
|
||||
right : 0px;
|
||||
height : @menuHeight;
|
||||
width : 90px;
|
||||
width : 125px;
|
||||
justify-content : space-between;
|
||||
&>div{
|
||||
height : @menuHeight;
|
||||
@@ -30,6 +30,14 @@
|
||||
&.meta{
|
||||
.tooltipLeft('Properties');
|
||||
}
|
||||
&.undo{
|
||||
.tooltipLeft('Undo');
|
||||
font-size : 0.75em;
|
||||
}
|
||||
&.redo{
|
||||
.tooltipLeft('Redo');
|
||||
font-size : 0.75em;
|
||||
}
|
||||
}
|
||||
}
|
||||
.snippetBarButton{
|
||||
|
||||
Reference in New Issue
Block a user