From 7a8c69a6f9722c32e624d64a3cb8f78e9b0203b2 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 23 Nov 2022 22:47:20 +0100 Subject: [PATCH 1/9] fix jumping cursor position after closing a dialog, fixes #3325 --- src/public/app/services/utils.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/public/app/services/utils.js b/src/public/app/services/utils.js index 8cab5ec5b..21f79ceb7 100644 --- a/src/public/app/services/utils.js +++ b/src/public/app/services/utils.js @@ -230,7 +230,19 @@ function focusSavedElement() { return; } - $lastFocusedElement.focus(); + if ($lastFocusedElement.hasClass("ck")) { + // must handle CKEditor separately because of this bug: https://github.com/ckeditor/ckeditor5/issues/607 + // the bug manifests itself in resetting the cursor position to the first character - jumping above + + const editor = $lastFocusedElement + .closest('.ck-editor__editable') + .prop('ckeditorInstance'); + + editor.editing.view.focus(); + } else { + $lastFocusedElement.focus(); + } + $lastFocusedElement = null; } @@ -241,7 +253,7 @@ async function openDialog($dialog, closeActDialog = true) { } saveFocusedElement(); -- + $dialog.modal(); $dialog.on('hidden.bs.modal', () => { From a402c792870ed8138d7392408e1a172c7de07fff Mon Sep 17 00:00:00 2001 From: Rai Date: Sun, 27 Nov 2022 19:33:05 -0800 Subject: [PATCH 2/9] Add Ctrl+PgUp/Dn for tab switching, pointer to Electron docs --- src/public/app/widgets/dialogs/options/shortcuts.js | 5 ++++- src/services/keyboard_actions.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/public/app/widgets/dialogs/options/shortcuts.js b/src/public/app/widgets/dialogs/options/shortcuts.js index 34abd5c29..224431850 100644 --- a/src/public/app/widgets/dialogs/options/shortcuts.js +++ b/src/public/app/widgets/dialogs/options/shortcuts.js @@ -7,7 +7,10 @@ const TPL = `

Keyboard shortcuts

-

Multiple shortcuts for the same action can be separated by comma.

+

+ Multiple shortcuts for the same action can be separated by comma. + See Electron documentation for available modifiers and key codes. +

diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js index 9e223d46b..d665692a9 100644 --- a/src/services/keyboard_actions.js +++ b/src/services/keyboard_actions.js @@ -215,13 +215,13 @@ const DEFAULT_KEYBOARD_ACTIONS = [ }, { actionName: "activateNextTab", - defaultShortcuts: isElectron ? ["CommandOrControl+Tab"] : [], + defaultShortcuts: isElectron ? ["CommandOrControl+Tab", "CommandOrControl+PageDown"] : [], description: "Activates tab on the right", scope: "window" }, { actionName: "activatePreviousTab", - defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab"] : [], + defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab", "CommandOrControl+PageUp"] : [], description: "Activates tab on the left", scope: "window" }, From 8ea3608bf1dd4b66e3f5c678d3b8f3e56b211005 Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 29 Nov 2022 00:00:45 +0100 Subject: [PATCH 3/9] each stripped tag will be replace by a space, #3355 --- src/services/search/expressions/note_content_fulltext.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/search/expressions/note_content_fulltext.js b/src/services/search/expressions/note_content_fulltext.js index 548578c2b..e6c182ed6 100644 --- a/src/services/search/expressions/note_content_fulltext.js +++ b/src/services/search/expressions/note_content_fulltext.js @@ -100,7 +100,7 @@ class NoteContentFulltextExp extends Expression { if (type === 'text' && mime === 'text/html') { if (!this.raw && content.length < 20000) { // striptags is slow for very large notes // allow link to preserve URLs: https://github.com/zadam/trilium/issues/2412 - content = striptags(content, ['a']); + content = striptags(content, ['a'], ' '); // at least the closing tag can be easily stripped content = content.replace(/<\/a>/ig, ""); From 36c98e919aa5d4bd7da0d4bbdb4d048ea12f53c8 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 1 Dec 2022 22:50:53 +0100 Subject: [PATCH 4/9] fix cursor jumping problem when having same note open in two tabs, closes #3365 --- src/public/app/widgets/note_detail.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index 7a6fff9ea..f7b124827 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -283,11 +283,15 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { // probably incorrect event // calling this.refresh() is not enough since the event needs to be propagated to children as well // FIXME: create a separate event to force hierarchical refresh - this.triggerEvent('noteTypeMimeChanged', {noteId: this.noteId}); + + // this uses handleEvent to make sure that the ordinary content updates are propagated only in the subtree + // to avoid problem in #3365 + this.handleEvent('noteTypeMimeChanged', {noteId: this.noteId}); } else if (loadResults.isNoteReloaded(this.noteId, this.componentId) && (this.type !== await this.getWidgetType() || this.mime !== this.note.mime)) { + // this needs to have a triggerEvent so that e.g. note type (not in the component subtree) is updated this.triggerEvent('noteTypeMimeChanged', {noteId: this.noteId}); } else { @@ -304,6 +308,8 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { && attributeService.isAffecting(attr, this.note)); if (label || relation) { + console.log("OOOO"); + // probably incorrect event // calling this.refresh() is not enough since the event needs to be propagated to children as well this.triggerEvent('noteTypeMimeChanged', {noteId: this.noteId}); From 0480f391d30f23e495b9917fbb6fa1f8efa68c39 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 1 Dec 2022 22:56:29 +0100 Subject: [PATCH 5/9] release 0.57.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 4cc9133e5..f3e24517c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.57.1-beta", + "version": "0.57.2", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/services/build.js b/src/services/build.js index 58c0c6adb..be85e9eea 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2022-11-20T23:43:38+01:00", buildRevision: "4001953fd76f5ed47f95b66b6089794071a1764a" }; +module.exports = { buildDate:"2022-12-01T22:56:29+01:00", buildRevision: "36c98e919aa5d4bd7da0d4bbdb4d048ea12f53c8" }; From 851465da622ad098008f3730b30ab535e6149093 Mon Sep 17 00:00:00 2001 From: DynamoFox Date: Fri, 2 Dec 2022 18:15:03 +0100 Subject: [PATCH 6/9] Fix missing webpack bundle generation in Docker container build --- Dockerfile | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0b0e8f0d3..d563ef797 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,9 @@ FROM node:16.18.0-alpine # Create app directory WORKDIR /usr/src/app +# Bundle app source +COPY . . + COPY server-package.json package.json # Install app dependencies @@ -18,20 +21,19 @@ RUN set -x \ nasm \ libpng-dev \ python3 \ - && npm install --production \ - && apk del .build-dependencies + && npm install \ + && apk del .build-dependencies \ + && npm run webpack \ + && npm prune --omit=dev \ +# Set the path to the newly created webpack bundle + && sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' src/views/desktop.ejs \ + && sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' src/views/mobile.ejs \ + && sed -i -e 's/app\/setup.js/app-dist\/setup.js/g' src/views/setup.ejs \ + && sed -i -e 's/app\/share.js/app-dist\/share.js/g' src/views/share/*.ejs # Some setup tools need to be kept RUN apk add --no-cache su-exec shadow -# Bundle app source -COPY . . - -RUN sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' src/views/desktop.ejs && \ - sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' src/views/mobile.ejs && \ - sed -i -e 's/app\/setup.js/app-dist\/setup.js/g' src/views/setup.ejs && \ - sed -i -e 's/app\/share.js/app-dist\/share.js/g' src/views/share/*.ejs - # Add application user and setup proper volume permissions RUN adduser -s /bin/false node; exit 0 From 8ce9dcf4aa4a293c936b6459521ead2ff1ddec18 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 2 Dec 2022 22:06:18 +0100 Subject: [PATCH 7/9] fix webmanifest and robots.txt --- src/app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app.js b/src/app.js index c98d15591..f1c8a4d65 100644 --- a/src/app.js +++ b/src/app.js @@ -52,6 +52,8 @@ app.use(`/node_modules/@excalidraw/excalidraw/dist/`, express.static(path.join(_ app.use(`/${assetPath}/node_modules/@excalidraw/excalidraw/dist/`, express.static(path.join(__dirname, '..', 'node_modules/@excalidraw/excalidraw/dist/'))); app.use(`/${assetPath}/images`, express.static(path.join(__dirname, '..', 'images'))); app.use(`/assets/vX/images`, express.static(path.join(__dirname, '..', 'images'))); +app.use(`/manifest.webmanifest`, express.static(path.join(__dirname, 'public/manifest.webmanifest'))); +app.use(`/robots.txt`, express.static(path.join(__dirname, 'public/robots.txt'))); const sessionParser = session({ secret: sessionSecret, resave: false, // true forces the session to be saved back to the session store, even if the session was never modified during the request. From 42cd33369407a1a64eeeced4a0729b5fcd7cac47 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 2 Dec 2022 22:12:07 +0100 Subject: [PATCH 8/9] clarification on the 5 minute sync auth leeway --- package-lock.json | 4 ++-- src/routes/api/login.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 90b601659..803689d63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "trilium", - "version": "0.56.2", + "version": "0.57.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "trilium", - "version": "0.56.2", + "version": "0.57.2", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { diff --git a/src/routes/api/login.js b/src/routes/api/login.js index 89d3ec4d7..f93467efa 100644 --- a/src/routes/api/login.js +++ b/src/routes/api/login.js @@ -26,7 +26,7 @@ function loginSync(req) { // login token is valid for 5 minutes if (Math.abs(timestamp.getTime() - now.getTime()) > 5 * 60 * 1000) { - return [401, { message: 'Auth request time is out of sync, please check that both client and server have correct time.' }]; + return [401, { message: 'Auth request time is out of sync, please check that both client and server have correct time. The difference between clocks has to be smaller than 5 minutes.' }]; } const syncVersion = req.body.syncVersion; From 46fdd15857a18bde337f36648b465e508de4bd63 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 2 Dec 2022 22:44:40 +0100 Subject: [PATCH 9/9] release 0.57.3 --- package.json | 2 +- src/services/build.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f3e24517c..e9a8b0218 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.57.2", + "version": "0.57.3", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/services/build.js b/src/services/build.js index be85e9eea..0e8f435ec 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2022-12-01T22:56:29+01:00", buildRevision: "36c98e919aa5d4bd7da0d4bbdb4d048ea12f53c8" }; +module.exports = { buildDate:"2022-12-02T22:44:40+01:00", buildRevision: "42cd33369407a1a64eeeced4a0729b5fcd7cac47" };