Allow palette-editor to be disabled via editorTheme

This commit is contained in:
Nick O'Leary
2016-08-10 20:15:17 +01:00
parent e4d788ad0b
commit 11656382a7
4 changed files with 25 additions and 14 deletions

View File

@@ -304,7 +304,8 @@ RED.palette.editor = (function() {
function initInstallTab() {
$("#palette-module-install-shade").show();
$.getJSON('http://catalog.nodered.org/catalog.json',function(v) {
$.getJSON('http://catalogue.nodered.org/catalogue.json',function(v) {
loadedList = v;
searchInput.searchBox('count',loadedList.length);
loadedList.forEach(function(m) {
@@ -321,6 +322,8 @@ RED.palette.editor = (function() {
}
function init() {
$(".palette-editor-button").show();
editorTabs = RED.tabs.create({
id:"palette-editor-tabs",
onchange:function(tab) {

View File

@@ -17,7 +17,7 @@
RED.palette = (function() {
var exclusion = ['config','unknown','deprecated'];
var core = ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced'];
var coreCategories = ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced'];
var categoryContainers = {};
@@ -174,7 +174,7 @@ RED.palette = (function() {
}
if ($("#palette-base-category-"+rootCategory).length === 0) {
if(core.indexOf(rootCategory) !== -1){
if(coreCategories.indexOf(rootCategory) !== -1){
createCategoryContainer(rootCategory, RED._("node-red:palette.label."+rootCategory, {defaultValue:rootCategory}));
} else {
var ns = def.set.id;
@@ -438,15 +438,18 @@ RED.palette = (function() {
}
})
var categoryList = coreCategories;
if (RED.settings.paletteCategories) {
RED.settings.paletteCategories.forEach(function(category){
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
});
} else {
core.forEach(function(category){
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
});
categoryList = RED.settings.paletteCategories;
} else if (RED.settings.theme('palette.categories')) {
categoryList = RED.settings.theme('palette.categories');
}
if (!Array.isArray(categoryList)) {
categoryList = coreCategories
}
categoryList.forEach(function(category){
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
});
$("#palette-collapse-all").on("click", function(e) {
e.preventDefault();
@@ -465,7 +468,9 @@ RED.palette = (function() {
}
});
RED.palette.editor.init();
if (RED.settings.theme('palette.editable') !== false) {
RED.palette.editor.init();
}
}
return {