mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
chore(docs): sync developer guide
This commit is contained in:
parent
d3e18a68a8
commit
cd35884446
File diff suppressed because it is too large
Load Diff
@ -5,13 +5,13 @@ In the project root:
|
||||
|
||||
Under NixOS the following `nix-shell` is needed:
|
||||
|
||||
```plain
|
||||
```
|
||||
nix-shell -p jq
|
||||
```
|
||||
|
||||
For Linux builds:
|
||||
|
||||
```plain
|
||||
```
|
||||
nix-shell -p jq fakeroot dpkg
|
||||
```
|
||||
|
||||
|
@ -25,7 +25,7 @@ Generally `ROOT_NOTE_ID` should not be changed since the note ID must match if t
|
||||
|
||||
Run:
|
||||
|
||||
```plain
|
||||
```
|
||||
./bin/docs/prepare.sh
|
||||
```
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Releasing a version
|
||||
On NixOS:
|
||||
|
||||
```plain
|
||||
```
|
||||
nix-shell -p dpkg fakeroot jq nodejs_20
|
||||
```
|
||||
|
||||
Then simply run from project root:
|
||||
|
||||
```plain
|
||||
```
|
||||
./bin/release.sh 1.2.3
|
||||
```
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Running a development build
|
||||
As always, install the dependencies for the first time (and re-run whenever there are errors about missing dependencies):
|
||||
|
||||
```sh
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
@ -9,13 +9,13 @@ npm install
|
||||
|
||||
Run with default settings:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run start-server
|
||||
```
|
||||
|
||||
Run with custom port:
|
||||
|
||||
```sh
|
||||
```
|
||||
TRILIUM_PORT=8082 npm run start-server
|
||||
```
|
||||
|
||||
@ -23,25 +23,25 @@ TRILIUM_PORT=8082 npm run start-server
|
||||
|
||||
Rebuild `better-sqlite3` dependency:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run switch-electron
|
||||
```
|
||||
|
||||
Then run Electron:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run start-electron
|
||||
```
|
||||
|
||||
To run Electron using the same data directory as the production version:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run start-electron-no-dir
|
||||
```
|
||||
|
||||
When done, switch back the `better-sqlite3` dependency:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run switch-server
|
||||
```
|
||||
|
||||
@ -49,13 +49,13 @@ npm run switch-server
|
||||
|
||||
To start Electron without running `switch-electron` first:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run qstart-electron
|
||||
```
|
||||
|
||||
Similarly, to start the server without running `switch-server` first:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run qstart-server
|
||||
```
|
||||
|
||||
@ -63,7 +63,7 @@ npm run qstart-server
|
||||
|
||||
Safe mode is off by default, to enable it temporarily on a Unix shell, prepend the environment variable setting:
|
||||
|
||||
```sh
|
||||
```
|
||||
TRILIUM_SAFE_MODE=1 npm run start-server
|
||||
```
|
||||
|
||||
@ -78,12 +78,12 @@ To have the same behaviour on Windows, we would need to alter `package.json`:
|
||||
|
||||
When doing development, the Electron binary retrieved from NPM is not going to be compatible with NixOS, resulting in errors when trying to run it. To bypass this, there is a special command to run electron using `nix-shell`:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run start-electron-nix
|
||||
```
|
||||
|
||||
Similarly to the original command, to use the same data directory as the production version:
|
||||
|
||||
```sh
|
||||
```
|
||||
npm run start-electron-no-dir-nix
|
||||
```
|
@ -3,7 +3,7 @@ In the past some libraries have been copy-pasted (and adapted if needed) to the
|
||||
|
||||
The first step is to install the desired library. As an example we are going to install `i18next`:
|
||||
|
||||
```plain
|
||||
```
|
||||
npm i i18next
|
||||
```
|
||||
|
||||
@ -11,7 +11,7 @@ npm i i18next
|
||||
|
||||
After installing the dependency, it's important to know how it's structured. You can do this by looking at the directory structure of the newly imported dependency:
|
||||
|
||||
```plain
|
||||
```
|
||||
$ tree node_modules/i18next
|
||||
node_modules/i18next
|
||||
├── dist
|
||||
|
@ -11,7 +11,7 @@ The SVG export needs to be handled inside the note type implementation.
|
||||
|
||||
The first goal is to create a method to handle the <a class="reference-link" href="SVG%20rendering.md">SVG rendering</a>. Make sure to deduplicate the code if the SVG rendering is already handled.
|
||||
|
||||
```plain
|
||||
```
|
||||
async renderSvg() {
|
||||
return await this.mind.exportSvg().text();
|
||||
}
|
||||
@ -19,7 +19,7 @@ async renderSvg() {
|
||||
|
||||
Then create an event handler to manage the SVG export:
|
||||
|
||||
```plain
|
||||
```
|
||||
async exportSvgEvent({ntxId}) {
|
||||
if (!this.isNoteContext(ntxId) || this.note.type !== "mindMap") {
|
||||
return;
|
||||
|
@ -49,6 +49,6 @@ Go to `src/becca/entities/rows.ts` and add the new note type to `ALLOWED_NOTE_TY
|
||||
|
||||
Type widgets do a check whenever a note is selected to determine whether the widget needs to be displayed or not, based on the note type. Make sure `getType()` is well implemented in the newly added type widget (take great care that the value is returned but also that the note type ID matches the ones registered in the previous steps):
|
||||
|
||||
```plain
|
||||
```
|
||||
static getType() { return "foo"; }
|
||||
```
|
@ -1,7 +1,7 @@
|
||||
# Loading data
|
||||
Data loading can be done in `doRefresh()` since it gets a reference to the note:
|
||||
|
||||
```plain
|
||||
```
|
||||
const blob = await note.getBlob();
|
||||
const content = blob.getJsonContent();
|
||||
```
|
||||
|
@ -13,7 +13,7 @@ If the returned value is a `Blob`, then the underlying text can be obtained via
|
||||
|
||||
To save the SVG as an attachment alongside the content, simply modify `getData()`:
|
||||
|
||||
```plain
|
||||
```
|
||||
async getData() {
|
||||
const mind = this.mind;
|
||||
if (!mind) {
|
||||
@ -47,7 +47,7 @@ Alter the `returnImageInt` method as follows:
|
||||
1. Add the image type to the guard condition which returns 400 for unsupported note types.
|
||||
2. Add an `if` statement to render the attachment using the correct name:
|
||||
|
||||
```plain
|
||||
```
|
||||
if (image.type === "mindMap") {
|
||||
renderSvgAttachment(image, res, 'mindmap-export.svg');
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ The data persistence is achieved via the spaced update mechanism which is alread
|
||||
|
||||
First, the class must implement `getData`, in order to retrieve the data from the custom widget in a serialized form. As an example from the mind map implementation:
|
||||
|
||||
```plain
|
||||
```
|
||||
async getData() {
|
||||
const mind = this.mind;
|
||||
if (!mind) {
|
||||
@ -20,7 +20,7 @@ Here the content is a string containing a JSON. It is also possible to provide a
|
||||
|
||||
Then to trigger an update, register a listener within the custom widget that calls the spaced update, for example:
|
||||
|
||||
```plain
|
||||
```
|
||||
mind.bus.addListener("operation", (operation) => {
|
||||
this.spacedUpdate.scheduleUpdate();
|
||||
});
|
||||
|
@ -1,2 +1,2 @@
|
||||
# attachments
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>attachmentId</code></th><td>Text</td><td>Non-null</td><td> </td><td>Unique ID (e.g. <code>qhC1vzU4nwSE</code>)</td></tr><tr><th><code>ownerId</code></th><td>Text</td><td>Non-null</td><td> </td><td>The unique ID of a row in <a class="reference-link" href="notes.md">notes</a>.</td></tr><tr><th><code>role</code></th><td>Text</td><td>Non-null</td><td> </td><td>The role of the attachment: <code>image</code> for images that are attached to a note.</td></tr><tr><th><code>mime</code></th><td>Text</td><td>Non-null</td><td> </td><td>The MIME type of the attachment (e.g. <code>image/png</code>)</td></tr><tr><th><code>title</code></th><td>Text</td><td>Non-null</td><td> </td><td>The title of the attachment.</td></tr><tr><th><code>isProtected</code></th><td>Integer</td><td>Non-null</td><td>0</td><td><code>1</code> if the entity is <a href="../Protected%20entities.md">protected</a>, <code>0</code> otherwise.</td></tr><tr><th><code>position</code></th><td>Integer</td><td>Non-null</td><td>0</td><td>Not sure where the position is relevant for attachments (saw it with values of 10 and 0).</td></tr><tr><th><code>blobId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>The corresponding <code>blobId</code> from the <a class="reference-link" href="blobs.md">blobs</a> table.</td></tr><tr><th><code>dateModified</code></th><td>Text</td><td>Non-null</td><td> </td><td>Localized modification date (e.g. <code>2023-11-08 18:43:44.204+0200</code>)</td></tr><tr><th><code>utcDateModified</code></th><td>Text</td><td>Non-null</td><td> </td><td>Modification date in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>)</td></tr><tr><th><code>utcDateScheduledForErasure</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td> </td></tr><tr><th><code>isDeleted</code></th><td>Integer</td><td>Non-null</td><td> </td><td><code>1</code> if the entity is <a href="../Deleted%20notes.md">deleted</a>, <code>0</code> otherwise.</td></tr><tr><th><code>deleteId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td> </td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Column Name</th><th>Data Type</th><th>Nullity</th><th>Default value</th><th>Description</th></tr></thead><tbody><tr><th><code>attachmentId</code></th><td>Text</td><td>Non-null</td><td> </td><td>Unique ID (e.g. <code>qhC1vzU4nwSE</code>)</td></tr><tr><th><code>ownerId</code></th><td>Text</td><td>Non-null</td><td> </td><td>The unique ID of a row in <a class="reference-link" href="notes.md">notes</a>.</td></tr><tr><th><code>role</code></th><td>Text</td><td>Non-null</td><td> </td><td>The role of the attachment: <code>image</code> for images that are attached to a note.</td></tr><tr><th><code>mime</code></th><td>Text</td><td>Non-null</td><td> </td><td>The MIME type of the attachment (e.g. <code>image/png</code>)</td></tr><tr><th><code>title</code></th><td>Text</td><td>Non-null</td><td> </td><td>The title of the attachment.</td></tr><tr><th><code>isProtected</code></th><td>Integer</td><td>Non-null</td><td>0</td><td><code>1</code> if the entity is <a href="../Protected%20entities.md">protected</a>, <code>0</code> otherwise.</td></tr><tr><th><code>position</code></th><td>Integer</td><td>Non-null</td><td>0</td><td>Not sure where the position is relevant for attachments (saw it with values of 10 and 0).</td></tr><tr><th><code>blobId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td>The corresponding <code>blobId</code> from the <a class="reference-link" href="blobs.md">blobs</a> table.</td></tr><tr><th><code>dateModified</code></th><td>Text</td><td>Non-null</td><td> </td><td>Localized modification date (e.g. <code>2023-11-08 18:43:44.204+0200</code>)</td></tr><tr><th><code>utcDateModified</code></th><td>Text</td><td>Non-null</td><td> </td><td>Modification date in UTC format (e.g. <code>2023-11-08 16:43:44.204Z</code>)</td></tr><tr><th><code>utcDateScheduledForErasure</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td> </td></tr><tr><th><code>isDeleted</code></th><td>Integer</td><td>Non-null</td><td> </td><td><code>1</code> if the entity is <a href="../Deleted%20notes.md">deleted</a>, <code>0</code> otherwise.</td></tr><tr><th><code>deleteId</code></th><td>Text</td><td>Nullable</td><td><code>null</code></td><td> </td></tr></tbody></table></figure>
|
@ -11,7 +11,7 @@ After making the necessary modifications, simply export the “Trilium Demo” n
|
||||
|
||||
## Testing the changes
|
||||
|
||||
```plain
|
||||
```
|
||||
rm -r data
|
||||
npm run start-server
|
||||
```
|
||||
|
@ -1,18 +1,18 @@
|
||||
# Docker
|
||||
To run a Docker build:
|
||||
|
||||
```plain
|
||||
```
|
||||
./bin/builder-docker.sh
|
||||
```
|
||||
|
||||
To run the built Docker image:
|
||||
|
||||
```plain
|
||||
```
|
||||
sudo docker run -p 8081:8080 triliumnext/notes:v0.90.6-beta
|
||||
```
|
||||
|
||||
To enter a shell in the Docker container:
|
||||
|
||||
```plain
|
||||
```
|
||||
sudo docker run -it --entrypoint=/bin/sh zadam/trilium:0.63-latest
|
||||
```
|
@ -1,6 +1,6 @@
|
||||
# Adaptive icon
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col></colgroup><tbody><tr><th>Before</th><td><figure class="image"><img src="1_Adaptive icon_image.png"></figure></td></tr><tr><th>After</th><td><figure class="image"><img src="6_Adaptive icon_image.png"></figure></td></tr><tr><th>With new scale</th><td><figure class="image"><img src="4_Adaptive icon_image.png"></figure></td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col></colgroup><tbody><tr><th>Before</th><td><figure class="image"><img src="1_Adaptive icon_image.png"></figure></td></tr><tr><th>After</th><td><figure class="image"><img src="6_Adaptive icon_image.png"></figure></td></tr><tr><th>With new scale</th><td><figure class="image"><img src="4_Adaptive icon_image.png"></figure></td></tr></tbody></table></figure>
|
||||
|
||||
## Scale
|
||||
|
||||
<figure class="table" style="width:300px"><table><tbody><tr><th>0.9</th><td style="background-color:hsl(0, 0%, 90%)"><figure class="image"><img src="2_Adaptive icon_image.png"></figure></td></tr><tr><th>0.85</th><td style="background-color:hsl(0, 0%, 90%)"><figure class="image"><img src="5_Adaptive icon_image.png"></figure></td></tr><tr><th>0.8</th><td style="background-color:hsl(0, 0%, 90%)"><figure class="image"><img src="Adaptive icon_image.png"></figure></td></tr><tr><th>0.75</th><td style="background-color:hsl(0, 0%, 90%)"><figure class="image"><img src="3_Adaptive icon_image.png"></figure></td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:300px;"><table><tbody><tr><th>0.9</th><td style="background-color:hsl(0, 0%, 90%)"><figure class="image"><img src="2_Adaptive icon_image.png"></figure></td></tr><tr><th>0.85</th><td style="background-color:hsl(0, 0%, 90%);"><figure class="image"><img src="5_Adaptive icon_image.png"></figure></td></tr><tr><th>0.8</th><td style="background-color:hsl(0, 0%, 90%);"><figure class="image"><img src="Adaptive icon_image.png"></figure></td></tr><tr><th>0.75</th><td style="background-color:hsl(0, 0%, 90%);"><figure class="image"><img src="3_Adaptive icon_image.png"></figure></td></tr></tbody></table></figure>
|
@ -7,14 +7,14 @@ In the screenshot, the icon is around 650px whereas the closest image we have is
|
||||
|
||||
Before:
|
||||
|
||||
```plain
|
||||
```
|
||||
File: ../images/app-icons/mac/icon.icns
|
||||
ic09: 62069 bytes, png: 512x512
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```plain
|
||||
```
|
||||
File: ../images/app-icons/mac/icon.icns
|
||||
icp4: 1140 bytes, png: 16x16
|
||||
icp5: 1868 bytes, png: 32x32
|
||||
|
@ -65,7 +65,7 @@ where `msgid` is the key of the message being translated.
|
||||
|
||||
In the translation, enclose the variables with `{{` and `}}`:
|
||||
|
||||
```plain
|
||||
```
|
||||
{
|
||||
"key": "{{what}} is {{how}}"
|
||||
}
|
||||
@ -73,7 +73,7 @@ In the translation, enclose the variables with `{{` and `}}`:
|
||||
|
||||
Then pass the arguments when reading the translation:
|
||||
|
||||
```plain
|
||||
```
|
||||
t('key', { what: 'i18next', how: 'great' })
|
||||
```
|
||||
|
||||
|
@ -11,7 +11,7 @@ However, a core difference is that Electron watches `dist/src/public` instead of
|
||||
|
||||
To ameliorate that, a separate watch script has been implemented which automatically copies files from `src/public` to `dist/src/public` whenever a change is detected. To run it:
|
||||
|
||||
```plain
|
||||
```
|
||||
npm run
|
||||
```
|
||||
|
||||
|
@ -3,7 +3,7 @@ The note type is defined by the `type` column in <a class="reference-link" href
|
||||
|
||||
Possible types:
|
||||
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Note Type</th><th><code>type</code> value</th><th>Corresponding MIME type</th><th>Content of the note's blob</th><th>Relevant attributes</th></tr></thead><tbody><tr><th>Text</th><td><code>text</code></td><td> </td><td>The HTML of the note.</td><td> </td></tr><tr><th><a href="https://github.com/zadam/trilium/wiki/Relation-map">Relation Map </a></th><td><code>relationMap</code></td><td><code>application/json</code></td><td><p>A JSON describing the note:</p><pre><code class="language-text-plain">{
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Note Type</th><th><code>type</code> value</th><th>Corresponding MIME type</th><th>Content of the note's blob</th><th>Relevant attributes</th></tr></thead><tbody><tr><th>Text</th><td><code>text</code></td><td> </td><td>The HTML of the note.</td><td> </td></tr><tr><th><a href="https://github.com/zadam/trilium/wiki/Relation-map">Relation Map </a></th><td><code>relationMap</code></td><td><code>application/json</code></td><td><p>A JSON describing the note:</p><pre><code class="language-text-plain">{
|
||||
"notes": [
|
||||
{
|
||||
"noteId": "gFQDL11KEm9G",
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Check box option
|
||||
In the TPL:
|
||||
|
||||
```html
|
||||
```
|
||||
<div class="options-section">
|
||||
<h4>Background effects</h4>
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Creating a new option
|
||||
1. Go to `options_interface.ts` and add the option to `OptionDefinitions`, specifying its intended data type (boolean, string, number). Note that in the end the option will still be stored as a string, but this aids in type safety across the application.
|
||||
|
||||
2. To add a new option with a set default, go to `options_init.ts` in the server and add a new entry in the `defaultOptions`.
|
||||
|
||||
3. **Make the option adjustable by the client**
|
||||
By default options are not adjustable or visible to the client. To do so, modify `routes/api/options.ts` to add the newly added option to `ALLOWED_OPTIONS`.
|
@ -5,7 +5,7 @@ For example, to create a select:
|
||||
|
||||
First, modify the template (`TPL`), to add the new widget:
|
||||
|
||||
```plain
|
||||
```
|
||||
<div class="col-6">
|
||||
<label>First day of the week</label>
|
||||
<select class="first-day-of-week-select form-control">
|
||||
@ -17,19 +17,19 @@ First, modify the template (`TPL`), to add the new widget:
|
||||
|
||||
Secondly, create a reference to the new element in `doRender()`:
|
||||
|
||||
```plain
|
||||
```
|
||||
this.$firstDayOfWeek = this.$widget.find(".first-day-of-week-select");
|
||||
```
|
||||
|
||||
Then in `optionsLoaded` adjust the value to the one set in the database:
|
||||
|
||||
```plain
|
||||
```
|
||||
this.$firstDayOfWeek.val(options.firstDayOfWeek);
|
||||
```
|
||||
|
||||
To actually update the option, add a listener in `doRender`:
|
||||
|
||||
```plain
|
||||
```
|
||||
this.$firstDayOfWeek.on("change", () => {
|
||||
this.updateOption("firstDayOfWeek", this.$firstDayOfWeek.val());
|
||||
});
|
||||
|
@ -5,7 +5,7 @@ Hard-coded links are present throughout the application, either in dialogs or in
|
||||
|
||||
You can identify these links by searching for:
|
||||
|
||||
```plain
|
||||
```
|
||||
https://triliumnext.github.io/Docs/Wiki/
|
||||
```
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Updating dependencies
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Dependency</th><th>Name in <code>library_loader</code></th><th>Things to check for a basic sanity check</th><th> </th><th>Protected by unit tests</th></tr></thead><tbody><tr><td><code>better-sqlite3</code></td><td> </td><td>See <a class="reference-link" href="Updating%20dependencies/bettersqlite%20binaries.md">bettersqlite binaries</a>.</td><td> </td><td> </td></tr><tr><td><code>jsdom</code></td><td> </td><td><ul><li>Note map</li><li>Clipper</li><li>Note similarity</li></ul></td><td>Protected by typings, should catch any potential changes in API.</td><td>Yes</td></tr><tr><td><code>async-mutex</code></td><td> </td><td><ul><li>Sync</li></ul></td><td> </td><td> </td></tr><tr><td><code>axios</code></td><td> </td><td><ul><li>Can't be directly tested, as it's exposed only via the backend script API.</li></ul></td><td> </td><td> </td></tr><tr><td><code>sax</code></td><td> </td><td><ul><li>EverNote imports</li></ul></td><td> </td><td> </td></tr><tr><td><ul><li><code>ws</code></li><li><code>debounce</code></li></ul></td><td> </td><td><ul><li>Check any action is reported from server to client (e.g. delete a note).</li></ul></td><td> </td><td> </td></tr><tr><td><code>ejs</code></td><td> </td><td><ul><li>Onboarding / first setup</li></ul></td><td> </td><td> </td></tr><tr><td><code>dayjs</code></td><td> </td><td><ul><li>Day notes</li></ul></td><td> </td><td> </td></tr><tr><td><code>semver</code></td><td> </td><td><ul><li>Application should start.</li></ul></td><td> </td><td> </td></tr><tr><td><code>https-proxy-agent</code></td><td> </td><td>???</td><td> </td><td> </td></tr><tr><td><code>sax</code></td><td> </td><td><ul><li>EverNote import</li></ul></td><td> </td><td> </td></tr><tr><td><code>ini</code></td><td> </td><td><ul><li>Affects config, generally if the application starts then it should be OK.</li></ul></td><td> </td><td> </td></tr><tr><td><code>jsplumb</code></td><td><code>RELATION_MAP</code></td><td><ul><li>Relation map note type</li></ul></td><td> </td><td> </td></tr><tr><td><code>jquery.mark.es6</code></td><td><code>MARKJS</code></td><td><ul><li>In search, when highlighting the text that matched.</li><li>In search in HTML, which might not actually be used since it seems to have been replaced by CKEditor's own find & replace dialog.</li></ul></td><td> </td><td> </td></tr><tr><td><code>knockout.js</code></td><td> </td><td><ul><li>Used in rendering the login and main layout of the application.</li></ul></td><td> </td><td> </td></tr><tr><td><code>normalize.min.css</code></td><td> </td><td><ul><li>Used in shared notes.</li></ul></td><td> </td><td> </td></tr><tr><td><code>wheel-zoom.min.js</code></td><td><code>WHEEL_ZOOM</code></td><td><ul><li>When opening a image that is in attachment.</li><li>When opening a stand-alone image note.</li><li>When zooming in a mermaid chart.</li></ul></td><td> </td><td> </td></tr><tr><td><code>fancytree</code></td><td> </td><td><ul><li>The note tree should be fully functional.</li></ul></td><td> </td><td> </td></tr><tr><td><code>bootstrap</code></td><td> </td><td><ul><li>Check mostly the on-boarding pages, when there is no database.</li></ul></td><td> </td><td> </td></tr><tr><td><code>electron-debug</code></td><td> </td><td><ul><li>Run electron using <code>npm run start-electron</code> and check that the debug hotkeys are still working (Ctrl+Shift+I on Windows/Linux, Cmd+Alt+I for dev tools, Cmd/Ctrl+R for reload).</li></ul></td><td> </td><td> </td></tr><tr><td><code>electron-dl</code></td><td> </td><td> </td><td> </td><td> </td></tr><tr><td><code>eslint</code></td><td> </td><td> </td><td> </td><td> </td></tr><tr><td><code>marked</code></td><td> </td><td><ul><li>Importing a markdown note.</li></ul></td><td> </td><td>Yes</td></tr><tr><td><code>force-graph</code></td><td> </td><td><ul><li>Note map</li></ul></td><td> </td><td> </td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Dependency</th><th>Name in <code>library_loader</code></th><th>Things to check for a basic sanity check</th><th> </th><th>Protected by unit tests</th></tr></thead><tbody><tr><td><code>better-sqlite3</code></td><td> </td><td>See <a class="reference-link" href="Updating%20dependencies/bettersqlite%20binaries.md">bettersqlite binaries</a>.</td><td> </td><td> </td></tr><tr><td><code>jsdom</code></td><td> </td><td><ul><li>Note map</li><li>Clipper</li><li>Note similarity</li></ul></td><td>Protected by typings, should catch any potential changes in API.</td><td>Yes</td></tr><tr><td><code>async-mutex</code></td><td> </td><td><ul><li>Sync</li></ul></td><td> </td><td> </td></tr><tr><td><code>axios</code></td><td> </td><td><ul><li>Can't be directly tested, as it's exposed only via the backend script API.</li></ul></td><td> </td><td> </td></tr><tr><td><code>sax</code></td><td> </td><td><ul><li>EverNote imports</li></ul></td><td> </td><td> </td></tr><tr><td><ul><li><code>ws</code></li><li><code>debounce</code></li></ul></td><td> </td><td><ul><li>Check any action is reported from server to client (e.g. delete a note).</li></ul></td><td> </td><td> </td></tr><tr><td><code>ejs</code></td><td> </td><td><ul><li>Onboarding / first setup</li></ul></td><td> </td><td> </td></tr><tr><td><code>dayjs</code></td><td> </td><td><ul><li>Day notes</li></ul></td><td> </td><td> </td></tr><tr><td><code>semver</code></td><td> </td><td><ul><li>Application should start.</li></ul></td><td> </td><td> </td></tr><tr><td><code>https-proxy-agent</code></td><td> </td><td>???</td><td> </td><td> </td></tr><tr><td><code>sax</code></td><td> </td><td><ul><li>EverNote import</li></ul></td><td> </td><td> </td></tr><tr><td><code>ini</code></td><td> </td><td><ul><li>Affects config, generally if the application starts then it should be OK.</li></ul></td><td> </td><td> </td></tr><tr><td><code>jsplumb</code></td><td><code>RELATION_MAP</code></td><td><ul><li>Relation map note type</li></ul></td><td> </td><td> </td></tr><tr><td><code>jquery.mark.es6</code></td><td><code>MARKJS</code></td><td><ul><li>In search, when highlighting the text that matched.</li><li>In search in HTML, which might not actually be used since it seems to have been replaced by CKEditor's own find & replace dialog.</li></ul></td><td> </td><td> </td></tr><tr><td><code>knockout.js</code></td><td> </td><td><ul><li>Used in rendering the login and main layout of the application.</li></ul></td><td> </td><td> </td></tr><tr><td><code>normalize.min.css</code></td><td> </td><td><ul><li>Used in shared notes.</li></ul></td><td> </td><td> </td></tr><tr><td><code>wheel-zoom.min.js</code></td><td><code>WHEEL_ZOOM</code></td><td><ul><li>When opening a image that is in attachment.</li><li>When opening a stand-alone image note.</li><li>When zooming in a mermaid chart.</li></ul></td><td> </td><td> </td></tr><tr><td><code>fancytree</code></td><td> </td><td><ul><li>The note tree should be fully functional.</li></ul></td><td> </td><td> </td></tr><tr><td><code>bootstrap</code></td><td> </td><td><ul><li>Check mostly the on-boarding pages, when there is no database.</li></ul></td><td> </td><td> </td></tr><tr><td><code>electron-debug</code></td><td> </td><td><ul><li>Run electron using <code>npm run start-electron</code> and check that the debug hotkeys are still working (Ctrl+Shift+I on Windows/Linux, Cmd+Alt+I for dev tools, Cmd/Ctrl+R for reload).</li></ul></td><td> </td><td> </td></tr><tr><td><code>electron-dl</code></td><td> </td><td> </td><td> </td><td> </td></tr><tr><td><code>eslint</code></td><td> </td><td> </td><td> </td><td> </td></tr><tr><td><code>marked</code></td><td> </td><td><ul><li>Importing a markdown note.</li></ul></td><td> </td><td>Yes</td></tr><tr><td><code>force-graph</code></td><td> </td><td><ul><li>Note map</li></ul></td><td> </td><td> </td></tr></tbody></table></figure>
|
@ -1,6 +1,8 @@
|
||||
# Node.js, Electron and `better-sqlite3`
|
||||
## Node.js, Electron and `better-sqlite3`
|
||||
|
||||
`better-sqlite3` requires a native module in order to work. In order to ease the installation process, prebuilt binaries are provided by the library developers.
|
||||
|
||||
Trilium Next started with version [8.4.0](https://github.com/WiseLibs/better-sqlite3/releases/tag/v8.4.0) for `better-sqlite3`
|
||||
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col> <col> <col></colgroup><tbody><tr><td><code>better-sqlite3</code> version</td><td>SQLite version</td><td>Node.js prebuilds</td><td>Electron.js prebuilds</td></tr><tr><td>8.4.0</td><td><3.43.0</td><td>v20</td><td>???</td></tr><tr><td>8.5.0</td><td>v20</td><td>v25</td></tr><tr><td>8.5.1</td><td> </td><td>v26</td></tr><tr><td>8.5.2</td><td>v20 (macOS + arm64)</td></tr><tr><td>8.6.0</td><td>3.43.0</td><td> </td></tr><tr><td>8.7.0</td><td>3.43.1</td><td> </td></tr><tr><td>9.0.0</td><td>3.43.2</td><td> </td><td>v27</td></tr><tr><td>9.1.0</td><td>3.44.0</td><td> </td></tr><tr><td>9.1.1</td><td>macOS + Alpine</td></tr><tr><td>9.2.0</td><td>3.44.2</td><td> </td></tr><tr><td>9.2.1 / 9.2.2</td><td> </td><td>v28</td></tr><tr><td>9.3.0</td><td>3.45.0</td><td> </td></tr><tr><td>9.4.0</td><td>3.45.1</td><td> </td></tr><tr><td>9.4.1</td><td>Windows arm, arm64</td></tr><tr><td>9.4.2</td><td> </td><td><v29</td></tr><tr><td>9.4.3</td><td> </td><td><v29</td></tr><tr><td>9.4.4</td><td> </td><td>v29</td></tr><tr><td>9.4.5</td><td>Better prebuilds</td></tr><tr><td>9.5.0</td><td>3.45.2</td><td> </td></tr><tr><td>9.6.0</td><td>3.45.3</td><td> </td><td>v30</td></tr><tr><td>10.0.0</td><td>v22</td></tr><tr><td>10.1.0</td><td>3.46.0</td><td> </td></tr><tr><td>11.0.0</td><td>>21</td></tr><tr><td>11.1.0 (prerelease)</td><td> </td><td> </td><td>v31</td></tr><tr><td>11.1.1</td><td> </td><td> </td></tr><tr><td>11.1.2</td><td> </td><td> </td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col> <col></colgroup><tbody><tr><td><code>better-sqlite3</code> version</td><td>SQLite version</td><td>Node.js prebuilds</td><td>Electron.js prebuilds</td></tr><tr><td>8.4.0</td><td><3.43.0</td><td>v20</td><td>???</td></tr><tr><td>8.5.0</td><td>v20</td><td>v25</td></tr><tr><td>8.5.1</td><td> </td><td>v26</td></tr><tr><td>8.5.2</td><td>v20 (macOS + arm64)</td></tr><tr><td>8.6.0</td><td>3.43.0</td><td> </td></tr><tr><td>8.7.0</td><td>3.43.1</td><td> </td></tr><tr><td>9.0.0</td><td>3.43.2</td><td> </td><td>v27</td></tr><tr><td>9.1.0</td><td>3.44.0</td><td> </td></tr><tr><td>9.1.1</td><td>macOS + Alpine</td></tr><tr><td>9.2.0</td><td>3.44.2</td><td> </td></tr><tr><td>9.2.1 / 9.2.2</td><td> </td><td>v28</td></tr><tr><td>9.3.0</td><td>3.45.0</td><td> </td></tr><tr><td>9.4.0</td><td>3.45.1</td><td> </td></tr><tr><td>9.4.1</td><td>Windows arm, arm64</td></tr><tr><td>9.4.2</td><td> </td><td><v29</td></tr><tr><td>9.4.3</td><td> </td><td><v29</td></tr><tr><td>9.4.4</td><td> </td><td>v29</td></tr><tr><td>9.4.5</td><td>Better prebuilds</td></tr><tr><td>9.5.0</td><td>3.45.2</td><td> </td></tr><tr><td>9.6.0</td><td>3.45.3</td><td> </td><td>v30</td></tr><tr><td>10.0.0</td><td>v22</td></tr><tr><td>10.1.0</td><td>3.46.0</td><td> </td></tr><tr><td>11.0.0</td><td>>21</td></tr><tr><td>11.1.0 (prerelease)</td><td> </td><td> </td><td>v31</td></tr><tr><td>11.1.1</td><td> </td><td> </td></tr><tr><td>11.1.2</td><td> </td><td> </td></tr></tbody></table></figure>
|
@ -1,2 +1,2 @@
|
||||
# Testing compatibility
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col> <col></colgroup><thead><tr><th><code>better-sqlite3</code> version<br><a href="https://github.com/WiseLibs/better-sqlite3/releases">Change log</a></th><th>SQLite version<br><a href="https://www.sqlite.org/changes.html">Change log</a></th><th>Compatibility with upstream Trilium</th></tr></thead><tbody><tr><td>8.4.0</td><td><3.43.0</td><td>Compatible, same version.</td></tr><tr><td>8.6.0</td><td>3.43.0</td><td> </td></tr><tr><td>8.7.0</td><td>3.43.1</td><td> </td></tr><tr><td>9.0.0</td><td>3.43.2</td><td> </td></tr><tr><td>9.1.0 + 9.1.1</td><td>3.44.0</td><td> </td></tr><tr><td>9.2.0 + 9.2.1 + 9.2.2</td><td>3.44.2</td><td> </td></tr><tr><td>9.3.0</td><td>3.45.0</td><td> </td></tr><tr><td>9.4.0, 9.4.1, 9.4.2, 9.4.3, 9.4.4, 9.4.5</td><td>3.45.1</td><td> </td></tr><tr><td>9.5.0</td><td>3.45.2</td><td> </td></tr><tr><td>9.6.0 / 10.0.0</td><td>3.45.3</td><td> </td></tr><tr><td>10.1.0 / 11.0.0 / 11.1.1 / 11.1.2 / 11.2.0 / 11.2.1</td><td>3.46.0</td><td> </td></tr><tr><td>11.3.0</td><td>3.46.1</td><td> </td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col></colgroup><thead><tr><th><code>better-sqlite3</code> version<br><a href="https://github.com/WiseLibs/better-sqlite3/releases">Change log</a></th><th>SQLite version<br><a href="https://www.sqlite.org/changes.html">Change log</a></th><th>Compatibility with upstream Trilium</th></tr></thead><tbody><tr><td>8.4.0</td><td><3.43.0</td><td>Compatible, same version.</td></tr><tr><td>8.6.0</td><td>3.43.0</td><td> </td></tr><tr><td>8.7.0</td><td>3.43.1</td><td> </td></tr><tr><td>9.0.0</td><td>3.43.2</td><td> </td></tr><tr><td>9.1.0 + 9.1.1</td><td>3.44.0</td><td> </td></tr><tr><td>9.2.0 + 9.2.1 + 9.2.2</td><td>3.44.2</td><td> </td></tr><tr><td>9.3.0</td><td>3.45.0</td><td> </td></tr><tr><td>9.4.0, 9.4.1, 9.4.2, 9.4.3, 9.4.4, 9.4.5</td><td>3.45.1</td><td> </td></tr><tr><td>9.5.0</td><td>3.45.2</td><td> </td></tr><tr><td>9.6.0 / 10.0.0</td><td>3.45.3</td><td> </td></tr><tr><td>10.1.0 / 11.0.0 / 11.1.1 / 11.1.2 / 11.2.0 / 11.2.1</td><td>3.46.0</td><td> </td></tr><tr><td>11.3.0</td><td>3.46.1</td><td> </td></tr></tbody></table></figure>
|
@ -7,7 +7,7 @@ Note that Electron and Node.js versions need different versions of these binding
|
||||
|
||||
During development, `npm install` tries to build or reuse prebuilt natives for the current Node.js version. This makes `npm run start-server` work out of the box. Trying to run `npm run start-electron` with these versions generally causes an error such as this:
|
||||
|
||||
```plain
|
||||
```
|
||||
Uncaught Exception:
|
||||
Error: The module '/Users/elian/Projects/Notes/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
|
||||
was compiled against a different Node.js version using
|
||||
|
@ -1,14 +1,14 @@
|
||||
# Server-side imports
|
||||
Trilium Notes allowed the use of Common.js module imports inside backend scripts, such as:
|
||||
|
||||
```plain
|
||||
```
|
||||
const isBetween = require('dayjs/plugin/isBetween')
|
||||
api.dayjs.extend(isBetween)
|
||||
```
|
||||
|
||||
For TriliumNext, the backend has been switched to use ESM which has a slightly more complicated syntax. Instead of `require` we now have `import` but which is asynchronous so it will require an `await`:
|
||||
|
||||
```plain
|
||||
```
|
||||
const isBetween = (await import("dayjs/plugin/isBetween")).default;
|
||||
api.dayjs.extend(isBetween);
|
||||
```
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Widgets
|
||||
To create a basic widget, simply create a code note with type “JS frontend”. Add the `#widget` label in order for it to be loaded at startup.
|
||||
|
||||
```plain
|
||||
```
|
||||
const template = `<div id="my-widget"><button>Click Me!</button></div>`;
|
||||
|
||||
class MyWidget extends api.BasicWidget {
|
||||
@ -28,6 +28,6 @@ module.exports = new MyWidget();
|
||||
|
||||
Reference:
|
||||
|
||||
* [https://trilium.rocks/X7pxYpiu0lgU](https://trilium.rocks/X7pxYpiu0lgU)
|
||||
* [https://github.com/zadam/trilium/wiki/Widget-Basics](https://github.com/zadam/trilium/wiki/Widget-Basics)
|
||||
* [https://trilium.rocks/X7pxYpiu0lgU](https://trilium.rocks/X7pxYpiu0lgU)
|
||||
* [https://github.com/zadam/trilium/wiki/Widget-Basics](https://github.com/zadam/trilium/wiki/Widget-Basics)
|
||||
* [https://github.com/zadam/trilium/wiki/Frontend-Basics](https://github.com/zadam/trilium/wiki/Frontend-Basics)
|
@ -1,7 +1,7 @@
|
||||
# CSS
|
||||
In `doRender()`:
|
||||
|
||||
```plain
|
||||
```
|
||||
this.cssBlock(`#my-widget {
|
||||
position: absolute;
|
||||
bottom: 40px;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* `parentWidget()` must be set to `“rightPane”`.
|
||||
* `widgetTitle()` getter can optionally be overriden, otherwise the widget will be displayed as “Untitled widget”.
|
||||
|
||||
```plain
|
||||
```
|
||||
const template = `<div>Hi</div>`;
|
||||
|
||||
class ToDoListWidget extends api.RightPanelWidget {
|
||||
|
@ -3,7 +3,7 @@ First, make sure <a class="reference-link" href="Environment%20setup.md">Enviro
|
||||
|
||||
## Trigger the build
|
||||
|
||||
```plain
|
||||
```
|
||||
cd packages/ckeditor5-build-trilium
|
||||
yarn build
|
||||
```
|
||||
@ -16,6 +16,6 @@ Go to `packages/ckeditor5-build-balloon-trilium/build` and copy `ckeditor.js` an
|
||||
|
||||
An example shell command to copy it:
|
||||
|
||||
```plain
|
||||
```
|
||||
cp build/ckeditor.* ~/Projects/TriliumNext/Notes/libraries/ckeditor/
|
||||
```
|
@ -3,7 +3,7 @@
|
||||
* Zadam left a TODO in `findandreplaceUI`: `// FIXME: keyboard shortcut doesn't work:` [`https://github.com/ckeditor/ckeditor5/issues/10645`](https://github.com/ckeditor/ckeditor5/issues/10645)
|
||||
* `packages\ckeditor5-build-balloon-block\src\mention_customization.js` introduces note insertion via `@` character.
|
||||
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Affected file</th><th>Affected method</th><th>Changed in</th><th>Reason for change</th></tr></thead><tbody><tr><td><code>packages/ckeditor5-mention/src/mentionui.ts</code></td><td><code>createRegExp()</code></td><td><code>6db05043be24bacf9bd51ea46408232b01a1b232</code> (added back)</td><td>Allows triggering the autocomplete for labels and attributes in the attribute editor.</td></tr><tr><td><code>init()</code></td><td><code>55a63a1934efb9a520fcc2d69f3ce55ac22aca39</code></td><td>Allows dismissing @-mention permanently after pressing ESC, otherwise it would automatically show up as soon as a space was entered.</td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Affected file</th><th>Affected method</th><th>Changed in</th><th>Reason for change</th></tr></thead><tbody><tr><td><code>packages/ckeditor5-mention/src/mentionui.ts</code></td><td><code>createRegExp()</code></td><td><code>6db05043be24bacf9bd51ea46408232b01a1b232</code> (added back)</td><td>Allows triggering the autocomplete for labels and attributes in the attribute editor.</td></tr><tr><td><code>init()</code></td><td><code>55a63a1934efb9a520fcc2d69f3ce55ac22aca39</code></td><td>Allows dismissing @-mention permanently after pressing ESC, otherwise it would automatically show up as soon as a space was entered.</td></tr></tbody></table></figure>
|
||||
|
||||
## Checking the old repo
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
To set up the repository:
|
||||
|
||||
```plain
|
||||
```
|
||||
git clone https://github.com/TriliumNext/trilium-ckeditor5.git
|
||||
```
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Versions and external plugins
|
||||
## External plugins
|
||||
|
||||
<figure class="table" style="width:100%"><table class="ck-table-resized"><colgroup><col> <col> <col></colgroup><tbody><tr><td>trilium-ckeditor5</td><td>43.2.0</td><td> </td></tr><tr><td><code>ckeditor5-math</code></td><td> </td><td>See <a class="reference-link" href="../ckeditor5-math.md">ckeditor5-math</a>.</td></tr><tr><td> </td><td> </td><td> </td></tr></tbody></table></figure>
|
||||
<figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col> <col> <col></colgroup><tbody><tr><td>trilium-ckeditor5</td><td>43.2.0</td><td> </td></tr><tr><td><code>ckeditor5-math</code></td><td> </td><td>See <a class="reference-link" href="../ckeditor5-math.md">ckeditor5-math</a>.</td></tr><tr><td> </td><td> </td><td> </td></tr></tbody></table></figure>
|
@ -3,7 +3,7 @@
|
||||
|
||||
Before starting Playwright, it has to be installed locally via:
|
||||
|
||||
```plain
|
||||
```
|
||||
npx playwright install
|
||||
```
|
||||
|
||||
@ -27,12 +27,12 @@ When asked for a password, the password is `demo1234`.
|
||||
|
||||
After starting the integration test server, to run the Playwright UI, run in the terminal:
|
||||
|
||||
```plain
|
||||
```
|
||||
npx playwright test --ui
|
||||
```
|
||||
|
||||
It is also possible to run the interactive code generator instead:
|
||||
|
||||
```plain
|
||||
```
|
||||
npx playwright codegen
|
||||
```
|
@ -15,7 +15,7 @@ As mentioned previously, the database itself can be edited manually in order to
|
||||
|
||||
In order to do so, run a separate integration test server with:
|
||||
|
||||
```plain
|
||||
```
|
||||
npm run integration-edit-db
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user