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

View File

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

View File

@@ -122,7 +122,7 @@ class NoteDetailRelationMap {
this.clipboard = null; this.clipboard = null;
this.$createChildNote.click(async () => { 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" }); const title = await promptDialog.ask({ message: "Enter title of new note", defaultValue: "new note" });
if (!title.trim()) { if (!title.trim()) {

View File

@@ -8,21 +8,13 @@ import server from "../services/server.js";
const TPL = ` const TPL = `
<div class="calendar-widget"> <div class="calendar-widget">
<div class="calendar-header"> <div class="calendar-header">
<button class="calendar-btn" data-calendar-toggle="previous"> <button class="calendar-btn jam jam-arrow-left" data-calendar-toggle="previous"></button>
<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>
<div class="calendar-header__label" data-calendar-label="month"> <div class="calendar-header__label" data-calendar-label="month">
March 2017 March 2017
</div> </div>
<button class="calendar-btn" data-calendar-toggle="next"> <button class="calendar-btn jam jam-arrow-right" data-calendar-toggle="next"></button>
<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>
</div> </div>
<div class="calendar-week"> <div class="calendar-week">

View File

@@ -16,7 +16,7 @@
border: 0; border: 0;
color: inherit; color: inherit;
cursor: pointer; cursor: pointer;
font: inherit; font-size: x-large;
line-height: normal; line-height: normal;
min-width: 27px; min-width: 27px;
outline: none; outline: none;
@@ -61,7 +61,7 @@
.calendar-widget .calendar-date { .calendar-widget .calendar-date {
align-items: center; align-items: center;
background-color: #fff; background-color: var(--main-background-color);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 0 0 14.28%; 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 * @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
*/ */
this.createNoteAndRefresh = async function(parentNoteId, title, content, extraOptions) { 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(); ws.refreshTree();
return ret;
}; };
/** /**
@@ -315,4 +317,4 @@ function BackendScriptApi(currentNote, apiParams) {
this.getAppInfo = () => appInfo this.getAppInfo = () => appInfo
} }
module.exports = BackendScriptApi; module.exports = BackendScriptApi;

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"; "use strict";
const Attribute = require('../../entities/attribute'); const Attribute = require('../../entities/attribute');
const utils = require('../../services/utils'); const utils = require('../../services/utils');
const log = require('../../services/log'); const log = require('../../services/log');
@@ -114,28 +113,18 @@ async function importTar(importContext, fileBuffer, importRootNote) {
} }
function getNoteId(noteMeta, filePath) { function getNoteId(noteMeta, filePath) {
let noteId;
const filePathNoExt = getTextFileWithoutExtension(filePath); const filePathNoExt = getTextFileWithoutExtension(filePath);
if (noteMeta) { console.log(`Searching for noteId of filePath ${filePath} with meta: ${!!noteMeta}`);
if (filePathNoExt in createdPaths) {
noteId = createdPaths[filePathNoExt]; if (filePathNoExt in createdPaths) {
noteIdMap[noteMeta.noteId] = noteId; console.log("Found existing path", filePathNoExt, createdPaths[filePathNoExt]);
}
else { return createdPaths[filePathNoExt];
noteId = getNewNoteId(noteMeta.noteId);
}
}
else {
if (filePathNoExt in createdPaths) {
noteId = createdPaths[filePathNoExt];
}
else {
noteId = utils.newEntityId();
}
} }
const noteId = noteMeta ? getNewNoteId(noteMeta.noteId) : utils.newEntityId();
createdPaths[filePathNoExt] = noteId; createdPaths[filePathNoExt] = noteId;
return noteId; return noteId;
@@ -161,6 +150,11 @@ async function importTar(importContext, fileBuffer, importRootNote) {
continue; 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') { if (attr.type === 'relation') {
attr.value = getNewNoteId(attr.value); attr.value = getNewNoteId(attr.value);
} }
@@ -234,7 +228,8 @@ async function importTar(importContext, fileBuffer, importRootNote) {
absUrl += (absUrl.length > 0 ? '/' : '') + url; absUrl += (absUrl.length > 0 ? '/' : '') + url;
const targetNoteId = getNoteId(null, absUrl); const {noteMeta} = getMeta(absUrl);
const targetNoteId = getNoteId(noteMeta, absUrl);
return targetNoteId; return targetNoteId;
} }
@@ -340,22 +335,6 @@ async function importTar(importContext, fileBuffer, importRootNote) {
await saveAttributes(note, noteMeta); await saveAttributes(note, noteMeta);
if (!noteMeta && (type === 'file' || type === 'image')) {
attributes.push({
noteId,
type: 'label',
name: 'originalFileName',
value: path.basename(filePath)
});
attributes.push({
noteId,
type: 'label',
name: 'fileSize',
value: content.byteLength
});
}
if (!firstNote) { if (!firstNote) {
firstNote = note; firstNote = note;
} }
@@ -364,6 +343,22 @@ async function importTar(importContext, fileBuffer, importRootNote) {
filePath = getTextFileWithoutExtension(filePath); filePath = getTextFileWithoutExtension(filePath);
} }
} }
if (!noteMeta && (type === 'file' || type === 'image')) {
attributes.push({
noteId,
type: 'label',
name: 'originalFileName',
value: path.basename(filePath)
});
attributes.push({
noteId,
type: 'label',
name: 'fileSize',
value: content.byteLength
});
}
} }
/** @return {string} path without leading or trailing slash and backslashes converted to forward ones*/ /** @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]; const noteId = createdPaths[path];
createdNoteIds[noteId] = true; createdNoteIds[noteId] = true;
}
for (const noteId in createdNoteIds) { // now the noteIds are unique
await noteService.scanForLinks(noteId); await noteService.scanForLinks(noteId);
importContext.increaseProgressCount(); importContext.increaseProgressCount();

View File

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

View File

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