1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure info tab sections are collapsible when set from palette

This commit is contained in:
Nick O'Leary 2017-05-24 21:11:23 +01:00
parent 6a6a692891
commit 6bd59b10c7
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 20 additions and 20 deletions

View File

@ -210,8 +210,7 @@ RED.palette = (function() {
} else {
helpText = $("script[data-help-name='"+d.type+"']").html()||"";
}
var help = '<div class="node-help">'+helpText+"</div>";
RED.sidebar.info.set(help);
RED.sidebar.info.set(helpText);
});
var chart = $("#chart");
var chartOffset = chart.offset();

View File

@ -233,6 +233,18 @@ RED.sidebar.info = (function() {
infoText = infoText + marked(textInfo);
}
if (infoText) {
setInfoText(infoText);
}
$(".node-info-property-header").click(function(e) {
e.preventDefault();
expandedSections["property"] = !expandedSections["property"];
$(this).toggleClass("expanded",expandedSections["property"]);
$(".node-info-property-row").toggle(expandedSections["property"]);
});
}
function setInfoText(infoText) {
var info = addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(infoText)+'">'+infoText+'</span></div>')).appendTo(infoSection.content);
info.find(".bidiAware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" );
var foldingHeader = "H3";
@ -248,17 +260,6 @@ RED.sidebar.info = (function() {
$(this).toggleClass('expanded',!isExpanded);
})
}
$(".node-info-property-header").click(function(e) {
e.preventDefault();
expandedSections["property"] = !expandedSections["property"];
$(this).toggleClass("expanded",expandedSections["property"]);
$(".node-info-property-row").toggle(expandedSections["property"]);
});
}
var tips = (function() {
var enabled = true;
var startDelay = 1000;
@ -349,8 +350,8 @@ RED.sidebar.info = (function() {
// tips.stop();
sections.show();
nodeSection.container.hide();
var wrapped = $('<div class="node-help"></div>').html(html);
$(infoSection.content).empty().append(wrapped);
$(infoSection.content).empty();
setInfoText(html);
}