From 7ec73698ab9576f351d9028f6cf2ec1bf983abcb Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Mon, 14 Apr 2025 17:20:35 +0800 Subject: [PATCH 01/17] Allow the tab row scroll --- src/public/app/widgets/tab_row.ts | 254 ++++++++++++++++---- src/public/stylesheets/theme-next/shell.css | 11 +- 2 files changed, 220 insertions(+), 45 deletions(-) diff --git a/src/public/app/widgets/tab_row.ts b/src/public/app/widgets/tab_row.ts index 4de766357..a1c731971 100644 --- a/src/public/app/widgets/tab_row.ts +++ b/src/public/app/widgets/tab_row.ts @@ -11,10 +11,11 @@ import type NoteContext from "../components/note_context.js"; const isDesktop = utils.isDesktop(); -const TAB_CONTAINER_MIN_WIDTH = 24; +const TAB_CONTAINER_MIN_WIDTH = 100; const TAB_CONTAINER_MAX_WIDTH = 240; const TAB_CONTAINER_LEFT_PADDING = 5; -const NEW_TAB_WIDTH = 32; +const SCROLL_BUTTON_WIDTH = 36; +const NEW_TAB_WIDTH = 36; const MIN_FILLER_WIDTH = isDesktop ? 50 : 15; const MARGIN_WIDTH = 5; @@ -32,6 +33,8 @@ const TAB_TPL = ` `; +const CONTAINER_ANCHOR_TPL = `
`; + const NEW_TAB_BUTTON_TPL = `All operations with the REST API have to be authenticated using a token.
+ You can get this token either from Options -> ETAPI or programmatically
+ using the /auth/login
REST call (see the spec).
All operations have to be authenticated using a token. You can get this
- token either from Options -> ETAPI or programmatically using the /auth/login
REST
- call (see the spec):
GET https://myserver.com/etapi/app-info
+Via the Authorization
header
GET https://myserver.com/etapi/app-info
Authorization: ETAPITOKEN
-Alternatively, since 0.56 you can also use basic auth format:
GET https://myserver.com/etapi/app-info
+where ETAPITOKEN
is the token obtained in the previous step.
+For compatibility with various tools, it's also possible to specify the
+ value of the Authorization
header in the format Bearer ETAPITOKEN
(since
+ 0.93.0).
+Basic authentication
+Since v0.56 you can also use basic auth format:
GET https://myserver.com/etapi/app-info
Authorization: Basic BATOKEN
- Where
BATOKEN = BASE64(username + ':' + password)
- this is
diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html b/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html
index 72b77aef3..26e837d8b 100644
--- a/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html
+++ b/src/public/app/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/1. Installing the server/Using Docker.html
@@ -36,8 +36,8 @@
Running the Docker Container
Local Access Only
Run the container to make it accessible only from the localhost. This
- setup is suitable for testing or when using a prox ay server like Nginx
- or Apache.
sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]
+ setup is suitable for testing or when using a proxy server like Nginx or
+ Apache.sudo docker run -t -i -p 127.0.0.1:8080:8080 -v ~/trilium-data:/home/node/trilium-data triliumnext/notes:[VERSION]
- Verify the container is running using
docker ps
.
- Access Trilium via a web browser at
127.0.0.1:8080
.
diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Scripting/Script API.html b/src/public/app/doc_notes/en/User Guide/User Guide/Scripting/Script API.html
index a2ea49ead..25b181b48 100644
--- a/src/public/app/doc_notes/en/User Guide/User Guide/Scripting/Script API.html
+++ b/src/public/app/doc_notes/en/User Guide/User Guide/Scripting/Script API.html
@@ -1,11 +1,10 @@
-For script code notes,
- Trilium offers an API that gives them access to various features of the
- application.
+For script code notes, Trilium offers
+ an API that gives them access to various features of the application.
There are two APIs:
- - One for the front-end scripts: Frontend API
+
- One for the front-end scripts: Frontend API
- - One for the back-end scripts: Backend API
+
- One for the back-end scripts: Backend API
In both cases, the API resides in a global variable, api
,
From d1c2672f99dd2137e1c49cb692349b367c10453d Mon Sep 17 00:00:00 2001
From: SiriusXT <1160925501@qq.com>
Date: Tue, 15 Apr 2025 23:38:08 +0800
Subject: [PATCH 14/17] Fix trackpad not switching tabs.
---
src/public/app/types-lib.d.ts | 2 +-
src/public/app/widgets/tab_row.ts | 10 ++--------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/public/app/types-lib.d.ts b/src/public/app/types-lib.d.ts
index 770021751..57b810f76 100644
--- a/src/public/app/types-lib.d.ts
+++ b/src/public/app/types-lib.d.ts
@@ -13,7 +13,7 @@ declare module "draggabilly" {
containment: HTMLElement
});
element: HTMLElement;
- on(event: "pointerDown" | "pointerUp" | "dragStart" | "dragEnd" | "dragMove", callback: Callback);
+ on(event: "staticClick" | "dragStart" | "dragEnd" | "dragMove", callback: Callback);
dragEnd();
isDragging: boolean;
positionDrag: () => void;
diff --git a/src/public/app/widgets/tab_row.ts b/src/public/app/widgets/tab_row.ts
index e5c93ab99..c5fb4e582 100644
--- a/src/public/app/widgets/tab_row.ts
+++ b/src/public/app/widgets/tab_row.ts
@@ -676,14 +676,8 @@ export default class TabRowWidget extends BasicWidget {
this.draggabillies.push(draggabilly);
- let pointerDownTime: number = 0;
- draggabilly.on("pointerDown", () => {
- pointerDownTime = Date.now();
- });
- draggabilly.on("pointerUp", () => {
- if (Date.now() - pointerDownTime < 200) {
- appContext.tabManager.activateNoteContext(tabEl.getAttribute("data-ntx-id"));
- }
+ draggabilly.on("staticClick", () => {
+ appContext.tabManager.activateNoteContext(tabEl.getAttribute("data-ntx-id"));
});
draggabilly.on("dragStart", () => {
From 2b4d9f85368a6cc7452b37c87c180040e85dbff5 Mon Sep 17 00:00:00 2001
From: Elian Doran
Date: Tue, 15 Apr 2025 19:54:48 +0300
Subject: [PATCH 15/17] fix(sql): prepared statements leak raw state (fixes
#1705)
---
src/services/sql.ts | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/services/sql.ts b/src/services/sql.ts
index d135b54da..f686b0876 100644
--- a/src/services/sql.ts
+++ b/src/services/sql.ts
@@ -112,12 +112,21 @@ function upsert(tableName: string, primaryKey: string, rec: T) {
execute(query, rec);
}
-function stmt(sql: string) {
- if (!(sql in statementCache)) {
- statementCache[sql] = dbConnection.prepare(sql);
+/**
+ * For the given SQL query, returns a prepared statement. For the same query (string comparison), the same statement is returned.
+ *
+ * @param sql the SQL query for which to return a prepared statement.
+ * @param isRaw indicates whether `.raw()` is going to be called on the prepared statement in order to return the raw rows (e.g. via {@link getRawRows()}). The reason is that the raw state is preserved in the saved statement and would break non-raw calls for the same query.
+ * @returns the corresponding {@link Statement}.
+ */
+function stmt(sql: string, isRaw?: boolean) {
+ const key = (isRaw ? "raw/" + sql : sql);
+
+ if (!(key in statementCache)) {
+ statementCache[key] = dbConnection.prepare(sql);
}
- return statementCache[sql];
+ return statementCache[key];
}
function getRow(query: string, params: Params = []): T {
@@ -172,7 +181,7 @@ function getRows(query: string, params: Params = []): T[] {
}
function getRawRows(query: string, params: Params = []): T[] {
- return (wrap(query, (s) => s.raw().all(params)) as T[]) || [];
+ return (wrap(query, (s) => s.raw().all(params), true) as T[]) || [];
}
function iterateRows(query: string, params: Params = []): IterableIterator {
@@ -234,7 +243,10 @@ function executeScript(query: string): DatabaseType {
return dbConnection.exec(query);
}
-function wrap(query: string, func: (statement: Statement) => unknown): unknown {
+/**
+ * @param isRaw indicates whether `.raw()` is going to be called on the prepared statement in order to return the raw rows (e.g. via {@link getRawRows()}). The reason is that the raw state is preserved in the saved statement and would break non-raw calls for the same query.
+ */
+function wrap(query: string, func: (statement: Statement) => unknown, isRaw?: boolean): unknown {
const startTimestamp = Date.now();
let result;
@@ -243,7 +255,7 @@ function wrap(query: string, func: (statement: Statement) => unknown): unknown {
}
try {
- result = func(stmt(query));
+ result = func(stmt(query, isRaw));
} catch (e: any) {
if (e.message.includes("The database connection is not open")) {
// this often happens on killing the app which puts these alerts in front of user
From b2b52956ad40874fc7de7de52d247c4256ca351a Mon Sep 17 00:00:00 2001
From: Elian Doran
Date: Tue, 15 Apr 2025 19:57:26 +0300
Subject: [PATCH 16/17] chore(release): mention bugfix
---
docs/Release Notes/Release Notes/v0.93.0.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/Release Notes/Release Notes/v0.93.0.md b/docs/Release Notes/Release Notes/v0.93.0.md
index 0d30c0b82..56726e070 100644
--- a/docs/Release Notes/Release Notes/v0.93.0.md
+++ b/docs/Release Notes/Release Notes/v0.93.0.md
@@ -14,6 +14,7 @@
* [Note background is gray in 0.92.7 (light theme)](https://github.com/TriliumNext/Notes/issues/1689)
* [config.Session.cookieMaxAge is ignored](https://github.com/TriliumNext/Notes/issues/1709) by @pano9000
* [Return correct HTTP status code on failed login attempts instead of 200](https://github.com/TriliumNext/Notes/issues/1707) by @pano9000
+* [Calendar stops displaying notes after adding a Day Note](https://github.com/TriliumNext/Notes/issues/1705)
## ✨ Improvements
From 80f895a2d536280ecf2c55b5307a1d49a1563486 Mon Sep 17 00:00:00 2001
From: Elian Doran
Date: Tue, 15 Apr 2025 21:26:04 +0300
Subject: [PATCH 17/17] chore(release): mention feature in changelog
---
docs/Release Notes/Release Notes/v0.93.0.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/Release Notes/Release Notes/v0.93.0.md b/docs/Release Notes/Release Notes/v0.93.0.md
index 56726e070..fd13d57b4 100644
--- a/docs/Release Notes/Release Notes/v0.93.0.md
+++ b/docs/Release Notes/Release Notes/v0.93.0.md
@@ -34,6 +34,7 @@
* Native ARM builds for Windows are now back.
* Basic Touch Bar support for macOS.
* [Support Bearer Token](https://github.com/TriliumNext/Notes/issues/1701)
+* The tab bar is now scrollable when there are many tabs by @SiriusXT
## 🌍 Internationalization