diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index f71bd2577..57a41fb81 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -20,7 +20,9 @@ "fill": "Fill", "label": "Label", "color": "Color", - "position": "Position" + "position": "Position", + "enable": "Enable", + "disable": "Disable" }, "type": { "string": "string", @@ -595,7 +597,9 @@ "showTips":"You can open the tips from the settings panel", "outline": "Outline", "empty": "empty", - "globalConfig": "Global Configuration Nodes" + "globalConfig": "Global Configuration Nodes", + "triggerAction": "Trigger action", + "find": "Find in workspace" }, "help": { "name": "Help", diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js index 3df2f9a51..962d87081 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js @@ -33,7 +33,7 @@ * methods: * - addItem(itemData) * - insertItemAt : function(data,index) - add an item at the specified index - * - removeItem(itemData) + * - removeItem(itemData, detach) - remove the item. Optionally detach to preserve any event handlers on the item's label * - getItemAt(index) * - indexOf(itemData) * - width(width) @@ -332,11 +332,15 @@ this.addItem(items[i]); } }, - removeItem: function(data) { + removeItem: function(data,detach) { var items = this.element.children().filter(function(f) { return data === $(this).children(".red-ui-editableList-item-content").data('data'); }); - items.remove(); + if (detach) { + items.detach(); + } else { + items.remove(); + } if (this.options.removeItem) { this.options.removeItem(data); } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/treeList.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/treeList.js index d6313422a..f11dab38d 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/treeList.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/treeList.js @@ -65,7 +65,7 @@ * item.treeList.container * item.treeList.label - the label element for the item * item.treeList.parentList - the editableList instance this item is in - * item.treeList.remove() - removes the item from the tree + * item.treeList.remove(detach) - removes the item from the tree. Optionally detach to preserve any event handlers on the item's label * item.treeList.makeLeaf(detachChildElements) - turns an element with children into a leaf node, * removing the UI decoration etc. * detachChildElements - any children with custom @@ -311,9 +311,9 @@ this._items[item.id] = item; item.treeList = {}; item.depth = depth; - item.treeList.remove = function() { + item.treeList.remove = function(detach) { if (item.treeList.parentList) { - item.treeList.parentList.editableList('removeItem',item); + item.treeList.parentList.editableList('removeItem',item,detach); } if (item.parent) { var index = item.parent.children.indexOf(item); @@ -322,7 +322,7 @@ } that._selected.delete(item); delete item.treeList; - delete(that._items[item.id]); + delete that._items[item.id]; } item.treeList.insertChildAt = function(newItem,position,select) { newItem.parent = item; diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js index f9064c65b..f9111fba8 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js @@ -135,11 +135,12 @@ RED.sidebar.info.outliner = (function() { function addControls(n,div) { var controls = $('
',{class:"red-ui-info-outline-item-controls red-ui-info-outline-item-hover-controls"}).appendTo(div); if (n._def.button) { - $('').appendTo(controls).on("click",function(evt) { + var triggerButton = $('').appendTo(controls).on("click",function(evt) { evt.preventDefault(); evt.stopPropagation(); RED.view.clickNodeButton(n); }) + RED.popover.tooltip(triggerButton,RED._("sidebar.info.triggerAction")); } // $('').appendTo(controls).on("click",function(evt) { // evt.preventDefault(); @@ -147,7 +148,7 @@ RED.sidebar.info.outliner = (function() { // RED.view.reveal(n.id); // }) if (n.type !== 'group' && n.type !== 'subflow') { - $('').appendTo(controls).on("click",function(evt) { + var toggleButton = $('').appendTo(controls).on("click",function(evt) { evt.preventDefault(); evt.stopPropagation(); if (n.type === 'tab') { @@ -179,6 +180,9 @@ RED.sidebar.info.outliner = (function() { RED.view.redraw(); } }); + RED.popover.tooltip(toggleButton,function() { + return RED._("common.label."+((n.type==='tab' && n.disabled) || (n.type!=='tab' && n.d))?"enable":"disable") + }); } else { $('
').appendTo(controls) } @@ -361,7 +365,7 @@ RED.sidebar.info.outliner = (function() { function onNodeChange(n) { var existingObject = objects[n.id]; - var parent = n.g||n.z; + var parent = n.g||n.z||"__global__"; var nodeLabelText = getNodeLabelText(n); if (nodeLabelText) { @@ -369,10 +373,9 @@ RED.sidebar.info.outliner = (function() { } else { existingObject.element.find(".red-ui-info-outline-item-label").html(" "); } - if (parent !== existingObject.parent.id) { - existingObject.treeList.remove(); - if (!parent) { + existingObject.treeList.remove(true); + if (parent === "__global__") { globalConfigNodes.treeList.addChild(existingObject); } else { if (empties[parent]) { @@ -401,11 +404,12 @@ RED.sidebar.info.outliner = (function() { } function getGutter(n) { var span = $("",{class:"red-ui-info-outline-gutter"}); - $('').appendTo(span).on("click",function(evt) { + var revealButton = $('').appendTo(span).on("click",function(evt) { evt.preventDefault(); evt.stopPropagation(); RED.view.reveal(n.id); }) + RED.popover.tooltip(revealButton,RED._("sidebar.info.find")); return span; } function onNodeAdd(n) { diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.html b/packages/node_modules/@node-red/nodes/core/function/10-function.html index 78e7f2d63..f0e5c7d68 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/core/function/10-function.html @@ -222,8 +222,10 @@ } } var val = editor.getValue(); - if (defaultValue && val == defaultValue) { - val = ""; + if (defaultValue) { + if (val.trim() == defaultValue.trim()) { + val = ""; + } } editor.destroy(); delete node[editorName]; diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.js b/packages/node_modules/@node-red/nodes/core/function/10-function.js index a6573a787..a876ed741 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-function.js +++ b/packages/node_modules/@node-red/nodes/core/function/10-function.js @@ -92,8 +92,8 @@ module.exports = function(RED) { var node = this; node.name = n.name; node.func = n.func; - node.ini = n.initialize ? n.initialize : ""; - node.fin = n.finalize ? n.finalize : ""; + node.ini = n.initialize ? n.initialize.trim() : ""; + node.fin = n.finalize ? n.finalize.trim() : ""; var handleNodeDoneCall = true;