1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Apply user specified palette cateogies and remaining core ones

This commit is contained in:
Nick O'Leary 2019-08-21 17:27:06 +01:00
parent 10077ae750
commit 03aa6c7d3a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -553,20 +553,26 @@ RED.palette = (function() {
sidebarControls.stop(false,true);
sidebarControls.hide();
})
var categoryList = coreCategories;
var userCategories = [];
if (RED.settings.paletteCategories) {
categoryList = RED.settings.paletteCategories;
userCategories = RED.settings.paletteCategories;
} else if (RED.settings.theme('palette.categories')) {
categoryList = RED.settings.theme('palette.categories');
userCategories = RED.settings.theme('palette.categories');
}
if (!Array.isArray(categoryList)) {
categoryList = coreCategories
if (!Array.isArray(userCategories)) {
userCategories = [];
}
categoryList.forEach(function(category){
var addedCategories = {};
userCategories.forEach(function(category){
addedCategories[category] = true;
createCategoryContainer(category, escapeCategory(category), "palette.label."+escapeCategory(category));
});
coreCategories.forEach(function(category){
if (!addedCategories[category]) {
createCategoryContainer(category, escapeCategory(category), "palette.label."+escapeCategory(category));
}
});
var paletteFooterButtons = $('<span class="button-group"></span>').appendTo("#red-ui-palette .red-ui-component-footer");
var paletteCollapseAll = $('<button type="button" class="red-ui-footer-button"><i class="fa fa-angle-double-up"></i></button>').appendTo(paletteFooterButtons);