Compare commits

...

9 Commits

Author SHA1 Message Date
zadam
ebd26f85bd release 0.32.3 2019-06-02 14:04:32 +02:00
zadam
fbfb7b3b30 sync endpoints should not set csrf cookie, #541 2019-06-02 13:52:31 +02:00
zadam
5b14358620 fix folder status rendering issues when opening not-yet-loaded notes 2019-06-01 20:54:39 +02:00
zadam
c4669cbaa3 fallback to display empty tab if the requested note doesn't exist anymore 2019-06-01 20:32:11 +02:00
zadam
74b41c9911 tree reloads should preserve activated node, fixes #552 2019-06-01 14:12:27 +02:00
zadam
d08a36174d attribute sync should trigger note reload, fixes #551 2019-06-01 12:14:09 +02:00
zadam
237749e4af make recent notes dialog scrollable 2019-05-30 20:58:01 +02:00
zadam
15f4782947 make node activation after load clearer 2019-05-30 20:55:39 +02:00
zadam
d48efd1925 FIXME 2019-05-29 23:34:23 +02:00
8 changed files with 42 additions and 35 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.32.1-beta",
"version": "0.32.2-beta",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

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

View File

@@ -232,6 +232,12 @@ async function loadNoteDetail(origNotePath, options = {}) {
if (!notePath) {
console.error(`Cannot resolve note path ${origNotePath}`);
// fallback to display something
if (tabContexts.length === 0) {
await openEmptyTab();
}
return;
}
@@ -337,10 +343,18 @@ function fireDetailLoaded() {
}
messagingService.subscribeToSyncMessages(syncData => {
for (const sync of syncData) {
if (sync.entityName === 'notes') {
refreshTabs(null, sync.entityId);
}
const noteIdsToRefresh = new Set();
syncData
.filter(sync => sync.entityName === 'notes')
.forEach(sync => noteIdsToRefresh.add(sync.entityId));
syncData
.filter(sync => sync.entityName === 'attributes')
.forEach(sync => noteIdsToRefresh.add(sync.noteId));
for (const noteId of noteIdsToRefresh) {
refreshTabs(null, noteId);
}
});

View File

@@ -109,6 +109,8 @@ async function getNodeFromPath(notePath, expand = false, expandOpts = {}) {
// we expand only after hoisted note since before then nodes are not actually present in the tree
if (parentNode) {
checkFolderStatus(parentNode);
if (!parentNode.isLoaded()) {
await parentNode.load();
}
@@ -369,8 +371,6 @@ async function treeInitialized() {
setFrontendAsLoaded();
}
let ignoreNextActivationNoteId = null;
function initFancyTree(tree) {
utils.assertArguments(tree);
@@ -402,26 +402,11 @@ function initFancyTree(tree) {
return false;
}
},
beforeActivate: (event, data) => {
// this is for the case when tree reload has been called and we don't want to
if (ignoreNextActivationNoteId && getActiveNode() !== null) {
ignoreNextActivationNoteId = null;
return false;
}
},
activate: async (event, data) => {
const node = data.node;
const noteId = node.data.noteId;
if (ignoreNextActivationNoteId === noteId) {
ignoreNextActivationNoteId = null;
return;
}
// click event won't propagate so let's close context menu manually
contextMenuWidget.hideContextMenu();
const notePath = await treeUtils.getNotePath(node);
const notePath = await treeUtils.getNotePath(data.node);
noteDetailService.switchToNote(notePath);
},
@@ -495,14 +480,16 @@ function getTree() {
async function reload() {
const notes = await loadTree();
// make sure the reload won't trigger reactivation. This is important especially in cases where we wait for the reload
// to finish to then activate some other note. But since the activate() event is called asynchronously, it may be called
// (or finished calling) after we switched to a different note.
if (getActiveNode()) {
ignoreNextActivationNoteId = getActiveNode().data.noteId;
}
const activeNotePath = getActiveNode() !== null ? await treeUtils.getNotePath(getActiveNode()) : null;
await getTree().reload(notes);
// reactivate originally activated node, but don't trigger note loading
if (activeNotePath) {
const node = await getNodeFromPath(activeNotePath, true);
await node.setActive(true, {noEvents: true});
}
}
function isNotePathInAddress() {
@@ -546,7 +533,7 @@ async function collapseTree(node = null) {
async function scrollToActiveNote() {
const activeContext = noteDetailService.getActiveTabContext();
if (activeContext) {
if (activeContext && activeContext.notePath) {
const node = await expandToNote(activeContext.notePath);
node.makeVisible({scrollIntoView: true});

View File

@@ -172,11 +172,11 @@ function register(app) {
apiRoute(POST, '/api/password/change', passwordApiRoute.changePassword);
apiRoute(POST, '/api/sync/test', syncApiRoute.testSync);
apiRoute(GET, '/api/sync/check', syncApiRoute.checkSync);
apiRoute(POST, '/api/sync/now', syncApiRoute.syncNow);
apiRoute(POST, '/api/sync/fill-sync-rows', syncApiRoute.fillSyncRows);
apiRoute(POST, '/api/sync/force-full-sync', syncApiRoute.forceFullSync);
apiRoute(POST, '/api/sync/force-note-sync/:noteId', syncApiRoute.forceNoteSync);
route(GET, '/api/sync/check', [auth.checkApiAuth], syncApiRoute.checkSync, apiResultHandler);
route(GET, '/api/sync/changed', [auth.checkApiAuth], syncApiRoute.getChanged, apiResultHandler);
route(PUT, '/api/sync/update', [auth.checkApiAuth], syncApiRoute.update, apiResultHandler);
route(POST, '/api/sync/finished', [auth.checkApiAuth], syncApiRoute.syncFinished, apiResultHandler);

View File

@@ -1 +1 @@
module.exports = { buildDate:"2019-05-29T23:14:59+02:00", buildRevision: "0a0cac5f41df0b867d0644fa392abb7a0ad4507a" };
module.exports = { buildDate:"2019-06-02T14:04:32+02:00", buildRevision: "fbfb7b3b306d48ba9e7c09b7218af7354c58a3d1" };

View File

@@ -65,6 +65,13 @@ async function sendMessageToAllClients(message) {
async function sendPing(client, lastSentSyncId) {
const syncData = await sql.getRows("SELECT * FROM sync WHERE id > ?", [lastSentSyncId]);
for (const sync of syncData) {
if (sync.entityName === 'attributes') {
sync.noteId = await sql.getValue(`SELECT noteId FROM attributes WHERE attributeId = ?`, [sync.entityId]);
}
}
const stats = require('./sync').stats;
await sendMessage(client, {

View File

@@ -1,6 +1,5 @@
<div id="recent-changes-dialog" class="modal fade mx-auto" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Recent changes</h5>