Compare commits

...

7 Commits

Author SHA1 Message Date
zadam
a15be82f00 release 0.35.2 2019-10-09 23:09:38 +02:00
zadam
6c3809e1db calendar widget styling for dark themes
(cherry picked from commit c9432990b7)
2019-10-09 23:07:15 +02:00
zadam
33a2cd21a3 fix double import of auto generated link relations
(cherry picked from commit 144e75da9e)
2019-10-09 23:05:52 +02:00
zadam
3eebce22e7 fix incorrect import of relations from tar
(cherry picked from commit 8d14a0d687)
2019-10-09 23:05:51 +02:00
zadam
adae0625b9 rename var so it's not misleading
(cherry picked from commit dd147a7209)
2019-10-09 23:05:14 +02:00
Arne
5063cfb979 BackendAPI: Return Note created within createNoteAndRefresh (#647)
(cherry picked from commit 334a38c493)
2019-10-09 23:05:14 +02:00
zadam
0835930a8a fix creating child in relation map, closes #655 2019-10-09 23:04:01 +02:00
11 changed files with 57 additions and 60 deletions

Binary file not shown.

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.35.0-beta",
"version": "0.35.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -3063,9 +3063,9 @@
"integrity": "sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ=="
},
"electron": {
"version": "6.0.10",
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.10.tgz",
"integrity": "sha512-eTFm6uTn7NKZE1OtSZSOxNuOrCXXeUR0U3vdF3R00byB7mrNe5AOaXEDDMwtzRGGY1jMuUX9Z7RvgXaCXRYSmw==",
"version": "6.0.12",
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.12.tgz",
"integrity": "sha512-70ODZa1RP6K0gE9IV9YLCXPSyhLjXksCuYSSPb3MljbfwfHo5uE6X0CGxzm+54YuPdE2e7EPnWZxOOsJYrS5iQ==",
"dev": true,
"requires": {
"@types/node": "^10.12.18",

View File

@@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.35.1",
"version": "0.35.2",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
@@ -79,7 +79,7 @@
"xml2js": "0.4.22"
},
"devDependencies": {
"electron": "6.0.10",
"electron": "6.0.12",
"electron-builder": "21.2.0",
"electron-compile": "6.4.4",
"electron-installer-debian": "2.0.1",

View File

@@ -122,7 +122,7 @@ class NoteDetailRelationMap {
this.clipboard = null;
this.$createChildNote.click(async () => {
const promptDialog = await import('"../dialogs/prompt.js"');
const promptDialog = await import('../dialogs/prompt.js');
const title = await promptDialog.ask({ message: "Enter title of new note", defaultValue: "new note" });
if (!title.trim()) {

View File

@@ -8,21 +8,13 @@ import server from "../services/server.js";
const TPL = `
<div class="calendar-widget">
<div class="calendar-header">
<button class="calendar-btn" data-calendar-toggle="previous">
<svg height="24" version="1.1" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"></path>
</svg>
</button>
<button class="calendar-btn jam jam-arrow-left" data-calendar-toggle="previous"></button>
<div class="calendar-header__label" data-calendar-label="month">
March 2017
</div>
<button class="calendar-btn" data-calendar-toggle="next">
<svg height="24" version="1.1" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z"></path>
</svg>
</button>
<button class="calendar-btn jam jam-arrow-right" data-calendar-toggle="next"></button>
</div>
<div class="calendar-week">

View File

@@ -16,7 +16,7 @@
border: 0;
color: inherit;
cursor: pointer;
font: inherit;
font-size: x-large;
line-height: normal;
min-width: 27px;
outline: none;
@@ -61,7 +61,7 @@
.calendar-widget .calendar-date {
align-items: center;
background-color: #fff;
background-color: var(--main-background-color);
display: flex;
flex-direction: column;
flex: 0 0 14.28%;

View File

@@ -209,9 +209,11 @@ function BackendScriptApi(currentNote, apiParams) {
* @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
*/
this.createNoteAndRefresh = async function(parentNoteId, title, content, extraOptions) {
await noteService.createNote(parentNoteId, title, content, extraOptions);
const ret = await noteService.createNote(parentNoteId, title, content, extraOptions);
ws.refreshTree();
return ret;
};
/**

View File

@@ -1 +1 @@
module.exports = { buildDate:"2019-09-30T22:18:23+02:00", buildRevision: "f6fc24d11d9c9a15086c0726dde30f6c382c578f" };
module.exports = { buildDate:"2019-10-09T23:09:38+02:00", buildRevision: "6c3809e1db71ebca7bf0ca69f664c3c3f1af793a" };

View File

@@ -1,6 +1,5 @@
"use strict";
const Attribute = require('../../entities/attribute');
const utils = require('../../services/utils');
const log = require('../../services/log');
@@ -114,28 +113,18 @@ async function importTar(importContext, fileBuffer, importRootNote) {
}
function getNoteId(noteMeta, filePath) {
let noteId;
const filePathNoExt = getTextFileWithoutExtension(filePath);
if (noteMeta) {
console.log(`Searching for noteId of filePath ${filePath} with meta: ${!!noteMeta}`);
if (filePathNoExt in createdPaths) {
noteId = createdPaths[filePathNoExt];
noteIdMap[noteMeta.noteId] = noteId;
}
else {
noteId = getNewNoteId(noteMeta.noteId);
}
}
else {
if (filePathNoExt in createdPaths) {
noteId = createdPaths[filePathNoExt];
}
else {
noteId = utils.newEntityId();
}
console.log("Found existing path", filePathNoExt, createdPaths[filePathNoExt]);
return createdPaths[filePathNoExt];
}
const noteId = noteMeta ? getNewNoteId(noteMeta.noteId) : utils.newEntityId();
createdPaths[filePathNoExt] = noteId;
return noteId;
@@ -161,6 +150,11 @@ async function importTar(importContext, fileBuffer, importRootNote) {
continue;
}
if (attr.type === 'relation' && ['internal-link', 'image-link', 'relation-map-link'].includes(attr.name)) {
// these relations are created automatically and as such don't need to be duplicated in the import
continue;
}
if (attr.type === 'relation') {
attr.value = getNewNoteId(attr.value);
}
@@ -234,7 +228,8 @@ async function importTar(importContext, fileBuffer, importRootNote) {
absUrl += (absUrl.length > 0 ? '/' : '') + url;
const targetNoteId = getNoteId(null, absUrl);
const {noteMeta} = getMeta(absUrl);
const targetNoteId = getNoteId(noteMeta, absUrl);
return targetNoteId;
}
@@ -340,6 +335,15 @@ async function importTar(importContext, fileBuffer, importRootNote) {
await saveAttributes(note, noteMeta);
if (!firstNote) {
firstNote = note;
}
if (type === 'text') {
filePath = getTextFileWithoutExtension(filePath);
}
}
if (!noteMeta && (type === 'file' || type === 'image')) {
attributes.push({
noteId,
@@ -355,15 +359,6 @@ async function importTar(importContext, fileBuffer, importRootNote) {
value: content.byteLength
});
}
if (!firstNote) {
firstNote = note;
}
if (type === 'text') {
filePath = getTextFileWithoutExtension(filePath);
}
}
}
/** @return {string} path without leading or trailing slash and backslashes converted to forward ones*/
@@ -426,7 +421,9 @@ async function importTar(importContext, fileBuffer, importRootNote) {
const noteId = createdPaths[path];
createdNoteIds[noteId] = true;
}
for (const noteId in createdNoteIds) { // now the noteIds are unique
await noteService.scanForLinks(noteId);
importContext.increaseProgressCount();

View File

@@ -248,7 +248,7 @@ function findRelationMapLinks(content, foundLinks) {
foundLinks.push({
name: 'relation-map-link',
value: note.noteId
})
});
}
}

View File

@@ -64,12 +64,14 @@ async function fillSyncRows(entityName, entityKey, condition = '') {
const entityIds = await sql.getColumn(`SELECT ${entityKey} FROM ${entityName}`
+ (condition ? ` WHERE ${condition}` : ''));
let createdCount = 0;
for (const entityId of entityIds) {
const existingRows = await sql.getValue("SELECT COUNT(id) FROM sync WHERE entityName = ? AND entityId = ?", [entityName, entityId]);
// we don't want to replace existing entities (which would effectively cause full resync)
if (existingRows === 0) {
log.info(`Creating missing sync record for ${entityName} ${entityId}`);
createdCount++;
await sql.insert("sync", {
entityName: entityName,
@@ -79,6 +81,10 @@ async function fillSyncRows(entityName, entityKey, condition = '') {
});
}
}
if (createdCount > 0) {
log.info(`Created ${createdCount} missing sync records for ${entityName}.`);
}
}
catch (e) {
// this is to fix migration from 0.30 to 0.32, can be removed later