diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 9dbee4280..c03c01212 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -163,15 +163,22 @@ const SnippetGroup = createClass({ onSnippetClick : function(){}, }; }, - handleSnippetClick : function(snippet){ + handleSnippetClick : function(e, snippet){ + e.stopPropagation(); this.props.onSnippetClick(execute(snippet.gen, this.props.brew)); }, - renderSnippets : function(){ - return _.map(this.props.snippets, (snippet)=>{ - return
this.handleSnippetClick(snippet)}> + renderSnippets : function(snippets){ + return _.map(snippets, (snippet)=>{ + return
this.handleSnippetClick(e, snippet)}> {snippet.name} + {snippet.subsnippets && <> + +
+ {this.renderSnippets(snippet.subsnippets)} +
}
; + }); }, @@ -182,7 +189,7 @@ const SnippetGroup = createClass({ {this.props.groupName}
- {this.renderSnippets()} + {this.renderSnippets(this.props.snippets)}
; }, diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index 371f51fda..2947837bd 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -83,7 +83,7 @@ .snippetGroup{ border-right : 1px solid black; &:hover{ - .dropdown{ + &>.dropdown{ visibility : visible; } } @@ -97,15 +97,29 @@ background-color : #ddd; .snippet{ .animate(background-color); + width : max-content; padding : 5px; cursor : pointer; font-size : 10px; i{ margin-right : 8px; font-size : 1.2em; + &~i{ + margin-right: 0; + margin-left: 8px; + } } &:hover{ background-color : #999; + &>.dropdown{ + visibility : visible; + &.side { + left: 100%; + top: 0%; + margin-left:0; + box-shadow: -1px 1px 2px 0px #999; + } + } } } }