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:
parent
fc5a0ceaf5
commit
a118272222
@ -89,20 +89,24 @@ 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) {
|
||||||
var nodeWidth = 82;
|
var nodeWidth = 82;
|
||||||
@ -427,11 +431,12 @@ 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();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user