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

View File

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

View File

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