mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
open recent notes autocomplete by focus so it is then closed with blur, fixes #272
This commit is contained in:
parent
f5b933149a
commit
0b251530fa
@ -6,8 +6,6 @@ const $dialog = $("#jump-to-note-dialog");
|
|||||||
const $autoComplete = $("#jump-to-note-autocomplete");
|
const $autoComplete = $("#jump-to-note-autocomplete");
|
||||||
const $showInFullTextButton = $("#show-in-full-text-button");
|
const $showInFullTextButton = $("#show-in-full-text-button");
|
||||||
|
|
||||||
$dialog.on("shown.bs.modal", e => $autoComplete.focus());
|
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ function clearText($el) {
|
|||||||
function showRecentNotes($el) {
|
function showRecentNotes($el) {
|
||||||
$el.setSelectedPath("");
|
$el.setSelectedPath("");
|
||||||
$el.autocomplete("val", "");
|
$el.autocomplete("val", "");
|
||||||
$el.autocomplete("open");
|
$el.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initNoteAutocomplete($el, options) {
|
function initNoteAutocomplete($el, options) {
|
||||||
@ -61,7 +61,13 @@ function initNoteAutocomplete($el, options) {
|
|||||||
|
|
||||||
$clearTextButton.click(() => clearText($el));
|
$clearTextButton.click(() => clearText($el));
|
||||||
|
|
||||||
$showRecentNotesButton.click(() => showRecentNotes($el));
|
$showRecentNotesButton.click(e => {
|
||||||
|
showRecentNotes($el);
|
||||||
|
|
||||||
|
// this will cause the click not give focus to the "show recent notes" button
|
||||||
|
// this is important because otherwise input will lose focus immediatelly and not show the results
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
$goToSelectedNoteButton.click(() => {
|
$goToSelectedNoteButton.click(() => {
|
||||||
if ($el.hasClass("disabled")) {
|
if ($el.hasClass("disabled")) {
|
||||||
|
@ -87,7 +87,7 @@ $searchInput.keyup(e => {
|
|||||||
if (e && e.which === $.ui.keyCode.ENTER) {
|
if (e && e.which === $.ui.keyCode.ENTER) {
|
||||||
doSearch();
|
doSearch();
|
||||||
}
|
}
|
||||||
}).focus();
|
});
|
||||||
|
|
||||||
$doSearchButton.click(() => doSearch()); // keep long form because of argument
|
$doSearchButton.click(() => doSearch()); // keep long form because of argument
|
||||||
$resetSearchButton.click(resetSearch);
|
$resetSearchButton.click(resetSearch);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user