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", "name": "trilium",
"version": "0.43.3", "version": "0.43.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -77,7 +77,7 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.2", "cross-env": "7.0.2",
"electron": "9.2.1", "electron": "9.3.0",
"electron-builder": "22.8.0", "electron-builder": "22.8.0",
"electron-packager": "15.1.0", "electron-packager": "15.1.0",
"electron-rebuild": "2.0.1", "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', () => { $el.on('autocomplete:closed', () => {
if (!$el.val().trim()) { if (!$el.val().trim()) {
clearText($el); clearText($el);

View File

@ -57,12 +57,16 @@ function getRecentNotes(activeNoteId) {
LIMIT 200`, params); LIMIT 200`, params);
return recentNotes.map(rn => { 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 { return {
notePath: rn.notePath, notePath: rn.notePath,
notePathTitle: title, noteTitle,
highlightedNotePathTitle: utils.escapeHtml(title) notePathTitle,
highlightedNotePathTitle: utils.escapeHtml(notePathTitle)
}; };
}); });
} }