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

Fixed name conflict of icon property for dashboard node (#1524)

This commit is contained in:
Kazuki Nakanishi 2017-12-19 20:11:10 +09:00 committed by Nick O'Leary
parent d7c8adfd82
commit 7697c46652
2 changed files with 67 additions and 60 deletions

View File

@ -492,7 +492,7 @@ RED.nodes = (function() {
if (n.outputs > 0 && n.outputLabels && !/^\s*$/.test(n.outputLabels.join(""))) {
node.outputLabels = n.outputLabels.slice();
}
if (n.icon) {
if (!n._def.defaults.hasOwnProperty("icon") && n.icon) {
var defIcon = RED.utils.getDefaultNodeIcon(n._def, n);
if (n.icon !== defIcon.module+"/"+defIcon.file) {
node.icon = n.icon;

View File

@ -110,6 +110,9 @@ RED.editor = (function() {
}
if (node.icon) {
var iconPath = RED.utils.separateIconPath(node.icon);
if (!iconPath.module) {
return isValid;
}
var iconSets = RED.nodes.getIconSets();
var iconFileList = iconSets[iconPath.module];
if (!iconFileList || iconFileList.indexOf(iconPath.file) === -1) {
@ -167,7 +170,7 @@ RED.editor = (function() {
}
}
}
if (node.icon) {
if (!node._def.defaults.hasOwnProperty("icon") && node.icon) {
var iconPath = RED.utils.separateIconPath(node.icon);
var iconSets = RED.nodes.getIconSets();
var iconFileList = iconSets[iconPath.module];
@ -736,6 +739,7 @@ RED.editor = (function() {
buildLabelRow().appendTo(outputsDiv);
}
if (!node._def.defaults.hasOwnProperty("icon")) {
$('<div class="form-row"><div id="node-settings-icon"></div></div>').appendTo(dialogForm);
var iconDiv = $("#node-settings-icon");
$('<label data-i18n="editor.settingIcon">').appendTo(iconDiv);
@ -780,6 +784,7 @@ RED.editor = (function() {
}
selectIconFile.val(iconPath.file);
}
}
function moduleChange(selectIconModule, selectIconFile, iconModuleHidden, iconFileHidden, iconSets, updateIconFile) {
selectIconFile.children().remove();
@ -1051,6 +1056,7 @@ RED.editor = (function() {
changed = true;
}
if (!editing_node._def.defaults.hasOwnProperty("icon")) {
var iconModule = $("#node-settings-icon-module-hidden").val();
var iconFile = $("#node-settings-icon-file-hidden").val();
var icon = (iconModule && iconFile) ? iconModule+"/"+iconFile : "";
@ -1075,6 +1081,7 @@ RED.editor = (function() {
}
}
}
}
if (changed) {
var wasChanged = editing_node.changed;