Merge branch 'stable'

# Conflicts:
#	src/services/build.js
This commit is contained in:
zadam 2023-04-17 22:26:01 +02:00
commit 8725f7cfb2
6 changed files with 25 additions and 7 deletions

1
package-lock.json generated
View File

@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "trilium",
"version": "0.59.3",
"hasInstallScript": true,
"license": "AGPL-3.0-only",

View File

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

View File

@ -141,7 +141,7 @@ async function processBranchChange(loadResults, ec) {
const childNote = froca.notes[ec.entity.noteId];
let parentNote = froca.notes[ec.entity.parentNoteId];
if (childNote && !parentNote) {
if (childNote && !childNote.isRoot() && !parentNote) {
// a branch cannot exist without the parent
// a note loaded into froca has to also contain all its ancestors
// this problem happened e.g. in sharing where _share was hidden and thus not loaded

View File

@ -1,7 +1,6 @@
import libraryLoader from "../services/library_loader.js";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import froca from "../services/froca.js";
import server from "../services/server.js";
const TPL = `<div class="mermaid-widget">
<style>
@ -74,6 +73,8 @@ export default class MermaidWidget extends NoteContextAwareWidget {
const wheelZoomLoaded = libraryLoader.requireLibrary(libraryLoader.WHEEL_ZOOM);
this.$errorContainer.hide();
try {
await this.renderSvg(async renderedSvg => {
this.$display.html(renderedSvg);
@ -88,8 +89,6 @@ export default class MermaidWidget extends NoteContextAwareWidget {
speed: 20,
zoomOnClick: false
});
this.$errorContainer.hide();
});
} catch (e) {
this.$errorMessage.text(e.message);

View File

@ -1 +1 @@
module.exports = { buildDate:"", buildRevision: "9881e6de3e4966af39ec6245562dca6ac7b25eaa" };
module.exports = { buildDate:"2023-04-17T21:40:35+02:00", buildRevision: "1d3272e9f8c27106a66227fbb580677ae5d70427" };

View File

@ -21,6 +21,7 @@ const dayjs = require("dayjs");
const htmlSanitizer = require("./html_sanitizer");
const ValidationError = require("../errors/validation_error");
const noteTypesService = require("./note_types");
const fs = require("fs");
function getNewNotePosition(parentNote) {
if (parentNote.isLabelTruthy('newNotesOnTop')) {
@ -375,7 +376,24 @@ const imageUrlToNoteIdMapping = {};
async function downloadImage(noteId, imageUrl) {
try {
const imageBuffer = await request.getImage(imageUrl);
let imageBuffer;
if (imageUrl.toLowerCase().startsWith("file://")) {
imageBuffer = await new Promise((res, rej) => {
const localFilePath = imageUrl.substr("file://".length);
return fs.readFile(localFilePath, (err, data) => {
if (err) {
rej(err);
} else {
res(data);
}
});
});
} else {
imageBuffer = await request.getImage(imageUrl);
}
const parsedUrl = url.parse(imageUrl);
const title = path.basename(parsedUrl.pathname);