From 7a6bb81345a641d77cf67f5c7d8559156afb7007 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 20 Feb 2021 20:10:45 +0100 Subject: [PATCH] display note path in search results --- package-lock.json | 12 ++++++------ package.json | 2 +- src/public/app/services/note_list_renderer.js | 14 ++++++++++++-- src/public/app/widgets/search_result.js | 2 +- src/services/export/md.js | 4 ++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index a5a6f02ad..3cd1273b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 771d61341..a7734a39c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/public/app/services/note_list_renderer.js b/src/public/app/services/note_list_renderer.js index e42ee06dc..d354eb368 100644 --- a/src/public/app/services/note_list_renderer.js +++ b/src/public/app/services/note_list_renderer.js @@ -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} list of noteIds included (images, included notes) into a parent note and which @@ -298,7 +308,7 @@ class NoteListRenderer { .append( $('
') .append($expander) - .append(await linkService.createNoteLink(note.noteId, {showTooltip: false})) + .append(await linkService.createNoteLink(note.noteId, {showTooltip: false, showNotePath: this.showNotePath})) .append($renderedAttributes) ); diff --git a/src/public/app/widgets/search_result.js b/src/public/app/widgets/search_result.js index 22a273121..9658f9cfa 100644 --- a/src/public/app/widgets/search_result.js +++ b/src/public/app/widgets/search_result.js @@ -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(); } diff --git a/src/services/export/md.js b/src/services/export/md.js index 8374d368e..9638de188 100644 --- a/src/services/export/md.js +++ b/src/services/export/md.js @@ -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; @@ -16,4 +16,4 @@ function toMarkdown(content) { module.exports = { toMarkdown -}; \ No newline at end of file +};