Merge remote-tracking branch 'origin/develop' into style/next/restyle-ckeditor
@ -0,0 +1,189 @@
|
||||
import { fileURLToPath } from "url";
|
||||
import { dirname, join } from "path";
|
||||
import swaggerJsdoc from 'swagger-jsdoc';
|
||||
import fs from "fs";
|
||||
|
||||
/*
|
||||
* Usage: npm run generate-openapi | tail -n1 > x.json
|
||||
*
|
||||
* Inspect generated file by opening it in https://editor-next.swagger.io/
|
||||
*
|
||||
*/
|
||||
|
||||
const options = {
|
||||
definition: {
|
||||
openapi: '3.1.1',
|
||||
info: {
|
||||
title: 'Trilium Notes - Sync server API',
|
||||
version: '0.96.6',
|
||||
description: "This is the internal sync server API used by Trilium Notes / TriliumNext Notes.\n\n_If you're looking for the officially supported External Trilium API, see [here](https://triliumnext.github.io/Docs/Wiki/etapi.html)._\n\nThis page does not yet list all routes. For a full list, see the [route controller](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/routes.ts).",
|
||||
contact: {
|
||||
name: "TriliumNext issue tracker",
|
||||
url: "https://github.com/TriliumNext/Notes/issues",
|
||||
},
|
||||
license: {
|
||||
name: "GNU Free Documentation License 1.3 (or later)",
|
||||
url: "https://www.gnu.org/licenses/fdl-1.3",
|
||||
},
|
||||
},
|
||||
},
|
||||
apis: [
|
||||
// Put individual files here to have them ordered first.
|
||||
'./src/routes/api/setup.ts',
|
||||
// all other files
|
||||
'./src/routes/api/*.ts', './bin/generate-openapi.js'
|
||||
],
|
||||
};
|
||||
|
||||
const openapiSpecification = swaggerJsdoc(options);
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const outputPath = join(scriptDir, "..", "src", "routes", "api", "openapi.json");
|
||||
fs.writeFileSync(outputPath, JSON.stringify(openapiSpecification));
|
||||
console.log("Saved to ", outputPath);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* - name: auth
|
||||
* description: Authentication
|
||||
* - name: sync
|
||||
* description: Synchronization
|
||||
* - name: data
|
||||
*/
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* components:
|
||||
* schemas:
|
||||
* Attribute:
|
||||
* type: object
|
||||
* properties:
|
||||
* attributeId:
|
||||
* type: string
|
||||
* example: "4G1DPrI58PAb"
|
||||
* noteId:
|
||||
* $ref: "#/components/schemas/NoteId"
|
||||
* type:
|
||||
* type: string
|
||||
* enum: ["attribute", "relation"]
|
||||
* name:
|
||||
* type: string
|
||||
* example: "internalLink"
|
||||
* value:
|
||||
* type: string
|
||||
* example: "hA8aHSpTRdZ6"
|
||||
* description: "If type = \"relation\", a note ID. Otherwise, the attribute content."
|
||||
* position:
|
||||
* type: integer
|
||||
* example: 20
|
||||
* isInheritable:
|
||||
* type: boolean
|
||||
* Blob:
|
||||
* type: object
|
||||
* properties:
|
||||
* blobId:
|
||||
* type: string
|
||||
* example: "8iqMIB8eiY1tPYmElfjm"
|
||||
* content:
|
||||
* type:
|
||||
* - string
|
||||
* - 'null'
|
||||
* description: "`null` if not text."
|
||||
* contentLength:
|
||||
* type: integer
|
||||
* dateModified:
|
||||
* $ref: "#/components/schemas/DateTime"
|
||||
* utcDateModified:
|
||||
* $ref: "#/components/schemas/UtcDateTime"
|
||||
* Branch:
|
||||
* type: object
|
||||
* properties:
|
||||
* branchId:
|
||||
* $ref: "#/components/schemas/BranchId"
|
||||
* noteId:
|
||||
* $ref: "#/components/schemas/NoteId"
|
||||
* parentNoteId:
|
||||
* $ref: "#/components/schemas/NoteId"
|
||||
* notePosition:
|
||||
* type: integer
|
||||
* example: 20
|
||||
* prefix:
|
||||
* type:
|
||||
* - string
|
||||
* - 'null'
|
||||
* isExpanded:
|
||||
* type: boolean
|
||||
* BranchId:
|
||||
* type: string
|
||||
* example: "WUjhaGp4EKah_ur11rSfHkzeV"
|
||||
* description: Equal to `{parentNoteId}_{noteId}`
|
||||
* DateTime:
|
||||
* type: string
|
||||
* example: "2025-02-14 08:19:59.203+0100"
|
||||
* EntityChange:
|
||||
* type: object
|
||||
* properties:
|
||||
* entityChange:
|
||||
* type: object
|
||||
* properties:
|
||||
* entityName:
|
||||
* type: string
|
||||
* example: "notes"
|
||||
* description: Database table for this entity.
|
||||
* changeId:
|
||||
* type: string
|
||||
* example: "changeId9630"
|
||||
* description: ID, referenced in `entity_changes` table.
|
||||
* entity:
|
||||
* type: object
|
||||
* description: Encoded entity data. Object has one property for each database column.
|
||||
* Note:
|
||||
* type: object
|
||||
* properties:
|
||||
* noteId:
|
||||
* $ref: "#/components/schemas/NoteId"
|
||||
* title:
|
||||
* type: string
|
||||
* isProtected:
|
||||
* type: boolean
|
||||
* type:
|
||||
* type: string
|
||||
* example: "text"
|
||||
* enum: ["text", "code", "render", "file", "image", "search", "relationMap", "book", "noteMap", "mermaid", "canvas", "webView", "launcher", "doc", "contentWidget", "mindMap", "geoMap"]
|
||||
* description: "[Reference list](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/note_types.ts)"
|
||||
* mime:
|
||||
* type: string
|
||||
* example: "text/html"
|
||||
* blobId:
|
||||
* type: string
|
||||
* example: "z4PhNX7vuL3xVChQ1m2A"
|
||||
* NoteId:
|
||||
* type: string
|
||||
* example: "ur11rSfHkzeV"
|
||||
* description: "12-character note ID. Special values: \"none\"`, `\"root\"."
|
||||
* Timestamps:
|
||||
* type: object
|
||||
* properties:
|
||||
* dateCreated:
|
||||
* $ref: "#/components/schemas/DateTime"
|
||||
* dateModified:
|
||||
* $ref: "#/components/schemas/DateTime"
|
||||
* utcDateCreated:
|
||||
* $ref: "#/components/schemas/UtcDateTime"
|
||||
* utcDateModified:
|
||||
* $ref: "#/components/schemas/UtcDateTime"
|
||||
* UtcDateTime:
|
||||
* type: string
|
||||
* example: "2025-02-13T07:42:47.698Z"
|
||||
* description: "Result of `new Date().toISOString().replace('T', ' ')`"
|
||||
* securitySchemes:
|
||||
* user-password:
|
||||
* type: apiKey
|
||||
* name: trilium-cred
|
||||
* in: header
|
||||
* description: "Username and password, formatted as `user:password`"
|
||||
* session:
|
||||
* type: apiKey
|
||||
* in: cookie
|
||||
* name: trilium.sid
|
||||
*/
|
||||
@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS "tasks"
|
||||
(
|
||||
"taskId" TEXT NOT NULL PRIMARY KEY,
|
||||
"parentNoteId" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL DEFAULT "",
|
||||
"dueDate" INTEGER,
|
||||
"isDone" INTEGER NOT NULL DEFAULT 0,
|
||||
"isDeleted" INTEGER NOT NULL DEFAULT 0,
|
||||
"utcDateModified" TEXT NOT NULL
|
||||
);
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.6 KiB |
@ -1,8 +1,9 @@
|
||||
import etapi from "../support/etapi.js";
|
||||
|
||||
/* TriliumNextTODO: port to Vitest
|
||||
etapi.describeEtapi("app_info", () => {
|
||||
it("get", async () => {
|
||||
const appInfo = await etapi.getEtapi("app-info");
|
||||
expect(appInfo.clipperProtocolVersion).toEqual("1.0");
|
||||
});
|
||||
});
|
||||
*/
|
||||
@ -1,8 +1,10 @@
|
||||
import etapi from "../support/etapi.js";
|
||||
|
||||
/* TriliumNextTODO: port to Vitest
|
||||
etapi.describeEtapi("backup", () => {
|
||||
it("create", async () => {
|
||||
const response = await etapi.putEtapiContent("backup/etapi_test");
|
||||
expect(response.status).toEqual(204);
|
||||
});
|
||||
});
|
||||
*/
|
||||
@ -0,0 +1,84 @@
|
||||
import date_utils from "../../services/date_utils.js";
|
||||
import AbstractBeccaEntity from "./abstract_becca_entity.js";
|
||||
import type BOption from "./boption.js";
|
||||
import type { TaskRow } from "./rows.js";
|
||||
|
||||
export default class BTask extends AbstractBeccaEntity<BOption> {
|
||||
|
||||
static get entityName() {
|
||||
return "tasks";
|
||||
}
|
||||
|
||||
static get primaryKeyName() {
|
||||
return "taskId";
|
||||
}
|
||||
|
||||
static get hashedProperties() {
|
||||
return [ "taskId", "parentNoteId", "title", "dueDate", "isDone", "isDeleted" ];
|
||||
}
|
||||
|
||||
taskId?: string;
|
||||
parentNoteId!: string;
|
||||
title!: string;
|
||||
dueDate?: string;
|
||||
isDone!: boolean;
|
||||
private _isDeleted?: boolean;
|
||||
|
||||
constructor(row?: TaskRow) {
|
||||
super();
|
||||
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateFromRow(row);
|
||||
this.init();
|
||||
}
|
||||
|
||||
get isDeleted() {
|
||||
return !!this._isDeleted;
|
||||
}
|
||||
|
||||
updateFromRow(row: TaskRow) {
|
||||
this.taskId = row.taskId;
|
||||
this.parentNoteId = row.parentNoteId;
|
||||
this.title = row.title;
|
||||
this.dueDate = row.dueDate;
|
||||
this.isDone = !!row.isDone;
|
||||
this._isDeleted = !!row.isDeleted;
|
||||
this.utcDateModified = row.utcDateModified;
|
||||
|
||||
if (this.taskId) {
|
||||
this.becca.tasks[this.taskId] = this;
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
if (this.taskId) {
|
||||
this.becca.tasks[this.taskId] = this;
|
||||
}
|
||||
}
|
||||
|
||||
protected beforeSaving(opts?: {}): void {
|
||||
super.beforeSaving();
|
||||
|
||||
this.utcDateModified = date_utils.utcNowDateTime();
|
||||
|
||||
if (this.taskId) {
|
||||
this.becca.tasks[this.taskId] = this;
|
||||
}
|
||||
}
|
||||
|
||||
getPojo() {
|
||||
return {
|
||||
taskId: this.taskId,
|
||||
parentNoteId: this.parentNoteId,
|
||||
title: this.title,
|
||||
dueDate: this.dueDate,
|
||||
isDone: this.isDone,
|
||||
isDeleted: this.isDeleted,
|
||||
utcDateModified: this.utcDateModified
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../../style.css">
|
||||
<base target="_parent">
|
||||
<title data-trilium-title>Custom resource providers</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1 data-trilium-h1>Custom resource providers</h1>
|
||||
|
||||
<div class="ck-content">
|
||||
<p>A custom resource provider allows any file imported into Trilium (images,
|
||||
fonts, stylesheets) to be publicly accessible via a URL.</p>
|
||||
<p>A potential use case for this is to add embed a custom font alongside
|
||||
a theme.</p>
|
||||
<h2>Steps for creating a custom resource provider</h2>
|
||||
<ol>
|
||||
<li>Import a file such as an image or a font into Trilium by drag & drop.</li>
|
||||
<li>Select the file and go to the <i>Owned Attributes</i> section.</li>
|
||||
<li>Add the label <code>#customResourceProvider=hello</code>.</li>
|
||||
<li>To test if it is working, use a browser to navigate to <code><protocol>://<host>/custom/hello</code> (where <code><protocol></code> is
|
||||
either <code>http</code> or <code>https</code> based on your setup, and <code><host></code> is
|
||||
the host or IP to your Trilium server instance). If you are running the
|
||||
TriliumNext application without a server, use <code>http://localhost:37840</code> as
|
||||
the base URL.</li>
|
||||
<li>If everything went well, at the previous step the browser should have
|
||||
downloaded the file uploaded in the first step.</li>
|
||||
</ol>
|
||||
<p>Instead of <code>hello</code>, the name can be:</p>
|
||||
<ul>
|
||||
<li>A path, such as <code>fonts/Roboto.ttf</code>, which would be accessible
|
||||
via <code><host>/custom/fonts/Roboto.ttf</code>.</li>
|
||||
<li>As a more advanced use case, a regular expression to match multiple routes,
|
||||
such as <code>hello/.*</code> which will be accessible via <code>/custom/hello/1</code>, <code>/custom/hello/2</code>, <code>/custom/hello/world</code>,
|
||||
etc.</li>
|
||||
</ul>
|
||||
<h2>Using it in a theme</h2>
|
||||
<p>For example, if you have a custom font to be imported by the theme, first
|
||||
upload a font file into Trilium and assign it the <code>#customResourceProvider=fonts/myfont.ttf</code> attribute.</p>
|
||||
<p>Then modify the theme CSS to point to:</p><pre><code class="language-text-css">@font-face {
|
||||
font-family: customFont;
|
||||
src: url("/custom/fonts/myfont.ttf");
|
||||
}
|
||||
|
||||
div {
|
||||
font-family: customFont;
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 340 B |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 79 KiB |
@ -0,0 +1,55 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../../style.css">
|
||||
<base target="_parent">
|
||||
<title data-trilium-title>Export as PDF</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1 data-trilium-h1>Export as PDF</h1>
|
||||
|
||||
<div class="ck-content">
|
||||
<figure class="image image-style-align-right image_resized" style="width:50.63%;">
|
||||
<img style="aspect-ratio:951/432;" src="Export as PDF_image.png" width="951"
|
||||
height="432">
|
||||
<figcaption>Screenshot of the note contextual menu indicating the “Export as PDF”
|
||||
option.</figcaption>
|
||||
</figure>
|
||||
<p>On the desktop application of Trilium it is possible to export a note
|
||||
as PDF. On the server or PWA (mobile), the option is not available due
|
||||
to technical constraints and it will be hidden.</p>
|
||||
<p>To print a note, select the
|
||||
<img src="2_Export as PDF_image.png" width="29"
|
||||
height="31">button to the right of the note and select <i>Export as PDF</i>.</p>
|
||||
<p>Afterwards you will be prompted to select where to save the PDF file.
|
||||
Upon confirmation, the resulting PDF will be opened automatically using
|
||||
the default/system application configured for PDFs.</p>
|
||||
<p>Should you encounter any visual issues in the resulting PDF file (e.g.
|
||||
a table does not fit properly, there is cut off text, etc.) feel free to
|
||||
<a
|
||||
href="#root/OeKBfN6JbMIq/jRV1MPt4mNSP/hrC6xn7hnDq5">report the issue</a>. In this case, it's best to offer a sample note (click
|
||||
on the
|
||||
<img src="2_Export as PDF_image.png" width="29" height="31">button, select Export note → This note and all of its descendants → HTML
|
||||
in ZIP archive). Make sure not to accidentally leak any personal information.</p>
|
||||
<h2>Landscape mode</h2>
|
||||
<p>When exporting to PDF, there are no customizable settings such as page
|
||||
orientation, size, etc. However, it is possible to specify a given note
|
||||
to be printed as a PDF in landscape mode by adding the <code>#printLandscape</code> attribute
|
||||
to it (see <a class="reference-link" href="#root/9QRytp0ZYFIf/PnO38wN0ffOA">Adding an attribute to a note</a>).</p>
|
||||
<h2>Page size</h2>
|
||||
<p>By default, the resulting PDF will be in Letter format. It is possible
|
||||
to adjust it to another page size via the <code>#printPageSize</code> attribute,
|
||||
with one of the following values: <code>A0</code>, <code>A1</code>, <code>A2</code>, <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>A6</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code>, <code>Ledger</code>.</p>
|
||||
<h2>Keyboard shortcut</h2>
|
||||
<p>It's possible to trigger the export to PDF from the keyboard by going
|
||||
to <i>Keyboard shortcuts</i> and assigning a key combination
|
||||
for the <code>exportAsPdf</code> action.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 95 KiB |
@ -0,0 +1,73 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="../../style.css">
|
||||
<base target="_parent">
|
||||
<title data-trilium-title>Zen mode</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1 data-trilium-h1>Zen mode</h1>
|
||||
|
||||
<div class="ck-content">
|
||||
<figure class="image image-style-align-center image_resized" style="width:62.15%;">
|
||||
<img style="aspect-ratio:855/677;" src="5_Zen mode_image.png" width="855"
|
||||
height="677">
|
||||
<figcaption>Screenshot of Zen Mode activated on a Windows 11 system with native title
|
||||
bar off and background effects on.</figcaption>
|
||||
</figure>
|
||||
<p>When Zen Mode is activated (pictured on the side), most of the user interface
|
||||
of Trilium is hidden away in order to be able to focus on the content,
|
||||
whether it's for reading or writing.</p>
|
||||
<figure class="image image-style-align-right image_resized"
|
||||
style="width:17.65%;">
|
||||
<img style="aspect-ratio:265/386;" src="3_Zen mode_image.png" width="265"
|
||||
height="386">
|
||||
<figcaption>Screenshot of the Zen Mode option in the global menu.</figcaption>
|
||||
</figure>
|
||||
<h2>Activating & deactivating</h2>
|
||||
<p>The Zen Mode can be activated by accessing the global menu and selecting
|
||||
the “Zen Mode” option:</p>
|
||||
<p>Aside from the global menu, it's also possible to activate this mode by
|
||||
using a keyboard shortcut which is Alt+Z by default. Look for <code>toggleZenMode</code> in
|
||||
the shortcut configuration.</p>
|
||||
<p>Once Zen Mode is activated, all the UI elements of the application will
|
||||
be hidden away, including the global menu. In that case, the Zen Mode can
|
||||
be deactivated either by pressing the
|
||||
<img src="6_Zen mode_image.png" width="29"
|
||||
height="31">icon in the top-right corner of the window or by pressing the keyboard
|
||||
combination again.</p>
|
||||
<p>Do note that, by design, activating or deactivating the Zen Mode applies
|
||||
only to the current window. Restarting the application will also disable
|
||||
the Zen Mode.</p>
|
||||
<h2>Moving the window around</h2>
|
||||
<p>If “Native title bar” is activated, then the operating system's default
|
||||
title bar can be used to drag the window around. If deactivated, the window
|
||||
can still be moved by dragging the mouse across the top part of the window
|
||||
where the note titles are.</p>
|
||||
<figure class="image image-style-align-left image_resized"
|
||||
style="width:50%;">
|
||||
<img style="aspect-ratio:1060/707;" src="7_Zen mode_image.png" width="1060"
|
||||
height="707">
|
||||
<figcaption>Screenshot of two notes side-by-side while Zen Mode is active, on Windows
|
||||
11 with background effects off.</figcaption>
|
||||
</figure>
|
||||
<h2>Split windows and tabs</h2>
|
||||
<p>Tabs are completely hidden, however it's still possible to use keyboard
|
||||
shortcuts such as <code>firstTab</code> (Ctrl+1 by default), <code>secondTab</code> (Ctrl+2
|
||||
by default). There are also some newer shortcuts such as <code>activateNextTab</code> (Ctrl+Tab)
|
||||
or <code>activatePreviousTab</code> (Ctrl+Shift+Tab) that allow easy navigation,
|
||||
however make sure that they are configured properly in the settings.</p>
|
||||
<p>For the split view of notes, there are no keyboard shortcuts at the time
|
||||
of writing, but it's still possible to have them in Zen Mode by creating
|
||||
the split while the Zen Mode is off and then reactivating it afterwards.</p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 323 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 191 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 515 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 397 KiB |
|
After Width: | Height: | Size: 5.2 KiB |