use just note title in note autocomplete input field

This commit is contained in:
zadam 2020-09-03 17:38:11 +02:00
parent a37fa0cb3f
commit 42ecc0e15b
4 changed files with 15 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.43.3",
"version": "0.43.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -77,7 +77,7 @@
},
"devDependencies": {
"cross-env": "7.0.2",
"electron": "9.2.1",
"electron": "9.3.0",
"electron-builder": "22.8.0",
"electron-packager": "15.1.0",
"electron-rebuild": "2.0.1",

View File

@ -95,7 +95,12 @@ function initNoteAutocomplete($el, options) {
}
]);
$el.on('autocomplete:selected', (event, suggestion) => $el.setSelectedNotePath(suggestion.notePath));
$el.on('autocomplete:selected', (event, suggestion) => {
$el.setSelectedNotePath(suggestion.notePath);
$el.autocomplete("val", suggestion.noteTitle);
});
$el.on('autocomplete:closed', () => {
if (!$el.val().trim()) {
clearText($el);

View File

@ -57,12 +57,16 @@ function getRecentNotes(activeNoteId) {
LIMIT 200`, params);
return recentNotes.map(rn => {
const title = noteCacheService.getNoteTitleForPath(rn.notePath.split('/'));
const notePathArray = rn.notePath.split('/');
const noteTitle = noteCacheService.getNoteTitle(notePathArray[notePathArray.length - 1]);
const notePathTitle = noteCacheService.getNoteTitleForPath(notePathArray);
return {
notePath: rn.notePath,
notePathTitle: title,
highlightedNotePathTitle: utils.escapeHtml(title)
noteTitle,
notePathTitle,
highlightedNotePathTitle: utils.escapeHtml(notePathTitle)
};
});
}