From 2375b170ba34ed7a466b16898b1e0085866ef750 Mon Sep 17 00:00:00 2001 From: jasontan056 Date: Sat, 1 Feb 2020 16:05:23 +0800 Subject: [PATCH 1/5] Pass deleteId to deleteBranch in ensureNoteIsAbsentFromParent (#846) --- src/services/cloning.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/cloning.js b/src/services/cloning.js index 0545ea240..ed991214a 100644 --- a/src/services/cloning.js +++ b/src/services/cloning.js @@ -7,6 +7,7 @@ const noteService = require('./notes'); const repository = require('./repository'); const Branch = require('../entities/branch'); const TaskContext = require("./task_context.js"); +const utils = require('./utils'); async function cloneNoteToParent(noteId, parentNoteId, prefix) { if (await isNoteDeleted(noteId) || await isNoteDeleted(parentNoteId)) { @@ -54,7 +55,8 @@ async function ensureNoteIsAbsentFromParent(noteId, parentNoteId) { const branch = await repository.getEntity(`SELECT * FROM branches WHERE noteId = ? AND parentNoteId = ? AND isDeleted = 0`, [noteId, parentNoteId]); if (branch) { - await noteService.deleteBranch(branch, new TaskContext()); + const deleteId = utils.randomString(10); + await noteService.deleteBranch(branch, deleteId, new TaskContext()); } } From 6e060b87b8e9d1889037b177d3bd988635ddcab0 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 1 Feb 2020 09:29:56 +0100 Subject: [PATCH 2/5] fix date parsing in local timezone, closes #845 --- package-lock.json | 2 +- src/public/javascripts/widgets/calendar.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index e8e6bc4fe..526e39421 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "trilium", - "version": "0.40.0-beta", + "version": "0.40.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/public/javascripts/widgets/calendar.js b/src/public/javascripts/widgets/calendar.js index 4e3fe63e2..22076d3dd 100644 --- a/src/public/javascripts/widgets/calendar.js +++ b/src/public/javascripts/widgets/calendar.js @@ -41,7 +41,7 @@ class CalendarWidget extends StandardWidget { } init($el, activeDate) { - this.activeDate = new Date(Date.parse(activeDate)); + this.activeDate = new Date(activeDate + "T12:00:00"); // attaching time fixes local timezone handling this.todaysDate = new Date(); this.date = new Date(this.activeDate.getTime()); From 1a49894adfdf8bcc7e1c3a4fba6d761617514000 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 1 Feb 2020 10:04:18 +0100 Subject: [PATCH 3/5] fix tree loading on mobile interface, closes #839 --- src/public/javascripts/mobile.js | 2 ++ src/public/javascripts/services/sidebar.js | 5 +++++ src/public/javascripts/services/tree.js | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/public/javascripts/mobile.js b/src/public/javascripts/mobile.js index 13d71b50d..659f3dc51 100644 --- a/src/public/javascripts/mobile.js +++ b/src/public/javascripts/mobile.js @@ -87,6 +87,8 @@ async function showTree() { }); } }); + + treeService.setTree($.ui.fancytree.getTree("#tree")); } $detail.on("click", ".note-menu-button", async e => { diff --git a/src/public/javascripts/services/sidebar.js b/src/public/javascripts/services/sidebar.js index 24bf629c4..523ec61bf 100644 --- a/src/public/javascripts/services/sidebar.js +++ b/src/public/javascripts/services/sidebar.js @@ -5,6 +5,7 @@ import splitService from "./split.js"; import optionService from "./options.js"; import server from "./server.js"; import noteDetailService from "./note_detail.js"; +import utils from "./utils.js"; const $sidebar = $("#right-pane"); const $sidebarContainer = $('#sidebar-container'); @@ -15,6 +16,10 @@ const $hideSidebarButton = $("#hide-sidebar-button"); optionService.waitForOptions().then(options => toggleSidebar(options.is('rightPaneVisible'))); function toggleSidebar(show) { + if (utils.isMobile()) { + return; + } + $sidebar.toggle(show); $showSidebarButton.toggle(!show); $hideSidebarButton.toggle(show); diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js index 6197e17b7..c159fedc7 100644 --- a/src/public/javascripts/services/tree.js +++ b/src/public/javascripts/services/tree.js @@ -913,6 +913,10 @@ function getNodeByKey(key) { return tree.getNodeByKey(key); } +function setTree(treeInstance) { + tree = treeInstance; +} + keyboardActionService.setGlobalActionHandler('CollapseTree', () => collapseTree()); // don't use shortened form since collapseTree() accepts argument $collapseTreeButton.on('click', () => collapseTree()); @@ -949,5 +953,6 @@ export default { focusTree, scrollToActiveNote, duplicateNote, - getNodeByKey + getNodeByKey, + setTree }; \ No newline at end of file From 0f25c8a95f381d99b66735b9c0af3e319edb72ed Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 1 Feb 2020 10:17:03 +0100 Subject: [PATCH 4/5] autobook should not be active on the mobile interface --- src/public/javascripts/services/tab_context.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js index 74c885c17..67c2e21b5 100644 --- a/src/public/javascripts/services/tab_context.js +++ b/src/public/javascripts/services/tab_context.js @@ -303,7 +303,11 @@ class TabContext { let type = this.note.type; - if (type === 'text' && !disableAutoBook && utils.isHtmlEmpty(this.note.content) && this.note.hasChildren()) { + if (type === 'text' + && !disableAutoBook + && utils.isHtmlEmpty(this.note.content) + && this.note.hasChildren() + && utils.isDesktop()) { type = 'book'; } From 7651c5336338547e5a6c4d62cf61cbc38a04b6a2 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 1 Feb 2020 10:17:51 +0100 Subject: [PATCH 5/5] release 0.40.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 edb5cd8b1..3fe10d404 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.40.1", + "version": "0.40.2", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/services/build.js b/src/services/build.js index 69ace9222..9a12d75ae 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2020-01-19T15:45:06+01:00", buildRevision: "ab535bf147edac113299f76f410ff88b2c06735b" }; +module.exports = { buildDate:"2020-02-01T10:17:51+01:00", buildRevision: "0f25c8a95f381d99b66735b9c0af3e319edb72ed" };