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

changed to color change reflect immediately on OK

This commit is contained in:
Hiroyasu Nishiyama 2019-07-11 08:22:31 +09:00
parent 3ee8bcad8c
commit d06dbbb4bd
3 changed files with 15 additions and 2 deletions

View File

@ -2219,6 +2219,8 @@ RED.editor = (function() {
editing_node.color = newColor;
changes.color = newColor;
changed = true;
RED.utils.clearNodeColorCache();
RED.palette.changeSubflowColor(editing_node, newColor);
}
var old_env = editing_node.env;
@ -2228,7 +2230,6 @@ RED.editor = (function() {
changes.env = editing_node.env;
changed = true;
}
RED.palette.refresh();
if (changed) {
@ -2242,6 +2243,7 @@ RED.editor = (function() {
id:n.id,
changed:n.changed
})
n._def.color = editing_node.color;
n.changed = true;
n.dirty = true;
updateNodeProperties(n);

View File

@ -593,6 +593,11 @@ RED.palette = (function() {
setTimeout(function() { $(window).trigger("resize"); } ,200);
}
function changeSubflowColor(sf, color) {
var paletteNode = getPaletteNode('subflow:'+sf.id);
paletteNode.css("backgroundColor", color);
}
function getCategories() {
var categories = [];
@ -608,6 +613,7 @@ RED.palette = (function() {
hide:hideNodeType,
show:showNodeType,
refresh:refreshNodeTypes,
getCategories: getCategories
getCategories: getCategories,
changeSubflowColor: changeSubflowColor
};
})();

View File

@ -912,6 +912,10 @@ RED.utils = (function() {
}
var nodeColorCache = {};
function clearNodeColorCache() {
nodeColorCache = {};
}
function getNodeColor(type, def) {
var result = def.color;
var paletteTheme = RED.settings.theme('palette.theme') || [];
@ -1044,6 +1048,7 @@ RED.utils = (function() {
getNodeIcon: getNodeIcon,
getNodeLabel: getNodeLabel,
getNodeColor: getNodeColor,
clearNodeColorCache: clearNodeColorCache,
addSpinnerOverlay: addSpinnerOverlay,
decodeObject: decodeObject,
parseContextKey: parseContextKey,