;(function() { RED.editor.registerEditPane("editor-tab-appearance", function(node) { return { label: RED._("editor-tab.appearance"), name: RED._("editor-tab.appearance"), iconClass: "fa fa-object-group", create: function(container) { this.content = container; buildAppearanceForm(this.content,node); if (node.type === 'subflow') { this.defaultIcon = "node-red/subflow.svg"; } else { var iconPath = RED.utils.getDefaultNodeIcon(node._def,node); this.defaultIcon = iconPath.module+"/"+iconPath.file; if (node.icon && node.icon !== this.defaultIcon) { this.isDefaultIcon = false; } else { this.isDefaultIcon = true; } } }, resize: function(size) { }, close: function() { }, show: function() { refreshLabelForm(this.content, node); }, apply: function(editState) { if (updateLabels(node, editState.changes, editState.outputMap)) { editState.changed = true; } if (!node._def.defaults || !node._def.defaults.hasOwnProperty("icon")) { var icon = $("#red-ui-editor-node-icon").val()||""; if (!this.isDefaultIcon) { if ((node.icon && icon !== node.icon) || (!node.icon && icon !== "")) { editState.changes.icon = node.icon; node.icon = icon; editState.changed = true; } } else { if (icon !== "" && icon !== this.defaultIcon) { editState.changes.icon = node.icon; node.icon = icon; editState.changed = true; } else { var iconPath = RED.utils.getDefaultNodeIcon(node._def, node); var currentDefaultIcon = iconPath.module+"/"+iconPath.file; if (this.defaultIcon !== currentDefaultIcon) { editState.changes.icon = node.icon; node.icon = currentDefaultIcon; editState.changed = true; } } } } if (node.type === "subflow") { var newCategory = $("#subflow-appearance-input-category").val().trim(); if (newCategory === "_custom_") { newCategory = $("#subflow-appearance-input-custom-category").val().trim(); if (newCategory === "") { newCategory = node.category; } } if (newCategory === 'subflows') { newCategory = ''; } if (newCategory != node.category) { editState.changes['category'] = node.category; node.category = newCategory; editState.changed = true; } var oldColor = node.color; var newColor = $("#red-ui-editor-node-color").val(); if (oldColor !== newColor) { editState.changes.color = node.color; node.color = newColor; editState.changed = true; RED.utils.clearNodeColorCache(); if (node.type === "subflow") { var nodeDefinition = RED.nodes.getType( "subflow:" + node.id ); nodeDefinition["color"] = newColor; } } } var showLabel = node._def.hasOwnProperty("showLabel")?node._def.showLabel:true; if (!$("#node-input-show-label").prop('checked')) { // Not checked - hide label if (showLabel) { // Default to show label if (node.l !== false) { editState.changes.l = node.l; editState.changed = true; } node.l = false; } else { // Node has showLabel:false (eg link nodes) if (node.hasOwnProperty('l') && node.l) { editState.changes.l = node.l; editState.changed = true; } delete node.l; } } else { // Checked - show label if (showLabel) { // Default to show label if (node.hasOwnProperty('l') && !node.l) { editState.changes.l = node.l; editState.changed = true; } delete node.l; } else { if (!node.l) { editState.changes.l = node.l; editState.changed = true; } node.l = true; } } } }; }); function buildAppearanceForm(container,node) { var dialogForm = $('
').appendTo(container); var i,row; if (node.type === "subflow") { var categoryRow = $("
", { class: "form-row" }).appendTo(dialogForm); $("