diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 24e975ebc..15aaffdfc 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -460,7 +460,9 @@ const Editor = createClass({ currentEditorTheme={this.state.editorTheme} updateEditorTheme={this.updateEditorTheme} snippetBundle={this.props.snippetBundle} - cursorPos={this.codeEditor.current?.getCursorPosition() || {}} /> + cursorPos={this.codeEditor.current?.getCursorPosition() || {}} + updateBrew={this.props.updateBrew} + /> {this.renderEditor()} diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 4e5908c5a..fbab67d2f 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -40,7 +40,8 @@ const Snippetbar = createClass({ unfoldCode : ()=>{}, updateEditorTheme : ()=>{}, cursorPos : {}, - snippetBundle : [] + snippetBundle : [], + updateBrew : ()=>{} }; }, @@ -148,6 +149,10 @@ const Snippetbar = createClass({ }); }, + replaceContent : function(item){ + return this.props.updateBrew(item); + }, + renderHistoryItems : function() { const historyItems = getHistoryItems(this.props.brew); @@ -156,12 +161,18 @@ const Snippetbar = createClass({ if(!item.savedAt) return; const saveTime = new Date(item.savedAt); - const diffTime = new Date() - saveTime; - const diffMins = Math.floor(diffTime / (60 * 1000)); + const diffMs = new Date() - saveTime; + const diffMins = Math.floor(diffMs / (60 * 1000)); - return