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

Palette: fix source code formatting.

This commit is contained in:
Bruno Feurer 2022-09-02 00:14:22 +02:00
parent fc5a0ceaf5
commit a118272222

View File

@ -89,20 +89,24 @@ RED.palette = (function() {
}
function rememberCategoryState(cat, open) {
const stateStr = localStorage.getItem('closedCategories');
if (!stateStr && open) return;
if (!stateStr && open) {
return;
}
const state = stateStr ? JSON.parse(stateStr) : [];
const idx = state.indexOf(cat);
if (open && idx >= 0)
if (open && idx >= 0) {
state.splice(idx, 1);
else if (!open && idx < 0)
} else if (!open && idx < 0) {
state.push(cat);
else
} else {
return;
if (state.length <= 0)
}
if (state.length <= 0) {
localStorage.removeItem('closedCategories');
else
} else {
localStorage.setItem('closedCategories', JSON.stringify(state));
}
}
function setLabel(type, el,label, info) {
var nodeWidth = 82;
@ -427,11 +431,12 @@ RED.palette = (function() {
if (categoryNode.find(".red-ui-palette-node").length === 1) {
const closedCategoriesStr = localStorage.getItem('closedCategories');
const closedCategories = closedCategoriesStr ? JSON.parse(closedCategoriesStr) : [];
if (closedCategories.indexOf(rootCategory) < 0)
if (closedCategories.indexOf(rootCategory) < 0) {
categoryContainers[rootCategory].open();
else
} else {
categoryContainers[rootCategory].close();
}
}
}
}