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 f0443ad8e..36690a06b 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 @@ -593,7 +593,8 @@ "search": "Search help", "nodeHelp": "Node Help", "showHelp": "Show help", - "showTopics": "Show topics" + "showTopics": "Show topics", + "noHelp": "No help topic selected" }, "config": { "name": "Configuration nodes", diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-help.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-help.js index bb2085533..11359010f 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-help.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-help.js @@ -37,15 +37,9 @@ RED.sidebar.help = (function() { content.className = "red-ui-sidebar-info" toolbar = $("
", {class:"red-ui-sidebar-header red-ui-info-toolbar"}).appendTo(content); - - $(' ').appendTo(toolbar) - - + $('').appendTo(toolbar) var showTOCButton = toolbar.find('#red-ui-sidebar-help-show-toc') - RED.popover.tooltip(showTOCButton,RED._("sidebar.help.showTopics")); - - showTOCButton.on("click",function(e) { e.preventDefault(); if ($(this).hasClass('selected')) { @@ -55,15 +49,7 @@ RED.sidebar.help = (function() { } }); - // var searchInput = $('').appendTo(toolbar).searchBox({ - // delay: 300, - // change: function() {} - // }); - - var stackContainer = $("
",{class:"red-ui-sidebar-help-stack"}).appendTo(content); - // var container = $("
", {class:"red-ui-info-outline"}).css({'height': '100%'}); - tocPanel = $("
", {class: "red-ui-sidebar-help-toc"}).appendTo(stackContainer); var helpPanel = $("
").css({ @@ -75,8 +61,6 @@ RED.sidebar.help = (function() { }) panels.ratio(0.5); - // var searchDiv = $("
",{class: "red-ui-help-search"}).appendTo(tocPanel); - helpSearch = $('').appendTo(toolbar).searchBox({ delay: 100, change: function() { @@ -105,6 +89,8 @@ RED.sidebar.help = (function() { "padding":"6px", }).appendTo(helpPanel) + $(''+RED._("sidebar.help.noHelp")+'').appendTo(helpSection); + treeList = $("
").css({width: "100%"}).appendTo(tocPanel).treeList({data: []}) treeList.on('treelistselect', function(e,item) { if (item.nodeType) { @@ -228,6 +214,9 @@ RED.sidebar.help = (function() { }) }) if (nodeTypes.length > 0) { + nodeTypes.sort(function(A,B) { + return A.nodeType.localeCompare(B.nodeType) + }) helpData[0].children.push({ id: moduleName, icon: "fa fa-cube", @@ -288,44 +277,6 @@ RED.sidebar.help = (function() { }); return el; } - function refresh(node) { - if (node === undefined) { - refreshSelection(); - return; - } - var subflowNode; - helpSection.empty(); - if (node === null || Array.isArray(node)) { - return; - } else { - // A single 'thing' selected. - - // Check to see if this is a subflow or subflow instance - var m = /^subflow(:(.+))?$/.exec(node.type); - if (m) { - if (m[2]) { - subflowNode = RED.nodes.subflow(m[2]); - } else { - subflowNode = node; - } - } - var helpText = ""; - if (node.type === "tab" || node.type === "subflow") { - } else { - if (subflowNode && node.type !== "subflow") { - // Selected a subflow instance node. - // - The subflow template info goes into help - helpText = (RED.utils.renderMarkdown(subflowNode.info||"")||(''+RED._("sidebar.info.none")+'')); - setInfoText(node.type, helpText, helpSection); - } else { - helpSearch.searchBox("value",node.type); - // helpText = $("script[data-help-name='"+node.type+"']").html()||(''+RED._("sidebar.info.none")+''); - } - } - - // $(".red-ui-sidebar-info-stack").scrollTop(0); - } - } function setInfoText(title, infoText,target) { if (title) { @@ -354,41 +305,24 @@ RED.sidebar.help = (function() { show(); } - // function refreshSelection(selection) { - // if (selection === undefined) { - // selection = RED.view.selection(); - // } - // if (selection.nodes) { - // if (selection.nodes.length == 1) { - // var node = selection.nodes[0]; - // if (node.type === "subflow" && node.direction) { - // refresh(RED.nodes.subflow(node.z)); - // } else { - // refresh(node); - // } - // } else { - // refresh(selection.nodes); - // } - // } else if (selection.flows || selection.subflows) { - // refresh(selection.flows); - // } else { - // var activeWS = RED.workspaces.active(); - // - // var flow = RED.nodes.workspace(activeWS) || RED.nodes.subflow(activeWS); - // if (flow) { - // refresh(flow); - // } else { - // var workspace = RED.nodes.workspace(RED.workspaces.active()); - // if (workspace && workspace.info) { - // refresh(workspace); - // } else { - // refresh(null) - // // clear(); - // } - // } - // } - // } - // RED.events.on("view:selection-changed",refreshSelection); + function refreshSelection(selection) { + if (selection === undefined) { + selection = RED.view.selection(); + } + if (selection.nodes) { + if (selection.nodes.length == 1) { + var node = selection.nodes[0]; + if (node.type === "subflow" && node.direction) { + // ignore subflow virtual ports + } else if (node.type !== 'group'){ + showHelp(node.type); + } + } else { + refresh(selection.nodes); + } + } + } + RED.events.on("view:selection-changed",refreshSelection); return { init: init,