mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
added "show results in full text"
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import treeService from '../services/tree.js';
|
||||
import linkService from '../services/link.js';
|
||||
import server from '../services/server.js';
|
||||
import searchNotesService from '../services/search_notes.js';
|
||||
|
||||
const $dialog = $("#jump-to-note-dialog");
|
||||
const $autoComplete = $("#jump-to-note-autocomplete");
|
||||
const $form = $("#jump-to-note-form");
|
||||
const $jumpToNoteButton = $("#jump-to-note-button");
|
||||
const $showInFullTextButton = $("#show-in-full-text-button");
|
||||
|
||||
async function showDialog() {
|
||||
glob.activeDialog = $dialog;
|
||||
@@ -24,12 +27,6 @@ async function showDialog() {
|
||||
},
|
||||
minLength: 2
|
||||
});
|
||||
|
||||
$autoComplete.autocomplete("instance")._renderItem = function(ul, item) {
|
||||
return $("<li>")
|
||||
.append("<div>" + item.label + "</div>")
|
||||
.appendTo(ul);
|
||||
};
|
||||
}
|
||||
|
||||
function getSelectedNotePath() {
|
||||
@@ -47,12 +44,32 @@ function goToNote() {
|
||||
}
|
||||
}
|
||||
|
||||
function showInFullText(e) {
|
||||
// stop from propagating upwards (dangerous especially with ctrl+enter executable javascript notes)
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const searchText = $autoComplete.val();
|
||||
|
||||
searchNotesService.resetSearch();
|
||||
searchNotesService.showSearch();
|
||||
searchNotesService.doSearch(searchText);
|
||||
|
||||
$dialog.dialog('close');
|
||||
}
|
||||
|
||||
$form.submit(() => {
|
||||
goToNote();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$jumpToNoteButton.click(goToNote);
|
||||
|
||||
$showInFullTextButton.click(showInFullText);
|
||||
|
||||
$dialog.bind('keydown', 'ctrl+return', showInFullText);
|
||||
|
||||
export default {
|
||||
showDialog
|
||||
};
|
||||
Reference in New Issue
Block a user