From 8077a91ff746c7cad3347413eca0f39aac11eac0 Mon Sep 17 00:00:00 2001 From: Gazook89 Date: Fri, 29 Sep 2023 09:30:19 -0500 Subject: [PATCH] add foldAll and unfoldAll buttons to snippet bar. --- client/homebrew/editor/editor.jsx | 10 +++++++++ .../homebrew/editor/snippetbar/snippetbar.jsx | 21 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index d6502e985..ee2853865 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -330,6 +330,14 @@ const Editor = createClass({ return this.refs.codeEditor?.undo(); }, + foldCode : function(){ + return this.refs.codeEditor?.foldAllCode(); + }, + + unfoldCode : function(){ + return this.refs.codeEditor?.unfoldAllCode(); + }, + render : function(){ return (
@@ -343,6 +351,8 @@ const Editor = createClass({ theme={this.props.brew.theme} undo={this.undo} redo={this.redo} + foldCode={this.foldCode} + unfoldCode={this.unfoldCode} historySize={this.historySize()} currentEditorTheme={this.state.editorTheme} updateEditorTheme={this.updateEditorTheme} diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 246d534a9..23f15c2b3 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -37,6 +37,8 @@ const Snippetbar = createClass({ undo : ()=>{}, redo : ()=>{}, historySize : ()=>{}, + foldCode : ()=>{}, + unfoldCode : ()=>{}, updateEditorTheme : ()=>{}, cursorPos : {} }; @@ -46,7 +48,7 @@ const Snippetbar = createClass({ return { renderer : this.props.renderer, themeSelector : false, - snippets : [] + snippets : [], }; }, @@ -144,6 +146,22 @@ const Snippetbar = createClass({ renderEditorButtons : function(){ if(!this.props.showEditButtons) return; + let foldButtons; + if(this.props.view == 'text'){ + foldButtons = + <> +
+ +
+
+ +
+ + + } + return
@@ -154,6 +172,7 @@ const Snippetbar = createClass({
+ {foldButtons}