Merge remote-tracking branch 'origin/stable'

This commit is contained in:
zadam 2021-03-11 21:14:58 +01:00
commit cb558e1378
5 changed files with 29 additions and 12 deletions

View File

@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.46.3-beta", "version": "0.46.4-beta",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {

View File

@ -254,22 +254,39 @@ class NoteShort {
return noteAttributeCache.attributes[this.noteId]; return noteAttributeCache.attributes[this.noteId];
} }
getAllNotePaths() { getAllNotePaths(encounteredNoteIds = null) {
if (this.noteId === 'root') { if (this.noteId === 'root') {
return [['root']]; return [['root']];
} }
if (!encounteredNoteIds) {
encounteredNoteIds = new Set();
}
encounteredNoteIds.add(this.noteId);
const parentNotes = this.getParentNotes(); const parentNotes = this.getParentNotes();
let paths; let paths;
if (parentNotes.length === 1) { // optimization for the most common case if (parentNotes.length === 1) { // optimization for the most common case
paths = parentNotes[0].getAllNotePaths(); if (encounteredNoteIds.has(parentNotes[0].noteId)) {
return [];
}
else {
paths = parentNotes[0].getAllNotePaths(encounteredNoteIds);
}
} }
else { else {
paths = []; paths = [];
for (const parentNote of parentNotes) { for (const parentNote of parentNotes) {
paths.push(...parentNote.getAllNotePaths()); if (encounteredNoteIds.has(parentNote.noteId)) {
continue;
}
const newSet = new Set(encounteredNoteIds);
paths.push(...parentNote.getAllNotePaths(newSet));
} }
} }

View File

@ -88,7 +88,7 @@ export default class NotePathsWidget extends TabAwareWidget {
.find('a') .find('a')
.addClass("no-tooltip-preview"); .addClass("no-tooltip-preview");
const comments = []; const icons = [];
if (this.notePath === notePath) { if (this.notePath === notePath) {
$noteLink.addClass("path-current"); $noteLink.addClass("path-current");
@ -98,23 +98,23 @@ export default class NotePathsWidget extends TabAwareWidget {
$noteLink.addClass("path-in-hoisted-subtree"); $noteLink.addClass("path-in-hoisted-subtree");
} }
else { else {
comments.push("outside of hoisting"); icons.push(`<span class="bx bx-trending-up" title="This path is outside of hoisted note and you would have to unhoist."></span>`);
} }
if (notePathRecord.isArchived) { if (notePathRecord.isArchived) {
$noteLink.addClass("path-archived"); $noteLink.addClass("path-archived");
comments.push("archived"); icons.push(`<span class="bx bx-archive" title="Archived"></span>`);
} }
if (notePathRecord.isSearch) { if (notePathRecord.isSearch) {
$noteLink.addClass("path-search"); $noteLink.addClass("path-search");
comments.push("search"); icons.push(`<span class="bx bx-search" title="Search"></span>`);
} }
if (comments.length > 0) { if (icons.length > 0) {
$noteLink.append(` (${comments.join(', ')})`); $noteLink.append(` ${icons.join(' ')}`);
} }
this.$notePathList.append($noteLink); this.$notePathList.append($noteLink);

View File

@ -106,7 +106,7 @@ function processContent(images, note, content) {
for (const {src, dataUrl, imageId} of images) { for (const {src, dataUrl, imageId} of images) {
const filename = path.basename(src); const filename = path.basename(src);
if (!dataUrl.startsWith("data:image")) { if (!dataUrl || !dataUrl.startsWith("data:image")) {
log.info("Image could not be recognized as data URL:", dataUrl.substr(0, Math.min(100, dataUrl.length))); log.info("Image could not be recognized as data URL:", dataUrl.substr(0, Math.min(100, dataUrl.length)));
continue; continue;
} }

View File

@ -1 +1 @@
module.exports = { buildDate:"2021-03-08T23:11:11+01:00", buildRevision: "f27370d44f08afaa22d4cd86cba489584f9c878b" }; module.exports = { buildDate:"2021-03-10T23:35:12+01:00", buildRevision: "6f901e6852c33ba0dae6c70efb9f65e5b0028995" };