From 0835930a8a28da1eb5722d8859ef17747968cfbb Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 9 Oct 2019 23:04:01 +0200 Subject: [PATCH 1/9] fix creating child in relation map, closes #655 --- package-lock.json | 8 ++++---- package.json | 2 +- .../javascripts/services/note_detail_relation_map.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 937052b71..50654a1a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index fc4eddfcd..c7b574a00 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.js index 3a322eb1f..346567116 100644 --- a/src/public/javascripts/services/note_detail_relation_map.js +++ b/src/public/javascripts/services/note_detail_relation_map.js @@ -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()) { From 5063cfb979ca7db1d8775d701b68e4741d423fd9 Mon Sep 17 00:00:00 2001 From: Arne Date: Tue, 1 Oct 2019 21:40:57 +0200 Subject: [PATCH 2/9] BackendAPI: Return Note created within createNoteAndRefresh (#647) (cherry picked from commit 334a38c493c19d207e25113c1d18493b812d26d1) --- src/services/backend_script_api.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js index 377b58d4d..514f70416 100644 --- a/src/services/backend_script_api.js +++ b/src/services/backend_script_api.js @@ -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 note = await noteService.createNote(parentNoteId, title, content, extraOptions); ws.refreshTree(); + + return note; }; /** @@ -315,4 +317,4 @@ function BackendScriptApi(currentNote, apiParams) { this.getAppInfo = () => appInfo } -module.exports = BackendScriptApi; \ No newline at end of file +module.exports = BackendScriptApi; From adae0625b98961b2c8e72ab988e0abc801c03bab Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 1 Oct 2019 21:42:36 +0200 Subject: [PATCH 3/9] rename var so it's not misleading (cherry picked from commit dd147a7209759bae97ba243d552088380abda991) --- src/services/backend_script_api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js index 514f70416..620f6480f 100644 --- a/src/services/backend_script_api.js +++ b/src/services/backend_script_api.js @@ -209,11 +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) { - const note = await noteService.createNote(parentNoteId, title, content, extraOptions); + const ret = await noteService.createNote(parentNoteId, title, content, extraOptions); ws.refreshTree(); - return note; + return ret; }; /** From 3eebce22e72f28bf0a8d70c62390477c2c7d8bf4 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 2 Oct 2019 23:22:58 +0200 Subject: [PATCH 4/9] fix incorrect import of relations from tar (cherry picked from commit 8d14a0d687f195ea24542f78091f3c1c5fd34974) --- db/demo.tar | Bin 537600 -> 535040 bytes src/services/import/tar.js | 64 ++++++++++++++++--------------------- src/services/notes.js | 2 +- src/services/sync_table.js | 8 ++++- 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/db/demo.tar b/db/demo.tar index c362321172f3073d84f560a2b645159fe7050029..48b750ba783ba9f039c3167b74f5d45ab20e8f24 100644 GIT binary patch delta 20767 zcmd5^dvqJsncq7~B0C;z<0L>5oY-;*CJjL|nuiRbM3&!{CEJqxN?~J5mMqJX<+tUf zB;}DU;gOJ`nLdC`whL@oSfE-Ev|R!{u&_YMvSHiO=7eNVx;xEi< z{~gGmKxyR%N}cRG|&W+nX(cQfy>BaP8+$3&C4GdwORUtY}Z zwJlK&8eDAsNRPM9I>m`nC`$fa+0(m3-8YL$lx>T)uygJ}pDS(`r-wT{+Uou?u-b0# z7-X;l306ae>Td4eynB6eiZD#ZpGydYQ#fWUrG z_$5ROm)%#WZ_3y0MP-NeCP7l8OpMHssz<2JCvpB%VlVj@;A>FD?68$sQ1X|OMBm2%{H_Q z&Dw0i(U#D}kbC2KzIBBwQz$=giV24*I_#M?I% zh7+%?+>Wyv=%rR(fcn*nAljguSRG&|osP!35uu(BhCRx0?`7MwvdqOZ7gHTq$_u;( z37D1^D$h?(Z`*1~xGKkSVGhMR+>WNe zV6fAkZ%P{|1=9^K)#k7R6qRjTFH5{obv>^AfzZfoFd+5xgzEB5kk$+ zL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*B^zf|*2slOxyWUTLjaC} z5$QHfmw-{+FTgUs%;ZJswrwWq0ysw$;ps=0V#45wcD~6-F?os+b@R!LE;Ffz;M+`9 z)57QF0aV1Bz@pO{3qKRu(9g zuMzMJsk6@Dbz%zMe_@|`(6qcjsd$r!8ob-m$BB;Go*p`wS~TLb_OZ+PB%+caGa zSDNM2Qj^UeHE!n>5pgSlYNTzi^NVhWjSS8U5rkVw5qapeXl<-sNwklb7u^mwcNRY& Y1j}%K5m^NAfpn%2sUQDRMbV=F1HzMMr~m)} diff --git a/src/services/import/tar.js b/src/services/import/tar.js index 7da144dfc..30ddc9d76 100644 --- a/src/services/import/tar.js +++ b/src/services/import/tar.js @@ -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) { - 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(`Searching for noteId of filePath ${filePath} with meta: ${!!noteMeta}`); + + if (filePathNoExt in createdPaths) { + console.log("Found existing path", filePathNoExt, createdPaths[filePathNoExt]); + + return createdPaths[filePathNoExt]; } + const noteId = noteMeta ? getNewNoteId(noteMeta.noteId) : utils.newEntityId(); + createdPaths[filePathNoExt] = noteId; return noteId; @@ -234,7 +223,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,22 +330,6 @@ async function importTar(importContext, fileBuffer, importRootNote) { 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) { firstNote = note; } @@ -364,6 +338,22 @@ async function importTar(importContext, fileBuffer, importRootNote) { 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*/ @@ -426,7 +416,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(); diff --git a/src/services/notes.js b/src/services/notes.js index 87c988ad2..853827f42 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -248,7 +248,7 @@ function findRelationMapLinks(content, foundLinks) { foundLinks.push({ name: 'relation-map-link', value: note.noteId - }) + }); } } diff --git a/src/services/sync_table.js b/src/services/sync_table.js index 03b0356d5..b293acabb 100644 --- a/src/services/sync_table.js +++ b/src/services/sync_table.js @@ -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 From 33a2cd21a3a413f04ad274d53d9f0e18955d812e Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 2 Oct 2019 23:28:29 +0200 Subject: [PATCH 5/9] fix double import of auto generated link relations (cherry picked from commit 144e75da9e7bbb7f89ee5dc8f313a875c528dfdd) --- src/services/import/tar.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/import/tar.js b/src/services/import/tar.js index 30ddc9d76..c61cf4d33 100644 --- a/src/services/import/tar.js +++ b/src/services/import/tar.js @@ -150,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); } From 6c3809e1db71ebca7bf0ca69f664c3c3f1af793a Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 8 Oct 2019 20:25:54 +0200 Subject: [PATCH 6/9] calendar widget styling for dark themes (cherry picked from commit c9432990b7b3c87a20e44d549d34b8f3ad363342) --- src/public/javascripts/widgets/calendar.js | 12 ++---------- src/public/stylesheets/calendar.css | 4 ++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/public/javascripts/widgets/calendar.js b/src/public/javascripts/widgets/calendar.js index 5518add7a..353232703 100644 --- a/src/public/javascripts/widgets/calendar.js +++ b/src/public/javascripts/widgets/calendar.js @@ -8,21 +8,13 @@ import server from "../services/server.js"; const TPL = `
- +
March 2017
- +
diff --git a/src/public/stylesheets/calendar.css b/src/public/stylesheets/calendar.css index 140be6f3b..4bf6b6e45 100755 --- a/src/public/stylesheets/calendar.css +++ b/src/public/stylesheets/calendar.css @@ -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%; From a15be82f006ba38835b3769bdd2738f48a836931 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 9 Oct 2019 23:09:38 +0200 Subject: [PATCH 7/9] release 0.35.2 --- package.json | 2 +- src/services/build.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c7b574a00..4cbb3dbd6 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/services/build.js b/src/services/build.js index 843546c4f..81ac3ff5e 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -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" }; From 98a6670cb4a43936f50421e518fb417120ee0151 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 10 Oct 2019 19:34:55 +0200 Subject: [PATCH 8/9] prevent default context menu on tab right click, closes #656 --- package-lock.json | 2 +- src/public/javascripts/services/link.js | 8 ++++---- src/public/javascripts/services/note_detail.js | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 50654a1a0..3f9dfde75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "trilium", - "version": "0.35.1", + "version": "0.35.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/public/javascripts/services/link.js b/src/public/javascripts/services/link.js index 1d66bd27e..2b89c064c 100644 --- a/src/public/javascripts/services/link.js +++ b/src/public/javascripts/services/link.js @@ -113,7 +113,7 @@ function addTextToEditor(text) { } } -function tabContextMenu(e) { +function newTabContextMenu(e) { const $link = $(e.target); const notePath = getNotePathFromLink($link); @@ -138,9 +138,9 @@ function tabContextMenu(e) { }); } -$(document).on('contextmenu', '.note-detail-text a', tabContextMenu); -$(document).on('contextmenu', "a[data-action='note']", tabContextMenu); -$(document).on('contextmenu', ".note-detail-render a", tabContextMenu); +$(document).on('contextmenu', '.note-detail-text a', newTabContextMenu); +$(document).on('contextmenu', "a[data-action='note']", newTabContextMenu); +$(document).on('contextmenu', ".note-detail-render a", newTabContextMenu); // when click on link popup, in case of internal link, just go the the referenced note instead of default behavior // of opening the link in new window/tab diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js index 6912d9f27..49e2e3211 100644 --- a/src/public/javascripts/services/note_detail.js +++ b/src/public/javascripts/services/note_detail.js @@ -385,6 +385,8 @@ tabRow.addListener('tabRemove', async ({ detail }) => { }); $(tabRow.el).on('contextmenu', '.note-tab', e => { + e.preventDefault(); + const tab = $(e.target).closest(".note-tab"); contextMenuService.initContextMenu(e, { From 85f736139b94db20b540d98522ab5a8e99a68171 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 10 Oct 2019 20:00:06 +0200 Subject: [PATCH 9/9] fix opening note revisions from the sidebar --- src/public/javascripts/dialogs/note_revisions.js | 12 +----------- src/public/javascripts/services/entrypoints.js | 13 +++++++++++++ src/public/javascripts/widgets/note_revisions.js | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/public/javascripts/dialogs/note_revisions.js b/src/public/javascripts/dialogs/note_revisions.js index 328c73402..783ff6a80 100644 --- a/src/public/javascripts/dialogs/note_revisions.js +++ b/src/public/javascripts/dialogs/note_revisions.js @@ -62,14 +62,4 @@ $list.on('change', () => { else { $content.text("Preview isn't available for this note type."); } -}); - -$(document).on('click', "a[data-action='note-revision']", event => { - const linkEl = $(event.target); - const noteId = linkEl.attr('data-note-path'); - const noteRevisionId = linkEl.attr('data-note-revision-id'); - - showNoteRevisionsDialog(noteId, noteRevisionId); - - return false; -}); +}); \ No newline at end of file diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js index f285a0e22..11b9e17a4 100644 --- a/src/public/javascripts/services/entrypoints.js +++ b/src/public/javascripts/services/entrypoints.js @@ -172,6 +172,19 @@ function registerEntrypoints() { utils.bindGlobalShortcut('ctrl+-', zoomService.decreaseZoomFactor); utils.bindGlobalShortcut('ctrl+=', zoomService.increaseZoomFactor); } + + $(document).on('click', "a[data-action='note-revision']", async event => { + const linkEl = $(event.target); + const noteId = linkEl.attr('data-note-path'); + const noteRevisionId = linkEl.attr('data-note-revision-id'); + + const attributesDialog = await import("../dialogs/note_revisions.js"); + + attributesDialog.showNoteRevisionsDialog(noteId, noteRevisionId); + + return false; + }); + } export default { diff --git a/src/public/javascripts/widgets/note_revisions.js b/src/public/javascripts/widgets/note_revisions.js index 4d6f9016e..a8fd86179 100644 --- a/src/public/javascripts/widgets/note_revisions.js +++ b/src/public/javascripts/widgets/note_revisions.js @@ -20,7 +20,7 @@ class NoteRevisionsWidget extends StandardWidget { const $showFullButton = $("").append("show dialog").addClass('widget-header-action'); $showFullButton.click(async () => { const attributesDialog = await import("../dialogs/note_revisions.js"); - attributesDialog.showDialog(); + attributesDialog.showCurrentNoteRevisions(this.ctx.note.noteId); }); return [$showFullButton];