1717RED . palette = ( function ( ) {
1818
1919 var exclusion = [ 'config' , 'unknown' , 'deprecated' ] ;
20- var core = [ 'subflows' , 'input' , 'output' , 'function' , 'social' , 'mobile' , 'storage' , 'analysis' , 'advanced' ] ;
20+ var coreCategories = [ 'subflows' , 'input' , 'output' , 'function' , 'social' , 'mobile' , 'storage' , 'analysis' , 'advanced' ] ;
2121
2222 var categoryContainers = { } ;
2323
@@ -174,7 +174,7 @@ RED.palette = (function() {
174174 }
175175
176176 if ( $ ( "#palette-base-category-" + rootCategory ) . length === 0 ) {
177- if ( core . indexOf ( rootCategory ) !== - 1 ) {
177+ if ( coreCategories . indexOf ( rootCategory ) !== - 1 ) {
178178 createCategoryContainer ( rootCategory , RED . _ ( "node-red:palette.label." + rootCategory , { defaultValue :rootCategory } ) ) ;
179179 } else {
180180 var ns = def . set . id ;
@@ -438,15 +438,18 @@ RED.palette = (function() {
438438 }
439439 } )
440440
441+ var categoryList = coreCategories ;
441442 if ( RED . settings . paletteCategories ) {
442- RED . settings . paletteCategories . forEach ( function ( category ) {
443- createCategoryContainer ( category , RED . _ ( "palette.label." + category , { defaultValue :category } ) ) ;
444- } ) ;
445- } else {
446- core . forEach ( function ( category ) {
447- createCategoryContainer ( category , RED . _ ( "palette.label." + category , { defaultValue :category } ) ) ;
448- } ) ;
443+ categoryList = RED . settings . paletteCategories ;
444+ } else if ( RED . settings . theme ( 'palette.categories' ) ) {
445+ categoryList = RED . settings . theme ( 'palette.categories' ) ;
446+ }
447+ if ( ! Array . isArray ( categoryList ) ) {
448+ categoryList = coreCategories
449449 }
450+ categoryList . forEach ( function ( category ) {
451+ createCategoryContainer ( category , RED . _ ( "palette.label." + category , { defaultValue :category } ) ) ;
452+ } ) ;
450453
451454 $ ( "#palette-collapse-all" ) . on ( "click" , function ( e ) {
452455 e . preventDefault ( ) ;
@@ -465,7 +468,9 @@ RED.palette = (function() {
465468 }
466469 } ) ;
467470
468- RED . palette . editor . init ( ) ;
471+ if ( RED . settings . theme ( 'palette.editable' ) !== false ) {
472+ RED . palette . editor . init ( ) ;
473+ }
469474 }
470475
471476 return {
0 commit comments