display note path in search results

This commit is contained in:
zadam 2021-02-20 20:10:45 +01:00
parent 1d5714c411
commit 7a6bb81345
5 changed files with 22 additions and 12 deletions

12
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.46.0-beta",
"version": "0.46.1-beta",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -4638,6 +4638,11 @@
"regenerator-runtime": "^0.13.3"
}
},
"joplin-turndown-plugin-gfm": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/joplin-turndown-plugin-gfm/-/joplin-turndown-plugin-gfm-1.0.12.tgz",
"integrity": "sha512-qL4+1iycQjZ1fs8zk3jSRk7cg3ROBUHk7GKtiLAQLFzLPKErnILUvz5DLszSQvz3s1sTjPbywLDISVUtBY6HaA=="
},
"jpeg-js": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.2.tgz",
@ -7379,11 +7384,6 @@
"domino": "^2.1.6"
}
},
"turndown-plugin-gfm": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/turndown-plugin-gfm/-/turndown-plugin-gfm-1.0.2.tgz",
"integrity": "sha512-vwz9tfvF7XN/jE0dGoBei3FXWuvll78ohzCZQuOb+ZjWrs3a0XhQVomJEb2Qh4VHTPNRO4GPZh0V7VRbiWwkRg=="
},
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",

View File

@ -70,7 +70,7 @@
"striptags": "3.1.1",
"tmp": "^0.2.1",
"turndown": "7.0.0",
"turndown-plugin-gfm": "1.0.2",
"joplin-turndown-plugin-gfm": "1.0.12",
"unescape": "1.0.1",
"ws": "7.4.3",
"yauzl": "2.10.0",

View File

@ -56,6 +56,14 @@ const TPL = `
.note-book-title {
margin-bottom: 0;
word-break: break-all;
}
/* not-expanded title is limited to one line only */
.note-book-card:not(.expanded) .note-book-title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.note-book-title .rendered-note-attributes {
@ -148,7 +156,7 @@ class NoteListRenderer {
/*
* We're using noteIds so that it's not necessary to load all notes at once when paging
*/
constructor($parent, parentNote, noteIds) {
constructor($parent, parentNote, noteIds, showNotePath = false) {
this.$noteList = $(TPL);
// note list must be added to the DOM immediatelly, otherwise some functionality scripting (canvas) won't work
@ -200,6 +208,8 @@ class NoteListRenderer {
await this.renderList();
});
this.showNotePath = showNotePath;
}
/** @return {Set<string>} list of noteIds included (images, included notes) into a parent note and which
@ -298,7 +308,7 @@ class NoteListRenderer {
.append(
$('<h5 class="note-book-title">')
.append($expander)
.append(await linkService.createNoteLink(note.noteId, {showTooltip: false}))
.append(await linkService.createNoteLink(note.noteId, {showTooltip: false, showNotePath: this.showNotePath}))
.append($renderedAttributes)
);

View File

@ -52,7 +52,7 @@ export default class SearchResultWidget extends TabAwareWidget {
this.$noResults.toggle(note.getChildNoteIds().length === 0 && !!note.searchResultsLoaded);
this.$notExecutedYet.toggle(!note.searchResultsLoaded);
const noteListRenderer = new NoteListRenderer(this.$content, note, note.getChildNoteIds());
const noteListRenderer = new NoteListRenderer(this.$content, note, note.getChildNoteIds(), true);
await noteListRenderer.renderList();
}

View File

@ -1,7 +1,7 @@
"use strict";
const TurndownService = require('turndown');
const turndownPluginGfm = require('turndown-plugin-gfm');
const turndownPluginGfm = require('joplin-turndown-plugin-gfm');
let instance = null;