").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,