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