mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-17 03:42:43 +00:00
Update snippetbar.jsx with filter for editor/view specific menus
Add logic to filter available snippet menus based on the view/editor that is open ("text" vs "style") for both Legacy and v3.
This commit is contained in:
@@ -39,12 +39,26 @@ const Snippetbar = createClass({
|
||||
renderSnippetGroups : function(){
|
||||
let snippets = [];
|
||||
|
||||
if(this.props.view === 'text') {
|
||||
if(this.props.renderer === 'V3')
|
||||
snippets = SnippetsV3;
|
||||
|
||||
if(this.props.renderer === 'V3')
|
||||
if(this.props.view === 'text') {
|
||||
snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'text');
|
||||
}
|
||||
else if(this.props.view === 'style') {
|
||||
snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'style');
|
||||
}
|
||||
else
|
||||
snippets = SnippetsLegacy;
|
||||
}
|
||||
snippets = null
|
||||
else
|
||||
if(this.props.view === 'text') {
|
||||
snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'text');
|
||||
}
|
||||
else if(this.props.view === 'style') {
|
||||
snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'style');
|
||||
}
|
||||
else
|
||||
snippets = null
|
||||
|
||||
|
||||
return _.map(snippets, (snippetGroup)=>{
|
||||
return <SnippetGroup
|
||||
|
||||
Reference in New Issue
Block a user