mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Collapse palette category when emptied
This commit is contained in:
parent
18a3d71024
commit
78cf310c58
@ -98,7 +98,6 @@ RED.palette = (function() {
|
||||
}
|
||||
|
||||
function addNodeType(nt,def) {
|
||||
|
||||
var nodeTypeId = escapeNodeType(nt);
|
||||
if ($("#palette_node_"+nodeTypeId).length) {
|
||||
return;
|
||||
@ -192,7 +191,15 @@ RED.palette = (function() {
|
||||
|
||||
function removeNodeType(nt) {
|
||||
var nodeTypeId = escapeNodeType(nt);
|
||||
$("#palette_node_"+nodeTypeId).remove();
|
||||
var paletteNode = $("#palette_node_"+nodeTypeId);
|
||||
var categoryNode = paletteNode.closest(".palette-category");
|
||||
paletteNode.remove();
|
||||
if (categoryNode.find(".palette_node").length === 0) {
|
||||
if (categoryNode.find("i").hasClass("expanded")) {
|
||||
categoryNode.find(".palette-content").slideToggle();
|
||||
categoryNode.find("i").toggleClass("expanded");
|
||||
}
|
||||
}
|
||||
}
|
||||
function hideNodeType(nt) {
|
||||
var nodeTypeId = escapeNodeType(nt);
|
||||
|
Loading…
Reference in New Issue
Block a user