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

@ -73,11 +73,7 @@ function setupGlobs() {
libraryLoader.requireCss(`api/notes/download/${appCssNoteId}`);
}
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/";
$(document).on("click", "*[data-help-page]", e => {
window.open(wikiBaseUrl + $(e.target).attr("data-help-page"), '_blank');
});
utils.initHelpButtons($(window));
$("body").on("click", "a.external", function () {
window.open($(this).attr("href"), '_blank');

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
};

View File

@ -10,10 +10,10 @@ const TPL = `
<input type="text" class="form-control search-string">
</td>
<td class="button-column">
<div class="dropdown">
<div class="dropdown help-dropdown">
<span class="bx bx-help-circle icon-action" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu dropdown-menu-right p-4" style="width: 500px;">
<strong>Search tips</strong> - also see <button class="btn btn-sm" type="button" data-help-page="Search">complete help on search</button>
<strong>Search syntax</strong> - also see <button class="btn btn-sm" type="button" data-help-page="Search">complete help on search syntax</button>
<p>
<ul>
<li>Just enter any text for full text search</li>
@ -64,6 +64,8 @@ export default class SearchString extends AbstractSearchOption {
this.$searchString.val(this.note.getLabelValue('searchString'));
utils.initHelpDropdown($option);
return $option;
}

View File

@ -929,3 +929,10 @@ ul.fancytree-container li {
.area-expander:hover .area-expander-text {
color: var(--main-text-color);
}
.help-dropdown .dropdown-menu {
border-radius: 10px;
border-width: 2px;
box-shadow: 10px 10px 93px -25px black;
padding: 10px 15px 10px 15px !important;
}