Open documentation when clicking on File>Help

pull/1/head
yflory 4 years ago
parent b099db3ef1
commit beba9d084d

@ -1117,7 +1117,6 @@ define([
var closeButton = h('span.cp-help-close.fa.fa-times'); var closeButton = h('span.cp-help-close.fa.fa-times');
var $toolbarButton = common.createButton('', true, { var $toolbarButton = common.createButton('', true, {
title: Messages.hide_help_button,
text: Messages.help_button, text: Messages.help_button,
name: 'help' name: 'help'
}).addClass('cp-toolbar-button-active'); }).addClass('cp-toolbar-button-active');
@ -1126,45 +1125,25 @@ define([
text text
]); ]);
$toolbarButton.attr('title', Messages.show_help_button);
var toggleHelp = function (forceClose) { var toggleHelp = function (forceClose) {
if ($(help).hasClass('cp-help-hidden')) {
if (forceClose) { return; }
common.setAttribute(['hideHelp', type], false);
$toolbarButton.addClass('cp-toolbar-button-active');
$toolbarButton.attr('title', Messages.hide_help_button);
return void $(help).removeClass('cp-help-hidden');
}
$toolbarButton.removeClass('cp-toolbar-button-active'); $toolbarButton.removeClass('cp-toolbar-button-active');
$toolbarButton.attr('title', Messages.show_help_button);
$(help).addClass('cp-help-hidden'); $(help).addClass('cp-help-hidden');
common.setAttribute(['hideHelp', type], true); common.setAttribute(['hideHelp', type], true);
}; };
var showMore = function () {
$(text).addClass("cp-help-small");
var $dot = $('<span>').text('...').appendTo($(text).find('h1'));
$(text).click(function () {
$(text).removeClass('cp-help-small');
$(text).off('click');
$dot.remove();
});
};
$(closeButton).click(function (e) { $(closeButton).click(function (e) {
e.stopPropagation(); e.stopPropagation();
toggleHelp(true); toggleHelp(true);
}); });
$toolbarButton.click(function () { $toolbarButton.click(function () {
toggleHelp(); common.openUnsafeURL(href);
}); });
common.getAttribute(['hideHelp', type], function (err, val) { common.getAttribute(['hideHelp', type], function (err, val) {
//if ($(window).height() < 800 || $(window).width() < 800) { return void toggleHelp(true); } if (val === true || $(window).height() < 800 || $(window).width() < 800) {
if (val === true) { return void toggleHelp(true); } toggleHelp(true);
// Note: Help is always hidden by default now, to avoid displaying to many things in the UI
// This is why we have (true || ...)
if (!val && (true || $(window).height() < 800 || $(window).width() < 800)) {
return void showMore();
} }
}); });

Loading…
Cancel
Save