Handle null subflow info property

This commit is contained in:
Nick O'Leary 2015-10-26 11:12:21 +00:00
parent 425b016d63
commit 20b321f928
2 changed files with 4 additions and 4 deletions

View File

@ -203,7 +203,7 @@ RED.palette = (function() {
RED.view.focus(); RED.view.focus();
var helpText; var helpText;
if (nt.indexOf("subflow:") === 0) { if (nt.indexOf("subflow:") === 0) {
helpText = marked(RED.nodes.subflow(nt.substring(8)).info) || ""; helpText = marked(RED.nodes.subflow(nt.substring(8)).info||"");
} else { } else {
helpText = $("script[data-help-name|='"+d.type+"']").html()||""; helpText = $("script[data-help-name|='"+d.type+"']").html()||"";
} }
@ -224,7 +224,7 @@ RED.palette = (function() {
RED.workspaces.show(nt.substring(8)); RED.workspaces.show(nt.substring(8));
e.preventDefault(); e.preventDefault();
}); });
nodeInfo = marked(def.info); nodeInfo = marked(def.info||"");
} }
setLabel(nt,$(d),label,nodeInfo); setLabel(nt,$(d),label,nodeInfo);
@ -279,7 +279,7 @@ RED.palette = (function() {
} else if (portOutput.length !== 0 && sf.out.length === 0) { } else if (portOutput.length !== 0 && sf.out.length === 0) {
portOutput.remove(); portOutput.remove();
} }
setLabel(sf.type+":"+sf.id,paletteNode,sf.name,marked(sf.info)); setLabel(sf.type+":"+sf.id,paletteNode,sf.name,marked(sf.info||""));
}); });
} }

View File

@ -140,7 +140,7 @@ RED.sidebar.info = (function() {
table += '<div class="node-help">'+helpText+"</div>"; table += '<div class="node-help">'+helpText+"</div>";
} }
if (subflowNode) { if (subflowNode) {
table += '<div class="node-help">'+marked(subflowNode.info)+'</div>'; table += '<div class="node-help">'+marked(subflowNode.info||"")+'</div>';
} else if (node._def && node._def.info) { } else if (node._def && node._def.info) {
var info = node._def.info; var info = node._def.info;
table += '<div class="node-help">'+marked(typeof info === "function" ? info.call(node) : info)+'</div>'; table += '<div class="node-help">'+marked(typeof info === "function" ? info.call(node) : info)+'</div>';