improvements to the search spec help button

This commit is contained in:
zadam
2021-01-26 14:44:53 +01:00
parent 80354d09fb
commit b936a63db3
4 changed files with 32 additions and 8 deletions

View File

@@ -317,6 +317,23 @@ function timeLimit(promise, limitMs) {
});
}
function initHelpDropdown($el) {
// stop inside clicks from closing the menu
const $dropdownMenu = $el.find('.help-dropdown .dropdown-menu');
$dropdownMenu.on('click', e => e.stopPropagation());
// previous propagation stop will also block help buttons from being opened so we need to re-init for this element
initHelpButtons($dropdownMenu);
}
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/"
function initHelpButtons($el) {
$el.on("click", "*[data-help-page]", e => {
window.open(wikiBaseUrl + $(e.target).attr("data-help-page"), '_blank');
});
}
export default {
reloadApp,
parseDate,
@@ -355,5 +372,7 @@ export default {
copySelectionToClipboard,
isCKEditorInitialized,
dynamicRequire,
timeLimit
timeLimit,
initHelpDropdown,
initHelpButtons
};