Compare commits

...

1116 Commits

Author SHA1 Message Date
perf3ct
5024e27885 feat(client): implement photoswipe at different points 2025-08-16 17:29:25 +00:00
perfectra1n
78c27dbe04 feat(client): create a better image viewing experience 2025-08-14 12:21:58 -07:00
Elian Doran
384a89b0e3 feat(etapi): also save note revision via etapi if needed too (#6602) 2025-08-13 19:45:56 +03:00
Elian Doran
e7fd9371b6 test(etapi): variable shadowing causing spurious error 2025-08-13 19:22:48 +03:00
Elian Doran
aa83429816 feat(logs): cleanup physical log files after 90 days by default (#6609) 2025-08-13 16:12:11 +03:00
Elian Doran
221ab02c24 docs(help): document backend logs retention 2025-08-13 16:10:11 +03:00
Elian Doran
0c4b751e8f Merge branch 'main' into feat/snapshot-etapi-notes-too 2025-08-13 15:17:27 +03:00
Elian Doran
43fd0924a1 feat(log): read from config.ini instead of options 2025-08-13 15:10:19 +03:00
Elian Doran
7a036fc777 fix(log): cyclic dependency to options breaking tests 2025-08-13 14:39:26 +03:00
Elian Doran
54efa6b38c Merge branch 'main' into feat/cleanup-logs 2025-08-13 13:26:52 +03:00
Elian Doran
6e37c9ee5a feat(search): improve search weights and operators (#6536) 2025-08-13 13:10:30 +03:00
Elian Doran
963f4586f3 docs: ✏️ Improve OIDC docs (#6628) 2025-08-13 13:03:37 +03:00
Elian Doran
4d0edebed3 Translations update from Hosted Weblate (#6627) 2025-08-13 12:03:28 +03:00
acwr47
cb39e8d0f8 Translated using Weblate (Japanese)
Currently translated at 72.4% (274 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-13 08:33:02 +00:00
Francis C
a336f472b8 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (1550 of 1550 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hans/
2025-08-13 08:33:01 +00:00
acwr47
0a097e72be Translated using Weblate (Japanese)
Currently translated at 63.7% (241 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-13 08:33:01 +00:00
acwr47
077f10af7b Translated using Weblate (Japanese)
Currently translated at 61.1% (231 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-13 08:33:00 +00:00
acwr47
9317658fc7 Translated using Weblate (Japanese)
Currently translated at 60.8% (230 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-13 08:32:59 +00:00
acwr47
21a13f2124 Translated using Weblate (Japanese)
Currently translated at 8.3% (130 of 1550 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ja/
2025-08-13 08:32:59 +00:00
acwr47
db6658c05f Translated using Weblate (Japanese)
Currently translated at 55.0% (208 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-13 08:32:58 +00:00
acwr47
653af0bc06 Translated using Weblate (Japanese)
Currently translated at 20.6% (78 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-13 08:32:57 +00:00
acwr47
93c5281af7 Translated using Weblate (Japanese)
Currently translated at 20.3% (77 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-13 08:32:57 +00:00
Francis C
ce28fbc968 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 100.0% (1550 of 1550 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hant/
2025-08-13 08:32:56 +00:00
Marcelo Popper Costa
eb41c45711 Translated using Weblate (Portuguese (Brazil))
Currently translated at 22.0% (342 of 1550 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-13 08:32:56 +00:00
Francis C
17ab14e098 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (1550 of 1550 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hans/
2025-08-13 08:32:55 +00:00
Hosted Weblate
a42f7b4ece Update translation files
Updated by "Remove blank strings" add-on in Weblate.

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/
2025-08-13 08:32:54 +00:00
Elian Doran
c7d69fa66b chore(deps): update dependency copy-webpack-plugin to v13.0.1 (#6630) 2025-08-13 11:32:44 +03:00
renovate[bot]
1da5c083ee chore(deps): update dependency copy-webpack-plugin to v13.0.1 2025-08-13 08:13:22 +00:00
Elian Doran
4fb911da40 chore(deps): update dependency vite to v7.1.2 (#6633) 2025-08-13 11:09:38 +03:00
Elian Doran
881417f860 Revert "fix(print): table captions not displayed properly (closes #6483)"
This reverts commit 3e0ef10b25.
2025-08-13 11:06:53 +03:00
renovate[bot]
9748b8bf94 chore(deps): update dependency vite to v7.1.2 2025-08-13 08:01:05 +00:00
Elian Doran
337326da2b fix(deps): update ckeditor monorepo to v46.0.1 (#6635) 2025-08-13 10:58:17 +03:00
Elian Doran
a088134d9b fix(deps): update dependency tsx to v4.20.4 (#6636) 2025-08-13 10:58:07 +03:00
renovate[bot]
e49100f3f4 fix(deps): update dependency tsx to v4.20.4 2025-08-13 07:30:57 +00:00
renovate[bot]
3c638e1574 fix(deps): update ckeditor monorepo to v46.0.1 2025-08-13 07:30:22 +00:00
Elian Doran
9131edf021 chore(deps): update dependency esbuild to v0.25.9 (#6631) 2025-08-13 10:24:19 +03:00
Elian Doran
52a1318475 chore(deps): update svelte monorepo (#6639) 2025-08-13 10:22:30 +03:00
renovate[bot]
5a7483d7c7 chore(deps): update svelte monorepo 2025-08-13 05:32:46 +00:00
renovate[bot]
41f2748829 chore(deps): update dependency esbuild to v0.25.9 2025-08-13 05:29:40 +00:00
Elian Doran
66bd5268ca chore(deps): update typescript-eslint monorepo to v8.39.1 (#6634) 2025-08-13 08:27:52 +03:00
Elian Doran
ebef134af7 chore(deps): update dependency typedoc-plugin-missing-exports to v4.1.0 (#6637) 2025-08-13 08:27:30 +03:00
Elian Doran
1173bf22ab chore(deps): update dependency webdriverio to v9.19.1 (#6638) 2025-08-13 08:26:34 +03:00
Elian Doran
e8f6828168 chore(deps): update dependency @types/tabulator-tables to v6.2.10 (#6629) 2025-08-13 08:26:10 +03:00
Elian Doran
02c9339f9c chore(deps): update actions/checkout action to v5 (#6640) 2025-08-13 08:25:51 +03:00
renovate[bot]
c72bf42684 chore(deps): update actions/checkout action to v5 2025-08-13 01:52:37 +00:00
renovate[bot]
f42eeb7ee8 chore(deps): update dependency webdriverio to v9.19.1 2025-08-13 01:51:53 +00:00
renovate[bot]
3d876121cc chore(deps): update dependency typedoc-plugin-missing-exports to v4.1.0 2025-08-13 01:51:12 +00:00
renovate[bot]
f9bcd7d90a chore(deps): update typescript-eslint monorepo to v8.39.1 2025-08-13 01:49:16 +00:00
renovate[bot]
b3af14fccb chore(deps): update dependency @types/tabulator-tables to v6.2.10 2025-08-13 01:10:44 +00:00
Jin
d224f33913 docs: ✏️ Improve OIDC docs 2025-08-12 22:03:36 +02:00
Elian Doran
3a5f33ba91 Merge remote-tracking branch 'weblate/main' 2025-08-12 22:54:06 +03:00
Elian Doran
e1ae8701b2 feat(client): rename themes 2025-08-12 22:39:03 +03:00
Hosted Weblate
aff5a4d0d5 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/
2025-08-12 19:18:38 +00:00
Hosted Weblate
17467a9c29 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/
2025-08-12 19:18:33 +00:00
acwr47
ebed661863 Translated using Weblate (Japanese)
Currently translated at 15.6% (59 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-12 19:07:14 +00:00
Elian Doran
c2e9f4764b Call to action (switch to Next theme, enable background effects) (#6625) 2025-08-12 22:07:04 +03:00
Elian Doran
7e5b87f00a feat(desktop): enable background effects by default for new users 2025-08-12 22:06:19 +03:00
Elian Doran
70182e863c test: enable background effects in integration DB 2025-08-12 21:41:46 +03:00
Elian Doran
f0d30c4e34 fix(canvas): links not working on desktop (fixes #6606) 2025-08-12 21:31:04 +03:00
Elian Doran
013e7a6aa4 refactor(canvas): use new rendering mechanism 2025-08-12 21:04:57 +03:00
Elian Doran
1b25b18d9e refactor(canvas): use tsx where appropriate 2025-08-12 20:59:45 +03:00
Elian Doran
72ff384187 refactor(call_to_action): clean up 2025-08-12 20:12:06 +03:00
Elian Doran
bac048f60f feat(call_to_action): allow dismissal 2025-08-12 19:37:32 +03:00
Elian Doran
d8d0a64134 Translations update from Hosted Weblate (#6624) 2025-08-12 19:15:08 +03:00
Elian Doran
b2db87db4e chore(call-to-action): add IDs for each call to action 2025-08-12 19:05:33 +03:00
Elian Doran
1baaee582e refactor(call-to-action): split into separate file & add translations 2025-08-12 18:42:55 +03:00
nejcmenard
9212b72351 Translated using Weblate (Slovenian)
Currently translated at 1.3% (5 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/sl/
2025-08-12 17:37:58 +02:00
nejcmenard
24af820477 Translated using Weblate (Slovenian)
Currently translated at 0.3% (5 of 1544 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/sl/
2025-08-12 17:37:58 +02:00
acwr47
6c4c2d22c6 Translated using Weblate (Japanese)
Currently translated at 15.3% (58 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ja/
2025-08-12 17:37:58 +02:00
acwr47
2e9b20be71 Translated using Weblate (Japanese)
Currently translated at 8.4% (130 of 1544 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ja/
2025-08-12 17:37:58 +02:00
Francis C
3216de5d89 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/zh_Hant/
2025-08-12 17:37:57 +02:00
Francis C
4bf7cb8099 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 75.5% (1166 of 1544 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hant/
2025-08-12 17:37:57 +02:00
Elian Doran
4871dbd7ef feat(call_to_action): add actual functionality on action buttons 2025-08-12 17:48:44 +03:00
Elian Doran
e125809fe0 fix(call_to_action): error if no items 2025-08-12 17:42:18 +03:00
Elian Doran
27b80b573f feat(call_to_action): filter call to actions 2025-08-12 17:05:52 +03:00
Elian Doran
38d6ae87b6 feat(call-to-action): add support for multiple actions 2025-08-12 16:35:27 +03:00
Elian Doran
1a7cbc13e0 feat(call-to-action): basic dialog 2025-08-12 15:57:29 +03:00
Elian Doran
8e4691d4a4 fix(calendar): missing locale for Russian 2025-08-12 14:58:39 +03:00
Elian Doran
b371337ed2 Translations update from Hosted Weblate (#6623) 2025-08-12 10:55:28 +03:00
nejcmenard
4d4b76ce39 Added translation using Weblate (Slovenian) 2025-08-12 09:46:43 +02:00
nejcmenard
289d3e9882 Added translation using Weblate (Slovenian) 2025-08-12 09:46:42 +02:00
acwr47
a57eb8f27f Translated using Weblate (Japanese)
Currently translated at 1.4% (22 of 1544 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ja/
2025-08-12 09:46:42 +02:00
Elian Doran
27023f1fd5 only run nightly.yml on TriliumNext/Trilium (#6620) 2025-08-12 09:27:14 +03:00
Elian Doran
20a152993f feat(): Update codemirror-themes and add new Cobalt2 theme (#6621) 2025-08-12 09:26:14 +03:00
Elian Doran
ba7636db75 Translations update from Hosted Weblate (#6622) 2025-08-12 09:08:55 +03:00
Flowerlywind
e3e51a2e1f Translated using Weblate (Vietnamese)
Currently translated at 1.8% (29 of 1544 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/vi/
2025-08-12 07:46:18 +02:00
hulmgulm
93b601fe98 Translated using Weblate (German)
Currently translated at 80.4% (1242 of 1544 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-12 07:46:18 +02:00
hulmgulm
203ebb0e7a Update codemirror-themes and add new Cobalt2 theme 2025-08-12 07:09:14 +02:00
matt wilkie
041c2e5693 Merge branch 'main' into mhw-nightly 2025-08-11 21:11:17 -07:00
matt wilkie
258c0d511e only run nightly.yml on TriliumNext/Trilium
stops nightly CI/CD errors on forks without having to disable CI/CD entirely
2025-08-11 21:07:15 -07:00
Elian Doran
15705553c7 Adds a get/set to bNote to allow getting an Attribute by it's Id, or … (#6596) 2025-08-11 22:43:11 +03:00
Elian Doran
27f023e399 chore(deps): update dependency typedoc to v0.28.10 (#6611) 2025-08-11 22:31:27 +03:00
Elian Doran
0d2242171c fix(deps): update dependency i18next to v25.3.4 (#6612) 2025-08-11 22:30:56 +03:00
Elian Doran
0c62ecda65 Translations update from Hosted Weblate (#6619) 2025-08-11 22:30:32 +03:00
wild
7cd7fec93b Translated using Weblate (Serbian)
Currently translated at 27.8% (435 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/sr/
2025-08-11 19:28:12 +00:00
infaktor
cfab5e6217 Translated using Weblate (German)
Currently translated at 80.8% (1261 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-11 19:28:11 +00:00
Grant Zhu
0c313e8b8f Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hans/
2025-08-11 19:28:10 +00:00
Grip
61366061e6 Translated using Weblate (Italian)
Currently translated at 35.1% (133 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/it/
2025-08-11 19:28:09 +00:00
Grip
b2c0685c09 Translated using Weblate (Italian)
Currently translated at 13.9% (218 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/it/
2025-08-11 19:28:09 +00:00
Elian Doran
e3ee284e91 fix(deps): update fullcalendar monorepo to v6.1.19 (#6613) 2025-08-11 22:27:58 +03:00
Elian Doran
58901855af React modals (#6544) 2025-08-11 22:26:14 +03:00
Elian Doran
c7f8a49c47 docs(readme): wrong link to the latest release 2025-08-11 15:09:26 +03:00
renovate[bot]
10685fe183 fix(deps): update fullcalendar monorepo to v6.1.19 2025-08-11 02:03:23 +00:00
renovate[bot]
9e514fe95e fix(deps): update dependency i18next to v25.3.4 2025-08-11 02:02:51 +00:00
renovate[bot]
f28a319e26 chore(deps): update dependency typedoc to v0.28.10 2025-08-11 02:02:15 +00:00
perf3ct
decfb58142 feat(logs): cleanup physical log files after 90 days by default
asdf
2025-08-11 00:50:40 +00:00
perf3ct
415bbc3b0a feat(docs): also update documentation for search updates 2025-08-10 23:16:37 +00:00
perf3ct
5b669ca287 feat(search): also implement defensive checks for undefined notes 2025-08-10 21:59:20 +00:00
Elian Doran
1700217241 fix(react/dialogs): broken test in cheatsheet 2025-08-10 23:37:05 +03:00
Elian Doran
f00c0d5d73 chore(deps): update dependency @anthropic-ai/sdk to v0.59.0 (#6594) 2025-08-10 23:11:36 +03:00
Elian Doran
64ce0d2911 Translations update from Hosted Weblate (#6603) 2025-08-10 23:01:39 +03:00
Elian Doran
82dce7a0d3 fix(react/dialogs): restore jump to note text 2025-08-10 22:41:20 +03:00
Elian Doran
b94f67aa72 fix(react/dialogs): entering command palette 2025-08-10 21:53:21 +03:00
Elian Doran
1ff77a1464 fix(react/dialogs): jump to note not supporting spaces 2025-08-10 21:07:41 +03:00
Elian Doran
adb0e1e844 chore(react/dialogs): remove unnecessary close translation 2025-08-10 20:39:41 +03:00
Elian Doran
2043a06a48 chore(react/dialogs): remove empty translations 2025-08-10 20:32:08 +03:00
Elian Doran
738ebb66ac Merge remote-tracking branch 'origin/main' into react/modals 2025-08-10 20:28:51 +03:00
Elian Doran
abf1f6c041 fix(react/dialogs): revision list not full height 2025-08-10 20:24:20 +03:00
Flowerlywind
7db0e90506 Translated using Weblate (Vietnamese)
Currently translated at 0.5% (2 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/vi/
2025-08-10 19:07:49 +02:00
Flowerlywind
400f9cf911 Translated using Weblate (Vietnamese)
Currently translated at 1.0% (17 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/vi/
2025-08-10 19:07:48 +02:00
Elian Doran
2d3b99c959 fix(react/dialogs): restore focus after modal is dismissed 2025-08-10 20:06:05 +03:00
Elian Doran
fd1ea05c78 fix(react/dialogs): add link default text not working 2025-08-10 19:51:56 +03:00
Elian Doran
d7c4b8f530 fix(react/dialogs): undelete note not working 2025-08-10 19:19:48 +03:00
Elian Doran
238f358d6a fix(react/dialogs): bring back keyboard navigation for note list 2025-08-10 18:56:37 +03:00
Elian Doran
50afdca150 fix(react/dialogs): autocomplete not reacting to clear 2025-08-10 18:19:39 +03:00
Elian Doran
b5555d94f5 fix(react/dialogs): note autocomplete not restoring note 2025-08-10 18:01:36 +03:00
Elian Doran
3d81633214 fix(react/dialogs): add back selection in revisions list 2025-08-10 17:53:45 +03:00
Elian Doran
5db7997a17 fix(react/dialogs): revisions not refreshing after deleting an item 2025-08-10 17:48:17 +03:00
Elian Doran
71dd428919 fix(react/dialogs): conform dialog not reporting properly 2025-08-10 17:41:31 +03:00
Elian Doran
a20d66a6b5 fix(react/dialogs): some dialogs are not displayed on top 2025-08-10 17:37:48 +03:00
Elian Doran
3caefa5409 refactor(react): use memoization where appropriate 2025-08-10 17:19:39 +03:00
Elian Doran
a6e56be55a refactor(react): move effects outside conditional 2025-08-10 17:15:38 +03:00
Flowerlywind
6d582f09be Added translation using Weblate (Vietnamese) 2025-08-10 15:58:52 +02:00
Flowerlywind
40cd46cd09 Added translation using Weblate (Vietnamese) 2025-08-10 15:58:51 +02:00
renovate[bot]
3cc59149cf chore(deps): update dependency @anthropic-ai/sdk to v0.59.0 2025-08-10 12:44:22 +00:00
Elian Doran
e659266d62 refactor(react): remove use of any 2025-08-10 15:28:52 +03:00
Elian Doran
14e09f5ea0 refactor(react): normalize imports 2025-08-10 15:21:49 +03:00
Elian Doran
11f6462a31 fix(react/dialogs): events triggering even when modal is hidden 2025-08-10 15:11:43 +03:00
Elian Doran
48eebbe2fe refactor(react/dialogs): don't render modals unless they are actually shown 2025-08-10 14:55:41 +03:00
Elian Doran
f7093c035b refactor(react/dialogs): add documentation & enforce some properties 2025-08-10 14:49:58 +03:00
Elian Doran
b25e9cdee6 fix(react/dialogs): delete notes not properly reporting state 2025-08-10 14:46:40 +03:00
Elian Doran
5cd7e4707a fix(react/dialogs): dollar signs in help tooltips 2025-08-10 14:07:54 +03:00
Elian Doran
861374bb87 fix(react/dialogs): bulk actions not working in search notes 2025-08-10 14:06:14 +03:00
Elian Doran
d3519b3059 refactor(react/dialogs): solve client errors 2025-08-10 13:02:17 +03:00
Elian Doran
da1f18c60f refactor(react/dialogs): integrate proper closing of modal 2025-08-10 12:22:11 +03:00
Elian Doran
b7482f2a6a refactor(react/dialogs): use shown everywhere 2025-08-10 11:38:12 +03:00
Elian Doran
fd616cafca fix(deps): update eslint monorepo to v9.33.0 (#6595) 2025-08-10 09:22:13 +03:00
Elian Doran
b262a5181f fix(deps): update dependency mind-elixir to v5.0.5 (#6598) 2025-08-10 09:21:52 +03:00
Elian Doran
adb54a9054 fix(deps): update dependency eslint-linter-browserify to v9.33.0 (#6599) 2025-08-10 09:21:21 +03:00
Elian Doran
5eb05f5550 Translations update from Hosted Weblate (#6600) 2025-08-10 09:20:37 +03:00
perf3ct
2950c5eaa4 feat(etapi): also save note revision via etapi if needed too
asdf
2025-08-10 05:06:48 +00:00
infaktor
16fd67c070 Translated using Weblate (German)
Currently translated at 69.0% (261 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/de/
2025-08-10 05:38:12 +02:00
Marcelo Nolasco
9e3559f97c Translated using Weblate (Portuguese (Brazil))
Currently translated at 23.2% (363 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-10 05:38:12 +02:00
infaktor
83eea30ea0 Translated using Weblate (German)
Currently translated at 80.8% (1261 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-10 05:38:11 +02:00
renovate[bot]
6ceccf1c7a fix(deps): update dependency eslint-linter-browserify to v9.33.0 2025-08-10 01:33:44 +00:00
renovate[bot]
31e1c4c712 fix(deps): update dependency mind-elixir to v5.0.5 2025-08-10 01:32:47 +00:00
Elian Doran
fa97ec6c72 refactor(react/dialogs): integrate self-triggering modal in more dialogs 2025-08-10 00:32:26 +03:00
Elian Doran
cd5467bf5c refactor(react/bulk_actions): set up way to self-enable modal 2025-08-09 23:12:27 +03:00
Elian Doran
899f85f4e7 chore(react/bulk_actions): clean up 2025-08-09 20:37:45 +03:00
Elian Doran
7c79fbefa6 feat(react/bulk_actions): port execute script 2025-08-09 20:34:33 +03:00
Elian Doran
18c6fe7ebd feat(react/bulk_actions): port update relation target 2025-08-09 20:26:21 +03:00
Elian Doran
6f6643d758 feat(react/bulk_actions): port rename relation 2025-08-09 20:09:27 +03:00
Elian Doran
356adebbce feat(react/bulk_actions): improve delete relation 2025-08-09 20:01:48 +03:00
Elian Doran
5c8e4fd6fd feat(react/bulk_actions): improve note auto complete handling 2025-08-09 19:49:32 +03:00
Elian Doran
5be9bb47a7 feat(react/bulk_actions): port add relation 2025-08-09 19:41:49 +03:00
Elian Doran
60c5dc525b feat(react/bulk_actions): port rename note 2025-08-09 19:30:35 +03:00
Elian Doran
abfffcec07 feat(react/bulk_actions): clear autocomplete selection 2025-08-09 19:10:40 +03:00
Elian Doran
09b12052f0 feat(react/bulk_actions): port move note 2025-08-09 18:45:39 +03:00
Elian Doran
78bb0ab016 Added zen mode to mobile layout (#6584) 2025-08-09 18:00:03 +03:00
Papierkorb2292
4cd4c2f607 Apply suggestions from code review
Use `mobile` class on body to determine the style of `CloseZenButton` instead of an extra class

Co-authored-by: Elian Doran <contact@eliandoran.me>
2025-08-09 16:31:56 +02:00
Elian Doran
f95b5d6f14 feat(react/bulk_actions): port delete revisions 2025-08-09 16:55:51 +03:00
Elian Doran
4a53be1e33 feat(react/bulk_actions): port delete note 2025-08-09 16:47:05 +03:00
Elian Doran
cbbe845d7b fix: remove unnecessary idea directory (#6554) 2025-08-09 13:37:41 +03:00
Elian Doran
b2b52e92a4 Added Simple Update/Autoupdate Script (#6568) 2025-08-09 13:35:39 +03:00
renovate[bot]
15a97a4675 fix(deps): update eslint monorepo to v9.33.0 2025-08-09 10:31:41 +00:00
Elian Doran
a01f25ec12 chore(deps): update dependency @sveltejs/vite-plugin-svelte to v6.1.1 (#6590) 2025-08-09 13:31:16 +03:00
Elian Doran
2f175765ec chore(deps): update dependency lint-staged to v16.1.5 (#6592) 2025-08-09 13:31:00 +03:00
Elian Doran
6a7ae72b1b chore(deps): update dependency tmp to v0.2.5 (#6593) 2025-08-09 13:30:31 +03:00
Elian Doran
e396bb1641 chore(deps): update dependency @types/node to v22.17.1 (#6591) 2025-08-09 13:30:10 +03:00
Elian Doran
baedac4746 chore(deps): update dependency @stylistic/eslint-plugin to v5.2.3 (#6589) 2025-08-09 13:28:05 +03:00
Elian Doran
268ef626ca chore(deps): update dependency @eslint/compat to v1.3.2 (#6588) 2025-08-09 13:27:37 +03:00
Elian Doran
40c7ad4b46 fix(react/bulk_actions): delete button not working 2025-08-09 10:12:26 +03:00
Elian Doran
54f9ce87f9 feat(react/bulk_actions): port delete/rename label 2025-08-09 10:04:58 +03:00
Elian Doran
12b8a70e5c feat(react/bulk_actions): port update label value 2025-08-09 09:28:48 +03:00
Elian Doran
acf204d0e3 fix(react/bulk_actions): spaced update triggering too fast 2025-08-09 09:15:54 +03:00
Geekswordsman
ee19f9ccaa Adds a get/set to bNote to allow getting an Attribute by it's Id, or setting an Attribute's value by it's Id 2025-08-08 21:47:20 -04:00
renovate[bot]
34c0cf33b9 chore(deps): update dependency tmp to v0.2.5 2025-08-09 00:41:34 +00:00
renovate[bot]
34ec624e46 chore(deps): update dependency lint-staged to v16.1.5 2025-08-09 00:40:50 +00:00
renovate[bot]
056d3f9f36 chore(deps): update dependency @types/node to v22.17.1 2025-08-09 00:40:21 +00:00
renovate[bot]
040673af0b chore(deps): update dependency @sveltejs/vite-plugin-svelte to v6.1.1 2025-08-09 00:39:45 +00:00
renovate[bot]
48fb0c5e21 chore(deps): update dependency @stylistic/eslint-plugin to v5.2.3 2025-08-09 00:39:01 +00:00
renovate[bot]
4c1a55708f chore(deps): update dependency @eslint/compat to v1.3.2 2025-08-09 00:38:56 +00:00
Elian Doran
6e1951b356 feat(react/bulk_actions): port add_label 2025-08-08 23:23:07 +03:00
Elian Doran
3dd6b05d2e fix(react/dialog): react to adding new bulk actions 2025-08-08 22:01:30 +03:00
Elian Doran
05f1ae01f3 Merge remote-tracking branch 'origin/main' into react/modals 2025-08-08 21:37:13 +03:00
Elian Doran
3975041798 feat(react): set up hook for reacting to events 2025-08-08 20:08:06 +03:00
serossi
3a29d65777 Merge branch 'TriliumNext:main' into patch-1 2025-08-08 15:29:44 +02:00
Elian Doran
eeeecb3988 chore(deps): update dependency electron to v37.2.6 (#6573) 2025-08-08 13:18:24 +03:00
Elian Doran
28ababcbb9 chore(deps): update dependency vite to v7.1.1 (#6583) 2025-08-08 13:18:17 +03:00
Elian Doran
f382943af3 Translations update from Hosted Weblate (#6585) 2025-08-08 13:17:42 +03:00
renovate[bot]
fa38332a6c chore(deps): update dependency vite to v7.1.1 2025-08-08 09:46:23 +00:00
renovate[bot]
5a58fcde96 chore(deps): update dependency electron to v37.2.6 2025-08-08 09:45:02 +00:00
Doğukan Çağatay
62d048433b Translated using Weblate (Turkish)
Currently translated at 1.6% (26 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/tr/
2025-08-08 09:42:50 +00:00
Doğukan Çağatay
db4ba53449 Added translation using Weblate (Turkish) 2025-08-08 09:42:50 +00:00
Doğukan Çağatay
da20916767 Added translation using Weblate (Turkish) 2025-08-08 09:42:49 +00:00
Marcelo Nolasco
b1e12182ce Translated using Weblate (Portuguese (Brazil))
Currently translated at 22.3% (348 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-08 09:42:48 +00:00
Elian Doran
80b2061935 chore(deps): update dependency stylelint to v16.23.1 (#6582) 2025-08-08 12:42:41 +03:00
Elian Doran
8ce92f8c93 chore(deps): update dependency ollama to v0.5.17 (#6580) 2025-08-08 12:42:32 +03:00
Elian Doran
05cd8cb547 chore(deps): update svelte monorepo (#6575) 2025-08-08 12:42:23 +03:00
Elian Doran
6e7d0bc51b chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.3 (#6574) 2025-08-08 12:42:15 +03:00
renovate[bot]
b9aede23e6 chore(deps): update svelte monorepo 2025-08-08 09:42:12 +00:00
renovate[bot]
1d52988826 chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.3 2025-08-08 09:41:29 +00:00
Elian Doran
ebe29f41f9 chore(deps): update dependency tmp to v0.2.4 [security] (#6572) 2025-08-08 12:40:01 +03:00
Elian Doran
598591a2da chore(deps): update electron-forge monorepo to v7.8.3 (#6564) 2025-08-08 12:39:06 +03:00
Elian Doran
32c2860b68 chore(deps): update dependency lint-staged to v16.1.4 (#6550) 2025-08-08 12:38:43 +03:00
Papierkorb2292
d975790e79 Added zen mode for mobile layout (useful on tablets) 2025-08-08 09:15:01 +02:00
renovate[bot]
3e1f74ae93 chore(deps): update electron-forge monorepo to v7.8.3 2025-08-08 06:51:40 +00:00
renovate[bot]
81a8908b98 chore(deps): update dependency stylelint to v16.23.1 2025-08-08 06:51:11 +00:00
renovate[bot]
892dfe2340 chore(deps): update dependency ollama to v0.5.17 2025-08-08 06:49:34 +00:00
renovate[bot]
fd175eb8a8 chore(deps): update dependency lint-staged to v16.1.4 2025-08-08 06:49:02 +00:00
renovate[bot]
c98f6d96d5 chore(deps): update dependency tmp to v0.2.4 [security] 2025-08-08 06:47:58 +00:00
Elian Doran
35b628e799 refactor(i18n): add type safety for Electron locale IDs 2025-08-08 08:35:02 +03:00
Elian Doran
49b79c016d Translations update from Hosted Weblate (#6579) 2025-08-08 08:11:08 +03:00
serossi
4d28df7a89 Merge branch 'main' into patch-1 2025-08-07 23:31:59 +02:00
Languages add-on
25a9a8a724 Added translation using Weblate (Serbian) 2025-08-07 22:58:31 +02:00
Languages add-on
313a61ec48 Added translation using Weblate (Japanese) 2025-08-07 22:58:29 +02:00
Languages add-on
a2eab03ee2 Added translation using Weblate (Russian) 2025-08-07 22:58:28 +02:00
Languages add-on
a563b1c9a0 Added translation using Weblate (Greek) 2025-08-07 22:58:27 +02:00
Elian Doran
20018b9c21 Adds duplicateSubtree to backend API. (#6577) 2025-08-07 23:57:28 +03:00
Geekswordsman
0a9bd5f6d1 Merge branch 'main' into geek-api-duplicate-subtree 2025-08-07 16:54:46 -04:00
Geekswordsman
911fee0213 Updated documentation for the duplicateSubtree, and removed commented out code per request. 2025-08-07 16:54:21 -04:00
Elian Doran
ffe4b53eee Translations update from Hosted Weblate (#6578) 2025-08-07 23:51:49 +03:00
Antonio Liccardo (TuxmAL)
cd5a68d230 Translated using Weblate (Italian)
Currently translated at 33.0% (125 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/it/
2025-08-07 22:44:23 +02:00
Elian Doran
95a2a69e0a feat(i18n): add Russian 2025-08-07 23:44:11 +03:00
Elian Doran
360b5d6de4 e2e(server): broken test after translations were introduced 2025-08-07 23:34:28 +03:00
Elian Doran
bf50883e40 Translations update from Hosted Weblate (#6569) 2025-08-07 23:17:43 +03:00
Geekswordsman
8e04690568 Adds duplicateSubtree to backend API. 2025-08-07 15:33:43 -04:00
Elian Doran
bd6c690160 chore(react/dialog): improve recent changes 2025-08-07 22:31:51 +03:00
Elian Doran
c0d7278827 refactor(react/dialogs): deduplicate raw HTML component 2025-08-07 22:00:37 +03:00
Elian Doran
f9eb0a20f7 feat(react/dialogs): port bulk actions 2025-08-07 21:58:47 +03:00
Elian Doran
8d27a5aa39 feat(react/dialogs): port import 2025-08-07 19:20:35 +03:00
Elian Doran
90f9416524 feat(react/modals): port export dialog 2025-08-07 18:52:39 +03:00
Kuzma Simonov
ae0af8b9c7 Translated using Weblate (Russian)
Currently translated at 56.8% (887 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-07 06:20:12 +00:00
Eduard Frigola
a03a0f8a75 Translated using Weblate (Catalan)
Currently translated at 18.5% (70 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ca/
2025-08-07 06:20:11 +00:00
Eduard Frigola
f0f27a9065 Translated using Weblate (Catalan)
Currently translated at 8.3% (130 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ca/
2025-08-07 06:20:11 +00:00
Antonio Liccardo (TuxmAL)
181d5ee36a Translated using Weblate (Italian)
Currently translated at 22.4% (85 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/it/
2025-08-07 06:20:10 +00:00
Antonio Liccardo (TuxmAL)
2758a230ac Translated using Weblate (Italian)
Currently translated at 13.7% (214 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/it/
2025-08-07 06:20:10 +00:00
Marcelo Nolasco
a46d32ed75 Translated using Weblate (Portuguese (Brazil))
Currently translated at 17.4% (272 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-07 06:20:09 +00:00
J. Lavoie
b2bcae8b74 Translated using Weblate (French)
Currently translated at 81.6% (1273 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/fr/
2025-08-07 06:20:08 +00:00
Elian Doran
49d662afba feat(ci): add way to reset signing 2025-08-07 09:19:54 +03:00
Elian Doran
a593ce7c40 fix(react/dialog): delete note not working properly 2025-08-06 23:11:53 +03:00
Elian Doran
31fbf2cb57 fix(react/dialogs): port recent_changes 2025-08-06 23:11:31 +03:00
Elian Doran
c0d3027e65 fix(react/dialogs): unnecessary listeners on modal render 2025-08-06 20:54:29 +03:00
Elian Doran
bde270b73f fix(react/dialogs): some type errors 2025-08-06 20:29:19 +03:00
Elian Doran
edd18b53d0 refactor(react/dialogs): solve some type errors 2025-08-06 18:10:02 +03:00
Elian Doran
2ad4b26c9e chore(react/dialogs): reintroduce footer in note revisions 2025-08-06 18:01:26 +03:00
serossi
f39a5c55ba Update Packaged version for Linux.md
Updated the Script for Version check
2025-08-06 16:30:39 +02:00
Elian Doran
0af5feab79 refactor(react/dialogs): deduplicate data types 2025-08-06 17:11:01 +03:00
serossi
68dd54a100 Update Packaged version for Linux.md
Added Autoupdate Script for Server from Github releases
2025-08-06 16:07:27 +02:00
Elian Doran
7a0f148d28 chore(react/dialogs): add back content buttons to note revision 2025-08-06 17:01:32 +03:00
Elian Doran
958b1592f8 chore(react/dialogs): add back rendering in revisions 2025-08-06 16:53:58 +03:00
Elian Doran
7ac0828ae7 feat(react/dialogs): port note revisions 2025-08-06 16:16:30 +03:00
Elian Doran
f7e7b38551 chore(react/dialogs): add back badges for choose note type 2025-08-06 12:13:38 +03:00
Elian Doran
33e3112290 feat(react/dialog): port note_type_chooser 2025-08-06 12:08:17 +03:00
Elian Doran
2a27666c53 Update actions/download-artifact action to v5 (#6567) 2025-08-06 09:36:36 +03:00
Elian Doran
f2d45cb780 Update dependency @anthropic-ai/sdk to v0.58.0 (#6565) 2025-08-06 09:36:01 +03:00
Elian Doran
c4b91c9777 Update dependency fs-extra to v11.3.1 (#6563) 2025-08-06 09:35:50 +03:00
Elian Doran
fa06f56f5d Update dependency openai to v5.12.0 (#6566) 2025-08-06 08:44:06 +03:00
Elian Doran
519b962af3 Merge branch 'main' into renovate/openai-5.x 2025-08-06 08:43:56 +03:00
Elian Doran
31e6ac2349 Update dependency @sveltejs/kit to v2.27.1 (#6562) 2025-08-06 08:43:33 +03:00
renovate[bot]
ed3ba2745f Update actions/download-artifact action to v5 2025-08-06 02:33:21 +00:00
renovate[bot]
f5b7648d6d Update dependency openai to v5.12.0 2025-08-06 02:33:15 +00:00
renovate[bot]
2d537b82f6 Update dependency @anthropic-ai/sdk to v0.58.0 2025-08-06 02:32:25 +00:00
renovate[bot]
073354fe04 Update dependency fs-extra to v11.3.1 2025-08-06 02:31:08 +00:00
renovate[bot]
165d093928 Update dependency @sveltejs/kit to v2.27.1 2025-08-06 02:30:30 +00:00
Elian Doran
e8cf3f4a10 Translations update from Hosted Weblate (#6552) 2025-08-06 00:02:25 +03:00
Elian Doran
2a40d6bb7e feat(react/dialogs): port upload attachments 2025-08-05 23:03:38 +03:00
Elian Doran
f196a78728 feat(react/checkbox): use bootstrap tooltip 2025-08-05 22:34:45 +03:00
Elian Doran
523c7ac273 chore(react/dialogs): improve display of description 2025-08-05 22:11:16 +03:00
Eduard Frigola
c36b00994b Added translation using Weblate (Catalan) 2025-08-05 21:09:05 +02:00
Eduard Frigola
76b856bfe5 Added translation using Weblate (Catalan) 2025-08-05 21:09:04 +02:00
Antonio Liccardo (TuxmAL)
7b084035a3 Translated using Weblate (Italian)
Currently translated at 9.6% (150 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/it/
2025-08-05 21:09:03 +02:00
Vincent
59fbdaa879 Translated using Weblate (French)
Currently translated at 63.7% (241 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/fr/
2025-08-05 21:09:03 +02:00
Elian Doran
ce324586f8 fix(react/dialogs): missing autocomplete opts 2025-08-05 21:15:02 +03:00
Elian Doran
35bd210062 fix(react/dialogs): recent notes not triggered in autocomplete 2025-08-05 21:15:02 +03:00
Elian Doran
0cfe3351bb feat(react/dialogs): port include_note 2025-08-05 21:15:02 +03:00
Elian Doran
7202f47716 feat(react/dialogs): port cheatsheet 2025-08-05 21:15:02 +03:00
Elian Doran
bde4545afc feat(react/dialogs): port prompt 2025-08-05 21:15:02 +03:00
Elian Doran
b3c81ce5f2 feat(react/dialogs): port password_not_set 2025-08-05 21:15:02 +03:00
Elian Doran
02b0d1fb5e refactor(react/dialogs): separate alert component 2025-08-05 21:15:02 +03:00
Elian Doran
87d9ea06f3 feat(react/dialogs): port delete_notes 2025-08-05 21:15:02 +03:00
Adorian Doran
a4e6a964c9 feat(react/dialogs): fix broken class name 2025-08-05 20:00:39 +03:00
Elian Doran
79c5d479fc feat(react/dialogs): port incorrect_cpu_arch 2025-08-05 15:39:49 +03:00
Elian Doran
8f0a9f91c1 feat(react/dialogs): port the rest of confirm 2025-08-05 15:13:09 +03:00
Elian Doran
93fae9cc8c feat(react/dialogs): port confirm dialog partially 2025-08-05 14:25:21 +03:00
Aris Kallergis
1046321117 Translated using Weblate (Greek)
Currently translated at 0.7% (11 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/el/
2025-08-05 13:22:12 +02:00
Antonio Liccardo (TuxmAL)
00fc92764b Translated using Weblate (Italian)
Currently translated at 7.1% (111 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/it/
2025-08-05 13:22:12 +02:00
Aris Kallergis
dea8bc307e Added translation using Weblate (Greek) 2025-08-05 11:11:45 +02:00
Kuzma Simonov
18a4fbaa4b Translated using Weblate (Russian)
Currently translated at 53.7% (838 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-05 11:11:44 +02:00
Hosted Weblate
3efc4b13d5 Update translation files
Updated by "Remove blank strings" add-on in Weblate.

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/
2025-08-05 07:41:24 +02:00
Kuzma Simonov
952456a69c Translated using Weblate (Russian)
Currently translated at 53.6% (837 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-05 07:41:24 +02:00
Marcelo Nolasco
bde8e17fe6 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/pt_BR/
2025-08-05 07:41:24 +02:00
Grant Zhu
9023ba1d0a Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/zh_Hans/
2025-08-05 07:41:24 +02:00
Marcelo Nolasco
61f9a86685 Translated using Weblate (Portuguese (Brazil))
Currently translated at 11.7% (184 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-05 07:41:24 +02:00
Grant Zhu
5520cfed5d Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hans/
2025-08-05 07:41:24 +02:00
Antonio Liccardo (TuxmAL)
43df984732 Translated using Weblate (Italian)
Currently translated at 3.1% (49 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/it/
2025-08-05 07:41:24 +02:00
wild
3f398c1a00 Translated using Weblate (Serbian)
Currently translated at 27.8% (435 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/sr/
2025-08-05 07:41:24 +02:00
Antonio Liccardo (TuxmAL)
ad35e3b48f Added translation using Weblate (Italian) 2025-08-05 07:41:24 +02:00
Antonio Liccardo (TuxmAL)
73ee44e177 Added translation using Weblate (Italian) 2025-08-05 07:41:23 +02:00
Hosted Weblate
18414cd155 Update translation files
Updated by "Remove blank strings" add-on in Weblate.

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/
2025-08-05 07:41:23 +02:00
Kuzma Simonov
652d78ac68 Translated using Weblate (Russian)
Currently translated at 36.7% (573 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-05 07:41:23 +02:00
wild
9a3ab05d73 Translated using Weblate (Serbian)
Currently translated at 22.4% (350 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/sr/
2025-08-05 07:41:23 +02:00
Kuzma Simonov
fe238b8afd Translated using Weblate (Russian)
Currently translated at 2.3% (36 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-05 07:41:23 +02:00
Kuzma Simonov
94492c7535 Added translation using Weblate (Russian) 2025-08-05 07:41:23 +02:00
Hosted Weblate
47caf970a1 Update translation files
Updated by "Remove blank strings" add-on in Weblate.

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/
2025-08-05 07:41:23 +02:00
Marcelo Nolasco
3e75ab39c2 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 43.3% (164 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/zh_Hant/
2025-08-05 07:41:23 +02:00
Marcelo Nolasco
72aacdbf6f Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/pt_BR/
2025-08-05 07:41:23 +02:00
Marcelo Nolasco
5461dafe02 Translated using Weblate (Portuguese (Brazil))
Currently translated at 5.5% (87 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-05 07:41:23 +02:00
repilac
30f9f66b8b Translated using Weblate (Japanese)
Currently translated at 0.8% (13 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ja/
2025-08-05 07:41:23 +02:00
Marcelo Nolasco
19de803142 Translated using Weblate (Portuguese (Brazil))
Currently translated at 75.3% (285 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/pt_BR/
2025-08-05 07:41:23 +02:00
Marcelo Nolasco
11b247fe07 Translated using Weblate (Portuguese (Brazil))
Currently translated at 3.8% (60 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-05 07:41:23 +02:00
Elian Doran
faa40494d8 chore(deps): update typescript-eslint monorepo to v8.39.0 (#6560) 2025-08-05 08:41:14 +03:00
Elian Doran
796802aea0 chore(deps): update node.js to v22.18.0 (#6559) 2025-08-05 08:40:46 +03:00
Elian Doran
06af5cf6d5 chore(deps): update dependency chalk to v5.5.0 (#6558) 2025-08-05 08:40:29 +03:00
Elian Doran
81a99c1e44 fix(deps): update dependency marked to v16.1.2 (#6557) 2025-08-05 08:39:23 +03:00
Elian Doran
1b384f35d2 chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.2 (#6556) 2025-08-05 08:38:56 +03:00
renovate[bot]
c1259f2ea2 chore(deps): update typescript-eslint monorepo to v8.39.0 2025-08-05 02:00:27 +00:00
renovate[bot]
92d9c82d97 chore(deps): update node.js to v22.18.0 2025-08-05 01:58:57 +00:00
renovate[bot]
064f0ef921 chore(deps): update dependency chalk to v5.5.0 2025-08-05 01:58:52 +00:00
renovate[bot]
e9a9b462d4 fix(deps): update dependency marked to v16.1.2 2025-08-05 01:57:55 +00:00
renovate[bot]
98888d5f1d chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.2 2025-08-05 01:57:06 +00:00
Elian Doran
134c869b07 feat(react/dialog): port protected session password 2025-08-04 23:22:45 +03:00
Elian Doran
beb0487513 feat(react): port move to 2025-08-04 22:37:31 +03:00
Elian Doran
aa9ffb8f6b feat(react/dialogs): port clone_to 2025-08-04 21:17:35 +03:00
Elian Doran
18eb704b81 feat(react/widgets): set up form group 2025-08-04 20:41:25 +03:00
Elian Doran
83fb62d4df fix(react/dialogs): listener leak in modal 2025-08-04 19:54:59 +03:00
Elian Doran
cb650b70cb fix(react/dialogs): autocomplete not displayed if list is empty 2025-08-04 19:27:53 +03:00
Elian Doran
d5e42318dd feat(dialogs): port jump to note partially 2025-08-04 18:54:56 +03:00
grantzhu
24ed474c8c fix: remove unnecessary idea directory, this will affect other developers using jetbrains ide from opening this project 2025-08-04 21:24:38 +08:00
Elian Doran
a9c25b4edd chore(react): bring back focus to add_link 2025-08-04 16:05:04 +03:00
Elian Doran
c89737ae7b feat(vscode): integrate i18n with react 2025-08-04 12:59:13 +03:00
Elian Doran
e619a6ef7c feat(react): port add_link 2025-08-04 12:58:42 +03:00
Elian Doran
6a2a096348 chore(deps): update svelte monorepo (#6551) 2025-08-04 10:35:50 +03:00
renovate[bot]
bf34ef2009 chore(deps): update svelte monorepo 2025-08-04 03:00:44 +00:00
perf3ct
583ab8dc92 feat(quick_search): make sure that we rank exact matches higher when merging results with fuzzy search 2025-08-03 21:29:18 +00:00
perf3ct
db1619af31 feat(quick_search): change the results to use the warning accent color? 2025-08-03 21:22:41 +00:00
Elian Doran
9cddb9ac1d fix(docs): fix notes -> trilium for docker install (#6543) 2025-08-04 00:15:09 +03:00
Elian Doran
d72d3db2a0 Translations update from Hosted Weblate (#6540) 2025-08-04 00:09:02 +03:00
perf3ct
22740a6c8d feat(quick_search): add tests for updated fuzzy search progressive fuzzy search functionality 2025-08-03 21:02:56 +00:00
perf3ct
e9409577db feat(quick_search): only "fallback" to fuzzy search, if there aren't that many search results found from user's query 2025-08-03 20:43:16 +00:00
perf3ct
9cef8c8e70 feat(quick_search): try using another color so that matches stand out more? might change back 2025-08-03 20:42:52 +00:00
perf3ct
53bcec602d feat(quick_search): result titles are now aligned, inline with result text 2025-08-03 20:22:30 +00:00
Elian Doran
a62f12b427 feat(react): port info modal 2025-08-03 23:20:32 +03:00
perf3ct
e20816a7ce feat(quick_search): getting closer to how we want the quick search results to look with the spacing... 2025-08-03 19:49:43 +00:00
perf3ct
58535df676 feat(quick_search): within the quick search, allow for "infinite" scrolling of results 2025-08-03 19:49:43 +00:00
perf3ct
057040af06 feat(quick_search): limit the size of the Notes to search through, to 2MB 2025-08-03 19:49:43 +00:00
perf3ct
c603783a44 feat(quick_search): show the "matched" text in the search results, even if "edit distance" (misspelling) occurs 2025-08-03 19:49:43 +00:00
perf3ct
1928356ad5 feat(quick_search): edit distance searching in quick search works 2025-08-03 19:49:43 +00:00
Elian Doran
e53ad2c62a chore(react): reintroduce max width 2025-08-03 21:39:25 +03:00
Elian Doran
bca397e3e4 feat(react): port sort child notes 2025-08-03 21:18:18 +03:00
repilac
14b3bea203 Added translation using Weblate (Japanese) 2025-08-03 20:05:49 +02:00
Aitanuqui
05c26d17d3 Translated using Weblate (Spanish)
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/es/
2025-08-03 20:05:49 +02:00
KeSch
51360d855a Translated using Weblate (German)
Currently translated at 61.6% (233 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/de/
2025-08-03 20:05:48 +02:00
Aitanuqui
ae7d03e3c7 Translated using Weblate (Spanish)
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/es/
2025-08-03 20:05:48 +02:00
Elian Doran
164feaa3ec fix(react): button not working as submit 2025-08-03 20:01:54 +03:00
Elian Doran
4d09fabad8 feat(react): slightly faster about 2025-08-03 20:00:30 +03:00
Jon Fuller
87e1ce64d1 fix(docs): fix notes -> trilium for docker install 2025-08-03 09:55:50 -07:00
Elian Doran
04913394c6 chore(react): clean up 2025-08-03 19:50:39 +03:00
Elian Doran
f8b563704f feat(react): add hlep page to branch prefix 2025-08-03 19:48:44 +03:00
Elian Doran
5d9bd0f6d3 feat(react): port branch prefix 2025-08-03 19:44:15 +03:00
Elian Doran
1229c26098 chore(react): add back Ctrl+Enter for markdown import 2025-08-03 19:06:21 +03:00
Elian Doran
77818d5453 feat(react): port markdown_import partially 2025-08-03 18:06:06 +03:00
liqiuchen1988
f9c7c5637b Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/zh_Hans/
2025-08-03 13:33:38 +00:00
liqiuchen1988
5d55b0b0a8 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 84.6% (1320 of 1559 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hans/
2025-08-03 13:33:37 +00:00
Aitanuqui
b2d7fbbcad Translated using Weblate (Spanish)
Currently translated at 96.8% (366 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/es/
2025-08-03 13:33:37 +00:00
liqiuchen1988
fbc6734e08 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 84.6% (320 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/zh_Hans/
2025-08-03 13:33:36 +00:00
Aitanuqui
a83172390f Translated using Weblate (Spanish)
Currently translated at 100.0% (1559 of 1559 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/es/
2025-08-03 13:33:35 +00:00
Elian Doran
4b1fd5e4a0 Basic React wrapper (#6542) 2025-08-03 16:33:29 +03:00
Elian Doran
51495b282f fix(board): items not displayed recursively 2025-08-03 16:23:18 +03:00
Elian Doran
b645d21fcd refactor(client): deduplicate app info type 2025-08-03 16:22:54 +03:00
Elian Doran
8f99ce7d14 fix(react): type errors 2025-08-03 16:04:19 +03:00
Elian Doran
6eb650bb22 chore(deps): update package lock 2025-08-03 15:30:01 +03:00
Elian Doran
a7f5702221 feat(react): port about dialog 2025-08-03 15:29:57 +03:00
Elian Doran
efeb9b90ca feat(react): basic integration for basic widget & modal 2025-08-03 13:39:23 +03:00
Elian Doran
3361a2e4ab feat(react): set up client to support Preact with JSX 2025-08-03 13:28:40 +03:00
Elian Doran
425ade5212 fix(hidden_subtree): launcher branches created both in visible & available (closes #6537) 2025-08-03 11:12:21 +03:00
Elian Doran
384ab1d1f3 feat(docs): update doc references from triliumnext/notes to triliumnext/trilium (#6535) 2025-08-03 10:48:37 +03:00
Elian Doran
70b1a37285 docs: sync changes to repo URL 2025-08-03 10:48:06 +03:00
Elian Doran
61a878e2a0 chore(deps): update dependency typescript to v5.9.2 (#6526) 2025-08-03 10:15:10 +03:00
Elian Doran
319cb8384c Translations update from Hosted Weblate (#6534) 2025-08-03 10:12:50 +03:00
perfectra1n
2d358342c5 feat(client): try to stylize the quick search even further in the client 2025-08-02 23:44:51 -07:00
renovate[bot]
dd7ee05388 chore(deps): update dependency typescript to v5.9.2 2025-08-03 05:28:24 +00:00
perf3ct
6c79be881d feat(search): allow for search through very large notes 2025-08-03 01:44:55 +00:00
perf3ct
51a8937c64 feat(quick_search): also try to show the "matched" text in quick search results and not just note titles 2025-08-03 00:29:21 +00:00
perf3ct
c436455b32 feat(tests): implement tests for updated fuzzy search operators, and text_utils used in search 2025-08-03 00:16:47 +00:00
perf3ct
f740edae91 fix(docs): revert references that were full URLs to old Notes repo 2025-08-03 00:10:02 +00:00
perf3ct
18f89b979d feat(search): normalize search text (fonts, etc.) 2025-08-02 23:59:45 +00:00
perf3ct
8094259c78 feat(search): implement edit_distances (misspelling tolerances) into fulltext search 2025-08-02 23:59:21 +00:00
perf3ct
b4f503b81e feat(search): implement additional operators (with bounds) for search comparison 2025-08-02 23:59:11 +00:00
perf3ct
4db04519bd feat(search): implement additional weights for search_results, normalize text as well 2025-08-02 23:56:23 +00:00
perf3ct
464c2bdf28 feat(docs): update doc references from triliumnext/notes to triliumnext/trilium 2025-08-02 23:48:39 +00:00
wild
8007bac8b8 Translated using Weblate (Serbian)
Currently translated at 20.5% (320 of 1559 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/sr/
2025-08-03 01:01:53 +02:00
Elian Doran
7a1ec266ad chore(release): prepare for v0.97.2 2025-08-02 23:34:39 +03:00
Elian Doran
42fedaa241 chore(deps): update nx monorepo to v21.3.11 (#6523) 2025-08-02 10:38:29 +03:00
renovate[bot]
4387bd4c6f chore(deps): update nx monorepo to v21.3.11 2025-08-02 07:22:22 +00:00
Elian Doran
51e1367b82 chore(deps): update dependency typescript to v5.9.2 (#6525) 2025-08-02 10:17:05 +03:00
renovate[bot]
8bea3f4422 chore(deps): update dependency typescript to v5.9.2 2025-08-02 07:00:23 +00:00
Elian Doran
0eb2e405ff chore(deps): update node.js to v22.18.0 (#6527) 2025-08-02 09:57:18 +03:00
Elian Doran
5dbd4a765f fix(deps): update dependency @codemirror/lang-markdown to v6.3.4 (#6524) 2025-08-02 09:57:04 +03:00
Elian Doran
f6961c7e06 chore(deps): update dependency typedoc to v0.28.9 (#6522) 2025-08-02 09:56:38 +03:00
Elian Doran
8d3ba90072 chore(deps): update dependency electron to v37.2.5 (#6521) 2025-08-02 09:55:22 +03:00
Elian Doran
3772412d82 chore(deps): update dependency @playwright/test to v1.54.2 (#6520) 2025-08-02 09:55:05 +03:00
Elian Doran
84389f467e chore(deps): update pnpm to v10.14.0 (#6528) 2025-08-02 09:54:42 +03:00
Elian Doran
eb41e0f96f chore(deps): update svelte monorepo (#6529) 2025-08-02 09:53:44 +03:00
renovate[bot]
2d44dff997 chore(deps): update svelte monorepo 2025-08-02 02:29:36 +00:00
renovate[bot]
1483bf3d46 chore(deps): update pnpm to v10.14.0 2025-08-02 02:28:49 +00:00
renovate[bot]
064cf6a3ee chore(deps): update node.js to v22.18.0 2025-08-02 02:28:39 +00:00
renovate[bot]
0c0d5eaa0a fix(deps): update dependency @codemirror/lang-markdown to v6.3.4 2025-08-02 02:27:03 +00:00
renovate[bot]
afecb33b5c chore(deps): update dependency typedoc to v0.28.9 2025-08-02 02:25:23 +00:00
renovate[bot]
fbb1e3a302 chore(deps): update dependency electron to v37.2.5 2025-08-02 02:25:17 +00:00
renovate[bot]
8704350359 chore(deps): update dependency @playwright/test to v1.54.2 2025-08-02 02:24:27 +00:00
Elian Doran
d09e725d98 fix(note_list): copy to clipboard button also opening note 2025-08-01 13:07:58 +03:00
Elian Doran
8be5b149c4 fix(note_list): note tooltip showing up 2025-08-01 13:05:17 +03:00
Elian Doran
faeea6af18 Merge branch 'main' of github.com:TriliumNext/trilium 2025-08-01 00:23:13 +03:00
Elian Doran
3fa5ea1010 docs(readme): mention translations 2025-08-01 00:23:09 +03:00
Elian Doran
6aa31ae125 Translations update from Hosted Weblate (#6516) 2025-08-01 00:13:50 +03:00
wild
27f2e9c286 Translated using Weblate (Serbian)
Currently translated at 9.1% (142 of 1559 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/sr/
2025-07-31 21:05:37 +00:00
Aitanuqui
67cc36fdd2 Translated using Weblate (Spanish)
Currently translated at 89.4% (338 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/es/
2025-07-31 21:05:36 +00:00
Aitanuqui
ef7297e03b Translated using Weblate (Spanish)
Currently translated at 96.4% (1503 of 1559 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/es/
2025-07-31 21:05:35 +00:00
wild
97a5314cdb Added translation using Weblate (Serbian) 2025-07-31 21:05:34 +00:00
Elian Doran
a1195a2856 feat(search): support doc notes (closes #6515) 2025-08-01 00:05:17 +03:00
Elian Doran
81419c6fe3 Translations update from Hosted Weblate (#6514) 2025-07-31 11:52:22 +03:00
Elian Doran
b8da793353 Translated using Weblate (Romanian)
Currently translated at 99.7% (377 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ro/
2025-07-31 10:51:13 +02:00
Adorian Doran
8140fa79cc Translated using Weblate (Romanian)
Currently translated at 99.7% (377 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ro/
2025-07-31 10:51:12 +02:00
Elian Doran
abff4fe67d Translated using Weblate (Romanian)
Currently translated at 100.0% (1559 of 1559 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ro/
2025-07-31 10:51:12 +02:00
Elian Doran
ec8f737eba Translations update from Hosted Weblate (#6513) 2025-07-31 09:22:49 +03:00
Hosted Weblate
cc6688ea00 Update translation files
Updated by "Remove blank strings" add-on in Weblate.

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/
2025-07-31 08:09:52 +02:00
Elian Doran
c448b29be7 chore(deps): update nx monorepo to v21.3.10 (#6511) 2025-07-31 08:04:27 +03:00
Elian Doran
61bde294b3 chore(deps): update dependency openai to v5.11.0 (#6512) 2025-07-31 08:03:35 +03:00
Elian Doran
acab81c61e chore(deps): update dependency eslint-plugin-playwright to v2.2.2 (#6510) 2025-07-31 08:03:20 +03:00
Elian Doran
1dd965973b chore(deps): update dependency @types/tabulator-tables to v6.2.9 (#6509) 2025-07-31 08:03:07 +03:00
renovate[bot]
d61981033f chore(deps): update dependency openai to v5.11.0 2025-07-31 01:17:46 +00:00
renovate[bot]
30197ba7ce chore(deps): update nx monorepo to v21.3.10 2025-07-31 01:17:03 +00:00
renovate[bot]
1b6c957334 chore(deps): update dependency eslint-plugin-playwright to v2.2.2 2025-07-31 01:16:19 +00:00
renovate[bot]
fb7a397bf9 chore(deps): update dependency @types/tabulator-tables to v6.2.9 2025-07-31 01:15:39 +00:00
Elian Doran
133c9c5a7b Remove unmaintained hotkeys dependency (#6507) 2025-07-31 00:02:29 +03:00
Elian Doran
8a587d4d21 chore(client): fix typecheck issues 2025-07-30 23:46:43 +03:00
Elian Doran
29b813fa3b Merge remote-tracking branch 'origin/main' into feature/replace_hotkeys_library 2025-07-30 23:29:16 +03:00
Elian Doran
1dfe27d3df feat(web_view): open externally from note preview 2025-07-30 23:18:05 +03:00
Elian Doran
cda8fc7146 style(next): improve border for pdf notes preview 2025-07-30 23:05:46 +03:00
Elian Doran
acb16f751b style(next): improve border for image notes preview 2025-07-30 23:03:02 +03:00
Elian Doran
a1ac276be5 feat(web_view): hide attribute from attribute preview 2025-07-30 22:58:42 +03:00
Elian Doran
54e3ab5139 fix(command_palette): full screen not working on the browser 2025-07-30 22:50:08 +03:00
Elian Doran
baf341b312 fix(command_palette): find in text not shown 2025-07-30 22:47:11 +03:00
Elian Doran
5b074c2e22 fix(command_palette): some note context-aware commands not working 2025-07-30 22:45:31 +03:00
Elian Doran
11d086ef12 fix(command_palette): text editor-based issues not working 2025-07-30 22:39:37 +03:00
Elian Doran
0e6b10e400 feat(command_palette): active tab-related commands on browser 2025-07-30 22:33:22 +03:00
Elian Doran
0240222998 chore(command_palette): disable two unsupported commands 2025-07-30 19:54:19 +03:00
Elian Doran
7fc739487f chore(command_palette): hide jump to note / command palette 2025-07-30 19:50:07 +03:00
Elian Doran
f6e275709f fix(command_palette): sort child notes not working 2025-07-30 19:47:01 +03:00
Elian Doran
7e01dfd220 fix(sort): refresh when sorting notes via dialog 2025-07-30 19:45:01 +03:00
Elian Doran
d5866a99ec test(hotkeys): add some basic tests 2025-07-30 19:30:27 +03:00
Elian Doran
5289d41b12 fix(hotkeys): shortcuts with number keys not working 2025-07-30 14:43:37 +03:00
Elian Doran
030178cad2 fix(hotkeys): errors on mouse clicks 2025-07-30 14:29:59 +03:00
Elian Doran
5d00630452 refactor(hotkeys): simplify normalization 2025-07-30 14:26:51 +03:00
Elian Doran
eb805bfa2a refactor(hotkeys): remove no longer necessary library 2025-07-30 14:19:02 +03:00
Elian Doran
ee3a8e105e refactor(hotkeys): remove unnecessary initialization code 2025-07-30 14:18:09 +03:00
Elian Doran
97fb273e7f fix(hotkeys): tree not using the right API 2025-07-30 14:15:29 +03:00
Elian Doran
2ef9009384 refactor(hotkeys): use own (rough) implementation 2025-07-30 14:11:41 +03:00
Elian Doran
27c7888628 fix(deps): update dependency @maplibre/maplibre-gl-leaflet to v0.1.3 (#6503) 2025-07-30 11:04:07 +03:00
Elian Doran
b4de37a9f4 chore(deps): update electron-forge monorepo to v7.8.2 (#6501) 2025-07-30 11:03:43 +03:00
Elian Doran
1c5ebb54f8 chore(deps): update nx monorepo to v21.3.9 (#6502) 2025-07-30 11:03:31 +03:00
Elian Doran
f3e69dd6bd Merge branch 'main' of github.com:TriliumNext/trilium 2025-07-30 11:03:17 +03:00
Elian Doran
66364f5ce0 test(server/e2e): add more assertions to try to avoid flaky test 2025-07-30 11:03:12 +03:00
renovate[bot]
f25a1fb865 chore(deps): update electron-forge monorepo to v7.8.2 2025-07-30 07:43:22 +00:00
renovate[bot]
62c5b8b1fc chore(deps): update nx monorepo to v21.3.9 2025-07-30 07:41:02 +00:00
Elian Doran
2b0de37fc0 chore(deps): update dependency @types/express-http-proxy to v1.6.7 (#6497) 2025-07-30 10:38:55 +03:00
Elian Doran
23ef73fe2f chore(deps): update dependency @types/node to v22.17.0 (#6504) 2025-07-30 10:38:23 +03:00
Elian Doran
92ac3ee4ef chore(deps): update dependency stylelint to v16.23.0 (#6505) 2025-07-30 10:36:12 +03:00
Elian Doran
a3ba5ca109 test(server/e2e): flaky test 2025-07-30 10:34:38 +03:00
renovate[bot]
5b4e81cf18 chore(deps): update dependency stylelint to v16.23.0 2025-07-30 06:53:17 +00:00
renovate[bot]
772e6f5ebc chore(deps): update dependency @types/node to v22.17.0 2025-07-30 06:52:25 +00:00
renovate[bot]
60a9428b8b fix(deps): update dependency @maplibre/maplibre-gl-leaflet to v0.1.3 2025-07-30 06:51:34 +00:00
renovate[bot]
a7752a8421 chore(deps): update dependency @types/express-http-proxy to v1.6.7 2025-07-30 06:48:57 +00:00
Elian Doran
aefa2315b7 fix(server/test): yet another cyclic import issue due to becca_loader 2025-07-30 09:19:02 +03:00
Elian Doran
37a79aeeab fix(server/test): non-platform agnostic test 2025-07-30 08:42:51 +03:00
Elian Doran
5bc4bdaeef fix(server/test): problematic cyclic dependency 2025-07-30 08:38:06 +03:00
Elian Doran
5e28df883d fix(server): migration failing due to geomap in protected mode (closes #6489) 2025-07-29 23:26:03 +03:00
Elian Doran
0a57748075 fix(deps): update dependency preact to v10.27.0 (#6500) 2025-07-29 08:49:15 +03:00
Elian Doran
45e3eee642 chore(deps): update dependency svelte to v5.37.1 (#6498) 2025-07-29 08:48:56 +03:00
Elian Doran
d724a80c2a chore(deps): update nx monorepo to v21.3.8 (#6499) 2025-07-29 08:48:31 +03:00
renovate[bot]
5ea8c94d18 fix(deps): update dependency preact to v10.27.0 2025-07-29 01:29:37 +00:00
renovate[bot]
769bc760b3 chore(deps): update nx monorepo to v21.3.8 2025-07-29 01:28:50 +00:00
renovate[bot]
f04f45ea62 chore(deps): update dependency svelte to v5.37.1 2025-07-29 01:28:09 +00:00
Elian Doran
a5cab6a2a2 Command palette (#6491) 2025-07-28 21:20:19 +03:00
Elian Doran
138611beaf chore(client): remove unnecessary log 2025-07-28 21:18:06 +03:00
Elian Doran
e1b608057a chore(deps): update dependency eslint-plugin-playwright to v2.2.1 (#6495) 2025-07-28 20:16:40 +03:00
Elian Doran
fed6d8329f chore(deps): update dependency typedoc to v0.28.8 (#6496) 2025-07-28 20:03:19 +03:00
Elian Doran
9d03d52f28 fix(hidden_subtree): unable to change language 2025-07-28 20:02:46 +03:00
Elian Doran
055e11174d refactor(hidden_subtree): deduplicate restoring title 2025-07-28 19:59:10 +03:00
Elian Doran
8fda2dd7f1 test(client): fix error due to JQuery 2025-07-28 18:58:26 +03:00
renovate[bot]
ea03695c75 chore(deps): update dependency typedoc to v0.28.8 2025-07-28 15:47:13 +00:00
renovate[bot]
17b206fc72 chore(deps): update dependency eslint-plugin-playwright to v2.2.1 2025-07-28 15:47:07 +00:00
Elian Doran
4ec8c5963a docs(guide): document command palette 2025-07-28 18:21:04 +03:00
Elian Doran
ab2d8accf5 chore(command_palette): hide system tray from web 2025-07-28 17:20:02 +03:00
Elian Doran
de8b7e9ebe feat(command_palette): sort commands by name 2025-07-28 17:17:11 +03:00
Elian Doran
18d11523a6 chore(server): add entry point for circular-deps 2025-07-28 15:19:15 +03:00
Elian Doran
7a0ab3c025 feat(command_palette): enforce title names 2025-07-28 15:19:05 +03:00
Elian Doran
3575a7dc93 fix(hidden_subtree): bring back enforcing branches for help 2025-07-28 13:15:12 +03:00
Elian Doran
bb9e7b1c6e fix(hidden_subtree): visible launchers broken due to branch enforcement 2025-07-28 12:20:14 +03:00
Elian Doran
115e9e0202 chore(test): undefined import when running under vitest 2025-07-28 12:16:31 +03:00
Elian Doran
e341de70c0 chore(command_palette): change placeholder 2025-07-28 11:21:18 +03:00
Elian Doran
1d1a0ac4fd fix(command_palette): print command showing modal 2025-07-28 11:15:48 +03:00
Elian Doran
d48470ffb1 Merge remote-tracking branch 'origin/main' into feature/command_palette 2025-07-28 11:12:47 +03:00
Elian Doran
6574ca42a3 chore(deps): update dependency svelte to v5.37.0 (#6492) 2025-07-28 10:52:11 +03:00
renovate[bot]
303ff35a76 chore(deps): update dependency svelte to v5.37.0 2025-07-28 00:38:54 +00:00
Elian Doran
e0850958b0 chore(client): type errors 2025-07-27 23:21:07 +03:00
Elian Doran
13115b9ed1 fix(keyboard_actions): missing keyboard action descriptions 2025-07-27 22:22:17 +03:00
Elian Doran
933a11e9db chore(command_palette): add translations 2025-07-27 22:16:04 +03:00
Elian Doran
6915993a35 feat(command_palette): remove duplicate actions 2025-07-27 22:12:08 +03:00
Elian Doran
237a4e9a74 feat(command_palette): hide electron-only actions on web 2025-07-27 22:05:24 +03:00
Elian Doran
1565a0fd80 feat(command_palette): differentiate tree-based operations 2025-07-27 21:47:30 +03:00
Elian Doran
e8b16287e0 refactor(command_palette): reduce duplication 2025-07-27 21:39:55 +03:00
Elian Doran
c09e124805 fix(command_palette): command title not updated while navigating 2025-07-27 21:36:42 +03:00
Elian Doran
b6f55b0e1a refactor(command_palette): unnecessary icon mapping 2025-07-27 21:18:00 +03:00
Elian Doran
964bc74b83 refactor(command_palette): use declarative command approach 2025-07-27 21:16:23 +03:00
Elian Doran
fa9b142cb7 fix(command_palette): triggering note tree actions 2025-07-27 21:03:31 +03:00
Elian Doran
7e3f412c84 fix(command_palette): missing icon 2025-07-27 20:41:01 +03:00
Elian Doran
82e16a5624 fix(command_palette): not showing after re-entering 2025-07-27 20:31:13 +03:00
Elian Doran
757488a95b feat(command_palette): improve dialog margins 2025-07-27 18:15:54 +03:00
Elian Doran
d7f154cfd1 feat(command_palette): improve layout 2025-07-27 18:11:43 +03:00
Elian Doran
3517715aab feat(command_palette): add icons to all actions 2025-07-27 17:41:00 +03:00
Elian Doran
d10bbdd7a7 feat(settings/keyboard_actions): display friendly name 2025-07-27 17:04:29 +03:00
Elian Doran
c4ec27bb1e chore(keyboard_actions): use translations for friendly names 2025-07-27 17:04:05 +03:00
Elian Doran
0b24553ace feat(keyboard_actions): add friendly names to all actions 2025-07-27 16:50:02 +03:00
Elian Doran
793867269b refactor(command_palette): separate model for keyboard shortcuts 2025-07-27 16:40:48 +03:00
Elian Doran
9508e92676 feat(command_palette): integrate all keyboard actions 2025-07-27 16:32:39 +03:00
Elian Doran
89378eae7b feat(command_palette): improve keyboard shortcut 2025-07-27 16:15:14 +03:00
Elian Doran
ace166a925 feat(command_palette): hide search in full text 2025-07-27 15:59:33 +03:00
Elian Doran
d59d544c0f style(command_palette): improve layout slightly 2025-07-27 15:49:12 +03:00
Elian Doran
37461d0eb3 refactor(command_palette): use CSS for styles 2025-07-27 15:44:47 +03:00
Elian Doran
126152ff63 feat(command_palette): display commands immediately 2025-07-27 15:42:44 +03:00
Elian Doran
60e19de0d1 feat(command_palette): add keyboard shortcut 2025-07-27 15:34:51 +03:00
Elian Doran
3247a9facc feat(command_palette): hide on command execution 2025-07-27 15:30:27 +03:00
Elian Doran
7b114bed26 feat(command_palette): basic implementation 2025-07-27 15:27:13 +03:00
Elian Doran
30ffbc760e Merge branch 'main' of https://github.com/TriliumNext/trilium 2025-07-27 12:17:21 +03:00
Elian Doran
4420913049 fix(export/markdown): superscript and subscript not preserved (closes #4307) 2025-07-27 12:17:13 +03:00
Elian Doran
3762690c5f Merge branch 'main' of github.com:TriliumNext/trilium 2025-07-27 11:04:03 +03:00
Elian Doran
d684ac40d8 fix(forge): nightly failing due to minimatch 2025-07-27 10:55:27 +03:00
Elian Doran
d217379644 chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.1 (#6487) 2025-07-27 09:14:18 +03:00
renovate[bot]
d5f7fa2fe5 chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.1 2025-07-27 01:36:11 +00:00
Elian Doran
3e0ef10b25 fix(print): table captions not displayed properly (closes #6483) 2025-07-26 23:25:04 +03:00
Elian Doran
28f88f2407 chore(deps): update dependency dotenv to v17.2.1 (#6476) 2025-07-26 15:48:30 +03:00
Elian Doran
e525a7a0ff chore(deps): update dependency svelte to v5.36.17 (#6484) 2025-07-26 15:48:12 +03:00
Elian Doran
3415f38e0a fix(deps): update dependency eslint-linter-browserify to v9.32.0 (#6485) 2025-07-26 15:47:54 +03:00
Elian Doran
910c0faade chore(deps): update dependency cross-env to v10 (#6486) 2025-07-26 15:47:41 +03:00
renovate[bot]
4ad1bb5e3a chore(deps): update dependency cross-env to v10 2025-07-26 10:38:57 +00:00
renovate[bot]
97f6f0a945 fix(deps): update dependency eslint-linter-browserify to v9.32.0 2025-07-26 10:38:01 +00:00
renovate[bot]
bc78c17a11 chore(deps): update dependency svelte to v5.36.17 2025-07-26 10:37:05 +00:00
Elian Doran
b8e813f7bd feat(promoted_attributes): better indicate no value 2025-07-26 10:12:46 +03:00
Elian Doran
db3581eb26 feat(promoted_attributes): improve color picker aspect 2025-07-26 09:53:26 +03:00
Elian Doran
d23230df68 feat(promoted_attributes): support removing color 2025-07-26 09:49:32 +03:00
Elian Doran
b29781b614 feat(promoted_attributes): add color type 2025-07-26 09:29:27 +03:00
Elian Doran
7d7c3e7cdb fix(ws): new attachments' title not decrypted (closes #6473) 2025-07-25 23:21:44 +03:00
Elian Doran
cbd8cb80ab chore(deps): update nx monorepo to v21.3.7 (#6479) 2025-07-25 23:20:55 +03:00
renovate[bot]
bfcdc34faf chore(deps): update nx monorepo to v21.3.7 2025-07-25 20:20:42 +00:00
Elian Doran
c728e6047d chore(deps): update dependency jiti to v2.5.1 (#6478) 2025-07-25 23:18:45 +03:00
renovate[bot]
4c53a9ba8c chore(deps): update dependency jiti to v2.5.1 2025-07-25 19:47:38 +00:00
Elian Doran
e10a7da7e3 chore(deps): update dependency @sveltejs/kit to v2.26.1 (#6475) 2025-07-25 22:42:39 +03:00
Elian Doran
5cc431b1bf chore(deps): update dependency dotenv to v17.2.1 (#6477) 2025-07-25 22:42:22 +03:00
Elian Doran
734aa2fcb5 fix(deps): update dependency mind-elixir to v5.0.4 (#6480) 2025-07-25 22:42:06 +03:00
Elian Doran
5e37319d9b fix(deps): update eslint monorepo to v9.32.0 (#6481) 2025-07-25 22:41:56 +03:00
renovate[bot]
2e9eb6e3e9 fix(deps): update eslint monorepo to v9.32.0 2025-07-25 19:13:01 +00:00
renovate[bot]
9ce57b123a fix(deps): update dependency mind-elixir to v5.0.4 2025-07-25 19:11:23 +00:00
renovate[bot]
e793168afa chore(deps): update dependency dotenv to v17.2.1 2025-07-25 19:08:36 +00:00
renovate[bot]
d1513424e7 chore(deps): update dependency dotenv to v17.2.1 2025-07-25 19:07:41 +00:00
renovate[bot]
1436a01dbe chore(deps): update dependency @sveltejs/kit to v2.26.1 2025-07-25 19:06:44 +00:00
Elian Doran
b9b936b92a chore(client): change book type to collection (closes #6471) 2025-07-25 19:09:03 +03:00
Elian Doran
adf14bec31 fix(views/board): unable to scroll vertically 2025-07-25 19:00:12 +03:00
Elian Doran
ca1403ffea docs(guide): creating collections & adding a description 2025-07-25 18:06:40 +03:00
Elian Doran
06672e439e docs(guide): board view 2025-07-25 17:57:34 +03:00
Elian Doran
e851701a9e fix(views/board): unable to click while editing column 2025-07-25 16:29:25 +03:00
Elian Doran
9589164008 fix(views/board): column duplication after batch rename 2025-07-25 16:20:33 +03:00
Elian Doran
a88b067081 refactor(views/board): use in-memory model 2025-07-25 16:17:54 +03:00
Elian Doran
b3777e6900 fix(views/board): column desynchronising due to API management 2025-07-25 16:11:26 +03:00
Elian Doran
d2646e291d chore(views/board): remove unnecessary highlight 2025-07-25 15:16:17 +03:00
Elian Doran
99ab9ee66b chore(views/board): set up context menu on the header 2025-07-25 15:15:10 +03:00
Elian Doran
08678e74e6 refactor(views/board): unnecessary fields 2025-07-25 14:57:51 +03:00
Elian Doran
62de52ab17 refactor(views/board): unnecessary API to manually refresh the board 2025-07-25 14:56:50 +03:00
Elian Doran
d9820d9725 fix(views/board): column not clickable after dragging 2025-07-25 14:54:50 +03:00
Elian Doran
fe8a8eeac9 feat(views/board): react to icon and color changes 2025-07-25 14:42:05 +03:00
Elian Doran
dfeb414aff feat(views/board): reintroduce one-click title edit 2025-07-25 12:00:04 +03:00
Elian Doran
69f12a2916 feat(views/board): drag columns by the title and not by a handle 2025-07-25 11:56:44 +03:00
Elian Doran
2b062e938e chore(views/board): use translations 2025-07-25 11:46:18 +03:00
Elian Doran
e0299bd1ae style(views/board): improve new buttons 2025-07-25 11:42:44 +03:00
Elian Doran
ac2f1b56fe style(views/board): shorter cards and smaller gaps 2025-07-25 11:35:07 +03:00
Elian Doran
06d98f6fcf refactor(views/board): unnecessary imports 2025-07-25 11:31:57 +03:00
Elian Doran
bb660d15b2 style(next): improve excalidraw dropdown fit 2025-07-25 11:06:20 +03:00
Elian Doran
4d73cdefef style(client): fix checkboxes override causing issues for canvas (closes #6463) 2025-07-25 10:08:14 +03:00
Elian Doran
313ba3df80 chore(deps): update dependency vite to v7.0.6 (#6465) 2025-07-25 08:24:18 +03:00
renovate[bot]
15377c32c2 chore(deps): update dependency vite to v7.0.6 2025-07-24 20:42:01 +00:00
Elian Doran
22b52f7c4a Merge branch 'main' of github.com:TriliumNext/trilium 2025-07-24 23:39:48 +03:00
Elian Doran
7055f77c91 docs(guide): document new features for geomap 2025-07-24 23:39:25 +03:00
Elian Doran
051fe67176 feat(views/geo): react to icon changes 2025-07-24 22:46:36 +03:00
Elian Doran
90accfcc48 chore(client): fix type errors 2025-07-24 22:26:29 +03:00
Elian Doran
4f99db0c90 refactor(views/geo): use a different attribute 2025-07-24 22:18:30 +03:00
Elian Doran
aeb356bf54 feat(views/geo): allow displaying scale 2025-07-24 22:14:51 +03:00
Elian Doran
0dffa0f333 feat(book_properties): group dark map styles 2025-07-24 21:54:57 +03:00
Elian Doran
d17f5b8447 feat(book_properties): group map style into vector & raster 2025-07-24 21:49:55 +03:00
Elian Doran
b5a57b3c66 style(book_properties): align label properly 2025-07-24 21:32:02 +03:00
Elian Doran
987a3404a9 chore(deps): update ckeditor5 config packages to v12.1.0 (#6466) 2025-07-24 21:24:43 +03:00
Elian Doran
eddc30769f chore(deps): update svelte monorepo (#6467) 2025-07-24 21:23:49 +03:00
Elian Doran
4d455650ba refactor(views/board): split row/column handling 2025-07-24 21:18:49 +03:00
Elian Doran
e2157aab26 fix(views/board): reordering same column not working 2025-07-24 21:18:49 +03:00
Elian Doran
b277f4bf3f feat(views/board): basic refresh after column change 2025-07-24 21:18:48 +03:00
Elian Doran
4047452b0f feat(views/board): drag works in between columns 2025-07-24 21:18:48 +03:00
Elian Doran
cb37724879 feat(views/board): basic column drag support 2025-07-24 21:18:48 +03:00
renovate[bot]
8890893412 chore(deps): update svelte monorepo 2025-07-24 18:01:27 +00:00
renovate[bot]
d0cbda7c0d chore(deps): update ckeditor5 config packages to v12.1.0 2025-07-24 18:00:32 +00:00
Elian Doran
60e7b9ffb0 feat(views/geo): set default theme 2025-07-24 15:52:01 +03:00
Elian Doran
45457c6f76 feat(views/geo): invert marker label on dark themes 2025-07-24 15:46:11 +03:00
Elian Doran
737f41d92b refactor(views/geo): get rid of empty theme 2025-07-24 15:36:06 +03:00
Elian Doran
180841f364 refactor(views/geo): remove dependency to leaflet in map layer 2025-07-24 15:35:03 +03:00
Elian Doran
bea40d4c2f feat(views/geo): add the rest of the map layers 2025-07-24 15:33:39 +03:00
Elian Doran
5f9a054441 refactor(book_properties): use translations 2025-07-24 15:20:32 +03:00
Elian Doran
f90bf1ce7c feat(views/geo): add combobox to adjust style 2025-07-24 15:14:43 +03:00
Elian Doran
8c4ed2d4da feat(views/geo): support vector maps 2025-07-24 15:07:47 +03:00
Elian Doran
0e590a1bbf chore(views/geo): add versatiles vector styles 2025-07-24 15:07:34 +03:00
Elian Doran
218a096135 chore(nx): update instructions 2025-07-24 13:57:41 +03:00
Elian Doran
8407bce370 chore(package): add output style to server:start 2025-07-24 13:57:23 +03:00
Elian Doran
43229f0b99 chore(deps): update nx monorepo to v21.3.5 (#6455) 2025-07-24 10:53:08 +03:00
renovate[bot]
84fa0002b9 chore(deps): update nx monorepo to v21.3.5 2025-07-24 07:22:18 +00:00
Elian Doran
e79c705b20 chore(deps): update dependency webdriverio to v9.18.4 (#6459) 2025-07-24 10:20:10 +03:00
Elian Doran
894d7ce15d chore(deps): update dependency express-openid-connect to v2.19.2 (#6456) 2025-07-24 10:05:07 +03:00
renovate[bot]
5830880582 chore(deps): update dependency webdriverio to v9.18.4 2025-07-24 06:52:40 +00:00
renovate[bot]
caab0f70ff chore(deps): update dependency express-openid-connect to v2.19.2 2025-07-24 06:51:51 +00:00
Elian Doran
641966fcdd chore(deps): update dependency @ckeditor/ckeditor5-package-tools to v4.0.2 (#6449) 2025-07-24 09:48:34 +03:00
renovate[bot]
24c22e9bbf chore(deps): update dependency @ckeditor/ckeditor5-package-tools to v4.0.2 2025-07-24 06:24:28 +00:00
Elian Doran
795f597bda chore(deps): update dependency jiti to v2.5.0 (#6457) 2025-07-24 09:22:19 +03:00
renovate[bot]
2228663a7e chore(deps): update dependency jiti to v2.5.0 2025-07-24 06:10:37 +00:00
Elian Doran
0c97df357d chore(deps): update dependency eslint-config-prettier to v10.1.8 (#6453) 2025-07-24 09:03:52 +03:00
Elian Doran
19f63f1be0 chore(deps): update dependency esbuild to v0.25.8 (#6452) 2025-07-24 09:03:26 +03:00
Elian Doran
fc000caf73 chore(deps): update svelte monorepo (#6436) 2025-07-24 09:03:08 +03:00
renovate[bot]
78929e0293 chore(deps): update svelte monorepo 2025-07-24 05:49:14 +00:00
renovate[bot]
71e22da987 chore(deps): update dependency esbuild to v0.25.8 2025-07-24 05:45:25 +00:00
renovate[bot]
24e99d9654 chore(deps): update dependency eslint-config-prettier to v10.1.8 2025-07-24 05:39:35 +00:00
Elian Doran
98299da424 chore(deps): update dependency @types/tabulator-tables to v6.2.8 (#6450) 2025-07-24 08:39:04 +03:00
Elian Doran
7014af66b6 chore(deps): update dependency electron to v37.2.4 (#6451) 2025-07-24 08:38:36 +03:00
Elian Doran
659bd90027 chore(deps): update dependency vite to v7.0.5 (#6454) 2025-07-24 08:37:54 +03:00
Elian Doran
146b0c284b chore(deps): update dependency stylelint to v16.22.0 (#6458) 2025-07-24 08:36:59 +03:00
Elian Doran
4a0ac8807f chore(deps): update typescript-eslint monorepo to v8.38.0 (#6460) 2025-07-24 08:36:20 +03:00
renovate[bot]
d67734832e chore(deps): update typescript-eslint monorepo to v8.38.0 2025-07-24 02:16:52 +00:00
renovate[bot]
1673bf026a chore(deps): update dependency stylelint to v16.22.0 2025-07-24 02:14:32 +00:00
renovate[bot]
1f29b000a9 chore(deps): update dependency vite to v7.0.5 2025-07-24 02:10:42 +00:00
renovate[bot]
a6d024123e chore(deps): update dependency electron to v37.2.4 2025-07-24 02:08:10 +00:00
renovate[bot]
fb1a7239ce chore(deps): update dependency @types/tabulator-tables to v6.2.8 2025-07-24 02:07:19 +00:00
Elian Doran
4f71d508cb chore(deps): audit 2025-07-23 22:32:49 +03:00
Elian Doran
2072bd61d1 fix(mermaid): lag during editing (closes #6443) 2025-07-23 22:28:15 +03:00
Elian Doran
6021178b7d feat(hidden_subtree): enforce original title in help 2025-07-23 21:22:58 +03:00
Elian Doran
179b0be2bb chore(deps): update dependency axios to v1.11.0 [security] (#6446) 2025-07-23 21:19:12 +03:00
renovate[bot]
bf2b45dd4a chore(deps): update dependency axios to v1.11.0 [security] 2025-07-23 16:53:39 +00:00
Elian Doran
513561234c chore(deps): update nx monorepo to v21.3.2 (#6438) 2025-07-23 08:57:04 +03:00
renovate[bot]
33da990ae7 chore(deps): update nx monorepo to v21.3.2 2025-07-23 05:43:38 +00:00
Elian Doran
4003946e68 chore(deps): fix pnpm-lock 2025-07-23 08:40:44 +03:00
Elian Doran
21f8d40789 chore(deps): update dependency @stylistic/eslint-plugin to v5.2.2 (#6432) 2025-07-23 08:30:28 +03:00
Elian Doran
d6c698e1d6 chore(deps): update dependency cheerio to v1.1.2 (#6433) 2025-07-23 08:30:04 +03:00
Elian Doran
6c227852ae chore(deps): update dependency openai to v5.10.2 (#6434) 2025-07-23 08:29:50 +03:00
Elian Doran
29cb22c4fd chore(deps): update dependency supertest to v7.1.4 (#6435) 2025-07-23 08:29:32 +03:00
Elian Doran
d040bc9e2d chore(deps): update dependency webdriverio to v9.18.3 (#6437) 2025-07-23 08:29:07 +03:00
Elian Doran
abb92f23a6 fix(deps): update dependency mind-elixir to v5.0.3 (#6439) 2025-07-23 08:28:47 +03:00
Elian Doran
da5c86bb69 chore(deps): update dependency @anthropic-ai/sdk to v0.57.0 (#6440) 2025-07-23 08:28:33 +03:00
Elian Doran
a0d428b12c chore(deps): update dependency express-openid-connect to v2.19.2 (#6441) 2025-07-23 08:28:20 +03:00
Elian Doran
e22fe20e23 chore(deps): update typescript-eslint monorepo to v8.38.0 (#6442) 2025-07-23 08:27:59 +03:00
renovate[bot]
1e6659aff9 chore(deps): update typescript-eslint monorepo to v8.38.0 2025-07-23 02:37:13 +00:00
renovate[bot]
60b32d5b05 chore(deps): update dependency express-openid-connect to v2.19.2 2025-07-23 02:35:35 +00:00
renovate[bot]
e2ee9053a0 chore(deps): update dependency @anthropic-ai/sdk to v0.57.0 2025-07-23 02:34:45 +00:00
renovate[bot]
d2f0422ecc fix(deps): update dependency mind-elixir to v5.0.3 2025-07-23 02:33:49 +00:00
renovate[bot]
bfd97da626 chore(deps): update dependency webdriverio to v9.18.3 2025-07-23 02:32:01 +00:00
renovate[bot]
1fd163f0bb chore(deps): update dependency supertest to v7.1.4 2025-07-23 02:30:18 +00:00
renovate[bot]
d15ce575df chore(deps): update dependency openai to v5.10.2 2025-07-23 02:29:21 +00:00
renovate[bot]
9999ff5a89 chore(deps): update dependency cheerio to v1.1.2 2025-07-23 02:28:26 +00:00
renovate[bot]
4653941082 chore(deps): update dependency @stylistic/eslint-plugin to v5.2.2 2025-07-23 02:27:33 +00:00
Elian Doran
fa509661ab Add grid to canvas (#6429) 2025-07-22 23:53:22 +03:00
Elian Doran
d9a289bf18 refactor(views/board): unnecessary re-render 2025-07-22 23:40:12 +03:00
Papierkorb2292
98c76b713d Save gridModeEnabled in CanvasContent 2025-07-22 19:12:08 +02:00
Papierkorb2292
05ed917a56 Removed disabling grid mode in ExcalidrawTypeWidget 2025-07-22 19:12:08 +02:00
Elian Doran
b833806ec7 feat(share): render inline mermaid (closes #5438) 2025-07-22 20:05:29 +03:00
Elian Doran
7fdef3418a refactor(share): check note type 2025-07-22 19:54:01 +03:00
Elian Doran
49e14ec542 feat(hidden_subtree): remove unexpected branches 2025-07-22 19:19:46 +03:00
Elian Doran
efd9244684 fix(help): missing branches if it was relocated 2025-07-22 18:52:39 +03:00
Elian Doran
318f2d1f8c docs(guide): relocate note list documentation 2025-07-22 18:33:46 +03:00
Elian Doran
92fa1cf052 fix(quick_edit): read-only notes not editable (closes #6425) 2025-07-22 17:30:03 +03:00
Elian Doran
17c6eb1680 fix(export/markdown): simple tables rendered as HTML (closes #6366) 2025-07-22 09:09:50 +03:00
Elian Doran
7c6af568d8 fix(share): ck text on dark theme not visible (closes #6427) 2025-07-22 08:44:45 +03:00
Elian Doran
23c9c6826e chore(env): add some instructions 2025-07-21 19:41:29 +03:00
Elian Doran
b08fda5e10 Kanban board (#6402) 2025-07-21 18:45:41 +03:00
Elian Doran
5ec3a49377 Merge remote-tracking branch 'origin/main' into feature/kanban_board 2025-07-21 18:24:36 +03:00
Elian Doran
1c728ae432 Merge branch 'release/v0.97.1' 2025-07-21 17:52:57 +03:00
Elian Doran
fd25c735c1 chore(release): bump version 2025-07-21 17:52:08 +03:00
Elian Doran
7de33907c5 docs(release): add change log for v0.97.1 2025-07-21 17:51:13 +03:00
Elian Doran
ec021be16c feat(views/board): display even if no children 2025-07-21 15:02:44 +03:00
Elian Doran
8b6826ffa4 feat(views/board): react to changes in "groupBy" 2025-07-21 15:02:38 +03:00
Elian Doran
00cc1ffe74 feat(views/board): add into view type switcher 2025-07-21 15:02:34 +03:00
Elian Doran
2384fdbaad chore(views/board): fix type errors 2025-07-21 15:02:31 +03:00
Elian Doran
08a93d81d7 feat(views/board): allow changing group by attribute 2025-07-21 15:02:28 +03:00
Elian Doran
86911100df refactor(views/board): use single point for obtaining status attribute 2025-07-21 15:02:22 +03:00
Elian Doran
ff01656268 chore(vscode): set up NX LLM integration 2025-07-21 15:02:20 +03:00
Elian Doran
d0ea6d9e8d feat(views/board): use same note title editing mechanism for insert above/below 2025-07-21 15:02:15 +03:00
Elian Doran
96ca3d5e38 fix(views/board): creating new notes would render as HTML 2025-07-21 13:14:07 +03:00
Elian Doran
3a569499cb feat(views/board): edit the note title inline on new 2025-07-21 11:28:46 +03:00
Elian Doran
545b19f978 fix(views/board): drop indicator remaining stuck 2025-07-21 11:19:14 +03:00
Elian Doran
d98be19c9a feat(views/board): set up differential renderer 2025-07-21 11:13:41 +03:00
Elian Doran
4826898c55 refactor(views/board): move drag logic to separate file 2025-07-21 11:01:49 +03:00
Elian Doran
482b592f77 feat(views/board): add drag preview when using touch 2025-07-21 11:01:49 +03:00
Elian Doran
939ebfe47b chore(deps): update dependency cheerio to v1.1.1 (#6417) 2025-07-21 10:07:37 +03:00
Elian Doran
c6dee1339b chore(deps): update dependency svelte to v5.36.12 (#6418) 2025-07-21 10:07:27 +03:00
Elian Doran
23f8c3ad3c chore(deps): update nx monorepo to v21.3.1 (#6419) 2025-07-21 10:06:25 +03:00
renovate[bot]
81c1b88376 chore(deps): update nx monorepo to v21.3.1 2025-07-21 02:58:10 +00:00
renovate[bot]
c4a85db698 chore(deps): update dependency svelte to v5.36.12 2025-07-21 02:57:09 +00:00
renovate[bot]
e6eda45c04 chore(deps): update dependency cheerio to v1.1.1 2025-07-21 02:56:06 +00:00
Elian Doran
a3014434cf chore(release): update version number 2025-07-20 23:39:58 +03:00
Elian Doran
3ebab2c126 docs(release): add changelog 2025-07-20 21:30:17 +03:00
Elian Doran
954619bd36 fix(views/table): note ID column being editable 2025-07-20 21:21:01 +03:00
Elian Doran
eb76362de4 chore(views/board): improve header 2025-07-20 20:55:41 +03:00
Elian Doran
1cde14859b feat(views/board): touch support 2025-07-20 20:31:07 +03:00
Elian Doran
c752b98995 chore(views/board): smaller add new column 2025-07-20 20:22:41 +03:00
Elian Doran
1f792ca418 feat(views/board): add new column 2025-07-20 20:06:54 +03:00
Elian Doran
b22e08b1eb refactor(views/board): use bulk API for renaming columns 2025-07-20 19:59:21 +03:00
Elian Doran
2b5029cc38 chore(views/board): delete values when deleting column 2025-07-20 19:52:16 +03:00
Elian Doran
9e936cb57b feat(views/board): delete empty columns 2025-07-20 19:52:10 +03:00
Elian Doran
e8fd2c1b3c fix(views/board): old column not removed when changing it 2025-07-20 19:52:06 +03:00
Elian Doran
977fbf54ee refactor(views/board): delegate storage to API 2025-07-20 19:52:01 +03:00
Elian Doran
3e5c91415d feat(views/board): rename columns 2025-07-20 19:51:56 +03:00
Elian Doran
d60b855f74 chore(views/board): disable move to for the current column 2025-07-20 19:51:52 +03:00
Elian Doran
4146192b6d chore(views/board): add icon to menu item 2025-07-20 19:51:46 +03:00
Elian Doran
26ee0ff48f feat(views/board): insert above/below 2025-07-20 17:35:52 +03:00
Elian Doran
6995fbfd06 chore(deps): update dependency esbuild to v0.25.8 (#6404) 2025-07-20 16:07:54 +03:00
Elian Doran
1763d80d5f feat(views/board): add move to in context menu 2025-07-20 13:24:22 +03:00
Elian Doran
a594e5147c feat(views/board): set up open in context menu 2025-07-20 12:42:19 +03:00
Elian Doran
e51ea1a619 feat(views/board): add context menu with delete 2025-07-20 12:40:30 +03:00
Elian Doran
83b72eafa6 Merge branch 'main' into renovate/esbuild-0.x-lockfile 2025-07-20 11:31:50 +03:00
Elian Doran
757a6777be chore(deps): update dependency svelte to v5.36.10 (#6405) 2025-07-20 11:30:49 +03:00
Elian Doran
37c9260dca feat(views/board): keep empty columns 2025-07-20 10:50:26 +03:00
Elian Doran
e1a8f4f5db chore(views/board): hide promoted attributes of collection 2025-07-20 10:50:13 +03:00
Elian Doran
b7b0b39afc feat(views/board): add preset notes 2025-07-20 10:36:36 +03:00
Elian Doran
af797489e8 feat(views/board): set up template 2025-07-20 10:30:48 +03:00
renovate[bot]
d003e91b89 chore(deps): update dependency svelte to v5.36.10 2025-07-20 01:09:12 +00:00
renovate[bot]
4a35df745a chore(deps): update dependency esbuild to v0.25.8 2025-07-20 01:08:07 +00:00
Elian Doran
b1b756b179 feat(views/board): store new columns into config 2025-07-19 22:21:24 +03:00
Elian Doran
9e3372df72 feat(views/board): react to changes in note title 2025-07-19 21:50:57 +03:00
Elian Doran
657df7a728 feat(views/board): add new item 2025-07-19 21:45:48 +03:00
Elian Doran
944f0b694b feat(views/board): open in popup 2025-07-19 21:09:55 +03:00
Elian Doran
efd409da17 fix(views/board): some runtime errors 2025-07-19 21:07:29 +03:00
Elian Doran
08d60c554c feat(views/board): set up reordering for same column 2025-07-19 20:44:54 +03:00
Elian Doran
a428ea7beb refactor(views/board): store both branch and note 2025-07-19 20:34:54 +03:00
Elian Doran
f69878b082 refactor(views/board): use branches instead of notes 2025-07-19 20:30:05 +03:00
Elian Doran
c5ffc2882b feat(views/board): react to changes 2025-07-19 19:57:02 +03:00
Elian Doran
765691751a feat(views/board): bypass horizontal scroll if column needs scrolling 2025-07-19 19:53:48 +03:00
Elian Doran
f19e5977c2 feat(views/board): set up dragging 2025-07-19 19:48:03 +03:00
Elian Doran
8f8b9af862 feat(views/board): set up scroll via mouse wheel 2025-07-19 19:31:13 +03:00
Elian Doran
3e7dc71995 feat(views/board): make scrollable 2025-07-19 19:23:42 +03:00
Elian Doran
2a25cd8686 feat(views/board): fixed column size 2025-07-19 19:20:32 +03:00
Elian Doran
7664839135 feat(views/board): display note icon 2025-07-19 19:16:39 +03:00
Elian Doran
47daebc65a feat(views/board): improve display of the notes 2025-07-19 19:03:09 +03:00
Elian Doran
0d18b944b6 feat(views/board): display columns 2025-07-19 18:44:50 +03:00
Elian Doran
951b5384a3 chore(views/board): prepare to group by attribute 2025-07-19 18:39:24 +03:00
Elian Doran
11547ecaa3 chore(views/board): create empty board 2025-07-19 18:29:31 +03:00
Adorian Doran
713a0f5b09 Merge branch 'main' of https://github.com/TriliumNext/Trilium 2025-07-19 16:28:56 +03:00
Adorian Doran
2cf9c98b43 style/table view: tweak table footer 2025-07-19 16:28:52 +03:00
Elian Doran
d7af196a0c feat(views/table): hide multiplicity when adding a new column 2025-07-19 16:03:58 +03:00
Adorian Doran
c363be57b7 client/table view: tweak icons 2025-07-19 16:02:11 +03:00
Adorian Doran
10645790de Merge branch 'main' of https://github.com/TriliumNext/Trilium 2025-07-19 15:55:06 +03:00
Adorian Doran
8b18cf382c style(next)/dropdown menus: fix rotated icons 2025-07-19 15:54:56 +03:00
Elian Doran
7a131e0bcc feat(views/table): support color class for title 2025-07-19 15:44:43 +03:00
Elian Doran
3d264379cc fix(views/table): color no longer shown for reference links 2025-07-19 15:44:42 +03:00
Elian Doran
f405682ec1 Merge branch 'main' of https://github.com/TriliumNext/trilium 2025-07-19 14:56:21 +03:00
Elian Doran
3debf3ce1c fix(views/calendar): not refreshing on note title change 2025-07-19 14:53:27 +03:00
Adorian Doran
5a76883969 Merge branch 'main' of https://github.com/TriliumNext/Trilium 2025-07-19 14:41:51 +03:00
Adorian Doran
6f51c5e0cc style/attribute detail dialog: fix stretched close button 2025-07-19 14:41:48 +03:00
Elian Doran
2c730d1f0b Merge branch 'main' of https://github.com/TriliumNext/trilium 2025-07-19 14:24:12 +03:00
Elian Doran
d487da0b2f feat(views/table): update new column in context menu to support relations also 2025-07-19 14:23:42 +03:00
Elian Doran
cb8a5cbb62 chore(views/table): add icons to add new column/row context menu 2025-07-19 14:06:00 +03:00
Elian Doran
ceb08593d8 chore(views/table): use translations for new label/relation 2025-07-19 14:04:25 +03:00
Elian Doran
9dd0eb7b9b fix(views/table): not reacting to external attribute changes 2025-07-19 14:02:19 +03:00
Elian Doran
ebff644d24 fix(views/table): changing column inheritability not working 2025-07-19 13:31:46 +03:00
Elian Doran
beb1c15fa5 fix(views/table): inheritable checkbox not respected 2025-07-19 13:25:54 +03:00
Elian Doran
40a5eee211 docs(views/table): describe exactly how to remove relation 2025-07-19 13:00:08 +03:00
Elian Doran
8f393d0bae refactor(bulk_action): fix type error 2025-07-19 12:57:58 +03:00
Elian Doran
94dad49e2f refactor(bulk_action): full type safety for client 2025-07-19 12:56:37 +03:00
Elian Doran
409638151c refactor(bulk_action): add basic type safety for client 2025-07-19 12:54:16 +03:00
Elian Doran
0d3de92890 refactor(views/table): move bulk action implementation in service 2025-07-19 12:46:38 +03:00
Elian Doran
5d619131ec fix(views/table): bulk actions sometimes not working 2025-07-19 12:44:55 +03:00
Elian Doran
e2c8443778 refactor(bulk_action): remake types & change method signature 2025-07-19 12:32:47 +03:00
Elian Doran
daa4743967 refactor(server): add some type safety to bulk actions 2025-07-19 12:15:33 +03:00
Elian Doran
56553078ef docs(views/table): update documentation 2025-07-19 09:47:10 +03:00
Elian Doran
5584a06cb3 chore(deps): update nx monorepo to v21.3.0 (#6398) 2025-07-19 09:28:55 +03:00
renovate[bot]
cfeb69ace6 chore(deps): update nx monorepo to v21.3.0 2025-07-19 06:03:54 +00:00
Elian Doran
b0c8f110de chore(deps): update dependency @types/node to v22.16.5 (#6392) 2025-07-19 09:00:33 +03:00
Elian Doran
aba1266c45 chore(deps): update svelte monorepo (#6395) 2025-07-19 08:59:56 +03:00
Elian Doran
c331e0103d chore(deps): update dependency eslint-config-prettier to v10.1.8 (#6394) 2025-07-19 08:56:51 +03:00
Elian Doran
13978574e0 chore(deps): update dependency stylelint to v16.22.0 (#6397) 2025-07-19 08:56:25 +03:00
renovate[bot]
be85963558 chore(deps): update dependency stylelint to v16.22.0 2025-07-19 05:55:03 +00:00
Elian Doran
8c19261ced fix(deps): update dependency marked to v16.1.1 (#6396) 2025-07-19 08:53:07 +03:00
Elian Doran
7ca17fa609 chore(deps): update dependency esbuild to v0.25.7 (#6393) 2025-07-19 08:52:36 +03:00
renovate[bot]
3d107572df fix(deps): update dependency marked to v16.1.1 2025-07-19 01:52:34 +00:00
renovate[bot]
f7488655a7 chore(deps): update svelte monorepo 2025-07-19 01:51:41 +00:00
renovate[bot]
876e0a29d4 chore(deps): update dependency eslint-config-prettier to v10.1.8 2025-07-19 01:50:50 +00:00
renovate[bot]
af74375695 chore(deps): update dependency esbuild to v0.25.7 2025-07-19 01:50:00 +00:00
renovate[bot]
896965fec5 chore(deps): update dependency @types/node to v22.16.5 2025-07-19 01:49:07 +00:00
Elian Doran
ba5ef93c1a fix(views/table): wrong type when renaming relations 2025-07-18 21:07:29 +03:00
Elian Doran
ef1153d336 fix(views/table): insert direction no longer working 2025-07-18 20:37:16 +03:00
Elian Doran
0d347f8823 feat(views/table): allow creating relations 2025-07-18 16:52:13 +03:00
Elian Doran
897cdc26ae chore(deps): update dependency express-session to v1.18.2 (#6372) 2025-07-18 11:53:17 +03:00
Elian Doran
aba621c099 fix(deps): update dependency mermaid to v11.9.0 (#6384) 2025-07-18 11:53:03 +03:00
renovate[bot]
839813ebde fix(deps): update dependency mermaid to v11.9.0 2025-07-18 08:35:57 +00:00
renovate[bot]
545e2ddbfc chore(deps): update dependency express-session to v1.18.2 2025-07-18 08:35:17 +00:00
Elian Doran
1d63a5903a fix(deps): update dependency marked to v16.1.0 (#6383) 2025-07-18 11:31:35 +03:00
Elian Doran
2b34c00a0c chore(deps): update dependency openai to v5.10.1 (#6378) 2025-07-18 11:31:17 +03:00
Elian Doran
123068062a chore(deps): update dependency @stylistic/eslint-plugin to v5.2.0 (#6376) 2025-07-18 11:31:01 +03:00
Elian Doran
9a668e8709 chore(deps): update node.js to v22.17.1 (#6374) 2025-07-18 11:30:51 +03:00
Elian Doran
f6f8937d64 chore(deps): update dependency express-rate-limit to v8.0.1 (#6371) 2025-07-18 11:30:24 +03:00
Elian Doran
c9f53a2880 chore(deps): update dependency compression to v1.8.1 (#6369) 2025-07-18 11:30:17 +03:00
Elian Doran
2887e712c3 chore(deps): update dependency multer to v2.0.2 [security] (#6368) 2025-07-18 11:29:21 +03:00
renovate[bot]
5d3a0ed1b4 fix(deps): update dependency marked to v16.1.0 2025-07-18 08:06:03 +00:00
renovate[bot]
334b6319de chore(deps): update dependency openai to v5.10.1 2025-07-18 08:05:15 +00:00
renovate[bot]
4c118c0fd4 chore(deps): update dependency @stylistic/eslint-plugin to v5.2.0 2025-07-18 08:04:29 +00:00
renovate[bot]
db00d60684 chore(deps): update node.js to v22.17.1 2025-07-18 08:04:25 +00:00
renovate[bot]
25b74af363 chore(deps): update dependency express-rate-limit to v8.0.1 2025-07-18 08:03:31 +00:00
renovate[bot]
eb57cf97ad chore(deps): update dependency compression to v1.8.1 2025-07-18 08:02:36 +00:00
renovate[bot]
c92e24363f chore(deps): update dependency multer to v2.0.2 [security] 2025-07-18 08:01:44 +00:00
Elian Doran
8d5d00ac0f chore(deps): update nx monorepo to v21.2.4 (#6375) 2025-07-18 10:59:33 +03:00
renovate[bot]
8b457384ba chore(deps): update nx monorepo to v21.2.4 2025-07-18 07:27:59 +00:00
Elian Doran
fab2d53ece chore(deps): update dependency vite to v7.0.5 (#6373) 2025-07-18 10:25:50 +03:00
renovate[bot]
774f27d8d2 chore(deps): update dependency vite to v7.0.5 2025-07-18 07:10:21 +00:00
Elian Doran
d7f02ef1b3 chore(deps): update dependency webdriverio to v9.18.1 (#6380) 2025-07-18 10:07:52 +03:00
renovate[bot]
97eaa6294c chore(deps): update dependency webdriverio to v9.18.1 2025-07-18 06:44:57 +00:00
Elian Doran
dc02bb0850 chore(deps): update svelte monorepo (#6382) 2025-07-18 09:41:49 +03:00
renovate[bot]
2c8c041e1c chore(deps): update svelte monorepo 2025-07-18 06:04:00 +00:00
Elian Doran
874b1c6654 chore(deps): update dependency electron to v37.2.3 (#6370) 2025-07-18 09:02:15 +03:00
Elian Doran
fb982c7097 fix(views/table): regression in restoring column width 2025-07-18 09:01:24 +03:00
Elian Doran
b7f5ce600e chore(renovate): add more packages to svelte monorepo 2025-07-18 08:58:35 +03:00
renovate[bot]
91604c9e26 chore(deps): update dependency electron to v37.2.3 2025-07-18 01:55:54 +00:00
Elian Doran
c874333a37 chore(client): fix type errors 2025-07-17 22:38:00 +03:00
Elian Doran
1298b968f2 fix(views/table): relation display sometimes not showing up 2025-07-17 22:31:54 +03:00
Elian Doran
6fe5a854a7 feat(views/table): allow deleting relations 2025-07-17 21:44:09 +03:00
Elian Doran
aba3b5cb19 feat(views/table): hide all buttons in relation editor 2025-07-17 21:07:44 +03:00
Elian Doran
282aed22b5 feat(views/geomap): support recursive notes 2025-07-17 20:51:15 +03:00
Elian Doran
669a3d9dcf feat(views/table): automatic index col width 2025-07-17 20:44:31 +03:00
Elian Doran
9d7455d28a fix(views/table): expander style affecting row number 2025-07-17 20:44:00 +03:00
Elian Doran
4f0c8b081c feat(views): improve style in collections properties 2025-07-17 19:56:14 +03:00
Elian Doran
a5db5298a0 feat(views/table): integrate depth limit into collection properties 2025-07-17 19:44:34 +03:00
Elian Doran
876c6e9252 feat(views/table): allow limiting depth 2025-07-17 19:34:29 +03:00
Elian Doran
aef824d262 feat(views/table): add a context menu for the header outside columns 2025-07-17 15:36:33 +03:00
Elian Doran
a25ce42490 feat(views/table): allow hiding number row & title 2025-07-17 15:00:19 +03:00
Elian Doran
8b0fdaccf4 feat(views/table): improve alignment for first level + increase indentation 2025-07-17 14:45:38 +03:00
Elian Doran
bd840a2421 feat(views/table): align items expanders 2025-07-17 14:40:44 +03:00
Elian Doran
27d515f289 refactor(views/table): use builtin way of disabling branch elements 2025-07-17 14:34:40 +03:00
Elian Doran
df3b9faf8d fix(client): tree operations no longer working due to loss of focus 2025-07-17 14:05:19 +03:00
Elian Doran
0f129734ae fix(link): popup triggering with bare right click 2025-07-17 11:19:29 +03:00
Elian Doran
275aacfba9 chore(vscode): add search excludes 2025-07-16 21:40:14 +03:00
Elian Doran
e7f47a0663 feat(views/table): delete column definition as well 2025-07-16 21:40:01 +03:00
Elian Doran
66486541fe feat(client): batch delete column values 2025-07-16 21:30:16 +03:00
Elian Doran
34f1a84769 fix(views/table): wrong position when renaming column 2025-07-16 09:23:06 +03:00
Elian Doran
2244f0368f fix(views/table): index column ends up in the wrong position 2025-07-16 09:16:47 +03:00
Elian Doran
9d85005255 chore(deps): update dependency express-rate-limit to v8 (#6362) 2025-07-16 08:32:51 +03:00
Elian Doran
ad8629dca6 chore(deps): update typescript-eslint monorepo to v8.37.0 (#6361) 2025-07-16 08:31:56 +03:00
Elian Doran
cccfe0e05a chore(deps): update svelte monorepo (#6360) 2025-07-16 08:31:36 +03:00
Elian Doran
a8874257e8 fix(deps): update dependency @codemirror/view to v6.38.1 (#6359) 2025-07-16 08:29:40 +03:00
Elian Doran
f689c55f56 chore(deps): update node.js to v22.17.1 (#6358) 2025-07-16 08:28:48 +03:00
Elian Doran
853c7be8b8 chore(deps): update dependency openai to v5.9.2 (#6357) 2025-07-16 08:28:39 +03:00
Elian Doran
823df1e12d chore(deps): update dependency electron to v37.2.2 (#6356) 2025-07-16 08:14:56 +03:00
renovate[bot]
7570f818e9 chore(deps): update dependency express-rate-limit to v8 2025-07-16 02:39:01 +00:00
renovate[bot]
03aa5aea2c chore(deps): update typescript-eslint monorepo to v8.37.0 2025-07-16 02:38:09 +00:00
renovate[bot]
a4e86ac353 chore(deps): update svelte monorepo 2025-07-16 02:36:37 +00:00
renovate[bot]
cf6efc050a fix(deps): update dependency @codemirror/view to v6.38.1 2025-07-16 02:35:51 +00:00
renovate[bot]
3e0802176b chore(deps): update node.js to v22.17.1 2025-07-16 02:35:04 +00:00
renovate[bot]
697954d4d9 chore(deps): update dependency openai to v5.9.2 2025-07-16 02:34:06 +00:00
renovate[bot]
741f6c1114 chore(deps): update dependency electron to v37.2.2 2025-07-16 02:33:19 +00:00
Adorian Doran
b2237ffa51 style/collections/tables: tweak nested rows 2025-07-16 05:23:13 +03:00
Adorian Doran
7b6d11bffa style/collections/tables: fix frozen cells overlapping with the outline of the left-side cells 2025-07-16 05:04:06 +03:00
Adorian Doran
97565e8f36 style(next)/collection/tables: improve the color scheme 2025-07-16 04:22:43 +03:00
perf3ct
c0dfee8439 fix(metrics): don't assign a timestamp to Prometheus metrics, let the scraper assign the timestamp to the time series 2025-07-15 20:39:36 +00:00
Elian Doran
fc98240614 chore(client): fix type error 2025-07-15 22:36:30 +03:00
Elian Doran
169d1203c2 fix(views/table): some context menu items active when they shouldn't 2025-07-15 22:30:52 +03:00
Elian Doran
f3350bc8f5 refactor(views/table): better cleanup 2025-07-15 22:06:32 +03:00
Elian Doran
504a19275c feat(views/table): basic renaming of fields 2025-07-15 21:48:16 +03:00
Elian Doran
14cdc52670 feat(views/table): support renaming columns 2025-07-15 20:42:47 +03:00
Elian Doran
cf8063f311 feat(views/table): format note ID as monospace 2025-07-15 19:32:13 +03:00
Elian Doran
aa8902f5b9 fix(client): popup not displayed for existing attributes (closes #5718) 2025-07-15 18:55:29 +03:00
Elian Doran
7cd0e664ac feat(views/table): basic editing of columns (rename not supported) 2025-07-15 18:51:51 +03:00
Elian Doran
a04804d3fa fix(views/table): wrong specs when restoring columns 2025-07-15 18:39:20 +03:00
Elian Doran
86f90e6685 fix(api): also rate limit etapi docs endpoint (#6352) 2025-07-15 17:06:52 +03:00
Elian Doran
8131a4b3d2 fix(views/table): events/commands not well sent 2025-07-15 15:49:32 +03:00
Elian Doran
b91a3e13b0 refactor(views/table): move row editing to own component 2025-07-15 15:32:30 +03:00
Elian Doran
5a7a0d32d1 refactor(views/table): move col editing to own component 2025-07-15 14:53:18 +03:00
perf3ct
3f5df18d6c fix(api): also rate limit etapi docs endpoint 2025-07-14 21:12:00 +00:00
Elian Doran
df2cede075 fix(views/calendar): nested entries in calendar view 2025-07-14 23:12:55 +03:00
Elian Doran
4321c161ac fix(views/calendar): duplicate entries in calendar view 2025-07-14 23:07:26 +03:00
Elian Doran
b1f0c64ef2 chore(views/geo): typing issue 2025-07-14 22:52:37 +03:00
Elian Doran
c9b37dcc77 refactor(views/table): rename event 2025-07-14 21:06:44 +03:00
Elian Doran
ab093ed9a0 chore(views/table): add translations 2025-07-14 20:59:29 +03:00
Elian Doran
cf31367acd feat(views/table): insert column to the right 2025-07-14 20:42:37 +03:00
Elian Doran
e3d306cac3 fix(views/table): wrong insert position for insert left 2025-07-14 20:34:05 +03:00
Elian Doran
960d321019 fix(views/table): position not restored after new columns (closes #6285) 2025-07-14 20:32:24 +03:00
Elian Doran
2d4ac93221 feat(views/table): basic implementation for inserting columns at position 2025-07-14 19:14:10 +03:00
Elian Doran
d4a4f15416 refactor(views/table): move attribute detail widget to view 2025-07-14 17:29:20 +03:00
Elian Doran
504a842d37 feat(views/table): force a refresh if #sorted is changed 2025-07-14 17:02:07 +03:00
Elian Doran
ded5b1f5d2 feat(views/table): expand child notes by default 2025-07-14 17:00:01 +03:00
Elian Doran
fcbbc21a80 feat(views/table): force a refresh if data tree changes 2025-07-14 16:58:14 +03:00
Elian Doran
38fce25b86 fix(views/table): show/hide columns not always updated properly 2025-07-14 16:51:20 +03:00
Elian Doran
4cc2fa5300 fix(snippets): warning about missing note IDs when deleting 2025-07-14 16:49:42 +03:00
Elian Doran
4a82c3f65a fix(views/table): insert above/below not working in nested trees 2025-07-14 16:49:29 +03:00
Elian Doran
b255d70e18 fix(views/table): context menu remains active while clicking on an expand/collapse button 2025-07-14 16:24:54 +03:00
Elian Doran
caa842cd55 fix(views/table): unable to update state for newly created rows 2025-07-14 16:16:55 +03:00
Elian Doran
cd338085fb refactor(views/table): clean up 2025-07-14 15:52:21 +03:00
Elian Doran
e703ce92a8 refactor(views/table): simplify context menu handling 2025-07-14 15:46:22 +03:00
Elian Doran
84479a2c2a feat(views/table): focus if creating child note 2025-07-14 15:38:57 +03:00
Elian Doran
c13969217c feat(views/table): insert child note 2025-07-14 13:37:18 +03:00
Elian Doran
402540f483 feat(views/table): support recursive children update 2025-07-14 13:15:41 +03:00
Elian Doran
8c56315313 refactor(views): move full height detection to rendererer 2025-07-14 12:56:17 +03:00
Elian Doran
b29c3eff6e refactor(views): prepare for supporting subtrees 2025-07-14 12:53:11 +03:00
Elian Doran
ec7dacfc9b feat(views/table): improve expand/collapse button 2025-07-14 12:04:13 +03:00
Elian Doran
5f9a6a9f76 feat(views/table): integrate expander into note title section 2025-07-14 11:39:12 +03:00
Elian Doran
28f4aea3d5 refactor(views/table): use slightly more performant formatter for row number 2025-07-14 11:30:46 +03:00
Elian Doran
8d29c5fe1b feat(views/table): hide draggable rows if not supported 2025-07-14 11:29:14 +03:00
Elian Doran
ccd935b562 refactor(views/table): don't configure reordering rows if not available 2025-07-14 11:22:32 +03:00
Elian Doran
d77a49857b feat(views/table): basic nested tree support 2025-07-14 11:11:08 +03:00
Elian Doran
e30478e5d4 chore(views/table): disable menu module since it's no longer necessary 2025-07-14 10:45:01 +03:00
Elian Doran
71863752cd feat(views/table): display both promoted and non-promoted attributes 2025-07-14 10:38:45 +03:00
Elian Doran
e4a2a8e56d fix(text): selection and cursor not maintained properly when switching tabs 2025-07-14 09:58:58 +03:00
Elian Doran
0f1c505823 fix(tab): editor not focused after switching tabs 2025-07-14 09:58:58 +03:00
Elian Doran
1ecce11113 chore(deps): update dependency vite-plugin-static-copy to v3.1.1 (#6345) 2025-07-14 08:10:18 +03:00
renovate[bot]
2287d67fb5 chore(deps): update dependency vite-plugin-static-copy to v3.1.1 2025-07-13 19:16:04 +00:00
Elian Doran
5b4f17ef3d Update README.md (#6344) 2025-07-13 22:14:33 +03:00
Elian Doran
3720ab6df6 fix(views/table): not reacting to title changes 2025-07-13 21:38:23 +03:00
diyoyo
3c893d69e5 Update README.md
updating from `Notes` to `Trilium` in the `Contribute`section.
2025-07-13 20:29:02 +02:00
Elian Doran
b93a4a3e42 fix(views/table): booleans not working 2025-07-13 21:06:41 +03:00
Elian Doran
23cef0ab94 chore(views/table): translate row menu 2025-07-13 16:56:03 +03:00
Elian Doran
c8ffb8d694 chore(views/table): translate column menu 2025-07-13 16:52:29 +03:00
Elian Doran
08e08d8920 feat(views/table): improve column context menu 2025-07-13 16:45:04 +03:00
Elian Doran
7acd300163 feat(views/table): add option to clear sorting 2025-07-13 16:41:43 +03:00
Elian Doran
d8d95db4ec feat(views/table): add sort by 2025-07-13 16:37:45 +03:00
Elian Doran
af97d3ef1d feat(views/table): add back show/hide columns 2025-07-13 16:22:57 +03:00
Elian Doran
c65ec14943 feat(views/table): hide column in contetx menu 2025-07-13 14:37:13 +03:00
Elian Doran
adfdc7edb4 feat(views/table): drag handle to avoid editing issues 2025-07-13 14:24:12 +03:00
Elian Doran
8cced607eb feat(views/table): insert row before 2025-07-13 14:10:37 +03:00
Elian Doran
5dd5af90c2 feat(views/table): insert row below 2025-07-13 13:06:53 +03:00
Elian Doran
7a48333b4f chore(deps): update dependency @sveltejs/vite-plugin-svelte to v6 (#6341) 2025-07-13 08:22:24 +03:00
Elian Doran
7044533398 fix(deps): update dependency mind-elixir to v5.0.2 (#6340) 2025-07-13 08:21:06 +03:00
renovate[bot]
560aad8df6 chore(deps): update dependency @sveltejs/vite-plugin-svelte to v6 2025-07-13 01:34:38 +00:00
renovate[bot]
36c2099b2e fix(deps): update dependency mind-elixir to v5.0.2 2025-07-13 01:33:47 +00:00
Elian Doran
6c157675d7 feat(views/table): open in new tab/quick edit 2025-07-13 00:44:44 +03:00
Elian Doran
458d66cb21 feat(views/table): delete row from context menu (closes #6288) 2025-07-13 00:36:34 +03:00
Elian Doran
201e8911c5 chore: prefer short name 2025-07-12 23:48:42 +03:00
Elian Doran
1b1ed2408f feat(funding): add Buy Me a Coffee 2025-07-12 23:28:07 +03:00
Elian Doran
62487d21d8 feat(funding): add LiberaPay 2025-07-12 23:20:55 +03:00
Elian Doran
bc752bdb0b fix(popup_editor): note icon overlapping with classic editor 2025-07-12 22:38:20 +03:00
Elian Doran
9e00d421fb fix(ckeditor): color and font mismatch after update 2025-07-12 22:34:27 +03:00
Elian Doran
e7f02fe22b fix(deps): update ckeditor monorepo (major) (#6283) 2025-07-12 22:03:15 +03:00
Elian Doran
6d694f8e53 chore(client): update types 2025-07-12 20:20:41 +03:00
Elian Doran
977befd0a7 chore(ckeditor5): update ckeditor theme variable names 2025-07-12 20:00:01 +03:00
Elian Doran
1566ae4fbd chore(ckeditor5): fix references: DocumentSelection -> ModelDocumentSelection 2025-07-12 19:45:00 +03:00
Elian Doran
4e97490cc6 chore(ckeditor5): fix references: Selectable -> ModelSelectable 2025-07-12 19:44:38 +03:00
Elian Doran
446d5a0fcc chore(ckeditor5): fix references: Item -> ModelItem 2025-07-12 19:44:12 +03:00
Elian Doran
1fd6465012 chore(ckeditor5): fix references: NodeAttributes -> ModelNodeAttributes 2025-07-12 19:43:48 +03:00
Elian Doran
6cea8e3b87 chore(ckeditor5): fix references: Range -> ModelRange 2025-07-12 19:43:18 +03:00
Elian Doran
28a63e0326 chore(ckeditor5): fix references: DocumentFragment -> ModelDocumentFragment 2025-07-12 19:42:54 +03:00
Elian Doran
b73da46111 chore(ckeditor5): fix references: Writer -> ModelWriter 2025-07-12 19:42:26 +03:00
Elian Doran
abafa8c2d2 chore(ckeditor5): fix references: Position -> ModelPosition 2025-07-12 19:41:30 +03:00
Elian Doran
4ae3272cdf chore(ckeditor5): fix references: Element -> ModelElement 2025-07-12 19:40:24 +03:00
Elian Doran
6aa3b8dbd7 chore(ckeditor5-admonition): fix references 2025-07-12 19:38:36 +03:00
Elian Doran
395e9b2228 chore(ckeditor5-admonition): fix references: DocumentFragment -> ViewDocumentFragment 2025-07-12 19:29:51 +03:00
Elian Doran
be33f68c52 chore(ckeditor5-math): fix references: DowncastWriter -> ViewDowncastWriter 2025-07-12 19:28:28 +03:00
Elian Doran
29d96381fa chore(ckeditor5-math): fix references: LiveRange -> ModelLiveRange 2025-07-12 19:27:46 +03:00
Elian Doran
da8eecf774 chore(ckeditor5-math): fix references: LivePosition -> ModelLivePosition 2025-07-12 19:27:22 +03:00
Elian Doran
de91326c12 chore(ckeditor5-math): fix references: Element -> ModelElement 2025-07-12 19:26:52 +03:00
Elian Doran
ee1c3c35d7 chore(ckeditor5-mermaid): fix references: {Item,Node} -> Model{Item,Node} 2025-07-12 19:25:40 +03:00
Elian Doran
70eece1429 chore(ckeditor5-mermaid): fix references: Element -> ModelElement 2025-07-12 19:24:39 +03:00
Elian Doran
b4f2be332b chore(ckeditor5-footnotes): fix references: Schema -> ModelSchema 2025-07-12 19:23:44 +03:00
Elian Doran
23fe76989b chore(ckeditor5-footnotes): fix references: Writer -> ModelWriter 2025-07-12 19:23:40 +03:00
Elian Doran
275d07659d chore(ckeditor5-footnotes): fix references: Range -> ModelRange 2025-07-12 19:23:37 +03:00
Elian Doran
a901e92573 chore(ckeditor5-footnotes): fix references: Element -> ModelElement 2025-07-12 19:23:33 +03:00
Elian Doran
6ead31b45f chore(ckeditor5-footnotes): fix references: RootElement -> ModelRootElement 2025-07-12 19:23:30 +03:00
Elian Doran
d4ce12dca9 chore(ckeditor5-footnotes): fix references: TextProxy -> ModelTextProxy 2025-07-12 19:23:25 +03:00
Elian Doran
bb6e22cdb7 chore(ckeditor5-footnotes): fix references: Text -> ModelText 2025-07-12 19:23:13 +03:00
Elian Doran
2c9fc4812e chore(deps): update dependency electron to v37.2.1 (#6303) 2025-07-12 19:05:18 +03:00
Elian Doran
60f4554afa Merge branch 'main' of https://github.com/TriliumNext/trilium 2025-07-12 19:04:43 +03:00
Elian Doran
3c486bfd1b chore(ci): set personal access token for conflict checker 2025-07-12 19:04:41 +03:00
Elian Doran
26b9a95bb2 chore(deps): update svelte monorepo (#6316) 2025-07-12 19:00:30 +03:00
Elian Doran
f7c9217cea Table Collections: restyle (#6298) 2025-07-12 18:59:56 +03:00
Elian Doran
e92022b73c Tree Context Menu: relocate the "Duplicate subtree" menu item (#6299) 2025-07-12 18:52:35 +03:00
Elian Doran
61ff2353c8 docs(help): update documentation on duplicate subtree 2025-07-12 18:52:12 +03:00
Elian Doran
c8cca26ca4 Merge remote-tracking branch 'origin/main' into feat/tree-context-menu/relocate-duplicate-note-command 2025-07-12 18:41:58 +03:00
Elian Doran
aa556ed4d5 Merge branch 'main' of https://github.com/TriliumNext/trilium 2025-07-12 18:40:28 +03:00
Elian Doran
5d694a7bdf chore(ci): permissions issue with merge checker 2025-07-12 18:40:25 +03:00
renovate[bot]
c4787dae23 fix(deps): update ckeditor monorepo 2025-07-12 10:57:11 +00:00
renovate[bot]
9f5f329c53 chore(deps): update dependency electron to v37.2.1 2025-07-12 10:55:36 +00:00
Elian Doran
f82b96fcc4 chore(deps): update dependency @types/node to v22.16.3 (#6302) 2025-07-12 13:53:21 +03:00
renovate[bot]
d4b24fa427 chore(deps): update svelte monorepo 2025-07-12 10:41:27 +00:00
renovate[bot]
c852f67c59 chore(deps): update dependency @types/node to v22.16.3 2025-07-12 10:39:43 +00:00
Elian Doran
92c228a3c9 chore(deps): update nx monorepo to v21.2.3 (#6306) 2025-07-12 13:17:34 +03:00
renovate[bot]
42f948e2b3 chore(deps): update nx monorepo to v21.2.3 2025-07-12 08:59:08 +00:00
Elian Doran
13e8932117 chore(deps): update dependency @playwright/test to v1.54.1 (#6308) 2025-07-12 11:55:42 +03:00
renovate[bot]
910d34bd42 chore(deps): update dependency @playwright/test to v1.54.1 2025-07-12 07:57:58 +00:00
Elian Doran
b204ba29e7 fix(deps): update eslint monorepo to v9.31.0 (#6311) 2025-07-12 10:54:00 +03:00
Elian Doran
d49244cbc8 Merge branch 'main' of https://github.com/TriliumNext/trilium 2025-07-12 10:08:35 +03:00
Elian Doran
ef2f2f17b4 feat(ci): mark PRs with merge conflicts 2025-07-12 10:08:33 +03:00
renovate[bot]
b9f21dcf4c fix(deps): update eslint monorepo to v9.31.0 2025-07-12 07:03:21 +00:00
Elian Doran
808fe690cc chore(deps): update dependency openai to v5.9.0 (#6309) 2025-07-12 10:01:18 +03:00
Elian Doran
901eec04e5 chore(deps): update dependency vite to v7.0.4 (#6305) 2025-07-12 10:01:02 +03:00
Elian Doran
9272394ada fix(deps): update dependency eslint-linter-browserify to v9.31.0 (#6310) 2025-07-12 09:59:19 +03:00
Elian Doran
4457982fae chore(deps): update ckeditor5 config packages to v12 (major) (#6312) 2025-07-12 09:59:05 +03:00
Elian Doran
7f67b2b461 chore(deps): update dependency dotenv to v17.2.0 (#6279) 2025-07-12 09:58:05 +03:00
Elian Doran
7f3934f4c3 chore(renovate): group svelte as monorepo 2025-07-12 09:57:29 +03:00
renovate[bot]
a3b80a2cc4 chore(deps): update ckeditor5 config packages to v12 2025-07-12 01:37:21 +00:00
renovate[bot]
6d967e5e51 fix(deps): update dependency eslint-linter-browserify to v9.31.0 2025-07-12 01:34:54 +00:00
renovate[bot]
b674ca90d1 chore(deps): update dependency openai to v5.9.0 2025-07-12 01:34:03 +00:00
renovate[bot]
95edb60a84 chore(deps): update dependency vite to v7.0.4 2025-07-12 01:29:46 +00:00
Adorian Doran
40add78ccb client/tree context menu: update translations 2025-07-12 02:22:00 +03:00
Adorian Doran
1029c24c06 client/tree context menu: relocate the "Duplicate subtree" menu item 2025-07-12 02:21:22 +03:00
Adorian Doran
94d94fe8fb Merge branch 'main' of https://github.com/TriliumNext/Trilium into feat/style/collections/table 2025-07-12 01:56:04 +03:00
Adorian Doran
49489c0f45 style/table collections: refactor 2025-07-12 01:55:07 +03:00
Adorian Doran
215833a2c9 style/table collections: tweak table footer 2025-07-12 01:40:18 +03:00
Adorian Doran
a7471a3d47 style/table collections: tweak checkbox cells 2025-07-12 01:34:22 +03:00
Adorian Doran
909aaefbd7 style/table collections: restyle context menus 2025-07-12 01:17:09 +03:00
Elian Doran
15c2f56bf2 fix(options): display a less ambiguous/scary message after performing… (#6284) 2025-07-12 00:34:23 +03:00
Elian Doran
84cdfec415 Popup editor (#6292) 2025-07-12 00:30:33 +03:00
Elian Doran
91572ab8b9 fix(popup_editor): use cmd on macos 2025-07-11 22:53:14 +03:00
Adorian Doran
ed758f4c92 style/table collections: tweak appearance 2025-07-11 22:39:49 +03:00
Elian Doran
f1fc15e115 fix(link): popup menu no longer triggering 2025-07-11 22:34:41 +03:00
Adorian Doran
22300e8151 style/table collections: tweak appearance 2025-07-11 21:52:35 +03:00
Elian Doran
292646e14a fix(popup_editor): styles showing up when classic toolbar is shown 2025-07-11 20:46:48 +03:00
Elian Doran
b4921a20d8 fix(client): type errors 2025-07-11 20:08:35 +03:00
Elian Doran
54be79a725 feat(in-app-help): link grid/list book types 2025-07-11 19:43:12 +03:00
Elian Doran
4fc47370fe docs(help): fix some old references to books 2025-07-11 19:42:19 +03:00
Elian Doran
9e30bcf233 docs(help): improve documentation on collections 2025-07-11 19:40:54 +03:00
Elian Doran
e5712c54e6 docs(help): add a section on feature highlights 2025-07-11 19:09:42 +03:00
Elian Doran
2a4fe21a39 docs(help): document keyboard shortcuts for note tree 2025-07-11 18:50:56 +03:00
Elian Doran
b259558f0f docs(help): document note tooltip 2025-07-11 18:33:16 +03:00
Elian Doran
e2f6d9e0d6 docs(help): document quick edit 2025-07-11 18:27:55 +03:00
Elian Doran
4fc2b0fa5e feat(popup_editor): focus on editor automatically for easier editing 2025-07-11 16:52:13 +03:00
Elian Doran
8dca79ecf2 fix(popup_editor): block toolbar from behind modal interfering 2025-07-11 16:52:13 +03:00
Elian Doran
c7f49f0e21 chore(popup_editor): switch keyboard combo to Ctrl+right click 2025-07-11 16:52:13 +03:00
Elian Doran
bce2094fb2 fix(tree): middle click triggering paste 2025-07-11 16:52:13 +03:00
renovate[bot]
65c33e1aa0 chore(deps): update dependency webdriverio to v9.17.0 2025-07-11 16:52:13 +03:00
renovate[bot]
8e108bc5e2 chore(deps): update dependency svelte to v5.35.5 2025-07-11 16:52:13 +03:00
renovate[bot]
4e75ce7fdb chore(deps): update pnpm to v10.13.1 2025-07-11 16:52:13 +03:00
renovate[bot]
1e42574d28 fix(deps): update dependency i18next to v25.3.2 2025-07-11 16:52:13 +03:00
renovate[bot]
85ebaf6afa chore(deps): update dependency dotenv to v17.2.0 2025-07-11 16:52:13 +03:00
renovate[bot]
661c7e4056 chore(deps): update dependency @sveltejs/kit to v2.22.4 2025-07-11 16:52:13 +03:00
Elian Doran
1e8ea54dbc feat(popup_editor): smoother operation 2025-07-11 12:16:56 +03:00
Elian Doran
ddbe7e9936 chore(popup_editor): clean up after closing modal 2025-07-11 12:00:32 +03:00
Elian Doran
cab86175ef fix(file): pdf having a 10px margin at the bottom 2025-07-11 11:28:10 +03:00
Elian Doran
ec7414b174 fix(popup_editor): collections being displayed under a full empty screen 2025-07-11 10:47:06 +03:00
Elian Doran
8343a5d1dd feat(popup_editor): add mobile support 2025-07-11 09:06:06 +03:00
Adorian Doran
18c55784c7 style/table collections: add a placeholder style for rows and cells 2025-07-11 00:16:15 +03:00
Elian Doran
39eac83d38 fix(popup_editor): mermaid not rendering properly 2025-07-10 23:21:37 +03:00
Elian Doran
55bd6fb57d feat(popup_editor): properly support file note types 2025-07-10 22:55:16 +03:00
Elian Doran
6fdec52332 fix(popup_editor): mind map not rendering properly 2025-07-10 22:48:33 +03:00
Adorian Doran
824a3c5fcc style/table collections: fix an issue with column headers 2025-07-10 21:54:32 +03:00
Adorian Doran
87da644027 style/table collections: add a placeholder style for column headers 2025-07-10 21:52:09 +03:00
Adorian Doran
4f42f543d8 style/table collections: create a stylesheet dedicated to the table view 2025-07-10 21:20:48 +03:00
Elian Doran
97ea3ac3fc fix(popup_editor): block popup not working 2025-07-10 20:54:50 +03:00
Elian Doran
f04b75fd36 feat(popup_editor): add shortcut in links 2025-07-10 19:56:13 +03:00
Elian Doran
f5bffc38f1 feat(popup_editor): add shortcut in note tree 2025-07-10 19:54:51 +03:00
Elian Doran
27738acefc feat(popup_editor): support collections 2025-07-10 19:39:08 +03:00
Elian Doran
59ce2072c5 feat(popup_editor): display promoted attributes 2025-07-10 19:19:44 +03:00
Elian Doran
ed68dda70b feat(popup_editor): integrate with note tooltip 2025-07-10 18:57:13 +03:00
Elian Doran
892ab02f06 feat(popup_editor): integrate with geomap 2025-07-10 18:21:12 +03:00
Elian Doran
7d9196d5e1 feat(popup_editor): integrate with calendar for day notes 2025-07-10 18:14:23 +03:00
Elian Doran
dccdb5ceb7 feat(popup_editor): integrate with calendar for existing notes 2025-07-10 17:54:27 +03:00
Elian Doran
f961698e44 feat(popup_editor): improve fit for wider notes 2025-07-10 17:40:57 +03:00
Elian Doran
278fe3262e feat(popup_editor): improve fit for full-height note types 2025-07-10 17:33:00 +03:00
Elian Doran
1fc860b052 feat(popup_editor): integrate with tree context menu 2025-07-10 17:26:40 +03:00
Elian Doran
88a8311173 feat(popup_editor): integrate with note link context menu 2025-07-10 17:19:10 +03:00
Elian Doran
63dc5697dd fix(popup_editor): classic editor toolbar displayed when it shouldn't 2025-07-10 16:37:34 +03:00
Elian Doran
b595d1fade fix(popup_editor): ckeditor modals not showing 2025-07-10 16:35:44 +03:00
Elian Doran
d91c59b7d0 feat(popup_editor): floating classic toolbar 2025-07-10 16:16:09 +03:00
Elian Doran
aa2ab0da31 feat(popup_editor): limit max height & reduce padding 2025-07-10 16:12:38 +03:00
Elian Doran
91f94106fb feat(popup_editor): integrate classic editor toolbar 2025-07-10 16:09:34 +03:00
Elian Doran
308f319138 feat(popup_editor): normalize paddings 2025-07-10 15:28:55 +03:00
Elian Doran
fa0c01591a feat(popup_editor): integrate note title + icon into modal header 2025-07-10 15:25:07 +03:00
Elian Doran
cb5a771490 feat(popup_editor): add editable note title and icon 2025-07-10 15:07:48 +03:00
Elian Doran
0c17a13462 fix(popup_editor): current tab events interfering 2025-07-10 14:57:32 +03:00
Romain DEP.
04593cb2d7 fix(options): display a less ambiguous/scary message after performing a consistency check.
The current message could easily be misinterpreted as an instruction for the user to go fix issues
2025-07-10 13:15:41 +02:00
Elian Doran
b6f50b6af0 chore(deps): update dependency webdriverio to v9.17.0 (#6281) 2025-07-10 13:57:25 +03:00
renovate[bot]
fc454cba03 chore(deps): update dependency webdriverio to v9.17.0 2025-07-10 09:54:03 +00:00
Elian Doran
6f165df29e chore(deps): update dependency svelte to v5.35.5 (#6277) 2025-07-10 12:49:50 +03:00
Elian Doran
d16468071d chore(deps): update pnpm to v10.13.1 (#6282) 2025-07-10 12:49:38 +03:00
renovate[bot]
20a492523f chore(deps): update dependency svelte to v5.35.5 2025-07-10 07:43:08 +00:00
Elian Doran
1216f51c78 fix(deps): update dependency i18next to v25.3.2 (#6278) 2025-07-10 10:42:16 +03:00
Elian Doran
ea3ac1041b chore(deps): update dependency dotenv to v17.2.0 (#6280) 2025-07-10 10:41:45 +03:00
Elian Doran
d838e8baf0 chore(deps): update dependency @sveltejs/kit to v2.22.4 (#6276) 2025-07-10 10:41:01 +03:00
renovate[bot]
60a7347d7d chore(deps): update pnpm to v10.13.1 2025-07-10 02:40:45 +00:00
renovate[bot]
4e05e79426 chore(deps): update dependency dotenv to v17.2.0 2025-07-10 02:39:34 +00:00
renovate[bot]
aa872f47f2 chore(deps): update dependency dotenv to v17.2.0 2025-07-10 02:38:39 +00:00
renovate[bot]
fbd833ad86 fix(deps): update dependency i18next to v25.3.2 2025-07-10 02:37:42 +00:00
renovate[bot]
bee65ed32c chore(deps): update dependency @sveltejs/kit to v2.22.4 2025-07-10 02:35:48 +00:00
Elian Doran
5adca76a9a refactor(popup_editor): better error handling 2025-07-09 21:56:11 +03:00
Elian Doran
e7467f6446 feat(popup_editor): get editor to show up if note is open somewhere else 2025-07-09 21:44:42 +03:00
Elian Doran
e49473fbd3 refactor(client): unused import 2025-07-09 21:20:24 +03:00
Elian Doran
bfec44aa5a refactor(popup_editor): inject note detail widget 2025-07-09 21:20:16 +03:00
Elian Doran
55b3bf6036 feat(popup_editor): create an empty modal with auto-trigger 2025-07-09 21:12:18 +03:00
Elian Doran
c9c07f0cb0 chore(book_properties): add config for all note types 2025-07-09 20:53:35 +03:00
Elian Doran
e25727441d chore(book_properties): add translations 2025-07-09 20:40:04 +03:00
Elian Doran
51b7955ccd refactor(book_properties): move rendering to book_properties 2025-07-09 20:37:05 +03:00
Elian Doran
196bba9cda refactor(book_properties): list buttons are now declarative 2025-07-09 20:29:58 +03:00
Elian Doran
430ed78d85 feat(book_properties): improve layout & accessibility 2025-07-09 20:14:42 +03:00
Elian Doran
2d11ed805d feat(book_properties): react to external changes 2025-07-09 20:13:08 +03:00
Elian Doran
f55426bdb0 feat(collections): basic properties for calendar 2025-07-09 20:10:25 +03:00
Elian Doran
87b5068fec chore(collections): rename references to book 2025-07-09 19:40:35 +03:00
Elian Doran
9ddd1a4ae2 feat(collections): add i18n 2025-07-09 19:37:10 +03:00
Elian Doran
736bc9c9bd chore(insert_note): improve layout slightly 2025-07-09 19:32:29 +03:00
Elian Doran
5a2da62992 feat(collections): hide book default note type 2025-07-09 19:28:44 +03:00
Elian Doran
1a72eb91ee feat(collections): display grid/view in collections list 2025-07-09 19:22:12 +03:00
Elian Doran
0d3c5b06e2 feat(collections): add calendar as a standalone template 2025-07-09 19:05:05 +03:00
711 changed files with 140640 additions and 24062 deletions

2
.github/FUNDING.yml vendored
View File

@@ -2,3 +2,5 @@
github: [eliandoran]
custom: ["https://paypal.me/eliandoran"]
liberapay: ElianDoran
buy_me_a_coffee: eliandoran

View File

@@ -44,7 +44,7 @@ runs:
steps:
# Checkout branch to compare to [required]
- name: Checkout base branch
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
path: br-base

40
.github/instructions/nx.instructions.md vendored Normal file
View File

@@ -0,0 +1,40 @@
---
applyTo: '**'
---
// This file is automatically generated by Nx Console
You are in an nx workspace using Nx 21.3.9 and pnpm as the package manager.
You have access to the Nx MCP server and the tools it provides. Use them. Follow these guidelines in order to best help the user:
# General Guidelines
- When answering questions, use the nx_workspace tool first to gain an understanding of the workspace architecture
- For questions around nx configuration, best practices or if you're unsure, use the nx_docs tool to get relevant, up-to-date docs!! Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the 'nx_workspace' tool to get any errors
- To help answer questions about the workspace structure or simply help with demonstrating how tasks depend on each other, use the 'nx_visualize_graph' tool
# Generation Guidelines
If the user wants to generate something, use the following flow:
- learn about the nx workspace and any specifics the user needs by using the 'nx_workspace' tool and the 'nx_project_details' tool if applicable
- get the available generators using the 'nx_generators' tool
- decide which generator to use. If no generators seem relevant, check the 'nx_available_plugins' tool to see if the user could install a plugin to help them
- get generator details using the 'nx_generator_schema' tool
- you may use the 'nx_docs' tool to learn more about a specific generator or technology if you're unsure
- decide which options to provide in order to best complete the user's request. Don't make any assumptions and keep the options minimalistic
- open the generator UI using the 'nx_open_generate_ui' tool
- wait for the user to finish the generator
- read the generator log file using the 'nx_read_generator_log' tool
- use the information provided in the log file to answer the user's question or continue with what they were doing
# Running Tasks Guidelines
If the user wants help with tasks or commands (which include keywords like "test", "build", "lint", or other similar actions), use the following flow:
- Use the 'nx_current_running_tasks_details' tool to get the list of tasks (this can include tasks that were completed, stopped or failed).
- If there are any tasks, ask the user if they would like help with a specific task then use the 'nx_current_running_task_output' tool to get the terminal output for that task/command
- Use the terminal output from 'nx_current_running_task_output' to see what's wrong and help the user fix their problem. Use the appropriate tools if necessary
- If the user would like to rerun the task or command, always use `nx run <taskId>` to rerun in the terminal. This will ensure that the task will run in the nx context and will be run the same way it originally executed
- If the task was marked as "continuous" do not offer to rerun the task. This task is already running and the user can see the output in the terminal. You can use 'nx_current_running_task_output' to get the output of the task to verify the output.

17
.github/workflows/checks.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Checks
on:
push:
pull_request_target:
types: [synchronize]
jobs:
main:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check if PRs have conflicts
uses: eps1lon/actions-label-merge-conflict@v3
with:
dirtyLabel: "merge-conflicts"
repoToken: "${{ secrets.MERGE_CONFLICT_LABEL_PAT }}"

View File

@@ -57,7 +57,7 @@ jobs:
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5
# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`

View File

@@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # needed for https://github.com/marketplace/actions/nx-set-shas
@@ -48,7 +48,7 @@ jobs:
- check-affected
steps:
- name: Checkout the repository
uses: actions/checkout@v4
uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies
@@ -68,7 +68,7 @@ jobs:
- test_dev
- check-affected
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install --frozen-lockfile
@@ -103,7 +103,7 @@ jobs:
- dockerfile: Dockerfile
steps:
- name: Checkout the repository
uses: actions/checkout@v4
uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- name: Install dependencies

View File

@@ -32,7 +32,7 @@ jobs:
- dockerfile: Dockerfile
steps:
- name: Checkout the repository
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set IMAGE_NAME to lowercase
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV
@@ -141,7 +141,7 @@ jobs:
run: echo "TEST_TAG=${TEST_TAG,,}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
@@ -223,7 +223,7 @@ jobs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
path: /tmp/digests
pattern: digests-*

View File

@@ -27,6 +27,7 @@ permissions:
jobs:
nightly-electron:
if: github.repository == 'TriliumNext/Trilium'
name: Deploy nightly
strategy:
fail-fast: false
@@ -47,7 +48,7 @@ jobs:
forge_platform: win32
runs-on: ${{ matrix.os.image }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
@@ -96,6 +97,7 @@ jobs:
path: apps/desktop/upload
nightly-server:
if: github.repository == 'TriliumNext/Trilium'
name: Deploy server nightly
strategy:
fail-fast: false
@@ -108,7 +110,7 @@ jobs:
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Run the build
uses: ./.github/actions/build-server

View File

@@ -14,7 +14,7 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
filter: tree:0
fetch-depth: 0

View File

@@ -32,7 +32,7 @@ jobs:
forge_platform: win32
runs-on: ${{ matrix.os.image }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
@@ -78,7 +78,7 @@ jobs:
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Run the build
uses: ./.github/actions/build-server
@@ -101,13 +101,13 @@ jobs:
steps:
- run: mkdir upload
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
sparse-checkout: |
docs/Release Notes
- name: Download all artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
merge-multiple: true
pattern: release-*

11
.github/workflows/unblock_signing.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
name: Unblock signing
on:
workflow_dispatch:
jobs:
unblock-win-signing:
runs-on: win-signing
steps:
- run: |
cat ${{ vars.WINDOWS_SIGN_ERROR_LOG }}
rm ${{ vars.WINDOWS_SIGN_ERROR_LOG }}

1
.gitignore vendored
View File

@@ -10,6 +10,7 @@ node_modules
# IDEs and editors
/.idea
.idea
.project
.classpath
.c9/

6
.idea/.gitignore generated vendored
View File

@@ -1,6 +0,0 @@
# Default ignored files
/workspace.xml
# Datasource local storage ignored files
/dataSources.local.xml
/dataSources/

View File

@@ -1,15 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</value>
</option>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

12
.idea/dataSources.xml generated
View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="document.db" uuid="2a4ac1e6-b828-4a2a-8e4a-3f59f10aff26">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/data/document.db</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

4
.idea/encodings.xml generated
View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

@@ -1,11 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSLintConfiguration">
<option devel="true" />
<option es6="true" />
<option maxerr="50" />
<option node="true" />
</component>
</project>

8
.idea/misc.xml generated
View File

@@ -1,8 +0,0 @@
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="openjdk-16" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/trilium.iml" filepath="$PROJECT_DIR$/trilium.iml" />
</modules>
</component>
</project>

7
.idea/sqldialects.xml generated
View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$" dialect="SQLite" />
<file url="PROJECT" dialect="SQLite" />
</component>
</project>

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -1,2 +1,2 @@
Adam Zivner <adam.zivner@gmail.com>
Adam Zivner <zadam.apps@gmail.com>
zadam <adam.zivner@gmail.com>
zadam <zadam.apps@gmail.com>

2
.nvmrc
View File

@@ -1 +1 @@
22.17.0
22.18.0

View File

@@ -3,6 +3,7 @@
languageIds:
- javascript
- typescript
- typescriptreact
- html
# An array of RegExes to find the key usage. **The key should be captured in the first match group**.
@@ -25,9 +26,10 @@ scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]"
# The "$1" will be replaced by the keypath specified.
refactorTemplates:
- t("$1")
- {t("$1")}
- ${t("$1")}
- <%= t("$1") %>
# If set to true, only enables this custom framework (will disable all built-in frameworks)
monopoly: true
monopoly: true

8
.vscode/mcp.json vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"servers": {
"nx-mcp": {
"type": "http",
"url": "http://localhost:9461/mcp"
}
}
}

10
.vscode/settings.json vendored
View File

@@ -28,5 +28,13 @@
"typescript.validate.enable": true,
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"search.exclude": {
"**/node_modules": true,
"docs/**/*.html": true,
"docs/**/*.png": true,
"apps/server/src/assets/doc_notes/**": true,
"apps/edit-docs/demo/**": true
},
"nxConsole.generateAiAgentRules": true
}

161
CLAUDE.md Normal file
View File

@@ -0,0 +1,161 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Overview
Trilium Notes is a hierarchical note-taking application with advanced features like synchronization, scripting, and rich text editing. It's built as a TypeScript monorepo using NX, with multiple applications and shared packages.
## Development Commands
### Setup
- `pnpm install` - Install all dependencies
- `corepack enable` - Enable pnpm if not available
### Running Applications
- `pnpm run server:start` - Start development server (http://localhost:8080)
- `pnpm nx run server:serve` - Alternative server start command
- `pnpm nx run desktop:serve` - Run desktop Electron app
- `pnpm run server:start-prod` - Run server in production mode
### Building
- `pnpm nx build <project>` - Build specific project (server, client, desktop, etc.)
- `pnpm run client:build` - Build client application
- `pnpm run server:build` - Build server application
- `pnpm run electron:build` - Build desktop application
### Testing
- `pnpm test:all` - Run all tests (parallel + sequential)
- `pnpm test:parallel` - Run tests that can run in parallel
- `pnpm test:sequential` - Run tests that must run sequentially (server, ckeditor5-mermaid, ckeditor5-math)
- `pnpm nx test <project>` - Run tests for specific project
- `pnpm coverage` - Generate coverage reports
### Linting & Type Checking
- `pnpm nx run <project>:lint` - Lint specific project
- `pnpm nx run <project>:typecheck` - Type check specific project
## Architecture Overview
### Monorepo Structure
- **apps/**: Runnable applications
- `client/` - Frontend application (shared by server and desktop)
- `server/` - Node.js server with web interface
- `desktop/` - Electron desktop application
- `web-clipper/` - Browser extension for saving web content
- Additional tools: `db-compare`, `dump-db`, `edit-docs`
- **packages/**: Shared libraries
- `commons/` - Shared interfaces and utilities
- `ckeditor5/` - Custom rich text editor with Trilium-specific plugins
- `codemirror/` - Code editor customizations
- `highlightjs/` - Syntax highlighting
- Custom CKEditor plugins: `ckeditor5-admonition`, `ckeditor5-footnotes`, `ckeditor5-math`, `ckeditor5-mermaid`
### Core Architecture Patterns
#### Three-Layer Cache System
- **Becca** (Backend Cache): Server-side entity cache (`apps/server/src/becca/`)
- **Froca** (Frontend Cache): Client-side mirror of backend data (`apps/client/src/services/froca.ts`)
- **Shaca** (Share Cache): Optimized cache for shared/published notes (`apps/server/src/share/`)
#### Entity System
Core entities are defined in `apps/server/src/becca/entities/`:
- `BNote` - Notes with content and metadata
- `BBranch` - Hierarchical relationships between notes (allows multiple parents)
- `BAttribute` - Key-value metadata attached to notes
- `BRevision` - Note version history
- `BOption` - Application configuration
#### Widget-Based UI
Frontend uses a widget system (`apps/client/src/widgets/`):
- `BasicWidget` - Base class for all UI components
- `NoteContextAwareWidget` - Widgets that respond to note changes
- `RightPanelWidget` - Widgets displayed in the right panel
- Type-specific widgets in `type_widgets/` directory
#### API Architecture
- **Internal API**: REST endpoints in `apps/server/src/routes/api/`
- **ETAPI**: External API for third-party integrations (`apps/server/src/etapi/`)
- **WebSocket**: Real-time synchronization (`apps/server/src/services/ws.ts`)
### Key Files for Understanding Architecture
1. **Application Entry Points**:
- `apps/server/src/main.ts` - Server startup
- `apps/client/src/desktop.ts` - Client initialization
2. **Core Services**:
- `apps/server/src/becca/becca.ts` - Backend data management
- `apps/client/src/services/froca.ts` - Frontend data synchronization
- `apps/server/src/services/backend_script_api.ts` - Scripting API
3. **Database Schema**:
- `apps/server/src/assets/db/schema.sql` - Core database structure
4. **Configuration**:
- `nx.json` - NX workspace configuration
- `package.json` - Project dependencies and scripts
## Note Types and Features
Trilium supports multiple note types, each with specialized widgets:
- **Text**: Rich text with CKEditor5 (markdown import/export)
- **Code**: Syntax-highlighted code editing with CodeMirror
- **File**: Binary file attachments
- **Image**: Image display with editing capabilities
- **Canvas**: Drawing/diagramming with Excalidraw
- **Mermaid**: Diagram generation
- **Relation Map**: Visual note relationship mapping
- **Web View**: Embedded web pages
- **Doc/Book**: Hierarchical documentation structure
## Development Guidelines
### Testing Strategy
- Server tests run sequentially due to shared database
- Client tests can run in parallel
- E2E tests use Playwright for both server and desktop apps
- Build validation tests check artifact integrity
### Scripting System
Trilium provides powerful user scripting capabilities:
- Frontend scripts run in browser context
- Backend scripts run in Node.js context with full API access
- Script API documentation available in `docs/Script API/`
### Internationalization
- Translation files in `apps/client/src/translations/`
- Supported languages: English, German, Spanish, French, Romanian, Chinese
### Security Considerations
- Per-note encryption with granular protected sessions
- CSRF protection for API endpoints
- OpenID and TOTP authentication support
- Sanitization of user-generated content
## Common Development Tasks
### Adding New Note Types
1. Create widget in `apps/client/src/widgets/type_widgets/`
2. Register in `apps/client/src/services/note_types.ts`
3. Add backend handling in `apps/server/src/services/notes.ts`
### Extending Search
- Search expressions handled in `apps/server/src/services/search/`
- Add new search operators in search context files
### Custom CKEditor Plugins
- Create new package in `packages/` following existing plugin structure
- Register in `packages/ckeditor5/src/plugins.ts`
### Database Migrations
- Add migration scripts in `apps/server/src/migrations/`
- Update schema in `apps/server/src/assets/db/schema.sql`
## Build System Notes
- Uses NX for monorepo management with build caching
- Vite for fast development builds
- ESBuild for production optimization
- pnpm workspaces for dependency management
- Docker support with multi-stage builds

View File

@@ -1,9 +1,9 @@
# Trilium Notes
![GitHub Sponsors](https://img.shields.io/github/sponsors/eliandoran?style=flat-square)
![Docker Pulls](https://img.shields.io/docker/pulls/triliumnext/notes?style=flat-square)
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/triliumnext/notes/total?style=flat-square)
[![RelativeCI](https://badges.relative-ci.com/badges/Di5q7dz9daNDZ9UXi0Bp?branch=develop&style=flat-square)](https://app.relative-ci.com/projects/Di5q7dz9daNDZ9UXi0Bp)
![GitHub Sponsors](https://img.shields.io/github/sponsors/eliandoran) ![LiberaPay patrons](https://img.shields.io/liberapay/patrons/ElianDoran)
![Docker Pulls](https://img.shields.io/docker/pulls/triliumnext/notes)
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/triliumnext/notes/total)
[![RelativeCI](https://badges.relative-ci.com/badges/Di5q7dz9daNDZ9UXi0Bp?branch=develop)](https://app.relative-ci.com/projects/Di5q7dz9daNDZ9UXi0Bp) [![Translation status](https://hosted.weblate.org/widget/trilium/svg-badge.svg)](https://hosted.weblate.org/engage/trilium/)
[English](./README.md) | [Chinese](./docs/README-ZH_CN.md) | [Russian](./docs/README.ru.md) | [Japanese](./docs/README.ja.md) | [Italian](./docs/README.it.md) | [Spanish](./docs/README.es.md)
@@ -82,7 +82,7 @@ Feel free to join our official conversations. We would love to hear what feature
### Windows / MacOS
Download the binary release for your platform from the [latest release page](https://github.com/TriliumNext/Notes/releases/latest), unzip the package and run the `trilium` executable.
Download the binary release for your platform from the [latest release page](https://github.com/TriliumNext/Trilium/releases/latest), unzip the package and run the `trilium` executable.
### Linux
@@ -90,7 +90,7 @@ If your distribution is listed in the table below, use your distribution's packa
[![Packaging status](https://repology.org/badge/vertical-allrepos/triliumnext.svg)](https://repology.org/project/triliumnext/versions)
You may also download the binary release for your platform from the [latest release page](https://github.com/TriliumNext/Notes/releases/latest), unzip the package and run the `trilium` executable.
You may also download the binary release for your platform from the [latest release page](https://github.com/TriliumNext/Trilium/releases/latest), unzip the package and run the `trilium` executable.
TriliumNext is also provided as a Flatpak, but not yet published on FlatHub.
@@ -115,12 +115,20 @@ To install TriliumNext on your own server (including via Docker from [Dockerhub]
## 💻 Contribute
### Translations
If you are a native speaker, help us translate Trilium by heading over to our [Weblate page](https://hosted.weblate.org/engage/trilium/).
Here's the language coverage we have so far:
[![Translation status](https://hosted.weblate.org/widget/trilium/multi-auto.svg)](https://hosted.weblate.org/engage/trilium/)
### Code
Download the repository, install dependencies using `pnpm` and then run the server (available at http://localhost:8080):
```shell
git clone https://github.com/TriliumNext/Notes.git
cd Notes
git clone https://github.com/TriliumNext/Trilium.git
cd Trilium
pnpm install
pnpm run server:start
```
@@ -129,8 +137,8 @@ pnpm run server:start
Download the repository, install dependencies using `pnpm` and then run the environment required to edit the documentation:
```shell
git clone https://github.com/TriliumNext/Notes.git
cd Notes
git clone https://github.com/TriliumNext/Trilium.git
cd Trilium
pnpm install
pnpm nx run edit-docs:edit-docs
```
@@ -138,8 +146,8 @@ pnpm nx run edit-docs:edit-docs
### Building the Executable
Download the repository, install dependencies using `pnpm` and then build the desktop app for Windows:
```shell
git clone https://github.com/TriliumNext/Notes.git
cd Notes
git clone https://github.com/TriliumNext/Trilium.git
cd Trilium
pnpm install
pnpm nx --project=desktop electron-forge:make -- --arch=x64 --platform=win32
```

View File

@@ -35,13 +35,13 @@
"chore:generate-openapi": "tsx bin/generate-openapi.js"
},
"devDependencies": {
"@playwright/test": "1.53.2",
"@stylistic/eslint-plugin": "5.1.0",
"@playwright/test": "1.54.2",
"@stylistic/eslint-plugin": "5.2.3",
"@types/express": "5.0.3",
"@types/node": "22.16.2",
"@types/node": "22.17.1",
"@types/yargs": "17.0.33",
"@vitest/coverage-v8": "3.2.4",
"eslint": "9.30.1",
"eslint": "9.33.0",
"eslint-plugin-simple-import-sort": "12.1.1",
"esm": "3.2.25",
"jsdoc": "4.0.4",
@@ -49,8 +49,8 @@
"rcedit": "4.0.1",
"rimraf": "6.0.1",
"tslib": "2.8.1",
"typedoc": "0.28.7",
"typedoc-plugin-missing-exports": "4.0.0"
"typedoc": "0.28.10",
"typedoc-plugin-missing-exports": "4.1.0"
},
"optionalDependencies": {
"appdmg": "0.6.6"

View File

@@ -1,6 +1,6 @@
{
"name": "@triliumnext/client",
"version": "0.96.0",
"version": "0.97.2",
"description": "JQuery-based client for TriliumNext, used for both web and desktop (via Electron)",
"private": true,
"license": "AGPL-3.0-only",
@@ -10,14 +10,15 @@
"url": "https://github.com/TriliumNext/Notes"
},
"dependencies": {
"@eslint/js": "9.30.1",
"@eslint/js": "9.33.0",
"@excalidraw/excalidraw": "0.18.0",
"@fullcalendar/core": "6.1.18",
"@fullcalendar/daygrid": "6.1.18",
"@fullcalendar/interaction": "6.1.18",
"@fullcalendar/list": "6.1.18",
"@fullcalendar/multimonth": "6.1.18",
"@fullcalendar/timegrid": "6.1.18",
"@fullcalendar/core": "6.1.19",
"@fullcalendar/daygrid": "6.1.19",
"@fullcalendar/interaction": "6.1.19",
"@fullcalendar/list": "6.1.19",
"@fullcalendar/multimonth": "6.1.19",
"@fullcalendar/timegrid": "6.1.19",
"@maplibre/maplibre-gl-leaflet": "0.1.3",
"@mermaid-js/layout-elk": "0.1.8",
"@mind-elixir/node-menu": "5.0.0",
"@popperjs/core": "2.11.8",
@@ -35,10 +36,9 @@
"draggabilly": "3.0.0",
"force-graph": "1.50.1",
"globals": "16.3.0",
"i18next": "25.3.1",
"i18next": "25.3.4",
"i18next-http-backend": "3.0.2",
"jquery": "3.7.1",
"jquery-hotkeys": "0.2.2",
"jquery.fancytree": "2.38.5",
"jsplumb": "2.15.6",
"katex": "0.16.22",
@@ -46,29 +46,31 @@
"leaflet": "1.9.4",
"leaflet-gpx": "2.2.0",
"mark.js": "8.11.1",
"marked": "16.0.0",
"mermaid": "11.8.1",
"mind-elixir": "5.0.1",
"marked": "16.1.2",
"mermaid": "11.9.0",
"mind-elixir": "5.0.5",
"normalize.css": "8.0.1",
"panzoom": "9.4.3",
"preact": "10.26.9",
"preact": "10.27.0",
"split.js": "1.6.5",
"svg-pan-zoom": "3.6.2",
"tabulator-tables": "6.3.1",
"vanilla-js-wheel-zoom": "9.0.4"
"vanilla-js-wheel-zoom": "9.0.4",
"photoswipe": "^5.4.4"
},
"devDependencies": {
"@ckeditor/ckeditor5-inspector": "4.1.0",
"@ckeditor/ckeditor5-inspector": "5.0.0",
"@preact/preset-vite": "2.10.2",
"@types/bootstrap": "5.2.10",
"@types/jquery": "3.5.32",
"@types/leaflet": "1.9.20",
"@types/leaflet-gpx": "1.3.7",
"@types/mark.js": "8.11.12",
"@types/tabulator-tables": "6.2.7",
"copy-webpack-plugin": "13.0.0",
"@types/tabulator-tables": "6.2.10",
"copy-webpack-plugin": "13.0.1",
"happy-dom": "18.0.1",
"script-loader": "0.7.2",
"vite-plugin-static-copy": "3.1.0"
"vite-plugin-static-copy": "3.1.1"
},
"nx": {
"name": "client",

View File

@@ -28,6 +28,9 @@ import TouchBarComponent from "./touch_bar.js";
import type { CKTextEditor } from "@triliumnext/ckeditor5";
import type CodeMirror from "@triliumnext/codemirror";
import { StartupChecks } from "./startup_checks.js";
import type { CreateNoteOpts } from "../services/note_create.js";
import { ColumnComponent } from "tabulator-tables";
import { ChooseNoteTypeCallback } from "../widgets/dialogs/note_type_chooser.jsx";
interface Layout {
getRootWidget: (appContext: AppContext) => RootWidget;
@@ -90,7 +93,9 @@ export type CommandMappings = {
closeTocCommand: CommandData;
closeHlt: CommandData;
showLaunchBarSubtree: CommandData;
showRevisions: CommandData;
showRevisions: CommandData & {
noteId?: string | null;
};
showLlmChat: CommandData;
createAiChat: CommandData;
showOptions: CommandData & {
@@ -122,6 +127,7 @@ export type CommandMappings = {
showImportDialog: CommandData & { noteId: string };
openNewNoteSplit: NoteCommandData;
openInWindow: NoteCommandData;
openInPopup: CommandData & { noteIdOrPath: string; };
openNoteInNewTab: CommandData;
openNoteInNewSplit: CommandData;
openNoteInNewWindow: CommandData;
@@ -130,6 +136,8 @@ export type CommandMappings = {
hideLeftPane: CommandData;
showCpuArchWarning: CommandData;
showLeftPane: CommandData;
showAttachments: CommandData;
showSearchHistory: CommandData;
hoistNote: CommandData & { noteId: string };
leaveProtectedSession: CommandData;
enterProtectedSession: CommandData;
@@ -140,6 +148,7 @@ export type CommandMappings = {
};
openInTab: ContextMenuCommandData;
openNoteInSplit: ContextMenuCommandData;
openNoteInPopup: ContextMenuCommandData;
toggleNoteHoisting: ContextMenuCommandData;
insertNoteAfter: ContextMenuCommandData;
insertChildNote: ContextMenuCommandData;
@@ -169,7 +178,7 @@ export type CommandMappings = {
deleteNotes: ContextMenuCommandData;
importIntoNote: ContextMenuCommandData;
exportNote: ContextMenuCommandData;
searchInSubtree: ContextMenuCommandData;
searchInSubtree: CommandData & { notePath: string; };
moveNoteUp: ContextMenuCommandData;
moveNoteDown: ContextMenuCommandData;
moveNoteUpInHierarchy: ContextMenuCommandData;
@@ -258,6 +267,73 @@ export type CommandMappings = {
closeThisNoteSplit: CommandData;
moveThisNoteSplit: CommandData & { isMovingLeft: boolean };
jumpToNote: CommandData;
commandPalette: CommandData;
// Keyboard shortcuts
backInNoteHistory: CommandData;
forwardInNoteHistory: CommandData;
forceSaveRevision: CommandData;
scrollToActiveNote: CommandData;
quickSearch: CommandData;
collapseTree: CommandData;
createNoteAfter: CommandData;
createNoteInto: CommandData;
addNoteAboveToSelection: CommandData;
addNoteBelowToSelection: CommandData;
openNewTab: CommandData;
activateNextTab: CommandData;
activatePreviousTab: CommandData;
openNewWindow: CommandData;
toggleTray: CommandData;
firstTab: CommandData;
secondTab: CommandData;
thirdTab: CommandData;
fourthTab: CommandData;
fifthTab: CommandData;
sixthTab: CommandData;
seventhTab: CommandData;
eigthTab: CommandData;
ninthTab: CommandData;
lastTab: CommandData;
showNoteSource: CommandData;
showSQLConsole: CommandData;
showBackendLog: CommandData;
showCheatsheet: CommandData;
showHelp: CommandData;
addLinkToText: CommandData;
followLinkUnderCursor: CommandData;
insertDateTimeToText: CommandData;
pasteMarkdownIntoText: CommandData;
cutIntoNote: CommandData;
addIncludeNoteToText: CommandData;
editReadOnlyNote: CommandData;
toggleRibbonTabClassicEditor: CommandData;
toggleRibbonTabBasicProperties: CommandData;
toggleRibbonTabBookProperties: CommandData;
toggleRibbonTabFileProperties: CommandData;
toggleRibbonTabImageProperties: CommandData;
toggleRibbonTabOwnedAttributes: CommandData;
toggleRibbonTabInheritedAttributes: CommandData;
toggleRibbonTabPromotedAttributes: CommandData;
toggleRibbonTabNoteMap: CommandData;
toggleRibbonTabNoteInfo: CommandData;
toggleRibbonTabNotePaths: CommandData;
toggleRibbonTabSimilarNotes: CommandData;
toggleRightPane: CommandData;
printActiveNote: CommandData;
exportAsPdf: CommandData;
openNoteExternally: CommandData;
renderActiveNote: CommandData;
unhoist: CommandData;
reloadFrontendApp: CommandData;
openDevTools: CommandData;
findInText: CommandData;
toggleLeftPane: CommandData;
toggleFullscreen: CommandData;
zoomOut: CommandData;
zoomIn: CommandData;
zoomReset: CommandData;
copyWithoutFormatting: CommandData;
// Geomap
deleteFromMap: { noteId: string };
@@ -274,12 +350,30 @@ export type CommandMappings = {
geoMapCreateChildNote: CommandData;
// Table view
addNewRow: CommandData & {
customOpts: CreateNoteOpts;
parentNotePath?: string;
};
addNewTableColumn: CommandData & {
columnToEdit?: ColumnComponent;
referenceColumn?: ColumnComponent;
direction?: "before" | "after";
type?: "label" | "relation";
};
deleteTableColumn: CommandData & {
columnToDelete?: ColumnComponent;
};
buildTouchBar: CommandData & {
TouchBar: typeof TouchBar;
buildIcon(name: string): NativeImage;
};
refreshTouchBar: CommandData;
reloadTextEditor: CommandData;
chooseNoteType: CommandData & {
callback: ChooseNoteTypeCallback
}
};
type EventMappings = {

View File

@@ -30,13 +30,6 @@ interface CreateChildrenResponse {
export default class Entrypoints extends Component {
constructor() {
super();
if (jQuery.hotkeys) {
// hot keys are active also inside inputs and content editables
jQuery.hotkeys.options.filterInputAcceptingElements = false;
jQuery.hotkeys.options.filterContentEditable = false;
jQuery.hotkeys.options.filterTextInputs = false;
}
}
openDevToolsCommand() {
@@ -113,7 +106,9 @@ export default class Entrypoints extends Component {
if (win.isFullScreenable()) {
win.setFullScreen(!win.isFullScreen());
}
} // outside of electron this is handled by the browser
} else {
document.documentElement.requestFullscreen();
}
}
reloadFrontendAppCommand() {

View File

@@ -325,8 +325,9 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
return false;
}
// Some book types must always display a note list, even if no children.
if (["calendar", "table", "geoMap"].includes(note.getLabelValue("viewType") ?? "")) {
// Collections must always display a note list, even if no children.
const viewType = note.getLabelValue("viewType") ?? "grid";
if (!["list", "grid"].includes(viewType)) {
return true;
}

View File

@@ -13,7 +13,8 @@ import type ElectronRemote from "@electron/remote";
import type Electron from "electron";
import "./stylesheets/bootstrap.scss";
import "boxicons/css/boxicons.min.css";
import "jquery-hotkeys";
import "./stylesheets/media-viewer.css";
import "./styles/gallery.css";
import "autocomplete.js/index_jquery.js";
await appContext.earlyInit();

View File

@@ -256,6 +256,20 @@ class FNote {
return this.children;
}
async getSubtreeNoteIds() {
let noteIds: (string | string[])[] = [];
for (const child of await this.getChildNotes()) {
noteIds.push(child.noteId);
noteIds.push(await child.getSubtreeNoteIds());
}
return noteIds.flat();
}
async getSubtreeNotes() {
const noteIds = await this.getSubtreeNoteIds();
return this.froca.getNotes(noteIds);
}
async getChildNotes() {
return await this.froca.getNotes(this.children);
}

View File

@@ -46,28 +46,7 @@ import SharedInfoWidget from "../widgets/shared_info.js";
import FindWidget from "../widgets/find.js";
import TocWidget from "../widgets/toc.js";
import HighlightsListWidget from "../widgets/highlights_list.js";
import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js";
import AboutDialog from "../widgets/dialogs/about.js";
import HelpDialog from "../widgets/dialogs/help.js";
import RecentChangesDialog from "../widgets/dialogs/recent_changes.js";
import BranchPrefixDialog from "../widgets/dialogs/branch_prefix.js";
import SortChildNotesDialog from "../widgets/dialogs/sort_child_notes.js";
import PasswordNoteSetDialog from "../widgets/dialogs/password_not_set.js";
import IncludeNoteDialog from "../widgets/dialogs/include_note.js";
import NoteTypeChooserDialog from "../widgets/dialogs/note_type_chooser.js";
import JumpToNoteDialog from "../widgets/dialogs/jump_to_note.js";
import AddLinkDialog from "../widgets/dialogs/add_link.js";
import CloneToDialog from "../widgets/dialogs/clone_to.js";
import MoveToDialog from "../widgets/dialogs/move_to.js";
import ImportDialog from "../widgets/dialogs/import.js";
import ExportDialog from "../widgets/dialogs/export.js";
import MarkdownImportDialog from "../widgets/dialogs/markdown_import.js";
import ProtectedSessionPasswordDialog from "../widgets/dialogs/protected_session_password.js";
import RevisionsDialog from "../widgets/dialogs/revisions.js";
import DeleteNotesDialog from "../widgets/dialogs/delete_notes.js";
import InfoDialog from "../widgets/dialogs/info.js";
import ConfirmDialog from "../widgets/dialogs/confirm.js";
import PromptDialog from "../widgets/dialogs/prompt.js";
import FloatingButtons from "../widgets/floating_buttons/floating_buttons.js";
import RelationMapButtons from "../widgets/floating_buttons/relation_map_buttons.js";
import SvgExportButton from "../widgets/floating_buttons/svg_export_button.js";
@@ -83,7 +62,7 @@ import CopyImageReferenceButton from "../widgets/floating_buttons/copy_image_ref
import ScrollPaddingWidget from "../widgets/scroll_padding.js";
import ClassicEditorToolbar from "../widgets/ribbon_widgets/classic_editor_toolbar.js";
import options from "../services/options.js";
import utils, { hasTouchBar } from "../services/utils.js";
import utils from "../services/utils.js";
import GeoMapButtons from "../widgets/floating_buttons/geo_map_button.js";
import ContextualHelpButton from "../widgets/floating_buttons/help_button.js";
import CloseZenButton from "../widgets/close_zen_button.js";
@@ -229,7 +208,7 @@ export default class DesktopLayout {
.child(new PromotedAttributesWidget())
.child(new SqlTableSchemasWidget())
.child(new NoteDetailWidget())
.child(new NoteListWidget())
.child(new NoteListWidget(false))
.child(new SearchResultWidget())
.child(new SqlResultWidget())
.child(new ScrollPaddingWidget())

View File

@@ -22,6 +22,15 @@ import RevisionsDialog from "../widgets/dialogs/revisions.js";
import DeleteNotesDialog from "../widgets/dialogs/delete_notes.js";
import InfoDialog from "../widgets/dialogs/info.js";
import IncorrectCpuArchDialog from "../widgets/dialogs/incorrect_cpu_arch.js";
import PopupEditorDialog from "../widgets/dialogs/popup_editor.js";
import FlexContainer from "../widgets/containers/flex_container.js";
import NoteIconWidget from "../widgets/note_icon.js";
import NoteTitleWidget from "../widgets/note_title.js";
import ClassicEditorToolbar from "../widgets/ribbon_widgets/classic_editor_toolbar.js";
import PromotedAttributesWidget from "../widgets/ribbon_widgets/promoted_attributes.js";
import NoteDetailWidget from "../widgets/note_detail.js";
import NoteListWidget from "../widgets/note_list.js";
import { CallToActionDialog } from "../widgets/dialogs/call_to_action.jsx";
export function applyModals(rootContainer: RootContainer) {
rootContainer
@@ -47,4 +56,16 @@ export function applyModals(rootContainer: RootContainer) {
.child(new ConfirmDialog())
.child(new PromptDialog())
.child(new IncorrectCpuArchDialog())
.child(new PopupEditorDialog()
.child(new FlexContainer("row")
.class("title-row")
.css("align-items", "center")
.cssBlock(".title-row > * { margin: 5px; }")
.child(new NoteIconWidget())
.child(new NoteTitleWidget()))
.child(new ClassicEditorToolbar())
.child(new PromotedAttributesWidget())
.child(new NoteDetailWidget())
.child(new NoteListWidget(true)))
.child(new CallToActionDialog());
}

View File

@@ -26,6 +26,7 @@ import TabRowWidget from "../widgets/tab_row.js";
import RefreshButton from "../widgets/floating_buttons/refresh_button.js";
import MobileEditorToolbar from "../widgets/ribbon_widgets/mobile_editor_toolbar.js";
import { applyModals } from "./layout_commons.js";
import CloseZenButton from "../widgets/close_zen_button.js";
const MOBILE_CSS = `
<style>
@@ -162,7 +163,7 @@ export default class MobileLayout {
.filling()
.contentSized()
.child(new NoteDetailWidget())
.child(new NoteListWidget())
.child(new NoteListWidget(false))
.child(new FilePropertiesWidget().css("font-size", "smaller"))
)
.child(new MobileEditorToolbar())
@@ -174,7 +175,8 @@ export default class MobileLayout {
.id("mobile-bottom-bar")
.child(new TabRowWidget().css("height", "40px"))
.child(new FlexContainer("row").class("horizontal").css("height", "53px").child(new LauncherContainer(true)).child(new GlobalMenuWidget(true)).id("launcher-pane"))
);
)
.child(new CloseZenButton());
applyModals(rootContainer);
return rootContainer;
}

View File

@@ -26,6 +26,11 @@ export interface MenuCommandItem<T> {
title: string;
command?: T;
type?: string;
/**
* The icon to display in the menu item.
*
* If not set, no icon is displayed and the item will appear shifted slightly to the left if there are other items with icons. To avoid this, use `bx bx-empty`.
*/
uiIcon?: string;
badges?: MenuItemBadge[];
templateNoteId?: string;

View File

@@ -2,6 +2,8 @@ import { t } from "../services/i18n.js";
import utils from "../services/utils.js";
import contextMenu from "./context_menu.js";
import imageService from "../services/image.js";
import mediaViewer from "../services/media_viewer.js";
import type { MediaItem } from "../services/media_viewer.js";
const PROP_NAME = "imageContextMenuInstalled";
@@ -18,6 +20,12 @@ function setupContextMenu($image: JQuery<HTMLElement>) {
x: e.pageX,
y: e.pageY,
items: [
{
title: "View in Lightbox",
command: "viewInLightbox",
uiIcon: "bx bx-expand",
enabled: true
},
{
title: t("image_context_menu.copy_reference_to_clipboard"),
command: "copyImageReferenceToClipboard",
@@ -30,7 +38,48 @@ function setupContextMenu($image: JQuery<HTMLElement>) {
}
],
selectMenuItemHandler: async ({ command }) => {
if (command === "copyImageReferenceToClipboard") {
if (command === "viewInLightbox") {
const src = $image.attr("src");
const alt = $image.attr("alt");
const title = $image.attr("title");
if (!src) {
console.error("Missing image source");
return;
}
const item: MediaItem = {
src: src,
alt: alt || "Image",
title: title || alt,
element: $image[0] as HTMLElement
};
// Try to get actual dimensions
const imgElement = $image[0] as HTMLImageElement;
if (imgElement.naturalWidth && imgElement.naturalHeight) {
item.width = imgElement.naturalWidth;
item.height = imgElement.naturalHeight;
}
mediaViewer.openSingle(item, {
bgOpacity: 0.95,
showHideOpacity: true,
pinchToClose: true,
closeOnScroll: false,
closeOnVerticalDrag: true,
wheelToZoom: true,
getThumbBoundsFn: () => {
// Get position for zoom animation
const rect = imgElement.getBoundingClientRect();
return {
x: rect.left,
y: rect.top,
w: rect.width
};
}
});
} else if (command === "copyImageReferenceToClipboard") {
imageService.copyImageReferenceToClipboard($image);
} else if (command === "copyImageToClipboard") {
try {

View File

@@ -16,7 +16,8 @@ function getItems(): MenuItem<CommandNames>[] {
return [
{ title: t("link_context_menu.open_note_in_new_tab"), command: "openNoteInNewTab", uiIcon: "bx bx-link-external" },
{ title: t("link_context_menu.open_note_in_new_split"), command: "openNoteInNewSplit", uiIcon: "bx bx-dock-right" },
{ title: t("link_context_menu.open_note_in_new_window"), command: "openNoteInNewWindow", uiIcon: "bx bx-window-open" }
{ title: t("link_context_menu.open_note_in_new_window"), command: "openNoteInNewWindow", uiIcon: "bx bx-window-open" },
{ title: t("link_context_menu.open_note_in_popup"), command: "openNoteInPopup", uiIcon: "bx bx-edit" }
];
}
@@ -40,6 +41,8 @@ function handleLinkContextMenuItem(command: string | undefined, notePath: string
appContext.triggerCommand("openNewNoteSplit", { ntxId, notePath, hoistedNoteId, viewScope });
} else if (command === "openNoteInNewWindow") {
appContext.triggerCommand("openInWindow", { notePath, hoistedNoteId, viewScope });
} else if (command === "openNoteInPopup") {
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath })
}
}

View File

@@ -23,7 +23,7 @@ let lastTargetNode: HTMLElement | null = null;
// This will include all commands that implement ContextMenuCommandData, but it will not work if it additional options are added via the `|` operator,
// so they need to be added manually.
export type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData> | "openBulkActionsDialog";
export type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData> | "openBulkActionsDialog" | "searchInSubtree";
export default class TreeContextMenu implements SelectMenuItemEventListener<TreeCommandNames> {
private treeWidget: NoteTreeWidget;
@@ -70,8 +70,8 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
const items: (MenuItem<TreeCommandNames> | null)[] = [
{ title: `${t("tree-context-menu.open-in-a-new-tab")}`, command: "openInTab", uiIcon: "bx bx-link-external", enabled: noSelectedNotes },
{ title: t("tree-context-menu.open-in-a-new-split"), command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes },
{ title: t("tree-context-menu.open-in-popup"), command: "openNoteInPopup", uiIcon: "bx bx-edit", enabled: noSelectedNotes },
isHoisted
? null
@@ -129,12 +129,6 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
enabled: isNotRoot && parentNotSearch && noSelectedNotes && notOptionsOrHelp
},
{ title: t("tree-context-menu.convert-to-attachment"), command: "convertNoteToAttachment", uiIcon: "bx bx-paperclip", enabled: isNotRoot && !isHoisted && notOptionsOrHelp },
{
title: `${t("tree-context-menu.duplicate-subtree")} <kbd data-command="duplicateSubtree">`,
command: "duplicateSubtree",
uiIcon: "bx bx-outline",
enabled: parentNotSearch && isNotRoot && !isHoisted && notOptionsOrHelp
},
{ title: "----" },
@@ -188,6 +182,13 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
{ title: `${t("tree-context-menu.clone-to")} <kbd data-command="cloneNotesTo"></kbd>`, command: "cloneNotesTo", uiIcon: "bx bx-duplicate", enabled: isNotRoot && !isHoisted },
{
title: `${t("tree-context-menu.duplicate")} <kbd data-command="duplicateSubtree">`,
command: "duplicateSubtree",
uiIcon: "bx bx-outline",
enabled: parentNotSearch && isNotRoot && !isHoisted && notOptionsOrHelp
},
{
title: `${t("tree-context-menu.delete")} <kbd data-command="deleteNotes"></kbd>`,
command: "deleteNotes",
@@ -246,6 +247,8 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
const { ntxId } = subContexts?.[subContexts.length - 1] ?? {};
this.treeWidget.triggerCommand("openNewNoteSplit", { ntxId, notePath });
} else if (command === "openNoteInPopup") {
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath })
} else if (command === "convertNoteToAttachment") {
if (!(await dialogService.confirm(t("tree-context-menu.convert-to-attachment-confirm")))) {
return;

View File

@@ -3,6 +3,7 @@ import noteAutocompleteService from "./services/note_autocomplete.js";
import glob from "./services/glob.js";
import "./stylesheets/bootstrap.scss";
import "boxicons/css/boxicons.min.css";
import "./stylesheets/media-viewer.css";
import "autocomplete.js/index_jquery.js";
glob.setupGlobs();

View File

@@ -79,7 +79,19 @@ async function renderAttributes(attributes: FAttribute[], renderIsInheritable: b
return $container;
}
const HIDDEN_ATTRIBUTES = ["originalFileName", "fileSize", "template", "inherit", "cssClass", "iconClass", "pageSize", "viewType", "geolocation", "docName"];
const HIDDEN_ATTRIBUTES = [
"originalFileName",
"fileSize",
"template",
"inherit",
"cssClass",
"iconClass",
"pageSize",
"viewType",
"geolocation",
"docName",
"webViewSrc"
];
async function renderNormalAttributes(note: FNote) {
const promotedDefinitionAttributes = note.getPromotedDefinitionAttributes();

View File

@@ -12,11 +12,12 @@ async function addLabel(noteId: string, name: string, value: string = "", isInhe
});
}
export async function setLabel(noteId: string, name: string, value: string = "") {
export async function setLabel(noteId: string, name: string, value: string = "", isInheritable = false) {
await server.put(`notes/${noteId}/set-attribute`, {
type: "label",
name: name,
value: value
value: value,
isInheritable
});
}

View File

@@ -95,7 +95,15 @@ async function moveToParentNote(branchIdsToMove: string[], newParentBranchId: st
}
}
async function deleteNotes(branchIdsToDelete: string[], forceDeleteAllClones = false) {
/**
* Shows the delete confirmation screen
*
* @param branchIdsToDelete the list of branch IDs to delete.
* @param forceDeleteAllClones whether to check by default the "Delete also all clones" checkbox.
* @param moveToParent whether to automatically go to the parent note path after a succesful delete. Usually makes sense if deleting the active note(s).
* @returns promise that returns false if the operation was cancelled or there was nothing to delete, true if the operation succeeded.
*/
async function deleteNotes(branchIdsToDelete: string[], forceDeleteAllClones = false, moveToParent = true) {
branchIdsToDelete = filterRootNote(branchIdsToDelete);
if (branchIdsToDelete.length === 0) {
@@ -110,10 +118,12 @@ async function deleteNotes(branchIdsToDelete: string[], forceDeleteAllClones = f
return false;
}
try {
await activateParentNotePath();
} catch (e) {
console.error(e);
if (moveToParent) {
try {
await activateParentNotePath();
} catch (e) {
console.error(e);
}
}
const taskId = utils.randomString(10);

View File

@@ -15,6 +15,8 @@ import AddRelationBulkAction from "../widgets/bulk_actions/relation/add_relation
import RenameNoteBulkAction from "../widgets/bulk_actions/note/rename_note.js";
import { t } from "./i18n.js";
import type FNote from "../entities/fnote.js";
import toast from "./toast.js";
import { BulkAction } from "@triliumnext/commons";
const ACTION_GROUPS = [
{
@@ -89,6 +91,17 @@ function parseActions(note: FNote) {
.filter((action) => !!action);
}
export async function executeBulkActions(targetNoteIds: string[], actions: BulkAction[], includeDescendants = false) {
await server.post("bulk-action/execute", {
noteIds: targetNoteIds,
includeDescendants,
actions
});
await ws.waitForMaxKnownEntityChangeId();
toast.showMessage(t("bulk_actions.bulk_actions_executed"), 3000);
}
export default {
addAction,
parseActions,

View File

@@ -0,0 +1,521 @@
/**
* CKEditor PhotoSwipe Integration
* Handles click-to-lightbox functionality for images in CKEditor content
*/
import mediaViewer from './media_viewer.js';
import galleryManager from './gallery_manager.js';
import appContext from '../components/app_context.js';
import type { MediaItem } from './media_viewer.js';
import type { GalleryItem } from './gallery_manager.js';
/**
* Configuration for CKEditor PhotoSwipe integration
*/
interface CKEditorPhotoSwipeConfig {
enableGalleryMode?: boolean;
showHints?: boolean;
hintDelay?: number;
excludeSelector?: string;
}
/**
* Integration manager for CKEditor and PhotoSwipe
*/
class CKEditorPhotoSwipeIntegration {
private static instance: CKEditorPhotoSwipeIntegration;
private config: Required<CKEditorPhotoSwipeConfig>;
private observers: Map<HTMLElement, MutationObserver> = new Map();
private processedImages: WeakSet<HTMLImageElement> = new WeakSet();
private containerGalleries: Map<HTMLElement, GalleryItem[]> = new Map();
private hintPool: HTMLElement[] = [];
private activeHints: Map<string, HTMLElement> = new Map();
private hintTimeouts: Map<string, number> = new Map();
private constructor() {
this.config = {
enableGalleryMode: true,
showHints: true,
hintDelay: 2000,
excludeSelector: '.no-lightbox, .cke_widget_element'
};
}
/**
* Get singleton instance
*/
static getInstance(): CKEditorPhotoSwipeIntegration {
if (!CKEditorPhotoSwipeIntegration.instance) {
CKEditorPhotoSwipeIntegration.instance = new CKEditorPhotoSwipeIntegration();
}
return CKEditorPhotoSwipeIntegration.instance;
}
/**
* Setup integration for a CKEditor content container
*/
setupContainer(container: HTMLElement | JQuery<HTMLElement>, config?: Partial<CKEditorPhotoSwipeConfig>): void {
const element = container instanceof $ ? container[0] : container;
if (!element) return;
// Merge configuration
if (config) {
this.config = { ...this.config, ...config };
}
// Process existing images
this.processImages(element);
// Setup mutation observer for dynamically added images
this.observeContainer(element);
// Setup gallery if enabled
if (this.config.enableGalleryMode) {
this.setupGalleryMode(element);
}
}
/**
* Process all images in a container
*/
private processImages(container: HTMLElement): void {
const images = container.querySelectorAll<HTMLImageElement>(`img:not(${this.config.excludeSelector})`);
images.forEach(img => {
if (!this.processedImages.has(img)) {
this.setupImageLightbox(img);
this.processedImages.add(img);
}
});
}
/**
* Setup lightbox for a single image
*/
private setupImageLightbox(img: HTMLImageElement): void {
// Skip if already processed or is a CKEditor widget element
if (img.closest('.cke_widget_element') || img.closest('.ck-widget')) {
return;
}
// Make image clickable and mark it as PhotoSwipe-enabled
img.style.cursor = 'zoom-in';
img.style.transition = 'opacity 0.2s';
img.classList.add('photoswipe-enabled');
img.setAttribute('data-photoswipe', 'true');
// Store event handlers for cleanup
const mouseEnterHandler = () => {
img.style.opacity = '0.9';
if (this.config.showHints) {
this.showHint(img);
}
};
const mouseLeaveHandler = () => {
img.style.opacity = '1';
this.hideHint(img);
};
// Add hover effect with cleanup tracking
img.addEventListener('mouseenter', mouseEnterHandler);
img.addEventListener('mouseleave', mouseLeaveHandler);
// Store handlers for cleanup
(img as any)._photoswipeHandlers = { mouseEnterHandler, mouseLeaveHandler };
// Add double-click handler to prevent default navigation behavior
const dblClickHandler = (e: MouseEvent) => {
// Only prevent double-click in specific contexts to avoid breaking other features
if (img.closest('.attachment-detail-wrapper') ||
img.closest('.note-detail-editable-text') ||
img.closest('.note-detail-readonly-text')) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
// Trigger the same behavior as single click (open lightbox)
img.click();
}
};
img.addEventListener('dblclick', dblClickHandler, true); // Use capture phase to ensure we get it first
(img as any)._photoswipeHandlers.dblClickHandler = dblClickHandler;
// Add click handler
img.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
// Check if we should open as gallery
const container = img.closest('.note-detail-editable-text, .note-detail-readonly-text');
if (container && this.config.enableGalleryMode) {
const gallery = this.containerGalleries.get(container as HTMLElement);
if (gallery && gallery.length > 1) {
// Find index of clicked image
const index = gallery.findIndex(item => {
const itemElement = document.querySelector(`img[src="${item.src}"]`);
return itemElement === img;
});
galleryManager.openGallery(gallery, index >= 0 ? index : 0, {
showThumbnails: true,
showCounter: true,
enableKeyboardNav: true,
loop: true
});
return;
}
}
// Open single image
this.openSingleImage(img);
});
// Add keyboard support
img.setAttribute('tabindex', '0');
img.setAttribute('role', 'button');
img.setAttribute('aria-label', 'Click to view in lightbox');
img.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
img.click();
}
});
}
/**
* Open a single image in lightbox
*/
private openSingleImage(img: HTMLImageElement): void {
const item: MediaItem = {
src: img.src,
alt: img.alt || 'Image',
title: img.title || img.alt,
element: img,
width: img.naturalWidth || undefined,
height: img.naturalHeight || undefined
};
mediaViewer.openSingle(item, {
bgOpacity: 0.95,
showHideOpacity: true,
pinchToClose: true,
closeOnScroll: false,
closeOnVerticalDrag: true,
wheelToZoom: true,
getThumbBoundsFn: () => {
const rect = img.getBoundingClientRect();
return {
x: rect.left,
y: rect.top,
w: rect.width
};
}
}, {
onClose: () => {
// Check if we're in attachment detail view and need to reset viewScope
const activeContext = appContext.tabManager.getActiveContext();
if (activeContext?.viewScope?.viewMode === 'attachments') {
// Get the note ID from the image source
const attachmentMatch = img.src.match(/\/api\/attachments\/([A-Za-z0-9_]+)\/image\//);
if (attachmentMatch) {
const currentAttachmentId = activeContext.viewScope.attachmentId;
if (currentAttachmentId === attachmentMatch[1]) {
// Actually reset the viewScope instead of just logging
try {
if (activeContext.note) {
activeContext.setNote(activeContext.note.noteId, {
viewScope: { viewMode: 'default' }
});
}
} catch (error) {
console.error('Failed to reset viewScope after PhotoSwipe close:', error);
}
}
}
}
// Restore focus to the image
img.focus();
}
});
}
/**
* Setup gallery mode for a container
*/
private setupGalleryMode(container: HTMLElement): void {
const images = container.querySelectorAll<HTMLImageElement>(`img:not(${this.config.excludeSelector})`);
if (images.length <= 1) return;
const galleryItems: GalleryItem[] = [];
images.forEach((img, index) => {
// Skip CKEditor widget elements
if (img.closest('.cke_widget_element') || img.closest('.ck-widget')) {
return;
}
const item: GalleryItem = {
src: img.src,
alt: img.alt || `Image ${index + 1}`,
title: img.title || img.alt,
element: img,
index: index,
width: img.naturalWidth || undefined,
height: img.naturalHeight || undefined
};
// Check for caption
const figure = img.closest('figure');
if (figure) {
const caption = figure.querySelector('figcaption');
if (caption) {
item.caption = caption.textContent || undefined;
}
}
galleryItems.push(item);
});
if (galleryItems.length > 0) {
this.containerGalleries.set(container, galleryItems);
}
}
/**
* Observe container for dynamic changes
*/
private observeContainer(container: HTMLElement): void {
// Disconnect existing observer if any
const existingObserver = this.observers.get(container);
if (existingObserver) {
existingObserver.disconnect();
}
const observer = new MutationObserver((mutations) => {
let hasNewImages = false;
mutations.forEach(mutation => {
if (mutation.type === 'childList') {
mutation.addedNodes.forEach(node => {
if (node.nodeType === Node.ELEMENT_NODE) {
const element = node as HTMLElement;
if (element.tagName === 'IMG') {
hasNewImages = true;
} else if (element.querySelector('img')) {
hasNewImages = true;
}
}
});
}
});
if (hasNewImages) {
// Process new images
this.processImages(container);
// Update gallery if enabled
if (this.config.enableGalleryMode) {
this.setupGalleryMode(container);
}
}
});
observer.observe(container, {
childList: true,
subtree: true
});
this.observers.set(container, observer);
}
/**
* Get or create a hint element from the pool
*/
private getHintFromPool(): HTMLElement {
let hint = this.hintPool.pop();
if (!hint) {
hint = document.createElement('div');
hint.className = 'ckeditor-image-hint';
hint.textContent = 'Click to view in lightbox';
hint.style.cssText = `
position: absolute;
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
z-index: 1000;
pointer-events: none;
opacity: 0;
transition: opacity 0.3s;
display: none;
`;
}
return hint;
}
/**
* Return hint to pool
*/
private returnHintToPool(hint: HTMLElement): void {
hint.style.opacity = '0';
hint.style.display = 'none';
if (this.hintPool.length < 10) { // Keep max 10 hints in pool
this.hintPool.push(hint);
} else {
hint.remove();
}
}
/**
* Show hint for an image
*/
private showHint(img: HTMLImageElement): void {
// Check if hint already exists
const imgId = img.dataset.imgId || `img-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
if (!img.dataset.imgId) {
img.dataset.imgId = imgId;
}
// Clear any existing timeout
const existingTimeout = this.hintTimeouts.get(imgId);
if (existingTimeout) {
clearTimeout(existingTimeout);
this.hintTimeouts.delete(imgId);
}
let hint = this.activeHints.get(imgId);
if (hint) {
hint.style.opacity = '1';
return;
}
// Get hint from pool
hint = this.getHintFromPool();
this.activeHints.set(imgId, hint);
// Position and show hint
if (!hint.parentElement) {
document.body.appendChild(hint);
}
const imgRect = img.getBoundingClientRect();
hint.style.display = 'block';
hint.style.left = `${imgRect.left + (imgRect.width - hint.offsetWidth) / 2}px`;
hint.style.top = `${imgRect.top - hint.offsetHeight - 5}px`;
// Show hint
requestAnimationFrame(() => {
hint.style.opacity = '1';
});
// Auto-hide after delay
const timeout = window.setTimeout(() => {
this.hideHint(img);
}, this.config.hintDelay);
this.hintTimeouts.set(imgId, timeout);
}
/**
* Hide hint for an image
*/
private hideHint(img: HTMLImageElement): void {
const imgId = img.dataset.imgId;
if (!imgId) return;
// Clear timeout
const timeout = this.hintTimeouts.get(imgId);
if (timeout) {
clearTimeout(timeout);
this.hintTimeouts.delete(imgId);
}
const hint = this.activeHints.get(imgId);
if (hint) {
hint.style.opacity = '0';
this.activeHints.delete(imgId);
setTimeout(() => {
this.returnHintToPool(hint);
}, 300);
}
}
/**
* Cleanup integration for a container
*/
cleanupContainer(container: HTMLElement | JQuery<HTMLElement>): void {
const element = container instanceof $ ? container[0] : container;
if (!element) return;
// Disconnect observer
const observer = this.observers.get(element);
if (observer) {
observer.disconnect();
this.observers.delete(element);
}
// Clear gallery
this.containerGalleries.delete(element);
// Remove event handlers and hints
const images = element.querySelectorAll<HTMLImageElement>('img');
images.forEach(img => {
this.hideHint(img);
// Remove event handlers
const handlers = (img as any)._photoswipeHandlers;
if (handlers) {
img.removeEventListener('mouseenter', handlers.mouseEnterHandler);
img.removeEventListener('mouseleave', handlers.mouseLeaveHandler);
if (handlers.dblClickHandler) {
img.removeEventListener('dblclick', handlers.dblClickHandler, true);
}
delete (img as any)._photoswipeHandlers;
}
// Mark as unprocessed
this.processedImages.delete(img);
});
}
/**
* Update configuration
*/
updateConfig(config: Partial<CKEditorPhotoSwipeConfig>): void {
this.config = { ...this.config, ...config };
}
/**
* Cleanup all integrations
*/
cleanup(): void {
// Disconnect all observers
this.observers.forEach(observer => observer.disconnect());
this.observers.clear();
// Clear all galleries
this.containerGalleries.clear();
// Clear all hints
this.activeHints.forEach(hint => hint.remove());
this.activeHints.clear();
// Clear all timeouts
this.hintTimeouts.forEach(timeout => clearTimeout(timeout));
this.hintTimeouts.clear();
// Clear hint pool
this.hintPool.forEach(hint => hint.remove());
this.hintPool = [];
// Clear processed images
this.processedImages = new WeakSet();
}
}
// Export singleton instance
export default CKEditorPhotoSwipeIntegration.getInstance();

View File

@@ -0,0 +1,295 @@
import { ActionKeyboardShortcut } from "@triliumnext/commons";
import appContext, { type CommandNames } from "../components/app_context.js";
import type NoteTreeWidget from "../widgets/note_tree.js";
import { t, translationsInitializedPromise } from "./i18n.js";
import keyboardActions from "./keyboard_actions.js";
import utils from "./utils.js";
export interface CommandDefinition {
id: string;
name: string;
description?: string;
icon?: string;
shortcut?: string;
commandName?: CommandNames;
handler?: () => Promise<unknown> | null | undefined | void;
aliases?: string[];
source?: "manual" | "keyboard-action";
/** Reference to the original keyboard action for scope checking. */
keyboardAction?: ActionKeyboardShortcut;
}
class CommandRegistry {
private commands: Map<string, CommandDefinition> = new Map();
private aliases: Map<string, string> = new Map();
constructor() {
this.loadCommands();
}
private async loadCommands() {
await translationsInitializedPromise;
this.registerDefaultCommands();
await this.loadKeyboardActionsAsync();
}
private registerDefaultCommands() {
this.register({
id: "export-note",
name: t("command_palette.export_note_title"),
description: t("command_palette.export_note_description"),
icon: "bx bx-export",
handler: () => {
const notePath = appContext.tabManager.getActiveContextNotePath();
if (notePath) {
appContext.triggerCommand("showExportDialog", {
notePath,
defaultType: "single"
});
}
}
});
this.register({
id: "show-attachments",
name: t("command_palette.show_attachments_title"),
description: t("command_palette.show_attachments_description"),
icon: "bx bx-paperclip",
handler: () => appContext.triggerCommand("showAttachments")
});
// Special search commands with custom logic
this.register({
id: "search-notes",
name: t("command_palette.search_notes_title"),
description: t("command_palette.search_notes_description"),
icon: "bx bx-search",
handler: () => appContext.triggerCommand("searchNotes", {})
});
this.register({
id: "search-in-subtree",
name: t("command_palette.search_subtree_title"),
description: t("command_palette.search_subtree_description"),
icon: "bx bx-search-alt",
handler: () => {
const notePath = appContext.tabManager.getActiveContextNotePath();
if (notePath) {
appContext.triggerCommand("searchInSubtree", { notePath });
}
}
});
this.register({
id: "show-search-history",
name: t("command_palette.search_history_title"),
description: t("command_palette.search_history_description"),
icon: "bx bx-history",
handler: () => appContext.triggerCommand("showSearchHistory")
});
this.register({
id: "show-launch-bar",
name: t("command_palette.configure_launch_bar_title"),
description: t("command_palette.configure_launch_bar_description"),
icon: "bx bx-sidebar",
handler: () => appContext.triggerCommand("showLaunchBarSubtree")
});
}
private async loadKeyboardActionsAsync() {
try {
const actions = await keyboardActions.getActions();
this.registerKeyboardActions(actions);
} catch (error) {
console.error("Failed to load keyboard actions:", error);
}
}
private registerKeyboardActions(actions: ActionKeyboardShortcut[]) {
for (const action of actions) {
// Skip actions that we've already manually registered
if (this.commands.has(action.actionName)) {
continue;
}
// Skip actions that don't have a description (likely separators)
if (!action.description) {
continue;
}
// Skip Electron-only actions if not in Electron environment
if (action.isElectronOnly && !utils.isElectron()) {
continue;
}
// Skip actions that should not appear in the command palette
if (action.ignoreFromCommandPalette) {
continue;
}
// Get the primary shortcut (first one in the list)
const primaryShortcut = action.effectiveShortcuts?.[0];
let name = action.friendlyName;
if (action.scope === "note-tree") {
name = t("command_palette.tree-action-name", { name: action.friendlyName });
}
// Create a command definition from the keyboard action
const commandDef: CommandDefinition = {
id: action.actionName,
name,
description: action.description,
icon: action.iconClass,
shortcut: primaryShortcut ? this.formatShortcut(primaryShortcut) : undefined,
commandName: action.actionName as CommandNames,
source: "keyboard-action",
keyboardAction: action
};
this.register(commandDef);
}
}
private formatShortcut(shortcut: string): string {
// Convert electron accelerator format to display format
return shortcut
.replace(/CommandOrControl/g, 'Ctrl')
.replace(/\+/g, ' + ');
}
register(command: CommandDefinition) {
this.commands.set(command.id, command);
// Register aliases
if (command.aliases) {
for (const alias of command.aliases) {
this.aliases.set(alias.toLowerCase(), command.id);
}
}
}
getCommand(id: string): CommandDefinition | undefined {
return this.commands.get(id);
}
getAllCommands(): CommandDefinition[] {
const commands = Array.from(this.commands.values());
// Sort commands by name
commands.sort((a, b) => a.name.localeCompare(b.name));
return commands;
}
searchCommands(query: string): CommandDefinition[] {
const normalizedQuery = query.toLowerCase();
const results: { command: CommandDefinition; score: number }[] = [];
for (const command of this.commands.values()) {
let score = 0;
// Exact match on name
if (command.name.toLowerCase() === normalizedQuery) {
score = 100;
}
// Name starts with query
else if (command.name.toLowerCase().startsWith(normalizedQuery)) {
score = 80;
}
// Name contains query
else if (command.name.toLowerCase().includes(normalizedQuery)) {
score = 60;
}
// Description contains query
else if (command.description?.toLowerCase().includes(normalizedQuery)) {
score = 40;
}
// Check aliases
else if (command.aliases?.some(alias => alias.toLowerCase().includes(normalizedQuery))) {
score = 50;
}
if (score > 0) {
results.push({ command, score });
}
}
// Sort by score (highest first) and then by name
results.sort((a, b) => {
if (a.score !== b.score) {
return b.score - a.score;
}
return a.command.name.localeCompare(b.command.name);
});
return results.map(r => r.command);
}
async executeCommand(commandId: string) {
const command = this.getCommand(commandId);
if (!command) {
console.error(`Command not found: ${commandId}`);
return;
}
// Execute custom handler if provided
if (command.handler) {
await command.handler();
return;
}
// Handle keyboard action with scope-aware execution
if (command.keyboardAction && command.commandName) {
if (command.keyboardAction.scope === "note-tree") {
this.executeWithNoteTreeFocus(command.commandName);
} else if (command.keyboardAction.scope === "text-detail") {
this.executeWithTextDetail(command.commandName);
} else {
appContext.triggerCommand(command.commandName, {
ntxId: appContext.tabManager.activeNtxId
});
}
return;
}
// Fallback for commands without keyboard action reference
if (command.commandName) {
appContext.triggerCommand(command.commandName, {
ntxId: appContext.tabManager.activeNtxId
});
return;
}
console.error(`Command ${commandId} has no handler or commandName`);
}
private executeWithNoteTreeFocus(actionName: CommandNames) {
const tree = document.querySelector(".tree-wrapper") as HTMLElement;
if (!tree) {
return;
}
const treeComponent = appContext.getComponentByEl(tree) as NoteTreeWidget;
const activeNode = treeComponent.getActiveNode();
treeComponent.triggerCommand(actionName, {
ntxId: appContext.tabManager.activeNtxId,
node: activeNode
});
}
private async executeWithTextDetail(actionName: CommandNames) {
const typeWidget = await appContext.tabManager.getActiveContext()?.getTypeWidget();
if (!typeWidget) {
return;
}
typeWidget.triggerCommand(actionName, {
ntxId: appContext.tabManager.activeNtxId
});
}
}
const commandRegistry = new CommandRegistry();
export default commandRegistry;

View File

@@ -65,6 +65,9 @@ async function getRenderedContent(this: {} | { ctx: string }, entity: FNote | FA
$renderedContent.append($("<div>").append("<div>This note is protected and to access it you need to enter password.</div>").append("<br/>").append($button));
} else if (entity instanceof FNote) {
$renderedContent
.css("display", "flex")
.css("flex-direction", "column");
$renderedContent.append(
$("<div>")
.css("display", "flex")
@@ -72,8 +75,33 @@ async function getRenderedContent(this: {} | { ctx: string }, entity: FNote | FA
.css("align-items", "center")
.css("height", "100%")
.css("font-size", "500%")
.css("flex-grow", "1")
.append($("<span>").addClass(entity.getIcon()))
);
if (entity.type === "webView" && entity.hasLabel("webViewSrc")) {
const $footer = $("<footer>")
.addClass("webview-footer");
const $openButton = $(`
<button class="file-open btn btn-primary" type="button">
<span class="bx bx-link-external"></span>
${t("content_renderer.open_externally")}
</button>
`)
.appendTo($footer)
.on("click", () => {
const webViewSrc = entity.getLabelValue("webViewSrc");
if (webViewSrc) {
if (utils.isElectron()) {
const electron = utils.dynamicRequire("electron");
electron.shell.openExternal(webViewSrc);
} else {
window.open(webViewSrc, '_blank', 'noopener,noreferrer');
}
}
});
$footer.appendTo($renderedContent);
}
}
if (entity instanceof FNote) {

View File

@@ -4,14 +4,14 @@ import type { ConfirmDialogOptions, ConfirmDialogResult, ConfirmWithMessageOptio
import type { PromptDialogOptions } from "../widgets/dialogs/prompt.js";
import { focusSavedElement, saveFocusedElement } from "./focus.js";
export async function openDialog($dialog: JQuery<HTMLElement>, closeActDialog = true) {
export async function openDialog($dialog: JQuery<HTMLElement>, closeActDialog = true, config?: Partial<Modal.Options>) {
if (closeActDialog) {
closeActiveDialog();
glob.activeDialog = $dialog;
}
saveFocusedElement();
Modal.getOrCreateInstance($dialog[0]).show();
Modal.getOrCreateInstance($dialog[0], config).show();
$dialog.on("hidden.bs.modal", () => {
const $autocompleteEl = $(".aa-input");
@@ -41,8 +41,14 @@ async function info(message: string) {
return new Promise((res) => appContext.triggerCommand("showInfoDialog", { message, callback: res }));
}
/**
* Displays a confirmation dialog with the given message.
*
* @param message the message to display in the dialog.
* @returns A promise that resolves to true if the user confirmed, false otherwise.
*/
async function confirm(message: string) {
return new Promise((res) =>
return new Promise<boolean>((res) =>
appContext.triggerCommand("showConfirmDialog", <ConfirmWithMessageOptions>{
message,
callback: (x: false | ConfirmDialogOptions) => res(x && x.confirmed)

View File

@@ -0,0 +1,387 @@
/**
* Tests for Gallery Manager
*/
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import galleryManager from './gallery_manager';
import mediaViewer from './media_viewer';
import type { GalleryItem, GalleryConfig } from './gallery_manager';
import type { MediaViewerCallbacks } from './media_viewer';
// Mock media viewer
vi.mock('./media_viewer', () => ({
default: {
open: vi.fn(),
openSingle: vi.fn(),
close: vi.fn(),
next: vi.fn(),
prev: vi.fn(),
goTo: vi.fn(),
getCurrentIndex: vi.fn(() => 0),
isOpen: vi.fn(() => false),
getImageDimensions: vi.fn(() => Promise.resolve({ width: 800, height: 600 }))
}
}));
// Mock froca
vi.mock('./froca', () => ({
default: {
getNoteComplement: vi.fn()
}
}));
// Mock utils
vi.mock('./utils', () => ({
default: {
createImageSrcUrl: vi.fn((note: any) => `/api/images/${note.noteId}`),
randomString: vi.fn(() => 'test123')
}
}));
describe('GalleryManager', () => {
let mockItems: GalleryItem[];
beforeEach(() => {
// Reset mocks
vi.clearAllMocks();
// Create mock gallery items
mockItems = [
{
src: '/api/images/note1/image1.jpg',
alt: 'Image 1',
title: 'First Image',
noteId: 'note1',
index: 0,
width: 800,
height: 600
},
{
src: '/api/images/note1/image2.jpg',
alt: 'Image 2',
title: 'Second Image',
noteId: 'note1',
index: 1,
width: 1024,
height: 768
},
{
src: '/api/images/note1/image3.jpg',
alt: 'Image 3',
title: 'Third Image',
noteId: 'note1',
index: 2,
width: 1920,
height: 1080
}
];
// Setup DOM
document.body.innerHTML = '';
});
afterEach(() => {
// Cleanup
galleryManager.cleanup();
document.body.innerHTML = '';
});
describe('Gallery Creation', () => {
it('should create gallery from container with images', async () => {
// Create container with images
const container = document.createElement('div');
container.innerHTML = `
<img src="/api/images/note1/image1.jpg" alt="Image 1" />
<img src="/api/images/note1/image2.jpg" alt="Image 2" />
<img src="/api/images/note1/image3.jpg" alt="Image 3" />
`;
document.body.appendChild(container);
// Create gallery from container
const items = await galleryManager.createGalleryFromContainer(container);
expect(items).toHaveLength(3);
expect(items[0].src).toBe('/api/images/note1/image1.jpg');
expect(items[0].alt).toBe('Image 1');
expect(items[0].index).toBe(0);
});
it('should extract captions from figure elements', async () => {
const container = document.createElement('div');
container.innerHTML = `
<figure>
<img src="/api/images/note1/image1.jpg" alt="Image 1" />
<figcaption>This is a caption</figcaption>
</figure>
`;
document.body.appendChild(container);
const items = await galleryManager.createGalleryFromContainer(container);
expect(items).toHaveLength(1);
expect(items[0].caption).toBe('This is a caption');
});
it('should handle images without dimensions', async () => {
const container = document.createElement('div');
container.innerHTML = `<img src="/api/images/note1/image1.jpg" alt="Image 1" />`;
document.body.appendChild(container);
const items = await galleryManager.createGalleryFromContainer(container);
expect(items).toHaveLength(1);
expect(items[0].width).toBe(800); // From mocked getImageDimensions
expect(items[0].height).toBe(600);
expect(mediaViewer.getImageDimensions).toHaveBeenCalledWith('/api/images/note1/image1.jpg');
});
});
describe('Gallery Opening', () => {
it('should open gallery with multiple items', () => {
const callbacks: MediaViewerCallbacks = {
onOpen: vi.fn(),
onClose: vi.fn(),
onChange: vi.fn()
};
galleryManager.openGallery(mockItems, 0, {}, callbacks);
expect(mediaViewer.open).toHaveBeenCalledWith(
mockItems,
0,
expect.objectContaining({
loop: true,
allowPanToNext: true,
preload: [2, 2]
}),
expect.objectContaining({
onOpen: expect.any(Function),
onClose: expect.any(Function),
onChange: expect.any(Function)
})
);
});
it('should handle empty items array', () => {
galleryManager.openGallery([], 0);
expect(mediaViewer.open).not.toHaveBeenCalled();
});
it('should apply custom configuration', () => {
const config: GalleryConfig = {
showThumbnails: false,
autoPlay: true,
slideInterval: 5000,
loop: false
};
galleryManager.openGallery(mockItems, 0, config);
expect(mediaViewer.open).toHaveBeenCalledWith(
mockItems,
0,
expect.objectContaining({
loop: false
}),
expect.any(Object)
);
});
});
describe('Gallery Navigation', () => {
beforeEach(() => {
// Open a gallery first
galleryManager.openGallery(mockItems, 0);
});
it('should navigate to next slide', () => {
galleryManager.nextSlide();
expect(mediaViewer.next).toHaveBeenCalled();
});
it('should navigate to previous slide', () => {
galleryManager.previousSlide();
expect(mediaViewer.prev).toHaveBeenCalled();
});
it('should go to specific slide', () => {
galleryManager.goToSlide(2);
expect(mediaViewer.goTo).toHaveBeenCalledWith(2);
});
it('should not navigate to invalid slide index', () => {
const state = galleryManager.getGalleryState();
if (state) {
// Try to go to invalid index
galleryManager.goToSlide(-1);
expect(mediaViewer.goTo).not.toHaveBeenCalled();
galleryManager.goToSlide(10);
expect(mediaViewer.goTo).not.toHaveBeenCalled();
}
});
});
describe('Slideshow Functionality', () => {
beforeEach(() => {
vi.useFakeTimers();
galleryManager.openGallery(mockItems, 0, { autoPlay: false });
});
afterEach(() => {
vi.useRealTimers();
});
it('should start slideshow', () => {
const state = galleryManager.getGalleryState();
expect(state?.isPlaying).toBe(false);
galleryManager.startSlideshow();
const updatedState = galleryManager.getGalleryState();
expect(updatedState?.isPlaying).toBe(true);
});
it('should stop slideshow', () => {
galleryManager.startSlideshow();
galleryManager.stopSlideshow();
const state = galleryManager.getGalleryState();
expect(state?.isPlaying).toBe(false);
});
it('should toggle slideshow', () => {
const initialState = galleryManager.getGalleryState();
expect(initialState?.isPlaying).toBe(false);
galleryManager.toggleSlideshow();
expect(galleryManager.getGalleryState()?.isPlaying).toBe(true);
galleryManager.toggleSlideshow();
expect(galleryManager.getGalleryState()?.isPlaying).toBe(false);
});
it('should advance slides automatically in slideshow', () => {
galleryManager.startSlideshow();
// Fast-forward time
vi.advanceTimersByTime(4000); // Default interval
expect(mediaViewer.goTo).toHaveBeenCalledWith(1);
});
it('should update slideshow interval', () => {
galleryManager.startSlideshow();
galleryManager.updateSlideshowInterval(5000);
const state = galleryManager.getGalleryState();
expect(state?.config.slideInterval).toBe(5000);
});
});
describe('Gallery State', () => {
it('should track gallery state', () => {
expect(galleryManager.getGalleryState()).toBeNull();
galleryManager.openGallery(mockItems, 1);
const state = galleryManager.getGalleryState();
expect(state).not.toBeNull();
expect(state?.items).toEqual(mockItems);
expect(state?.currentIndex).toBe(1);
});
it('should check if gallery is open', () => {
expect(galleryManager.isGalleryOpen()).toBe(false);
vi.mocked(mediaViewer.isOpen).mockReturnValue(true);
galleryManager.openGallery(mockItems, 0);
expect(galleryManager.isGalleryOpen()).toBe(true);
});
});
describe('Gallery Cleanup', () => {
it('should close gallery on cleanup', () => {
galleryManager.openGallery(mockItems, 0);
galleryManager.cleanup();
expect(mediaViewer.close).toHaveBeenCalled();
expect(galleryManager.getGalleryState()).toBeNull();
});
it('should stop slideshow on close', () => {
galleryManager.openGallery(mockItems, 0, { autoPlay: true });
const state = galleryManager.getGalleryState();
expect(state?.isPlaying).toBe(true);
galleryManager.closeGallery();
expect(mediaViewer.close).toHaveBeenCalled();
});
});
describe('UI Enhancements', () => {
beforeEach(() => {
// Create PhotoSwipe container mock
const pswpElement = document.createElement('div');
pswpElement.className = 'pswp';
document.body.appendChild(pswpElement);
});
it('should add thumbnail strip when enabled', (done) => {
galleryManager.openGallery(mockItems, 0, { showThumbnails: true });
// Wait for UI setup
setTimeout(() => {
const thumbnailStrip = document.querySelector('.gallery-thumbnail-strip');
expect(thumbnailStrip).toBeTruthy();
const thumbnails = document.querySelectorAll('.gallery-thumbnail');
expect(thumbnails).toHaveLength(3);
done();
}, 150);
});
it('should add slideshow controls', (done) => {
galleryManager.openGallery(mockItems, 0);
setTimeout(() => {
const controls = document.querySelector('.gallery-slideshow-controls');
expect(controls).toBeTruthy();
const playPauseBtn = document.querySelector('.slideshow-play-pause');
expect(playPauseBtn).toBeTruthy();
done();
}, 150);
});
it('should add image counter when enabled', (done) => {
galleryManager.openGallery(mockItems, 0, { showCounter: true });
setTimeout(() => {
const counter = document.querySelector('.gallery-counter');
expect(counter).toBeTruthy();
expect(counter?.textContent).toContain('1');
expect(counter?.textContent).toContain('3');
done();
}, 150);
});
it('should add keyboard hints', (done) => {
galleryManager.openGallery(mockItems, 0);
setTimeout(() => {
const hints = document.querySelector('.gallery-keyboard-hints');
expect(hints).toBeTruthy();
expect(hints?.textContent).toContain('Navigate');
expect(hints?.textContent).toContain('ESC');
done();
}, 150);
});
});
});

View File

@@ -0,0 +1,987 @@
/**
* Gallery Manager for PhotoSwipe integration in Trilium Notes
* Handles multi-image galleries, slideshow mode, and navigation features
*/
import mediaViewer, { MediaItem, MediaViewerCallbacks, MediaViewerConfig } from './media_viewer.js';
import utils from './utils.js';
import froca from './froca.js';
import type FNote from '../entities/fnote.js';
/**
* Gallery configuration options
*/
export interface GalleryConfig {
showThumbnails?: boolean;
thumbnailHeight?: number;
autoPlay?: boolean;
slideInterval?: number; // in milliseconds
showCounter?: boolean;
enableKeyboardNav?: boolean;
enableSwipeGestures?: boolean;
preloadCount?: number;
loop?: boolean;
}
/**
* Gallery item with additional metadata
*/
export interface GalleryItem extends MediaItem {
noteId?: string;
attachmentId?: string;
caption?: string;
description?: string;
index?: number;
}
/**
* Gallery state management
*/
interface GalleryState {
items: GalleryItem[];
currentIndex: number;
isPlaying: boolean;
slideshowTimer?: number;
config: Required<GalleryConfig>;
}
/**
* GalleryManager handles multi-image galleries with slideshow and navigation features
*/
class GalleryManager {
private static instance: GalleryManager;
private currentGallery: GalleryState | null = null;
private defaultConfig: Required<GalleryConfig> = {
showThumbnails: true,
thumbnailHeight: 80,
autoPlay: false,
slideInterval: 4000,
showCounter: true,
enableKeyboardNav: true,
enableSwipeGestures: true,
preloadCount: 2,
loop: true
};
private slideshowCallbacks: Set<() => void> = new Set();
private $thumbnailStrip?: JQuery<HTMLElement>;
private $slideshowControls?: JQuery<HTMLElement>;
// Track all dynamically created elements for proper cleanup
private createdElements: Map<string, HTMLElement | JQuery<HTMLElement>> = new Map();
private setupTimeout?: number;
private constructor() {
// Cleanup on window unload
window.addEventListener('beforeunload', () => this.cleanup());
}
/**
* Get singleton instance
*/
static getInstance(): GalleryManager {
if (!GalleryManager.instance) {
GalleryManager.instance = new GalleryManager();
}
return GalleryManager.instance;
}
/**
* Create gallery from images in a note's content
*/
async createGalleryFromNote(note: FNote, config?: GalleryConfig): Promise<GalleryItem[]> {
const items: GalleryItem[] = [];
try {
// Parse note content to find images
const parser = new DOMParser();
const content = await note.getContent();
const doc = parser.parseFromString(content || '', 'text/html');
const images = doc.querySelectorAll('img');
for (let i = 0; i < images.length; i++) {
const img = images[i];
const src = img.getAttribute('src');
if (!src) continue;
// Convert relative URLs to absolute
const absoluteSrc = this.resolveImageSrc(src, note.noteId);
const item: GalleryItem = {
src: absoluteSrc,
alt: img.getAttribute('alt') || `Image ${i + 1} from ${note.title}`,
title: img.getAttribute('title') || img.getAttribute('alt') || undefined,
caption: img.getAttribute('data-caption') || undefined,
noteId: note.noteId,
index: i,
width: parseInt(img.getAttribute('width') || '0') || undefined,
height: parseInt(img.getAttribute('height') || '0') || undefined
};
// Try to get thumbnail from data attribute or create one
const thumbnailSrc = img.getAttribute('data-thumbnail');
if (thumbnailSrc) {
item.msrc = this.resolveImageSrc(thumbnailSrc, note.noteId);
}
items.push(item);
}
// Also check for image attachments
const attachmentItems = await this.getAttachmentImages(note);
items.push(...attachmentItems);
} catch (error) {
console.error('Failed to create gallery from note:', error);
}
return items;
}
/**
* Get image attachments from a note
*/
private async getAttachmentImages(note: FNote): Promise<GalleryItem[]> {
const items: GalleryItem[] = [];
try {
// Get child notes that are images
const childNotes = await note.getChildNotes();
for (const childNote of childNotes) {
if (childNote.type === 'image') {
const item: GalleryItem = {
src: utils.createImageSrcUrl(childNote),
alt: childNote.title,
title: childNote.title,
noteId: childNote.noteId,
index: items.length
};
items.push(item);
}
}
} catch (error) {
console.error('Failed to get attachment images:', error);
}
return items;
}
/**
* Create gallery from a container element with images
*/
async createGalleryFromContainer(
container: HTMLElement | JQuery<HTMLElement>,
selector: string = 'img',
config?: GalleryConfig
): Promise<GalleryItem[]> {
const $container = $(container);
const images = $container.find(selector);
const items: GalleryItem[] = [];
for (let i = 0; i < images.length; i++) {
const img = images[i] as HTMLImageElement;
const item: GalleryItem = {
src: img.src,
alt: img.alt || `Image ${i + 1}`,
title: img.title || img.alt || undefined,
element: img,
index: i,
width: img.naturalWidth || undefined,
height: img.naturalHeight || undefined
};
// Try to extract caption from nearby elements
const $img = $(img);
const $figure = $img.closest('figure');
if ($figure.length) {
const $caption = $figure.find('figcaption');
if ($caption.length) {
item.caption = $caption.text();
}
}
// Check for data attributes
item.noteId = $img.data('note-id');
item.attachmentId = $img.data('attachment-id');
items.push(item);
}
return items;
}
/**
* Open gallery with specified items
*/
openGallery(
items: GalleryItem[],
startIndex: number = 0,
config?: GalleryConfig,
callbacks?: MediaViewerCallbacks
): void {
if (!items || items.length === 0) {
console.warn('No items provided to gallery');
return;
}
// Close any existing gallery
this.closeGallery();
// Merge configuration
const finalConfig = { ...this.defaultConfig, ...config };
// Initialize gallery state
this.currentGallery = {
items,
currentIndex: startIndex,
isPlaying: finalConfig.autoPlay,
config: finalConfig
};
// Enhanced PhotoSwipe configuration for gallery
const photoSwipeConfig: Partial<MediaViewerConfig> = {
bgOpacity: 0.95,
showHideOpacity: true,
allowPanToNext: true,
spacing: 0.12,
loop: finalConfig.loop,
arrowKeys: finalConfig.enableKeyboardNav,
pinchToClose: finalConfig.enableSwipeGestures,
closeOnVerticalDrag: finalConfig.enableSwipeGestures,
preload: [finalConfig.preloadCount, finalConfig.preloadCount],
wheelToZoom: true,
// Enable mobile and accessibility enhancements
mobileA11y: {
touch: {
hapticFeedback: true,
multiTouchEnabled: true
},
a11y: {
enableKeyboardNav: finalConfig.enableKeyboardNav,
enableScreenReaderAnnouncements: true,
keyboardShortcutsEnabled: true
},
mobileUI: {
bottomSheetEnabled: true,
adaptiveToolbar: true,
swipeIndicators: true,
gestureHints: true
},
performance: {
adaptiveQuality: true,
batteryOptimization: true
}
}
};
// Enhanced callbacks
const enhancedCallbacks: MediaViewerCallbacks = {
onOpen: () => {
this.onGalleryOpen();
callbacks?.onOpen?.();
},
onClose: () => {
this.onGalleryClose();
callbacks?.onClose?.();
},
onChange: (index) => {
this.onSlideChange(index);
callbacks?.onChange?.(index);
},
onImageLoad: callbacks?.onImageLoad,
onImageError: callbacks?.onImageError
};
// Open with media viewer
mediaViewer.open(items, startIndex, photoSwipeConfig, enhancedCallbacks);
// Setup gallery UI enhancements
this.setupGalleryUI();
// Start slideshow if configured
if (finalConfig.autoPlay) {
this.startSlideshow();
}
}
/**
* Setup gallery UI enhancements
*/
private setupGalleryUI(): void {
if (!this.currentGallery) return;
// Clear any existing timeout
if (this.setupTimeout) {
clearTimeout(this.setupTimeout);
}
// Add gallery-specific UI elements to PhotoSwipe
this.setupTimeout = window.setTimeout(() => {
// Validate gallery is still open before manipulating DOM
if (!this.currentGallery || !this.isGalleryOpen()) {
return;
}
// PhotoSwipe needs a moment to initialize
const pswpElement = document.querySelector('.pswp');
if (!pswpElement) return;
// Add thumbnail strip if enabled
if (this.currentGallery.config.showThumbnails) {
this.addThumbnailStrip(pswpElement);
}
// Add slideshow controls
this.addSlideshowControls(pswpElement);
// Add image counter if enabled
if (this.currentGallery.config.showCounter) {
this.addImageCounter(pswpElement);
}
// Add keyboard hints
this.addKeyboardHints(pswpElement);
}, 100);
}
/**
* Add thumbnail strip navigation
*/
private addThumbnailStrip(container: Element): void {
if (!this.currentGallery) return;
// Create thumbnail strip container safely using DOM APIs
const stripDiv = document.createElement('div');
stripDiv.className = 'gallery-thumbnail-strip';
stripDiv.setAttribute('style', `
position: absolute;
bottom: 60px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 8px;
padding: 10px;
background: rgba(0, 0, 0, 0.7);
border-radius: 8px;
max-width: 90%;
overflow-x: auto;
z-index: 100;
`);
// Create thumbnails safely
this.currentGallery.items.forEach((item, index) => {
const thumbDiv = document.createElement('div');
thumbDiv.className = 'gallery-thumbnail';
thumbDiv.dataset.index = index.toString();
thumbDiv.setAttribute('style', `
width: ${this.currentGallery!.config.thumbnailHeight}px;
height: ${this.currentGallery!.config.thumbnailHeight}px;
cursor: pointer;
border: 2px solid ${index === this.currentGallery!.currentIndex ? '#fff' : 'transparent'};
border-radius: 4px;
overflow: hidden;
flex-shrink: 0;
opacity: ${index === this.currentGallery!.currentIndex ? '1' : '0.6'};
transition: all 0.2s;
`);
const img = document.createElement('img');
// Sanitize src URLs
const src = this.sanitizeUrl(item.msrc || item.src);
img.src = src;
// Use textContent for safe text insertion
img.alt = this.sanitizeText(item.alt || '');
img.setAttribute('style', `
width: 100%;
height: 100%;
object-fit: cover;
`);
thumbDiv.appendChild(img);
stripDiv.appendChild(thumbDiv);
});
this.$thumbnailStrip = $(stripDiv);
$(container).append(this.$thumbnailStrip);
this.createdElements.set('thumbnailStrip', this.$thumbnailStrip);
// Handle thumbnail clicks
this.$thumbnailStrip.on('click', '.gallery-thumbnail', (e) => {
const index = parseInt($(e.currentTarget).data('index'));
this.goToSlide(index);
});
// Handle hover effect
this.$thumbnailStrip.on('mouseenter', '.gallery-thumbnail', (e) => {
if (!$(e.currentTarget).hasClass('active')) {
$(e.currentTarget).css('opacity', '0.8');
}
});
this.$thumbnailStrip.on('mouseleave', '.gallery-thumbnail', (e) => {
if (!$(e.currentTarget).hasClass('active')) {
$(e.currentTarget).css('opacity', '0.6');
}
});
}
/**
* Sanitize text content to prevent XSS
*/
private sanitizeText(text: string): string {
// Remove any HTML tags and entities
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
/**
* Sanitize URL to prevent XSS
*/
private sanitizeUrl(url: string): string {
// Only allow safe protocols
const allowedProtocols = ['http:', 'https:', 'data:'];
try {
const urlObj = new URL(url, window.location.href);
// Special validation for data URLs
if (urlObj.protocol === 'data:') {
// Only allow image MIME types for data URLs
const allowedImageTypes = [
'data:image/jpeg',
'data:image/jpg',
'data:image/png',
'data:image/gif',
'data:image/webp',
'data:image/svg+xml',
'data:image/bmp'
];
// Check if data URL starts with an allowed image type
const isAllowedImage = allowedImageTypes.some(type =>
url.toLowerCase().startsWith(type)
);
if (!isAllowedImage) {
console.warn('Rejected non-image data URL:', url.substring(0, 50));
return '';
}
// Additional check for base64 encoding
if (!url.includes(';base64,') && !url.includes(';charset=')) {
console.warn('Rejected data URL with invalid encoding');
return '';
}
} else if (!allowedProtocols.includes(urlObj.protocol)) {
return '';
}
return urlObj.href;
} catch {
// If URL parsing fails, check if it's a relative path
if (url.startsWith('/') || url.startsWith('api/')) {
return url;
}
return '';
}
}
/**
* Add slideshow controls
*/
private addSlideshowControls(container: Element): void {
if (!this.currentGallery) return;
const controlsHtml = `
<div class="gallery-slideshow-controls" style="
position: absolute;
top: 20px;
right: 20px;
display: flex;
gap: 10px;
z-index: 100;
">
<button class="slideshow-play-pause" style="
background: rgba(255, 255, 255, 0.9);
border: none;
border-radius: 4px;
width: 44px;
height: 44px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
" aria-label="${this.currentGallery.isPlaying ? 'Pause slideshow' : 'Play slideshow'}">
<i class="bx ${this.currentGallery.isPlaying ? 'bx-pause' : 'bx-play'}"></i>
</button>
<button class="slideshow-settings" style="
background: rgba(255, 255, 255, 0.9);
border: none;
border-radius: 4px;
width: 44px;
height: 44px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
" aria-label="Slideshow settings">
<i class="bx bx-cog"></i>
</button>
</div>
<div class="slideshow-interval-selector" style="
position: absolute;
top: 80px;
right: 20px;
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 10px;
border-radius: 4px;
display: none;
z-index: 101;
">
<label style="display: block; margin-bottom: 5px;">Slide interval:</label>
<select class="interval-select" style="
background: rgba(255, 255, 255, 0.1);
color: white;
border: 1px solid rgba(255, 255, 255, 0.3);
padding: 4px;
border-radius: 3px;
">
<option value="3000">3 seconds</option>
<option value="4000" selected>4 seconds</option>
<option value="5000">5 seconds</option>
<option value="7000">7 seconds</option>
<option value="10000">10 seconds</option>
</select>
</div>
`;
this.$slideshowControls = $(controlsHtml);
$(container).append(this.$slideshowControls);
this.createdElements.set('slideshowControls', this.$slideshowControls);
// Handle play/pause button
this.$slideshowControls.find('.slideshow-play-pause').on('click', () => {
this.toggleSlideshow();
});
// Handle settings button
this.$slideshowControls.find('.slideshow-settings').on('click', () => {
const $selector = this.$slideshowControls?.find('.slideshow-interval-selector');
$selector?.toggle();
});
// Handle interval change
this.$slideshowControls.find('.interval-select').on('change', (e) => {
const interval = parseInt($(e.target).val() as string);
this.updateSlideshowInterval(interval);
});
}
/**
* Add image counter
*/
private addImageCounter(container: Element): void {
if (!this.currentGallery) return;
// Create counter element safely
const counterDiv = document.createElement('div');
counterDiv.className = 'gallery-counter';
counterDiv.setAttribute('style', `
position: absolute;
top: 20px;
left: 20px;
background: rgba(0, 0, 0, 0.7);
color: white;
padding: 8px 12px;
border-radius: 4px;
font-size: 14px;
z-index: 100;
`);
const currentSpan = document.createElement('span');
currentSpan.className = 'current-index';
currentSpan.textContent = String(this.currentGallery.currentIndex + 1);
const separatorSpan = document.createElement('span');
separatorSpan.textContent = ' / ';
const totalSpan = document.createElement('span');
totalSpan.className = 'total-count';
totalSpan.textContent = String(this.currentGallery.items.length);
counterDiv.appendChild(currentSpan);
counterDiv.appendChild(separatorSpan);
counterDiv.appendChild(totalSpan);
container.appendChild(counterDiv);
this.createdElements.set('counter', counterDiv);
}
/**
* Add keyboard hints overlay
*/
private addKeyboardHints(container: Element): void {
// Create hints element safely
const hintsDiv = document.createElement('div');
hintsDiv.className = 'gallery-keyboard-hints';
hintsDiv.setAttribute('style', `
position: absolute;
bottom: 20px;
left: 20px;
background: rgba(0, 0, 0, 0.7);
color: white;
padding: 8px 12px;
border-radius: 4px;
font-size: 12px;
opacity: 0;
transition: opacity 0.3s;
z-index: 100;
`);
// Create hint items
const hints = [
{ key: '←/→', action: 'Navigate' },
{ key: 'Space', action: 'Play/Pause' },
{ key: 'ESC', action: 'Close' }
];
hints.forEach(hint => {
const hintItem = document.createElement('div');
const kbd = document.createElement('kbd');
kbd.style.cssText = 'background: rgba(255,255,255,0.2); padding: 2px 4px; border-radius: 2px;';
kbd.textContent = hint.key;
hintItem.appendChild(kbd);
hintItem.appendChild(document.createTextNode(' ' + hint.action));
hintsDiv.appendChild(hintItem);
});
container.appendChild(hintsDiv);
this.createdElements.set('keyboardHints', hintsDiv);
const $hints = $(hintsDiv);
// Show hints on hover with scoped selector
const handleMouseEnter = () => {
if (this.currentGallery) {
$hints.css('opacity', '0.6');
}
};
const handleMouseLeave = () => {
$hints.css('opacity', '0');
};
$(container).on('mouseenter.galleryHints', handleMouseEnter);
$(container).on('mouseleave.galleryHints', handleMouseLeave);
// Track cleanup callback
this.slideshowCallbacks.add(() => {
$(container).off('.galleryHints');
});
}
/**
* Handle gallery open event
*/
private onGalleryOpen(): void {
// Add keyboard listener for slideshow control
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === ' ') {
e.preventDefault();
this.toggleSlideshow();
}
};
document.addEventListener('keydown', handleKeyDown);
this.slideshowCallbacks.add(() => {
document.removeEventListener('keydown', handleKeyDown);
});
}
/**
* Handle gallery close event
*/
private onGalleryClose(): void {
this.stopSlideshow();
// Clear setup timeout if exists
if (this.setupTimeout) {
clearTimeout(this.setupTimeout);
this.setupTimeout = undefined;
}
// Cleanup event listeners
this.slideshowCallbacks.forEach(callback => callback());
this.slideshowCallbacks.clear();
// Remove all tracked UI elements
this.createdElements.forEach((element, key) => {
if (element instanceof HTMLElement) {
element.remove();
} else if (element instanceof $) {
element.remove();
}
});
this.createdElements.clear();
// Clear jQuery references
this.$thumbnailStrip = undefined;
this.$slideshowControls = undefined;
// Clear state
this.currentGallery = null;
}
/**
* Handle slide change event
*/
private onSlideChange(index: number): void {
if (!this.currentGallery) return;
this.currentGallery.currentIndex = index;
// Update thumbnail highlighting
if (this.$thumbnailStrip) {
this.$thumbnailStrip.find('.gallery-thumbnail').each((i, el) => {
const $thumb = $(el);
if (i === index) {
$thumb.css({
'border-color': '#fff',
'opacity': '1'
});
// Scroll thumbnail into view
const thumbLeft = $thumb.position().left;
const thumbWidth = $thumb.outerWidth() || 0;
const stripWidth = this.$thumbnailStrip!.width() || 0;
const scrollLeft = this.$thumbnailStrip!.scrollLeft() || 0;
if (thumbLeft < 0) {
this.$thumbnailStrip!.scrollLeft(scrollLeft + thumbLeft - 10);
} else if (thumbLeft + thumbWidth > stripWidth) {
this.$thumbnailStrip!.scrollLeft(scrollLeft + (thumbLeft + thumbWidth - stripWidth) + 10);
}
} else {
$thumb.css({
'border-color': 'transparent',
'opacity': '0.6'
});
}
});
}
// Update counter using tracked element
const counterElement = this.createdElements.get('counter');
if (counterElement instanceof HTMLElement) {
const currentIndexElement = counterElement.querySelector('.current-index');
if (currentIndexElement) {
currentIndexElement.textContent = String(index + 1);
}
}
}
/**
* Start slideshow
*/
startSlideshow(): void {
if (!this.currentGallery || this.currentGallery.isPlaying) return;
// Validate gallery state before starting slideshow
if (!this.isGalleryOpen() || this.currentGallery.items.length === 0) {
console.warn('Cannot start slideshow: gallery not ready');
return;
}
// Ensure PhotoSwipe is ready
if (!mediaViewer.isOpen()) {
console.warn('Cannot start slideshow: PhotoSwipe not ready');
return;
}
this.currentGallery.isPlaying = true;
// Update button icon
this.$slideshowControls?.find('.slideshow-play-pause i')
.removeClass('bx-play')
.addClass('bx-pause');
// Start timer
this.scheduleNextSlide();
}
/**
* Stop slideshow
*/
stopSlideshow(): void {
if (!this.currentGallery) return;
this.currentGallery.isPlaying = false;
// Clear timer
if (this.currentGallery.slideshowTimer) {
clearTimeout(this.currentGallery.slideshowTimer);
this.currentGallery.slideshowTimer = undefined;
}
// Update button icon
this.$slideshowControls?.find('.slideshow-play-pause i')
.removeClass('bx-pause')
.addClass('bx-play');
}
/**
* Toggle slideshow play/pause
*/
toggleSlideshow(): void {
if (!this.currentGallery) return;
if (this.currentGallery.isPlaying) {
this.stopSlideshow();
} else {
this.startSlideshow();
}
}
/**
* Schedule next slide in slideshow
*/
private scheduleNextSlide(): void {
if (!this.currentGallery || !this.currentGallery.isPlaying) return;
// Clear any existing timer
if (this.currentGallery.slideshowTimer) {
clearTimeout(this.currentGallery.slideshowTimer);
}
this.currentGallery.slideshowTimer = window.setTimeout(() => {
if (!this.currentGallery || !this.currentGallery.isPlaying) return;
// Go to next slide
const nextIndex = (this.currentGallery.currentIndex + 1) % this.currentGallery.items.length;
this.goToSlide(nextIndex);
// Schedule next transition
this.scheduleNextSlide();
}, this.currentGallery.config.slideInterval);
}
/**
* Update slideshow interval
*/
updateSlideshowInterval(interval: number): void {
if (!this.currentGallery) return;
this.currentGallery.config.slideInterval = interval;
// Restart slideshow with new interval if playing
if (this.currentGallery.isPlaying) {
this.stopSlideshow();
this.startSlideshow();
}
}
/**
* Go to specific slide
*/
goToSlide(index: number): void {
if (!this.currentGallery) return;
if (index >= 0 && index < this.currentGallery.items.length) {
mediaViewer.goTo(index);
}
}
/**
* Navigate to next slide
*/
nextSlide(): void {
mediaViewer.next();
}
/**
* Navigate to previous slide
*/
previousSlide(): void {
mediaViewer.prev();
}
/**
* Close gallery
*/
closeGallery(): void {
mediaViewer.close();
}
/**
* Check if gallery is open
*/
isGalleryOpen(): boolean {
return this.currentGallery !== null && mediaViewer.isOpen();
}
/**
* Get current gallery state
*/
getGalleryState(): GalleryState | null {
return this.currentGallery;
}
/**
* Resolve image source URL
*/
private resolveImageSrc(src: string, noteId: string): string {
// Handle different image source formats
if (src.startsWith('http://') || src.startsWith('https://')) {
return src;
}
if (src.startsWith('api/images/')) {
return `/${src}`;
}
if (src.startsWith('/')) {
return src;
}
// Assume it's a note ID or attachment reference
return `/api/images/${noteId}/${src}`;
}
/**
* Cleanup resources
*/
cleanup(): void {
// Clear any pending timeouts
if (this.setupTimeout) {
clearTimeout(this.setupTimeout);
this.setupTimeout = undefined;
}
this.closeGallery();
// Ensure all elements are removed
this.createdElements.forEach((element) => {
if (element instanceof HTMLElement) {
element.remove();
} else if (element instanceof $) {
element.remove();
}
});
this.createdElements.clear();
this.slideshowCallbacks.clear();
this.currentGallery = null;
}
}
// Export singleton instance
export default GalleryManager.getInstance();

View File

@@ -6,6 +6,11 @@ import type { Locale } from "@triliumnext/commons";
let locales: Locale[] | null;
/**
* A deferred promise that resolves when translations are initialized.
*/
export let translationsInitializedPromise = $.Deferred();
export async function initLocale() {
const locale = (options.get("locale") as string) || "en";
@@ -19,6 +24,8 @@ export async function initLocale() {
},
returnEmptyString: false
});
translationsInitializedPromise.resolve();
}
export function getAvailableLocales() {

View File

@@ -0,0 +1,597 @@
/**
* Image Annotations Module for PhotoSwipe
* Provides ability to add, display, and manage annotations on images
*/
import froca from './froca.js';
import server from './server.js';
import type FNote from '../entities/fnote.js';
import type FAttribute from '../entities/fattribute.js';
import { ImageValidator, withErrorBoundary, ImageError, ImageErrorType } from './image_error_handler.js';
/**
* Annotation position and data
*/
export interface ImageAnnotation {
id: string;
noteId: string;
x: number; // Percentage from left (0-100)
y: number; // Percentage from top (0-100)
text: string;
author?: string;
created: Date;
modified?: Date;
color?: string;
icon?: string;
type?: 'comment' | 'marker' | 'region';
width?: number; // For region type
height?: number; // For region type
}
/**
* Annotation configuration
*/
export interface AnnotationConfig {
enableAnnotations: boolean;
showByDefault: boolean;
allowEditing: boolean;
defaultColor: string;
defaultIcon: string;
}
/**
* ImageAnnotationsService manages image annotations using Trilium's attribute system
*/
class ImageAnnotationsService {
private static instance: ImageAnnotationsService;
private activeAnnotations: Map<string, ImageAnnotation[]> = new Map();
private annotationElements: Map<string, HTMLElement> = new Map();
private isEditMode: boolean = false;
private selectedAnnotation: ImageAnnotation | null = null;
private config: AnnotationConfig = {
enableAnnotations: true,
showByDefault: true,
allowEditing: true,
defaultColor: '#ffeb3b',
defaultIcon: 'bx-comment'
};
// Annotation attribute prefix in Trilium
private readonly ANNOTATION_PREFIX = 'imageAnnotation';
private constructor() {}
static getInstance(): ImageAnnotationsService {
if (!ImageAnnotationsService.instance) {
ImageAnnotationsService.instance = new ImageAnnotationsService();
}
return ImageAnnotationsService.instance;
}
/**
* Load annotations for an image note
*/
async loadAnnotations(noteId: string): Promise<ImageAnnotation[]> {
return await withErrorBoundary(async () => {
// Validate note ID
if (!noteId || typeof noteId !== 'string') {
throw new ImageError(
ImageErrorType.INVALID_INPUT,
'Invalid note ID provided'
);
}
const note = await froca.getNote(noteId);
if (!note) return [];
const attributes = note.getAttributes();
const annotations: ImageAnnotation[] = [];
// Parse annotation attributes
for (const attr of attributes) {
if (attr.name.startsWith(this.ANNOTATION_PREFIX)) {
try {
const annotationData = JSON.parse(attr.value);
annotations.push({
...annotationData,
id: attr.attributeId,
noteId: noteId,
created: new Date(annotationData.created),
modified: annotationData.modified ? new Date(annotationData.modified) : undefined
});
} catch (error) {
console.error('Failed to parse annotation:', error);
}
}
}
// Sort by creation date
annotations.sort((a, b) => a.created.getTime() - b.created.getTime());
this.activeAnnotations.set(noteId, annotations);
return annotations;
}) || [];
}
/**
* Save a new annotation
*/
async saveAnnotation(annotation: Omit<ImageAnnotation, 'id' | 'created'>): Promise<ImageAnnotation> {
return await withErrorBoundary(async () => {
// Validate annotation data
if (!annotation.text || !annotation.noteId) {
throw new ImageError(
ImageErrorType.INVALID_INPUT,
'Invalid annotation data'
);
}
// Sanitize text
annotation.text = this.sanitizeText(annotation.text);
const note = await froca.getNote(annotation.noteId);
if (!note) {
throw new Error('Note not found');
}
const newAnnotation: ImageAnnotation = {
...annotation,
id: this.generateId(),
created: new Date()
};
// Save as note attribute
const attributeName = `${this.ANNOTATION_PREFIX}_${newAnnotation.id}`;
const attributeValue = JSON.stringify({
x: newAnnotation.x,
y: newAnnotation.y,
text: newAnnotation.text,
author: newAnnotation.author,
created: newAnnotation.created.toISOString(),
color: newAnnotation.color,
icon: newAnnotation.icon,
type: newAnnotation.type,
width: newAnnotation.width,
height: newAnnotation.height
});
await server.put(`notes/${annotation.noteId}/attributes`, {
attributes: [{
type: 'label',
name: attributeName,
value: attributeValue
}]
});
// Update cache
const annotations = this.activeAnnotations.get(annotation.noteId) || [];
annotations.push(newAnnotation);
this.activeAnnotations.set(annotation.noteId, annotations);
return newAnnotation;
}) as Promise<ImageAnnotation>;
}
/**
* Update an existing annotation
*/
async updateAnnotation(annotation: ImageAnnotation): Promise<void> {
try {
const note = await froca.getNote(annotation.noteId);
if (!note) {
throw new Error('Note not found');
}
annotation.modified = new Date();
// Update attribute
const attributeName = `${this.ANNOTATION_PREFIX}_${annotation.id}`;
const attributeValue = JSON.stringify({
x: annotation.x,
y: annotation.y,
text: annotation.text,
author: annotation.author,
created: annotation.created.toISOString(),
modified: annotation.modified.toISOString(),
color: annotation.color,
icon: annotation.icon,
type: annotation.type,
width: annotation.width,
height: annotation.height
});
// Find and update the attribute
const attributes = note.getAttributes();
const attr = attributes.find(a => a.name === attributeName);
if (attr) {
await server.put(`notes/${annotation.noteId}/attributes/${attr.attributeId}`, {
value: attributeValue
});
}
// Update cache
const annotations = this.activeAnnotations.get(annotation.noteId) || [];
const index = annotations.findIndex(a => a.id === annotation.id);
if (index !== -1) {
annotations[index] = annotation;
this.activeAnnotations.set(annotation.noteId, annotations);
}
} catch (error) {
console.error('Failed to update annotation:', error);
throw error;
}
}
/**
* Delete an annotation
*/
async deleteAnnotation(noteId: string, annotationId: string): Promise<void> {
try {
const note = await froca.getNote(noteId);
if (!note) return;
const attributeName = `${this.ANNOTATION_PREFIX}_${annotationId}`;
const attributes = note.getAttributes();
const attr = attributes.find(a => a.name === attributeName);
if (attr) {
await server.remove(`notes/${noteId}/attributes/${attr.attributeId}`);
}
// Update cache
const annotations = this.activeAnnotations.get(noteId) || [];
const filtered = annotations.filter(a => a.id !== annotationId);
this.activeAnnotations.set(noteId, filtered);
// Remove element if exists
const element = this.annotationElements.get(annotationId);
if (element) {
element.remove();
this.annotationElements.delete(annotationId);
}
} catch (error) {
console.error('Failed to delete annotation:', error);
throw error;
}
}
/**
* Render annotations on an image container
*/
renderAnnotations(container: HTMLElement, noteId: string, imageElement: HTMLImageElement): void {
const annotations = this.activeAnnotations.get(noteId) || [];
// Clear existing annotation elements
this.clearAnnotationElements();
// Create annotation overlay container
const overlay = this.createOverlayContainer(container, imageElement);
// Render each annotation
annotations.forEach(annotation => {
const element = this.createAnnotationElement(annotation, overlay);
this.annotationElements.set(annotation.id, element);
});
// Add click handler for creating new annotations
if (this.config.allowEditing && this.isEditMode) {
this.setupAnnotationCreation(overlay, noteId);
}
// Add ARIA attributes for accessibility
overlay.setAttribute('role', 'img');
overlay.setAttribute('aria-label', 'Image with annotations');
}
/**
* Create overlay container for annotations
*/
private createOverlayContainer(container: HTMLElement, imageElement: HTMLImageElement): HTMLElement {
let overlay = container.querySelector('.annotation-overlay') as HTMLElement;
if (!overlay) {
overlay = document.createElement('div');
overlay.className = 'annotation-overlay';
overlay.style.cssText = `
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: ${this.isEditMode ? 'auto' : 'none'};
z-index: 10;
`;
// Position overlay over the image
const rect = imageElement.getBoundingClientRect();
const containerRect = container.getBoundingClientRect();
overlay.style.top = `${rect.top - containerRect.top}px`;
overlay.style.left = `${rect.left - containerRect.left}px`;
overlay.style.width = `${rect.width}px`;
overlay.style.height = `${rect.height}px`;
container.appendChild(overlay);
}
return overlay;
}
/**
* Create annotation element
*/
private createAnnotationElement(annotation: ImageAnnotation, container: HTMLElement): HTMLElement {
const element = document.createElement('div');
element.className = `annotation-marker annotation-${annotation.type || 'comment'}`;
element.dataset.annotationId = annotation.id;
// Position based on percentage
element.style.cssText = `
position: absolute;
left: ${annotation.x}%;
top: ${annotation.y}%;
transform: translate(-50%, -50%);
cursor: pointer;
z-index: 20;
pointer-events: auto;
`;
// Create marker based on type
if (annotation.type === 'region') {
// Region annotation
element.style.cssText += `
width: ${annotation.width || 20}%;
height: ${annotation.height || 20}%;
border: 2px solid ${annotation.color || this.config.defaultColor};
background: ${annotation.color || this.config.defaultColor}33;
border-radius: 4px;
`;
} else {
// Point annotation
const marker = document.createElement('div');
marker.style.cssText = `
width: 24px;
height: 24px;
background: ${annotation.color || this.config.defaultColor};
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
`;
const icon = document.createElement('i');
icon.className = `bx ${annotation.icon || this.config.defaultIcon}`;
icon.style.cssText = `
color: #333;
font-size: 14px;
`;
marker.appendChild(icon);
element.appendChild(marker);
// Add ARIA attributes for accessibility
element.setAttribute('role', 'button');
element.setAttribute('aria-label', `Annotation: ${this.sanitizeText(annotation.text)}`);
element.setAttribute('tabindex', '0');
}
// Add tooltip
const tooltip = document.createElement('div');
tooltip.className = 'annotation-tooltip';
tooltip.style.cssText = `
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
background: rgba(0,0,0,0.9);
color: white;
padding: 8px 12px;
border-radius: 4px;
font-size: 12px;
white-space: nowrap;
max-width: 200px;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s;
margin-bottom: 8px;
`;
// Use textContent to prevent XSS
tooltip.textContent = this.sanitizeText(annotation.text);
element.appendChild(tooltip);
// Show tooltip on hover
element.addEventListener('mouseenter', () => {
tooltip.style.opacity = '1';
});
element.addEventListener('mouseleave', () => {
tooltip.style.opacity = '0';
});
// Handle click for editing
element.addEventListener('click', (e) => {
e.stopPropagation();
this.selectAnnotation(annotation);
});
container.appendChild(element);
return element;
}
/**
* Setup annotation creation on click
*/
private setupAnnotationCreation(overlay: HTMLElement, noteId: string): void {
overlay.addEventListener('click', async (e) => {
if (!this.isEditMode) return;
const rect = overlay.getBoundingClientRect();
const x = ((e.clientX - rect.left) / rect.width) * 100;
const y = ((e.clientY - rect.top) / rect.height) * 100;
// Show annotation creation dialog
const text = prompt('Enter annotation text:');
if (text) {
await this.saveAnnotation({
noteId,
x,
y,
text,
author: 'current_user', // TODO: Get from session
type: 'comment'
});
// Reload annotations
await this.loadAnnotations(noteId);
// Re-render
const imageElement = overlay.parentElement?.querySelector('img') as HTMLImageElement;
if (imageElement && overlay.parentElement) {
this.renderAnnotations(overlay.parentElement, noteId, imageElement);
}
}
});
}
/**
* Select an annotation for editing
*/
private selectAnnotation(annotation: ImageAnnotation): void {
this.selectedAnnotation = annotation;
// Highlight selected annotation
this.annotationElements.forEach((element, id) => {
if (id === annotation.id) {
element.classList.add('selected');
element.style.outline = '2px solid #2196F3';
} else {
element.classList.remove('selected');
element.style.outline = 'none';
}
});
// Show edit options
if (this.isEditMode) {
this.showEditDialog(annotation);
}
}
/**
* Show edit dialog for annotation
*/
private showEditDialog(annotation: ImageAnnotation): void {
// Simple implementation - could be replaced with a proper modal
const newText = prompt('Edit annotation:', annotation.text);
if (newText !== null) {
annotation.text = newText;
this.updateAnnotation(annotation);
// Update tooltip with sanitized text
const element = this.annotationElements.get(annotation.id);
if (element) {
const tooltip = element.querySelector('.annotation-tooltip');
if (tooltip) {
// Use textContent to prevent XSS
tooltip.textContent = this.sanitizeText(newText);
}
}
}
}
/**
* Toggle edit mode
*/
toggleEditMode(): void {
this.isEditMode = !this.isEditMode;
// Update overlay pointer events
document.querySelectorAll('.annotation-overlay').forEach(overlay => {
(overlay as HTMLElement).style.pointerEvents = this.isEditMode ? 'auto' : 'none';
});
}
/**
* Clear all annotation elements
*/
private clearAnnotationElements(): void {
this.annotationElements.forEach(element => element.remove());
this.annotationElements.clear();
}
/**
* Generate unique ID
*/
private generateId(): string {
return `ann_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
}
/**
* Export annotations as JSON
*/
exportAnnotations(noteId: string): string {
const annotations = this.activeAnnotations.get(noteId) || [];
return JSON.stringify(annotations, null, 2);
}
/**
* Import annotations from JSON
*/
async importAnnotations(noteId: string, json: string): Promise<void> {
try {
const annotations = JSON.parse(json) as ImageAnnotation[];
for (const annotation of annotations) {
await this.saveAnnotation({
noteId,
x: annotation.x,
y: annotation.y,
text: annotation.text,
author: annotation.author,
color: annotation.color,
icon: annotation.icon,
type: annotation.type,
width: annotation.width,
height: annotation.height
});
}
await this.loadAnnotations(noteId);
} catch (error) {
console.error('Failed to import annotations:', error);
throw error;
}
}
/**
* Sanitize text to prevent XSS
*/
private sanitizeText(text: string): string {
if (!text) return '';
// Remove any HTML tags and dangerous characters
const div = document.createElement('div');
div.textContent = text;
// Additional validation
const sanitized = div.textContent || '';
// Remove any remaining special characters that could be dangerous
return sanitized
.replace(/<script[^>]*>.*?<\/script>/gi, '')
.replace(/<iframe[^>]*>.*?<\/iframe>/gi, '')
.replace(/javascript:/gi, '')
.replace(/on\w+\s*=/gi, '');
}
/**
* Cleanup resources
*/
cleanup(): void {
this.clearAnnotationElements();
this.activeAnnotations.clear();
this.selectedAnnotation = null;
this.isEditMode = false;
}
}
export default ImageAnnotationsService.getInstance();

View File

@@ -0,0 +1,877 @@
/**
* Image Comparison Module for Trilium Notes
* Provides side-by-side and overlay comparison modes for images
*/
import mediaViewer from './media_viewer.js';
import utils from './utils.js';
/**
* Comparison mode types
*/
export type ComparisonMode = 'side-by-side' | 'overlay' | 'swipe' | 'difference';
/**
* Image comparison configuration
*/
export interface ComparisonConfig {
mode: ComparisonMode;
syncZoom: boolean;
syncPan: boolean;
showLabels: boolean;
swipePosition?: number; // For swipe mode (0-100)
opacity?: number; // For overlay mode (0-1)
highlightDifferences?: boolean; // For difference mode
}
/**
* Comparison state
*/
interface ComparisonState {
leftImage: ComparisonImage;
rightImage: ComparisonImage;
config: ComparisonConfig;
container?: HTMLElement;
isActive: boolean;
}
/**
* Image data for comparison
*/
export interface ComparisonImage {
src: string;
title?: string;
noteId?: string;
width?: number;
height?: number;
}
/**
* ImageComparisonService provides various comparison modes for images
*/
class ImageComparisonService {
private static instance: ImageComparisonService;
private currentComparison: ComparisonState | null = null;
private comparisonContainer?: HTMLElement;
private leftCanvas?: HTMLCanvasElement;
private rightCanvas?: HTMLCanvasElement;
private leftContext?: CanvasRenderingContext2D;
private rightContext?: CanvasRenderingContext2D;
private swipeHandle?: HTMLElement;
private isDraggingSwipe: boolean = false;
private currentZoom: number = 1;
private panX: number = 0;
private panY: number = 0;
private defaultConfig: ComparisonConfig = {
mode: 'side-by-side',
syncZoom: true,
syncPan: true,
showLabels: true,
swipePosition: 50,
opacity: 0.5,
highlightDifferences: false
};
private constructor() {}
static getInstance(): ImageComparisonService {
if (!ImageComparisonService.instance) {
ImageComparisonService.instance = new ImageComparisonService();
}
return ImageComparisonService.instance;
}
/**
* Start image comparison
*/
async startComparison(
leftImage: ComparisonImage,
rightImage: ComparisonImage,
container: HTMLElement,
config?: Partial<ComparisonConfig>
): Promise<void> {
try {
// Close any existing comparison
this.closeComparison();
// Merge configuration
const finalConfig = { ...this.defaultConfig, ...config };
// Initialize state
this.currentComparison = {
leftImage,
rightImage,
config: finalConfig,
container,
isActive: true
};
// Load images
await this.loadImages(leftImage, rightImage);
// Create comparison UI based on mode
switch (finalConfig.mode) {
case 'side-by-side':
await this.createSideBySideComparison(container);
break;
case 'overlay':
await this.createOverlayComparison(container);
break;
case 'swipe':
await this.createSwipeComparison(container);
break;
case 'difference':
await this.createDifferenceComparison(container);
break;
}
// Add controls
this.addComparisonControls(container);
} catch (error) {
console.error('Failed to start image comparison:', error);
this.closeComparison();
throw error;
}
}
/**
* Load images and get dimensions
*/
private async loadImages(leftImage: ComparisonImage, rightImage: ComparisonImage): Promise<void> {
const loadImage = (src: string): Promise<HTMLImageElement> => {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`Failed to load image: ${src}`));
img.src = src;
});
};
const [leftImg, rightImg] = await Promise.all([
loadImage(leftImage.src),
loadImage(rightImage.src)
]);
// Update dimensions
leftImage.width = leftImg.naturalWidth;
leftImage.height = leftImg.naturalHeight;
rightImage.width = rightImg.naturalWidth;
rightImage.height = rightImg.naturalHeight;
}
/**
* Create side-by-side comparison
*/
private async createSideBySideComparison(container: HTMLElement): Promise<void> {
if (!this.currentComparison) return;
// Clear container
container.innerHTML = '';
container.style.cssText = `
display: flex;
width: 100%;
height: 100%;
position: relative;
background: #1a1a1a;
`;
// Create left panel
const leftPanel = document.createElement('div');
leftPanel.className = 'comparison-panel comparison-left';
leftPanel.style.cssText = `
flex: 1;
position: relative;
overflow: hidden;
border-right: 2px solid #333;
`;
// Create right panel
const rightPanel = document.createElement('div');
rightPanel.className = 'comparison-panel comparison-right';
rightPanel.style.cssText = `
flex: 1;
position: relative;
overflow: hidden;
`;
// Add images
const leftImg = await this.createImageElement(this.currentComparison.leftImage);
const rightImg = await this.createImageElement(this.currentComparison.rightImage);
leftPanel.appendChild(leftImg);
rightPanel.appendChild(rightImg);
// Add labels if enabled
if (this.currentComparison.config.showLabels) {
this.addImageLabel(leftPanel, this.currentComparison.leftImage.title || 'Image 1');
this.addImageLabel(rightPanel, this.currentComparison.rightImage.title || 'Image 2');
}
container.appendChild(leftPanel);
container.appendChild(rightPanel);
// Setup synchronized zoom and pan if enabled
if (this.currentComparison.config.syncZoom || this.currentComparison.config.syncPan) {
this.setupSynchronizedControls(leftPanel, rightPanel);
}
}
/**
* Create overlay comparison
*/
private async createOverlayComparison(container: HTMLElement): Promise<void> {
if (!this.currentComparison) return;
container.innerHTML = '';
container.style.cssText = `
position: relative;
width: 100%;
height: 100%;
background: #1a1a1a;
overflow: hidden;
`;
// Create base image
const baseImg = await this.createImageElement(this.currentComparison.leftImage);
baseImg.style.position = 'absolute';
baseImg.style.zIndex = '1';
// Create overlay image
const overlayImg = await this.createImageElement(this.currentComparison.rightImage);
overlayImg.style.position = 'absolute';
overlayImg.style.zIndex = '2';
overlayImg.style.opacity = String(this.currentComparison.config.opacity || 0.5);
container.appendChild(baseImg);
container.appendChild(overlayImg);
// Add opacity slider
this.addOpacityControl(container, overlayImg);
// Add labels
if (this.currentComparison.config.showLabels) {
const labelContainer = document.createElement('div');
labelContainer.style.cssText = `
position: absolute;
top: 10px;
left: 10px;
z-index: 10;
display: flex;
gap: 10px;
`;
const baseLabel = this.createLabel(this.currentComparison.leftImage.title || 'Base', '#4CAF50');
const overlayLabel = this.createLabel(this.currentComparison.rightImage.title || 'Overlay', '#2196F3');
labelContainer.appendChild(baseLabel);
labelContainer.appendChild(overlayLabel);
container.appendChild(labelContainer);
}
}
/**
* Create swipe comparison
*/
private async createSwipeComparison(container: HTMLElement): Promise<void> {
if (!this.currentComparison) return;
container.innerHTML = '';
container.style.cssText = `
position: relative;
width: 100%;
height: 100%;
background: #1a1a1a;
overflow: hidden;
cursor: ew-resize;
`;
// Create images
const leftImg = await this.createImageElement(this.currentComparison.leftImage);
const rightImg = await this.createImageElement(this.currentComparison.rightImage);
leftImg.style.position = 'absolute';
leftImg.style.zIndex = '1';
// Create clipping container for right image
const clipContainer = document.createElement('div');
clipContainer.className = 'swipe-clip-container';
clipContainer.style.cssText = `
position: absolute;
top: 0;
left: 0;
width: ${this.currentComparison.config.swipePosition}%;
height: 100%;
overflow: hidden;
z-index: 2;
`;
rightImg.style.position = 'absolute';
clipContainer.appendChild(rightImg);
// Create swipe handle
this.swipeHandle = document.createElement('div');
this.swipeHandle.className = 'swipe-handle';
this.swipeHandle.style.cssText = `
position: absolute;
top: 0;
left: ${this.currentComparison.config.swipePosition}%;
width: 4px;
height: 100%;
background: white;
cursor: ew-resize;
z-index: 3;
transform: translateX(-50%);
box-shadow: 0 0 10px rgba(0,0,0,0.5);
`;
// Add handle icon
const handleIcon = document.createElement('div');
handleIcon.style.cssText = `
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 40px;
height: 40px;
background: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.3);
`;
handleIcon.innerHTML = '<i class="bx bx-move-horizontal" style="font-size: 24px; color: #333;"></i>';
this.swipeHandle.appendChild(handleIcon);
container.appendChild(leftImg);
container.appendChild(clipContainer);
container.appendChild(this.swipeHandle);
// Setup swipe interaction
this.setupSwipeInteraction(container, clipContainer);
// Add labels
if (this.currentComparison.config.showLabels) {
this.addSwipeLabels(container);
}
}
/**
* Create difference comparison using canvas
*/
private async createDifferenceComparison(container: HTMLElement): Promise<void> {
if (!this.currentComparison) return;
container.innerHTML = '';
container.style.cssText = `
position: relative;
width: 100%;
height: 100%;
background: #1a1a1a;
overflow: hidden;
`;
// Create canvas for difference visualization
const canvas = document.createElement('canvas');
canvas.className = 'difference-canvas';
const ctx = canvas.getContext('2d');
if (!ctx) {
throw new Error('Failed to get canvas context');
}
// Load images
const leftImg = new Image();
const rightImg = new Image();
await Promise.all([
new Promise((resolve) => {
leftImg.onload = resolve;
leftImg.src = this.currentComparison!.leftImage.src;
}),
new Promise((resolve) => {
rightImg.onload = resolve;
rightImg.src = this.currentComparison!.rightImage.src;
})
]);
// Set canvas size
const maxWidth = Math.max(leftImg.width, rightImg.width);
const maxHeight = Math.max(leftImg.height, rightImg.height);
canvas.width = maxWidth;
canvas.height = maxHeight;
// Calculate difference
this.calculateImageDifference(ctx, leftImg, rightImg, maxWidth, maxHeight);
// Style canvas
canvas.style.cssText = `
max-width: 100%;
max-height: 100%;
object-fit: contain;
`;
container.appendChild(canvas);
// Add difference statistics
this.addDifferenceStatistics(container, ctx, maxWidth, maxHeight);
}
/**
* Calculate and visualize image difference
*/
private calculateImageDifference(
ctx: CanvasRenderingContext2D,
leftImg: HTMLImageElement,
rightImg: HTMLImageElement,
width: number,
height: number
): void {
// Draw left image
ctx.drawImage(leftImg, 0, 0, width, height);
const leftData = ctx.getImageData(0, 0, width, height);
// Draw right image
ctx.clearRect(0, 0, width, height);
ctx.drawImage(rightImg, 0, 0, width, height);
const rightData = ctx.getImageData(0, 0, width, height);
// Calculate difference
const diffData = ctx.createImageData(width, height);
let totalDiff = 0;
for (let i = 0; i < leftData.data.length; i += 4) {
const rDiff = Math.abs(leftData.data[i] - rightData.data[i]);
const gDiff = Math.abs(leftData.data[i + 1] - rightData.data[i + 1]);
const bDiff = Math.abs(leftData.data[i + 2] - rightData.data[i + 2]);
const avgDiff = (rDiff + gDiff + bDiff) / 3;
totalDiff += avgDiff;
if (this.currentComparison?.config.highlightDifferences && avgDiff > 30) {
// Highlight differences in red
diffData.data[i] = 255; // Red
diffData.data[i + 1] = 0; // Green
diffData.data[i + 2] = 0; // Blue
diffData.data[i + 3] = Math.min(255, avgDiff * 2); // Alpha based on difference
} else {
// Show original image with reduced opacity for non-different areas
diffData.data[i] = leftData.data[i];
diffData.data[i + 1] = leftData.data[i + 1];
diffData.data[i + 2] = leftData.data[i + 2];
diffData.data[i + 3] = avgDiff > 10 ? 255 : 128;
}
}
ctx.putImageData(diffData, 0, 0);
}
/**
* Add difference statistics overlay
*/
private addDifferenceStatistics(
container: HTMLElement,
ctx: CanvasRenderingContext2D,
width: number,
height: number
): void {
const imageData = ctx.getImageData(0, 0, width, height);
let changedPixels = 0;
const threshold = 30;
for (let i = 0; i < imageData.data.length; i += 4) {
const r = imageData.data[i];
const g = imageData.data[i + 1];
const b = imageData.data[i + 2];
if (r > threshold || g > threshold || b > threshold) {
changedPixels++;
}
}
const totalPixels = width * height;
const changePercentage = ((changedPixels / totalPixels) * 100).toFixed(2);
const statsDiv = document.createElement('div');
statsDiv.className = 'difference-stats';
statsDiv.style.cssText = `
position: absolute;
top: 10px;
right: 10px;
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 10px;
border-radius: 4px;
font-size: 12px;
z-index: 10;
`;
statsDiv.innerHTML = `
<div><strong>Difference Analysis</strong></div>
<div>Changed pixels: ${changedPixels.toLocaleString()}</div>
<div>Total pixels: ${totalPixels.toLocaleString()}</div>
<div>Difference: ${changePercentage}%</div>
`;
container.appendChild(statsDiv);
}
/**
* Create image element
*/
private async createImageElement(image: ComparisonImage): Promise<HTMLImageElement> {
const img = document.createElement('img');
img.src = image.src;
img.alt = image.title || 'Comparison image';
img.style.cssText = `
width: 100%;
height: 100%;
object-fit: contain;
`;
await new Promise((resolve, reject) => {
img.onload = resolve;
img.onerror = reject;
});
return img;
}
/**
* Add image label
*/
private addImageLabel(container: HTMLElement, text: string): void {
const label = document.createElement('div');
label.className = 'image-label';
label.style.cssText = `
position: absolute;
top: 10px;
left: 10px;
background: rgba(0, 0, 0, 0.7);
color: white;
padding: 6px 10px;
border-radius: 4px;
font-size: 12px;
z-index: 10;
`;
label.textContent = text;
container.appendChild(label);
}
/**
* Create label element
*/
private createLabel(text: string, color: string): HTMLElement {
const label = document.createElement('div');
label.style.cssText = `
background: ${color};
color: white;
padding: 4px 8px;
border-radius: 3px;
font-size: 12px;
`;
label.textContent = text;
return label;
}
/**
* Add swipe labels
*/
private addSwipeLabels(container: HTMLElement): void {
if (!this.currentComparison) return;
const leftLabel = document.createElement('div');
leftLabel.style.cssText = `
position: absolute;
top: 10px;
left: 10px;
background: rgba(76, 175, 80, 0.9);
color: white;
padding: 6px 10px;
border-radius: 4px;
font-size: 12px;
z-index: 10;
`;
leftLabel.textContent = this.currentComparison.leftImage.title || 'Left';
const rightLabel = document.createElement('div');
rightLabel.style.cssText = `
position: absolute;
top: 10px;
right: 10px;
background: rgba(33, 150, 243, 0.9);
color: white;
padding: 6px 10px;
border-radius: 4px;
font-size: 12px;
z-index: 10;
`;
rightLabel.textContent = this.currentComparison.rightImage.title || 'Right';
container.appendChild(leftLabel);
container.appendChild(rightLabel);
}
/**
* Setup swipe interaction
*/
private setupSwipeInteraction(container: HTMLElement, clipContainer: HTMLElement): void {
if (!this.swipeHandle) return;
let startX = 0;
let startPosition = this.currentComparison?.config.swipePosition || 50;
const handleMouseMove = (e: MouseEvent) => {
if (!this.isDraggingSwipe) return;
const rect = container.getBoundingClientRect();
const x = e.clientX - rect.left;
const percentage = Math.max(0, Math.min(100, (x / rect.width) * 100));
clipContainer.style.width = `${percentage}%`;
if (this.swipeHandle) {
this.swipeHandle.style.left = `${percentage}%`;
}
if (this.currentComparison) {
this.currentComparison.config.swipePosition = percentage;
}
};
const handleMouseUp = () => {
this.isDraggingSwipe = false;
document.removeEventListener('mousemove', handleMouseMove);
document.removeEventListener('mouseup', handleMouseUp);
container.style.cursor = 'default';
};
this.swipeHandle.addEventListener('mousedown', (e) => {
this.isDraggingSwipe = true;
startX = e.clientX;
startPosition = this.currentComparison?.config.swipePosition || 50;
container.style.cursor = 'ew-resize';
document.addEventListener('mousemove', handleMouseMove);
document.addEventListener('mouseup', handleMouseUp);
});
// Also allow dragging anywhere in the container
container.addEventListener('mousedown', (e) => {
if (e.target === this.swipeHandle || (e.target as HTMLElement).parentElement === this.swipeHandle) {
return;
}
const rect = container.getBoundingClientRect();
const x = e.clientX - rect.left;
const percentage = (x / rect.width) * 100;
clipContainer.style.width = `${percentage}%`;
if (this.swipeHandle) {
this.swipeHandle.style.left = `${percentage}%`;
}
if (this.currentComparison) {
this.currentComparison.config.swipePosition = percentage;
}
});
}
/**
* Add opacity control for overlay mode
*/
private addOpacityControl(container: HTMLElement, overlayImg: HTMLImageElement): void {
const control = document.createElement('div');
control.className = 'opacity-control';
control.style.cssText = `
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.8);
padding: 10px 20px;
border-radius: 4px;
z-index: 10;
display: flex;
align-items: center;
gap: 10px;
`;
const label = document.createElement('label');
label.textContent = 'Opacity:';
label.style.color = 'white';
label.style.fontSize = '12px';
const slider = document.createElement('input');
slider.type = 'range';
slider.min = '0';
slider.max = '100';
slider.value = String((this.currentComparison?.config.opacity || 0.5) * 100);
slider.style.width = '150px';
const value = document.createElement('span');
value.textContent = `${slider.value}%`;
value.style.color = 'white';
value.style.fontSize = '12px';
value.style.minWidth = '35px';
slider.addEventListener('input', () => {
const opacity = parseInt(slider.value) / 100;
overlayImg.style.opacity = String(opacity);
value.textContent = `${slider.value}%`;
if (this.currentComparison) {
this.currentComparison.config.opacity = opacity;
}
});
control.appendChild(label);
control.appendChild(slider);
control.appendChild(value);
container.appendChild(control);
}
/**
* Setup synchronized controls for side-by-side mode
*/
private setupSynchronizedControls(leftPanel: HTMLElement, rightPanel: HTMLElement): void {
const leftImg = leftPanel.querySelector('img') as HTMLImageElement;
const rightImg = rightPanel.querySelector('img') as HTMLImageElement;
if (!leftImg || !rightImg) return;
// Synchronize scroll
if (this.currentComparison?.config.syncPan) {
leftPanel.addEventListener('scroll', () => {
rightPanel.scrollLeft = leftPanel.scrollLeft;
rightPanel.scrollTop = leftPanel.scrollTop;
});
rightPanel.addEventListener('scroll', () => {
leftPanel.scrollLeft = rightPanel.scrollLeft;
leftPanel.scrollTop = rightPanel.scrollTop;
});
}
// Synchronize zoom with wheel events
if (this.currentComparison?.config.syncZoom) {
const handleWheel = (e: WheelEvent) => {
e.preventDefault();
const delta = e.deltaY < 0 ? 1.1 : 0.9;
this.currentZoom = Math.max(0.5, Math.min(5, this.currentZoom * delta));
leftImg.style.transform = `scale(${this.currentZoom})`;
rightImg.style.transform = `scale(${this.currentZoom})`;
};
leftPanel.addEventListener('wheel', handleWheel);
rightPanel.addEventListener('wheel', handleWheel);
}
}
/**
* Add comparison controls toolbar
*/
private addComparisonControls(container: HTMLElement): void {
const toolbar = document.createElement('div');
toolbar.className = 'comparison-toolbar';
toolbar.style.cssText = `
position: absolute;
top: 10px;
right: 10px;
background: rgba(0, 0, 0, 0.8);
border-radius: 4px;
padding: 8px;
display: flex;
gap: 8px;
z-index: 100;
`;
// Mode switcher
const modes: ComparisonMode[] = ['side-by-side', 'overlay', 'swipe', 'difference'];
modes.forEach(mode => {
const btn = document.createElement('button');
btn.className = `mode-btn mode-${mode}`;
btn.style.cssText = `
background: ${this.currentComparison?.config.mode === mode ? '#2196F3' : 'rgba(255,255,255,0.1)'};
color: white;
border: none;
padding: 6px 10px;
border-radius: 3px;
cursor: pointer;
font-size: 12px;
`;
btn.textContent = mode.replace('-', ' ').replace(/\b\w/g, l => l.toUpperCase());
btn.addEventListener('click', async () => {
if (this.currentComparison && this.currentComparison.container) {
this.currentComparison.config.mode = mode;
await this.startComparison(
this.currentComparison.leftImage,
this.currentComparison.rightImage,
this.currentComparison.container,
this.currentComparison.config
);
}
});
toolbar.appendChild(btn);
});
// Close button
const closeBtn = document.createElement('button');
closeBtn.style.cssText = `
background: rgba(255,0,0,0.5);
color: white;
border: none;
padding: 6px 10px;
border-radius: 3px;
cursor: pointer;
font-size: 12px;
margin-left: 10px;
`;
closeBtn.textContent = 'Close';
closeBtn.addEventListener('click', () => this.closeComparison());
toolbar.appendChild(closeBtn);
container.appendChild(toolbar);
}
/**
* Close comparison
*/
closeComparison(): void {
if (this.currentComparison?.container) {
this.currentComparison.container.innerHTML = '';
}
this.currentComparison = null;
this.comparisonContainer = undefined;
this.leftCanvas = undefined;
this.rightCanvas = undefined;
this.leftContext = undefined;
this.rightContext = undefined;
this.swipeHandle = undefined;
this.isDraggingSwipe = false;
this.currentZoom = 1;
this.panX = 0;
this.panY = 0;
}
/**
* Check if comparison is active
*/
isComparisonActive(): boolean {
return this.currentComparison?.isActive || false;
}
/**
* Get current comparison state
*/
getComparisonState(): ComparisonState | null {
return this.currentComparison;
}
}
export default ImageComparisonService.getInstance();

View File

@@ -0,0 +1,874 @@
/**
* Basic Image Editor Module for Trilium Notes
* Provides non-destructive image editing capabilities
*/
import server from './server.js';
import toastService from './toast.js';
import { ImageValidator, withErrorBoundary, MemoryMonitor, ImageError, ImageErrorType } from './image_error_handler.js';
/**
* Edit operation types
*/
export type EditOperation =
| 'rotate'
| 'crop'
| 'brightness'
| 'contrast'
| 'saturation'
| 'blur'
| 'sharpen';
/**
* Edit history entry
*/
export interface EditHistoryEntry {
operation: EditOperation;
params: any;
timestamp: Date;
}
/**
* Crop area definition
*/
export interface CropArea {
x: number;
y: number;
width: number;
height: number;
}
/**
* Editor state
*/
interface EditorState {
originalImage: HTMLImageElement | null;
currentImage: HTMLImageElement | null;
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
history: EditHistoryEntry[];
historyIndex: number;
isEditing: boolean;
}
/**
* Filter parameters
*/
export interface FilterParams {
brightness?: number; // -100 to 100
contrast?: number; // -100 to 100
saturation?: number; // -100 to 100
blur?: number; // 0 to 20
sharpen?: number; // 0 to 100
}
/**
* ImageEditorService provides basic image editing capabilities
*/
class ImageEditorService {
private static instance: ImageEditorService;
private editorState: EditorState;
private tempCanvas: HTMLCanvasElement;
private tempContext: CanvasRenderingContext2D;
private cropOverlay?: HTMLElement;
private cropHandles?: HTMLElement[];
private cropArea: CropArea | null = null;
private isDraggingCrop: boolean = false;
private dragStartX: number = 0;
private dragStartY: number = 0;
private currentFilters: FilterParams = {};
// Canvas size limits for security and memory management
private readonly MAX_CANVAS_SIZE = 8192; // Maximum width/height
private readonly MAX_CANVAS_AREA = 50000000; // 50 megapixels
private constructor() {
// Initialize canvases
this.editorState = {
originalImage: null,
currentImage: null,
canvas: document.createElement('canvas'),
context: null as any,
history: [],
historyIndex: -1,
isEditing: false
};
const ctx = this.editorState.canvas.getContext('2d');
if (!ctx) {
throw new Error('Failed to get canvas context');
}
this.editorState.context = ctx;
this.tempCanvas = document.createElement('canvas');
const tempCtx = this.tempCanvas.getContext('2d');
if (!tempCtx) {
throw new Error('Failed to get temp canvas context');
}
this.tempContext = tempCtx;
}
static getInstance(): ImageEditorService {
if (!ImageEditorService.instance) {
ImageEditorService.instance = new ImageEditorService();
}
return ImageEditorService.instance;
}
/**
* Start editing an image
*/
async startEditing(src: string | HTMLImageElement): Promise<HTMLCanvasElement> {
return await withErrorBoundary(async () => {
// Validate input
if (typeof src === 'string') {
ImageValidator.validateUrl(src);
}
// Load image
let img: HTMLImageElement;
if (typeof src === 'string') {
img = await this.loadImage(src);
} else {
img = src;
}
// Validate image dimensions
ImageValidator.validateDimensions(img.naturalWidth, img.naturalHeight);
// Check memory availability
const estimatedMemory = MemoryMonitor.estimateImageMemory(img.naturalWidth, img.naturalHeight);
if (!MemoryMonitor.checkMemoryAvailable(estimatedMemory)) {
throw new ImageError(
ImageErrorType.MEMORY_ERROR,
'Insufficient memory to process image',
{ estimatedMemory }
);
}
if (img.naturalWidth > this.MAX_CANVAS_SIZE ||
img.naturalHeight > this.MAX_CANVAS_SIZE ||
img.naturalWidth * img.naturalHeight > this.MAX_CANVAS_AREA) {
// Scale down if too large
const scale = Math.min(
this.MAX_CANVAS_SIZE / Math.max(img.naturalWidth, img.naturalHeight),
Math.sqrt(this.MAX_CANVAS_AREA / (img.naturalWidth * img.naturalHeight))
);
const scaledWidth = Math.floor(img.naturalWidth * scale);
const scaledHeight = Math.floor(img.naturalHeight * scale);
console.warn(`Image too large (${img.naturalWidth}x${img.naturalHeight}), scaling to ${scaledWidth}x${scaledHeight}`);
// Create scaled image
const scaledCanvas = document.createElement('canvas');
scaledCanvas.width = scaledWidth;
scaledCanvas.height = scaledHeight;
const scaledCtx = scaledCanvas.getContext('2d');
if (!scaledCtx) throw new Error('Failed to get scaled canvas context');
scaledCtx.drawImage(img, 0, 0, scaledWidth, scaledHeight);
// Create new image from scaled canvas
const scaledImg = new Image();
scaledImg.src = scaledCanvas.toDataURL();
await new Promise(resolve => scaledImg.onload = resolve);
img = scaledImg;
// Clean up scaled canvas
scaledCanvas.width = 0;
scaledCanvas.height = 0;
}
// Store original
this.editorState.originalImage = img;
this.editorState.currentImage = img;
this.editorState.isEditing = true;
this.editorState.history = [];
this.editorState.historyIndex = -1;
this.currentFilters = {};
// Setup canvas with validated dimensions
this.editorState.canvas.width = img.naturalWidth;
this.editorState.canvas.height = img.naturalHeight;
this.editorState.context.drawImage(img, 0, 0);
return this.editorState.canvas;
}, (error) => {
this.stopEditing();
throw error;
}) || this.editorState.canvas;
}
/**
* Rotate image by degrees (90, 180, 270)
*/
rotate(degrees: 90 | 180 | 270 | -90): void {
if (!this.editorState.isEditing) return;
const { canvas, context } = this.editorState;
const { width, height } = canvas;
// Setup temp canvas
if (degrees === 90 || degrees === -90 || degrees === 270) {
this.tempCanvas.width = height;
this.tempCanvas.height = width;
} else {
this.tempCanvas.width = width;
this.tempCanvas.height = height;
}
// Clear temp canvas
this.tempContext.clearRect(0, 0, this.tempCanvas.width, this.tempCanvas.height);
// Rotate
this.tempContext.save();
if (degrees === 90) {
this.tempContext.translate(height, 0);
this.tempContext.rotate(Math.PI / 2);
} else if (degrees === 180) {
this.tempContext.translate(width, height);
this.tempContext.rotate(Math.PI);
} else if (degrees === 270 || degrees === -90) {
this.tempContext.translate(0, width);
this.tempContext.rotate(-Math.PI / 2);
}
this.tempContext.drawImage(canvas, 0, 0);
this.tempContext.restore();
// Copy back to main canvas
canvas.width = this.tempCanvas.width;
canvas.height = this.tempCanvas.height;
context.drawImage(this.tempCanvas, 0, 0);
// Add to history
this.addToHistory('rotate', { degrees });
}
/**
* Start crop selection
*/
startCrop(container: HTMLElement): void {
if (!this.editorState.isEditing) return;
// Create crop overlay
this.cropOverlay = document.createElement('div');
this.cropOverlay.className = 'crop-overlay';
this.cropOverlay.style.cssText = `
position: absolute;
border: 2px dashed #fff;
background: rgba(0, 0, 0, 0.3);
cursor: move;
z-index: 1000;
`;
// Create resize handles
this.cropHandles = [];
const handlePositions = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'];
handlePositions.forEach(pos => {
const handle = document.createElement('div');
handle.className = `crop-handle crop-handle-${pos}`;
handle.dataset.position = pos;
handle.style.cssText = `
position: absolute;
width: 10px;
height: 10px;
background: white;
border: 1px solid #333;
z-index: 1001;
`;
// Position handles
switch (pos) {
case 'nw':
handle.style.top = '-5px';
handle.style.left = '-5px';
handle.style.cursor = 'nw-resize';
break;
case 'n':
handle.style.top = '-5px';
handle.style.left = '50%';
handle.style.transform = 'translateX(-50%)';
handle.style.cursor = 'n-resize';
break;
case 'ne':
handle.style.top = '-5px';
handle.style.right = '-5px';
handle.style.cursor = 'ne-resize';
break;
case 'e':
handle.style.top = '50%';
handle.style.right = '-5px';
handle.style.transform = 'translateY(-50%)';
handle.style.cursor = 'e-resize';
break;
case 'se':
handle.style.bottom = '-5px';
handle.style.right = '-5px';
handle.style.cursor = 'se-resize';
break;
case 's':
handle.style.bottom = '-5px';
handle.style.left = '50%';
handle.style.transform = 'translateX(-50%)';
handle.style.cursor = 's-resize';
break;
case 'sw':
handle.style.bottom = '-5px';
handle.style.left = '-5px';
handle.style.cursor = 'sw-resize';
break;
case 'w':
handle.style.top = '50%';
handle.style.left = '-5px';
handle.style.transform = 'translateY(-50%)';
handle.style.cursor = 'w-resize';
break;
}
this.cropOverlay.appendChild(handle);
this.cropHandles!.push(handle);
});
// Set initial crop area (80% of image)
const canvasRect = this.editorState.canvas.getBoundingClientRect();
const initialSize = Math.min(canvasRect.width, canvasRect.height) * 0.8;
const initialX = (canvasRect.width - initialSize) / 2;
const initialY = (canvasRect.height - initialSize) / 2;
this.cropArea = {
x: initialX,
y: initialY,
width: initialSize,
height: initialSize
};
this.updateCropOverlay();
container.appendChild(this.cropOverlay);
// Setup drag handlers
this.setupCropHandlers();
}
/**
* Setup crop interaction handlers
*/
private setupCropHandlers(): void {
if (!this.cropOverlay) return;
// Drag to move
this.cropOverlay.addEventListener('mousedown', (e) => {
if ((e.target as HTMLElement).classList.contains('crop-handle')) return;
this.isDraggingCrop = true;
this.dragStartX = e.clientX;
this.dragStartY = e.clientY;
const handleMove = (e: MouseEvent) => {
if (!this.isDraggingCrop || !this.cropArea) return;
const deltaX = e.clientX - this.dragStartX;
const deltaY = e.clientY - this.dragStartY;
this.cropArea.x += deltaX;
this.cropArea.y += deltaY;
this.dragStartX = e.clientX;
this.dragStartY = e.clientY;
this.updateCropOverlay();
};
const handleUp = () => {
this.isDraggingCrop = false;
document.removeEventListener('mousemove', handleMove);
document.removeEventListener('mouseup', handleUp);
};
document.addEventListener('mousemove', handleMove);
document.addEventListener('mouseup', handleUp);
});
// Resize handles
this.cropHandles?.forEach(handle => {
handle.addEventListener('mousedown', (e) => {
e.stopPropagation();
const position = handle.dataset.position!;
const startX = e.clientX;
const startY = e.clientY;
const startCrop = { ...this.cropArea! };
const handleResize = (e: MouseEvent) => {
if (!this.cropArea) return;
const deltaX = e.clientX - startX;
const deltaY = e.clientY - startY;
switch (position) {
case 'nw':
this.cropArea.x = startCrop.x + deltaX;
this.cropArea.y = startCrop.y + deltaY;
this.cropArea.width = startCrop.width - deltaX;
this.cropArea.height = startCrop.height - deltaY;
break;
case 'n':
this.cropArea.y = startCrop.y + deltaY;
this.cropArea.height = startCrop.height - deltaY;
break;
case 'ne':
this.cropArea.y = startCrop.y + deltaY;
this.cropArea.width = startCrop.width + deltaX;
this.cropArea.height = startCrop.height - deltaY;
break;
case 'e':
this.cropArea.width = startCrop.width + deltaX;
break;
case 'se':
this.cropArea.width = startCrop.width + deltaX;
this.cropArea.height = startCrop.height + deltaY;
break;
case 's':
this.cropArea.height = startCrop.height + deltaY;
break;
case 'sw':
this.cropArea.x = startCrop.x + deltaX;
this.cropArea.width = startCrop.width - deltaX;
this.cropArea.height = startCrop.height + deltaY;
break;
case 'w':
this.cropArea.x = startCrop.x + deltaX;
this.cropArea.width = startCrop.width - deltaX;
break;
}
// Ensure minimum size
this.cropArea.width = Math.max(50, this.cropArea.width);
this.cropArea.height = Math.max(50, this.cropArea.height);
this.updateCropOverlay();
};
const handleUp = () => {
document.removeEventListener('mousemove', handleResize);
document.removeEventListener('mouseup', handleUp);
};
document.addEventListener('mousemove', handleResize);
document.addEventListener('mouseup', handleUp);
});
});
}
/**
* Update crop overlay position
*/
private updateCropOverlay(): void {
if (!this.cropOverlay || !this.cropArea) return;
this.cropOverlay.style.left = `${this.cropArea.x}px`;
this.cropOverlay.style.top = `${this.cropArea.y}px`;
this.cropOverlay.style.width = `${this.cropArea.width}px`;
this.cropOverlay.style.height = `${this.cropArea.height}px`;
}
/**
* Apply crop
*/
applyCrop(): void {
if (!this.editorState.isEditing || !this.cropArea) return;
const { canvas, context } = this.editorState;
const canvasRect = canvas.getBoundingClientRect();
// Convert crop area from screen to canvas coordinates
const scaleX = canvas.width / canvasRect.width;
const scaleY = canvas.height / canvasRect.height;
const cropX = this.cropArea.x * scaleX;
const cropY = this.cropArea.y * scaleY;
const cropWidth = this.cropArea.width * scaleX;
const cropHeight = this.cropArea.height * scaleY;
// Get cropped image data
const imageData = context.getImageData(cropX, cropY, cropWidth, cropHeight);
// Resize canvas and put cropped image
canvas.width = cropWidth;
canvas.height = cropHeight;
context.putImageData(imageData, 0, 0);
// Clean up crop overlay
this.cancelCrop();
// Add to history
this.addToHistory('crop', {
x: cropX,
y: cropY,
width: cropWidth,
height: cropHeight
});
}
/**
* Cancel crop
*/
cancelCrop(): void {
if (this.cropOverlay) {
this.cropOverlay.remove();
this.cropOverlay = undefined;
}
this.cropHandles = undefined;
this.cropArea = null;
}
/**
* Apply brightness adjustment
*/
applyBrightness(value: number): void {
if (!this.editorState.isEditing) return;
this.currentFilters.brightness = value;
this.applyFilters();
}
/**
* Apply contrast adjustment
*/
applyContrast(value: number): void {
if (!this.editorState.isEditing) return;
this.currentFilters.contrast = value;
this.applyFilters();
}
/**
* Apply saturation adjustment
*/
applySaturation(value: number): void {
if (!this.editorState.isEditing) return;
this.currentFilters.saturation = value;
this.applyFilters();
}
/**
* Apply all filters
*/
private applyFilters(): void {
const { canvas, context, originalImage } = this.editorState;
if (!originalImage) return;
// Clear canvas and redraw original
context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(originalImage, 0, 0, canvas.width, canvas.height);
// Get image data
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
// Apply brightness
if (this.currentFilters.brightness) {
const brightness = this.currentFilters.brightness * 2.55; // Convert to 0-255 range
for (let i = 0; i < data.length; i += 4) {
data[i] = Math.min(255, Math.max(0, data[i] + brightness));
data[i + 1] = Math.min(255, Math.max(0, data[i + 1] + brightness));
data[i + 2] = Math.min(255, Math.max(0, data[i + 2] + brightness));
}
}
// Apply contrast
if (this.currentFilters.contrast) {
const factor = (259 * (this.currentFilters.contrast + 255)) / (255 * (259 - this.currentFilters.contrast));
for (let i = 0; i < data.length; i += 4) {
data[i] = Math.min(255, Math.max(0, factor * (data[i] - 128) + 128));
data[i + 1] = Math.min(255, Math.max(0, factor * (data[i + 1] - 128) + 128));
data[i + 2] = Math.min(255, Math.max(0, factor * (data[i + 2] - 128) + 128));
}
}
// Apply saturation
if (this.currentFilters.saturation) {
const saturation = this.currentFilters.saturation / 100;
for (let i = 0; i < data.length; i += 4) {
const gray = 0.2989 * data[i] + 0.5870 * data[i + 1] + 0.1140 * data[i + 2];
data[i] = Math.min(255, Math.max(0, gray + saturation * (data[i] - gray)));
data[i + 1] = Math.min(255, Math.max(0, gray + saturation * (data[i + 1] - gray)));
data[i + 2] = Math.min(255, Math.max(0, gray + saturation * (data[i + 2] - gray)));
}
}
// Put modified image data back
context.putImageData(imageData, 0, 0);
}
/**
* Apply blur effect
*/
applyBlur(radius: number): void {
if (!this.editorState.isEditing) return;
const { canvas, context } = this.editorState;
// Use CSS filter for performance
context.filter = `blur(${radius}px)`;
context.drawImage(canvas, 0, 0);
context.filter = 'none';
this.addToHistory('blur', { radius });
}
/**
* Apply sharpen effect
*/
applySharpen(amount: number): void {
if (!this.editorState.isEditing) return;
const { canvas, context } = this.editorState;
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
const width = canvas.width;
const height = canvas.height;
// Create copy of original data
const original = new Uint8ClampedArray(data);
// Sharpen kernel
const kernel = [
0, -1, 0,
-1, 5 + amount / 25, -1,
0, -1, 0
];
// Apply convolution
for (let y = 1; y < height - 1; y++) {
for (let x = 1; x < width - 1; x++) {
const idx = (y * width + x) * 4;
for (let c = 0; c < 3; c++) {
let sum = 0;
for (let ky = -1; ky <= 1; ky++) {
for (let kx = -1; kx <= 1; kx++) {
const kidx = ((y + ky) * width + (x + kx)) * 4;
sum += original[kidx + c] * kernel[(ky + 1) * 3 + (kx + 1)];
}
}
data[idx + c] = Math.min(255, Math.max(0, sum));
}
}
}
context.putImageData(imageData, 0, 0);
this.addToHistory('sharpen', { amount });
}
/**
* Undo last operation
*/
undo(): void {
if (!this.editorState.isEditing || this.editorState.historyIndex <= 0) return;
this.editorState.historyIndex--;
this.replayHistory();
}
/**
* Redo operation
*/
redo(): void {
if (!this.editorState.isEditing ||
this.editorState.historyIndex >= this.editorState.history.length - 1) return;
this.editorState.historyIndex++;
this.replayHistory();
}
/**
* Replay history up to current index
*/
private replayHistory(): void {
const { canvas, context, originalImage, history, historyIndex } = this.editorState;
if (!originalImage) return;
// Reset to original
canvas.width = originalImage.naturalWidth;
canvas.height = originalImage.naturalHeight;
context.drawImage(originalImage, 0, 0);
// Replay operations
for (let i = 0; i <= historyIndex; i++) {
const entry = history[i];
// Apply operation based on entry
// Note: This is simplified - actual implementation would need to store and replay exact operations
}
}
/**
* Add operation to history
*/
private addToHistory(operation: EditOperation, params: any): void {
// Remove any operations after current index
this.editorState.history = this.editorState.history.slice(0, this.editorState.historyIndex + 1);
// Add new operation
this.editorState.history.push({
operation,
params,
timestamp: new Date()
});
this.editorState.historyIndex++;
// Limit history size
if (this.editorState.history.length > 50) {
this.editorState.history.shift();
this.editorState.historyIndex--;
}
}
/**
* Save edited image
*/
async saveImage(noteId?: string): Promise<Blob> {
if (!this.editorState.isEditing) {
throw new ImageError(
ImageErrorType.INVALID_INPUT,
'No image being edited'
);
}
return new Promise((resolve, reject) => {
this.editorState.canvas.toBlob((blob) => {
if (blob) {
resolve(blob);
if (noteId) {
// Optionally save to server
this.saveToServer(noteId, blob);
}
} else {
reject(new Error('Failed to create blob'));
}
}, 'image/png');
});
}
/**
* Save edited image to server
*/
private async saveToServer(noteId: string, blob: Blob): Promise<void> {
try {
const formData = new FormData();
formData.append('image', blob, 'edited.png');
await server.upload(`notes/${noteId}/image`, formData);
toastService.showMessage('Image saved successfully');
} catch (error) {
console.error('Failed to save image:', error);
toastService.showError('Failed to save image');
}
}
/**
* Reset to original image
*/
reset(): void {
if (!this.editorState.isEditing || !this.editorState.originalImage) return;
const { canvas, context, originalImage } = this.editorState;
canvas.width = originalImage.naturalWidth;
canvas.height = originalImage.naturalHeight;
context.drawImage(originalImage, 0, 0);
this.currentFilters = {};
this.editorState.history = [];
this.editorState.historyIndex = -1;
}
/**
* Stop editing and clean up resources
*/
stopEditing(): void {
this.cancelCrop();
// Request garbage collection after cleanup
MemoryMonitor.requestGarbageCollection();
// Clean up canvas memory
if (this.editorState.canvas) {
this.editorState.context.clearRect(0, 0, this.editorState.canvas.width, this.editorState.canvas.height);
this.editorState.canvas.width = 0;
this.editorState.canvas.height = 0;
}
if (this.tempCanvas) {
this.tempContext.clearRect(0, 0, this.tempCanvas.width, this.tempCanvas.height);
this.tempCanvas.width = 0;
this.tempCanvas.height = 0;
}
// Release image references
if (this.editorState.originalImage) {
this.editorState.originalImage.src = '';
}
if (this.editorState.currentImage) {
this.editorState.currentImage.src = '';
}
this.editorState.isEditing = false;
this.editorState.originalImage = null;
this.editorState.currentImage = null;
this.editorState.history = [];
this.editorState.historyIndex = -1;
this.currentFilters = {};
}
/**
* Load image from URL
*/
private loadImage(src: string): Promise<HTMLImageElement> {
return new Promise((resolve, reject) => {
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`Failed to load image: ${src}`));
img.src = src;
});
}
/**
* Check if can undo
*/
canUndo(): boolean {
return this.editorState.historyIndex > 0;
}
/**
* Check if can redo
*/
canRedo(): boolean {
return this.editorState.historyIndex < this.editorState.history.length - 1;
}
/**
* Get current canvas
*/
getCanvas(): HTMLCanvasElement {
return this.editorState.canvas;
}
/**
* Check if editing
*/
isEditing(): boolean {
return this.editorState.isEditing;
}
}
export default ImageEditorService.getInstance();

View File

@@ -0,0 +1,369 @@
/**
* Error Handler for Image Processing Operations
* Provides error boundaries and validation for image-related operations
*/
import toastService from './toast.js';
/**
* Error types for image operations
*/
export enum ImageErrorType {
INVALID_INPUT = 'INVALID_INPUT',
SIZE_LIMIT_EXCEEDED = 'SIZE_LIMIT_EXCEEDED',
MEMORY_ERROR = 'MEMORY_ERROR',
PROCESSING_ERROR = 'PROCESSING_ERROR',
NETWORK_ERROR = 'NETWORK_ERROR',
SECURITY_ERROR = 'SECURITY_ERROR'
}
/**
* Custom error class for image operations
*/
export class ImageError extends Error {
constructor(
public type: ImageErrorType,
message: string,
public details?: any
) {
super(message);
this.name = 'ImageError';
}
}
/**
* Input validation utilities
*/
export class ImageValidator {
private static readonly MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
private static readonly ALLOWED_MIME_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
'image/gif',
'image/webp',
'image/svg+xml',
'image/bmp'
];
private static readonly MAX_DIMENSION = 16384;
private static readonly MAX_AREA = 100000000; // 100 megapixels
/**
* Validate file input
*/
static validateFile(file: File): void {
// Check file size
if (file.size > this.MAX_FILE_SIZE) {
throw new ImageError(
ImageErrorType.SIZE_LIMIT_EXCEEDED,
`File size exceeds maximum allowed size of ${this.MAX_FILE_SIZE / 1024 / 1024}MB`,
{ fileSize: file.size, maxSize: this.MAX_FILE_SIZE }
);
}
// Check MIME type
if (!this.ALLOWED_MIME_TYPES.includes(file.type)) {
throw new ImageError(
ImageErrorType.INVALID_INPUT,
`File type ${file.type} is not supported`,
{ fileType: file.type, allowedTypes: this.ALLOWED_MIME_TYPES }
);
}
}
/**
* Validate image dimensions
*/
static validateDimensions(width: number, height: number): void {
if (width <= 0 || height <= 0) {
throw new ImageError(
ImageErrorType.INVALID_INPUT,
'Invalid image dimensions',
{ width, height }
);
}
if (width > this.MAX_DIMENSION || height > this.MAX_DIMENSION) {
throw new ImageError(
ImageErrorType.SIZE_LIMIT_EXCEEDED,
`Image dimensions exceed maximum allowed size of ${this.MAX_DIMENSION}px`,
{ width, height, maxDimension: this.MAX_DIMENSION }
);
}
if (width * height > this.MAX_AREA) {
throw new ImageError(
ImageErrorType.SIZE_LIMIT_EXCEEDED,
`Image area exceeds maximum allowed area of ${this.MAX_AREA / 1000000} megapixels`,
{ area: width * height, maxArea: this.MAX_AREA }
);
}
}
/**
* Validate URL
*/
static validateUrl(url: string): void {
try {
const parsedUrl = new URL(url);
// Check protocol
if (!['http:', 'https:', 'data:', 'blob:'].includes(parsedUrl.protocol)) {
throw new ImageError(
ImageErrorType.SECURITY_ERROR,
`Unsupported protocol: ${parsedUrl.protocol}`,
{ url, protocol: parsedUrl.protocol }
);
}
// Additional security checks for data URLs
if (parsedUrl.protocol === 'data:') {
const [header] = url.split(',');
if (!header.includes('image/')) {
throw new ImageError(
ImageErrorType.INVALID_INPUT,
'Data URL does not contain image data',
{ url: url.substring(0, 100) }
);
}
}
} catch (error) {
if (error instanceof ImageError) {
throw error;
}
throw new ImageError(
ImageErrorType.INVALID_INPUT,
'Invalid URL format',
{ url, originalError: error }
);
}
}
/**
* Sanitize filename
*/
static sanitizeFilename(filename: string): string {
// Remove path traversal attempts
filename = filename.replace(/\.\./g, '');
filename = filename.replace(/[\/\\]/g, '_');
// Remove special characters except dots and dashes
filename = filename.replace(/[^a-zA-Z0-9._-]/g, '_');
// Limit length
if (filename.length > 255) {
const ext = filename.split('.').pop();
filename = filename.substring(0, 250) + '.' + ext;
}
return filename;
}
}
/**
* Error boundary wrapper for async operations
*/
export async function withErrorBoundary<T>(
operation: () => Promise<T>,
errorHandler?: (error: Error) => void
): Promise<T | null> {
try {
return await operation();
} catch (error) {
const imageError = error instanceof ImageError
? error
: new ImageError(
ImageErrorType.PROCESSING_ERROR,
error instanceof Error ? error.message : 'Unknown error occurred',
{ originalError: error }
);
// Log error
console.error('[Image Error]', imageError.type, imageError.message, imageError.details);
// Show user-friendly message
switch (imageError.type) {
case ImageErrorType.SIZE_LIMIT_EXCEEDED:
toastService.showError('Image is too large to process');
break;
case ImageErrorType.INVALID_INPUT:
toastService.showError('Invalid image or input provided');
break;
case ImageErrorType.MEMORY_ERROR:
toastService.showError('Not enough memory to process image');
break;
case ImageErrorType.SECURITY_ERROR:
toastService.showError('Security violation detected');
break;
case ImageErrorType.NETWORK_ERROR:
toastService.showError('Network error occurred');
break;
default:
toastService.showError('Failed to process image');
}
// Call custom error handler if provided
if (errorHandler) {
errorHandler(imageError);
}
return null;
}
}
/**
* Memory monitoring utilities
*/
export class MemoryMonitor {
private static readonly WARNING_THRESHOLD = 0.8; // 80% of available memory
/**
* Check if memory is available for operation
*/
static checkMemoryAvailable(estimatedBytes: number): boolean {
if ('memory' in performance && (performance as any).memory) {
const memory = (performance as any).memory;
const used = memory.usedJSHeapSize;
const limit = memory.jsHeapSizeLimit;
const available = limit - used;
if (estimatedBytes > available * this.WARNING_THRESHOLD) {
console.warn(`Memory warning: Estimated ${estimatedBytes} bytes needed, ${available} bytes available`);
return false;
}
}
return true;
}
/**
* Estimate memory needed for image
*/
static estimateImageMemory(width: number, height: number, channels: number = 4): number {
// Each pixel uses 4 bytes (RGBA) or specified channels
return width * height * channels;
}
/**
* Force garbage collection if available
*/
static requestGarbageCollection(): void {
if (typeof (globalThis as any).gc === 'function') {
(globalThis as any).gc();
}
}
}
/**
* Web Worker support for heavy operations
*/
export class ImageWorkerPool {
private workers: Worker[] = [];
private taskQueue: Array<{
data: any;
resolve: (value: any) => void;
reject: (error: any) => void;
}> = [];
private busyWorkers = new Set<Worker>();
constructor(
private workerScript: string,
private poolSize: number = navigator.hardwareConcurrency || 4
) {
this.initializeWorkers();
}
private initializeWorkers(): void {
for (let i = 0; i < this.poolSize; i++) {
try {
const worker = new Worker(this.workerScript);
worker.addEventListener('message', (e) => this.handleWorkerMessage(worker, e));
worker.addEventListener('error', (e) => this.handleWorkerError(worker, e));
this.workers.push(worker);
} catch (error) {
console.error('Failed to create worker:', error);
}
}
}
private handleWorkerMessage(worker: Worker, event: MessageEvent): void {
this.busyWorkers.delete(worker);
// Process next task if available
if (this.taskQueue.length > 0) {
const task = this.taskQueue.shift()!;
this.executeTask(worker, task);
}
}
private handleWorkerError(worker: Worker, event: ErrorEvent): void {
this.busyWorkers.delete(worker);
console.error('Worker error:', event);
}
private executeTask(
worker: Worker,
task: { data: any; resolve: (value: any) => void; reject: (error: any) => void }
): void {
this.busyWorkers.add(worker);
const messageHandler = (e: MessageEvent) => {
worker.removeEventListener('message', messageHandler);
worker.removeEventListener('error', errorHandler);
this.busyWorkers.delete(worker);
task.resolve(e.data);
// Process next task
if (this.taskQueue.length > 0) {
const nextTask = this.taskQueue.shift()!;
this.executeTask(worker, nextTask);
}
};
const errorHandler = (e: ErrorEvent) => {
worker.removeEventListener('message', messageHandler);
worker.removeEventListener('error', errorHandler);
this.busyWorkers.delete(worker);
task.reject(e);
// Process next task
if (this.taskQueue.length > 0) {
const nextTask = this.taskQueue.shift()!;
this.executeTask(worker, nextTask);
}
};
worker.addEventListener('message', messageHandler);
worker.addEventListener('error', errorHandler);
worker.postMessage(task.data);
}
async process(data: any): Promise<any> {
return new Promise((resolve, reject) => {
// Find available worker
const availableWorker = this.workers.find(w => !this.busyWorkers.has(w));
if (availableWorker) {
this.executeTask(availableWorker, { data, resolve, reject });
} else {
// Queue task
this.taskQueue.push({ data, resolve, reject });
}
});
}
terminate(): void {
this.workers.forEach(worker => worker.terminate());
this.workers = [];
this.taskQueue = [];
this.busyWorkers.clear();
}
}
export default {
ImageError,
ImageErrorType,
ImageValidator,
MemoryMonitor,
ImageWorkerPool,
withErrorBoundary
};

View File

@@ -0,0 +1,839 @@
/**
* EXIF Data Viewer Module for Trilium Notes
* Extracts and displays EXIF metadata from images
*/
/**
* EXIF data structure
*/
export interface ExifData {
// Image information
make?: string;
model?: string;
software?: string;
dateTime?: Date;
dateTimeOriginal?: Date;
dateTimeDigitized?: Date;
// Camera settings
exposureTime?: string;
fNumber?: number;
exposureProgram?: string;
iso?: number;
shutterSpeedValue?: string;
apertureValue?: number;
brightnessValue?: number;
exposureBiasValue?: number;
maxApertureValue?: number;
meteringMode?: string;
flash?: string;
focalLength?: number;
focalLengthIn35mm?: number;
// Image properties
imageWidth?: number;
imageHeight?: number;
orientation?: number;
xResolution?: number;
yResolution?: number;
resolutionUnit?: string;
colorSpace?: string;
whiteBalance?: string;
// GPS information
gpsLatitude?: number;
gpsLongitude?: number;
gpsAltitude?: number;
gpsTimestamp?: Date;
gpsSpeed?: number;
gpsDirection?: number;
// Other metadata
artist?: string;
copyright?: string;
userComment?: string;
imageDescription?: string;
lensModel?: string;
lensMake?: string;
// Raw data
raw?: Record<string, any>;
}
/**
* EXIF tag definitions
*/
const EXIF_TAGS: Record<number, string> = {
0x010F: 'make',
0x0110: 'model',
0x0131: 'software',
0x0132: 'dateTime',
0x829A: 'exposureTime',
0x829D: 'fNumber',
0x8822: 'exposureProgram',
0x8827: 'iso',
0x9003: 'dateTimeOriginal',
0x9004: 'dateTimeDigitized',
0x9201: 'shutterSpeedValue',
0x9202: 'apertureValue',
0x9203: 'brightnessValue',
0x9204: 'exposureBiasValue',
0x9205: 'maxApertureValue',
0x9207: 'meteringMode',
0x9209: 'flash',
0x920A: 'focalLength',
0xA002: 'imageWidth',
0xA003: 'imageHeight',
0x0112: 'orientation',
0x011A: 'xResolution',
0x011B: 'yResolution',
0x0128: 'resolutionUnit',
0xA001: 'colorSpace',
0xA403: 'whiteBalance',
0x8298: 'copyright',
0x013B: 'artist',
0x9286: 'userComment',
0x010E: 'imageDescription',
0xA434: 'lensModel',
0xA433: 'lensMake',
0xA432: 'focalLengthIn35mm'
};
/**
* GPS tag definitions
*/
const GPS_TAGS: Record<number, string> = {
0x0001: 'gpsLatitudeRef',
0x0002: 'gpsLatitude',
0x0003: 'gpsLongitudeRef',
0x0004: 'gpsLongitude',
0x0005: 'gpsAltitudeRef',
0x0006: 'gpsAltitude',
0x0007: 'gpsTimestamp',
0x000D: 'gpsSpeed',
0x0010: 'gpsDirection'
};
/**
* ImageExifService extracts and manages EXIF metadata from images
*/
class ImageExifService {
private static instance: ImageExifService;
private exifCache: Map<string, ExifData> = new Map();
private cacheOrder: string[] = []; // Track cache insertion order for LRU
private readonly MAX_CACHE_SIZE = 50; // Maximum number of cached entries
private readonly MAX_BUFFER_SIZE = 100 * 1024 * 1024; // 100MB max buffer size
private constructor() {}
static getInstance(): ImageExifService {
if (!ImageExifService.instance) {
ImageExifService.instance = new ImageExifService();
}
return ImageExifService.instance;
}
/**
* Extract EXIF data from image URL or file
*/
async extractExifData(source: string | File | Blob): Promise<ExifData | null> {
try {
// Check cache if URL
if (typeof source === 'string' && this.exifCache.has(source)) {
// Move to end for LRU
this.updateCacheOrder(source);
return this.exifCache.get(source)!;
}
// Get array buffer with size validation
const buffer = await this.getArrayBuffer(source);
// Validate buffer size
if (buffer.byteLength > this.MAX_BUFFER_SIZE) {
console.error('Buffer size exceeds maximum allowed size');
return null;
}
// Parse EXIF data
const exifData = this.parseExifData(buffer);
// Cache if URL with LRU eviction
if (typeof source === 'string' && exifData) {
this.addToCache(source, exifData);
}
return exifData;
} catch (error) {
console.error('Failed to extract EXIF data:', error);
return null;
}
}
/**
* Get array buffer from various sources
*/
private async getArrayBuffer(source: string | File | Blob): Promise<ArrayBuffer> {
if (source instanceof File || source instanceof Blob) {
return source.arrayBuffer();
} else {
const response = await fetch(source);
return response.arrayBuffer();
}
}
/**
* Parse EXIF data from array buffer
*/
private parseExifData(buffer: ArrayBuffer): ExifData | null {
const dataView = new DataView(buffer);
// Check for JPEG SOI marker
if (dataView.getUint16(0) !== 0xFFD8) {
return null; // Not a JPEG
}
// Find APP1 marker (EXIF)
let offset = 2;
let marker;
while (offset < dataView.byteLength) {
marker = dataView.getUint16(offset);
if (marker === 0xFFE1) {
// Found EXIF marker
return this.parseExifSegment(dataView, offset + 2);
}
if ((marker & 0xFF00) !== 0xFF00) {
break; // Invalid marker
}
offset += 2 + dataView.getUint16(offset + 2);
}
return null;
}
/**
* Parse EXIF segment with bounds checking
*/
private parseExifSegment(dataView: DataView, offset: number): ExifData | null {
// Bounds check
if (offset + 2 > dataView.byteLength) {
console.error('Invalid offset for EXIF segment');
return null;
}
const length = dataView.getUint16(offset);
// Validate segment length
if (offset + length > dataView.byteLength) {
console.error('EXIF segment length exceeds buffer size');
return null;
}
// Check for "Exif\0\0" identifier with bounds check
if (offset + 6 > dataView.byteLength) {
console.error('Invalid EXIF header offset');
return null;
}
const exifHeader = String.fromCharCode(
dataView.getUint8(offset + 2),
dataView.getUint8(offset + 3),
dataView.getUint8(offset + 4),
dataView.getUint8(offset + 5)
);
if (exifHeader !== 'Exif') {
return null;
}
// TIFF header offset
const tiffOffset = offset + 8;
// Check byte order
const byteOrder = dataView.getUint16(tiffOffset);
const littleEndian = byteOrder === 0x4949; // 'II' for Intel
if (byteOrder !== 0x4949 && byteOrder !== 0x4D4D) {
return null; // Invalid byte order
}
// Parse IFD
const ifdOffset = this.getUint32(dataView, tiffOffset + 4, littleEndian);
const exifData = this.parseIFD(dataView, tiffOffset, tiffOffset + ifdOffset, littleEndian);
// Parse GPS data if available
if (exifData.raw?.gpsIFDPointer) {
const gpsData = this.parseGPSIFD(
dataView,
tiffOffset,
tiffOffset + exifData.raw.gpsIFDPointer,
littleEndian
);
Object.assign(exifData, gpsData);
}
return this.formatExifData(exifData);
}
/**
* Parse IFD (Image File Directory) with bounds checking
*/
private parseIFD(
dataView: DataView,
tiffOffset: number,
ifdOffset: number,
littleEndian: boolean
): ExifData {
// Bounds check for IFD offset
if (ifdOffset + 2 > dataView.byteLength) {
console.error('Invalid IFD offset');
return { raw: {} };
}
const numEntries = this.getUint16(dataView, ifdOffset, littleEndian);
// Validate number of entries
if (numEntries > 1000) { // Reasonable limit
console.error('Too many IFD entries');
return { raw: {} };
}
const data: ExifData = { raw: {} };
for (let i = 0; i < numEntries; i++) {
const entryOffset = ifdOffset + 2 + (i * 12);
// Bounds check for entry
if (entryOffset + 12 > dataView.byteLength) {
console.warn('IFD entry exceeds buffer bounds');
break;
}
const tag = this.getUint16(dataView, entryOffset, littleEndian);
const type = this.getUint16(dataView, entryOffset + 2, littleEndian);
const count = this.getUint32(dataView, entryOffset + 4, littleEndian);
const valueOffset = entryOffset + 8;
const value = this.getTagValue(
dataView,
tiffOffset,
type,
count,
valueOffset,
littleEndian
);
const tagName = EXIF_TAGS[tag];
if (tagName) {
(data as any)[tagName] = value;
}
// Store raw value
data.raw![tag] = value;
// Check for EXIF IFD pointer
if (tag === 0x8769) {
const exifIFDOffset = tiffOffset + value;
const exifData = this.parseIFD(dataView, tiffOffset, exifIFDOffset, littleEndian);
Object.assign(data, exifData);
}
// Store GPS IFD pointer
if (tag === 0x8825) {
data.raw!.gpsIFDPointer = value;
}
}
return data;
}
/**
* Parse GPS IFD
*/
private parseGPSIFD(
dataView: DataView,
tiffOffset: number,
ifdOffset: number,
littleEndian: boolean
): Partial<ExifData> {
const numEntries = this.getUint16(dataView, ifdOffset, littleEndian);
const gpsData: any = {};
for (let i = 0; i < numEntries; i++) {
const entryOffset = ifdOffset + 2 + (i * 12);
// Bounds check for entry
if (entryOffset + 12 > dataView.byteLength) {
console.warn('IFD entry exceeds buffer bounds');
break;
}
const tag = this.getUint16(dataView, entryOffset, littleEndian);
const type = this.getUint16(dataView, entryOffset + 2, littleEndian);
const count = this.getUint32(dataView, entryOffset + 4, littleEndian);
const valueOffset = entryOffset + 8;
const value = this.getTagValue(
dataView,
tiffOffset,
type,
count,
valueOffset,
littleEndian
);
const tagName = GPS_TAGS[tag];
if (tagName) {
gpsData[tagName] = value;
}
}
// Convert GPS coordinates
const result: Partial<ExifData> = {};
if (gpsData.gpsLatitude && gpsData.gpsLatitudeRef) {
result.gpsLatitude = this.convertGPSCoordinate(
gpsData.gpsLatitude,
gpsData.gpsLatitudeRef
);
}
if (gpsData.gpsLongitude && gpsData.gpsLongitudeRef) {
result.gpsLongitude = this.convertGPSCoordinate(
gpsData.gpsLongitude,
gpsData.gpsLongitudeRef
);
}
if (gpsData.gpsAltitude) {
result.gpsAltitude = gpsData.gpsAltitude;
}
return result;
}
/**
* Get tag value based on type
*/
private getTagValue(
dataView: DataView,
tiffOffset: number,
type: number,
count: number,
offset: number,
littleEndian: boolean
): any {
switch (type) {
case 1: // BYTE
case 7: // UNDEFINED
if (count === 1) {
return dataView.getUint8(offset);
}
const bytes = [];
for (let i = 0; i < count; i++) {
bytes.push(dataView.getUint8(offset + i));
}
return bytes;
case 2: // ASCII
const stringOffset = count > 4
? tiffOffset + this.getUint32(dataView, offset, littleEndian)
: offset;
let str = '';
for (let i = 0; i < count - 1; i++) {
const char = dataView.getUint8(stringOffset + i);
if (char === 0) break;
str += String.fromCharCode(char);
}
return str;
case 3: // SHORT
if (count === 1) {
return this.getUint16(dataView, offset, littleEndian);
}
const shorts = [];
const shortOffset = count > 2
? tiffOffset + this.getUint32(dataView, offset, littleEndian)
: offset;
for (let i = 0; i < count; i++) {
shorts.push(this.getUint16(dataView, shortOffset + i * 2, littleEndian));
}
return shorts;
case 4: // LONG
if (count === 1) {
return this.getUint32(dataView, offset, littleEndian);
}
const longs = [];
const longOffset = tiffOffset + this.getUint32(dataView, offset, littleEndian);
for (let i = 0; i < count; i++) {
longs.push(this.getUint32(dataView, longOffset + i * 4, littleEndian));
}
return longs;
case 5: // RATIONAL
const ratOffset = tiffOffset + this.getUint32(dataView, offset, littleEndian);
if (count === 1) {
const num = this.getUint32(dataView, ratOffset, littleEndian);
const den = this.getUint32(dataView, ratOffset + 4, littleEndian);
return den === 0 ? 0 : num / den;
}
const rationals = [];
for (let i = 0; i < count; i++) {
const num = this.getUint32(dataView, ratOffset + i * 8, littleEndian);
const den = this.getUint32(dataView, ratOffset + i * 8 + 4, littleEndian);
rationals.push(den === 0 ? 0 : num / den);
}
return rationals;
default:
return null;
}
}
/**
* Convert GPS coordinate to decimal degrees
*/
private convertGPSCoordinate(coord: number[], ref: string): number {
if (!coord || coord.length !== 3) return 0;
const degrees = coord[0];
const minutes = coord[1];
const seconds = coord[2];
let decimal = degrees + minutes / 60 + seconds / 3600;
if (ref === 'S' || ref === 'W') {
decimal = -decimal;
}
return decimal;
}
/**
* Format EXIF data for display
*/
private formatExifData(data: ExifData): ExifData {
const formatted: ExifData = { ...data };
// Format dates
if (formatted.dateTime) {
formatted.dateTime = this.parseExifDate(formatted.dateTime as any);
}
if (formatted.dateTimeOriginal) {
formatted.dateTimeOriginal = this.parseExifDate(formatted.dateTimeOriginal as any);
}
if (formatted.dateTimeDigitized) {
formatted.dateTimeDigitized = this.parseExifDate(formatted.dateTimeDigitized as any);
}
// Format exposure time
if (formatted.exposureTime) {
const time = formatted.exposureTime as any;
if (typeof time === 'number') {
if (time < 1) {
formatted.exposureTime = `1/${Math.round(1 / time)}`;
} else {
formatted.exposureTime = `${time}s`;
}
}
}
// Format exposure program
if (formatted.exposureProgram) {
const programs = [
'Not defined',
'Manual',
'Normal program',
'Aperture priority',
'Shutter priority',
'Creative program',
'Action program',
'Portrait mode',
'Landscape mode'
];
const index = formatted.exposureProgram as any;
formatted.exposureProgram = programs[index] || 'Unknown';
}
// Format metering mode
if (formatted.meteringMode) {
const modes = [
'Unknown',
'Average',
'Center-weighted average',
'Spot',
'Multi-spot',
'Pattern',
'Partial'
];
const index = formatted.meteringMode as any;
formatted.meteringMode = modes[index] || 'Unknown';
}
// Format flash
if (formatted.flash !== undefined) {
const flash = formatted.flash as any;
formatted.flash = (flash & 1) ? 'Flash fired' : 'Flash did not fire';
}
return formatted;
}
/**
* Parse EXIF date string
*/
private parseExifDate(dateStr: string): Date {
// EXIF date format: "YYYY:MM:DD HH:MM:SS"
const parts = dateStr.split(' ');
if (parts.length !== 2) return new Date(dateStr);
const dateParts = parts[0].split(':');
const timeParts = parts[1].split(':');
if (dateParts.length !== 3 || timeParts.length !== 3) {
return new Date(dateStr);
}
return new Date(
parseInt(dateParts[0]),
parseInt(dateParts[1]) - 1,
parseInt(dateParts[2]),
parseInt(timeParts[0]),
parseInt(timeParts[1]),
parseInt(timeParts[2])
);
}
/**
* Get uint16 with endianness and bounds checking
*/
private getUint16(dataView: DataView, offset: number, littleEndian: boolean): number {
if (offset + 2 > dataView.byteLength) {
console.error('Uint16 read exceeds buffer bounds');
return 0;
}
return dataView.getUint16(offset, littleEndian);
}
/**
* Get uint32 with endianness and bounds checking
*/
private getUint32(dataView: DataView, offset: number, littleEndian: boolean): number {
if (offset + 4 > dataView.byteLength) {
console.error('Uint32 read exceeds buffer bounds');
return 0;
}
return dataView.getUint32(offset, littleEndian);
}
/**
* Create EXIF display panel
*/
createExifPanel(exifData: ExifData): HTMLElement {
const panel = document.createElement('div');
panel.className = 'exif-panel';
panel.style.cssText = `
background: rgba(0, 0, 0, 0.9);
color: white;
padding: 15px;
border-radius: 8px;
max-width: 400px;
max-height: 500px;
overflow-y: auto;
font-size: 12px;
`;
const sections = [
{
title: 'Camera',
fields: ['make', 'model', 'lensModel']
},
{
title: 'Settings',
fields: ['exposureTime', 'fNumber', 'iso', 'focalLength', 'exposureProgram', 'meteringMode', 'flash']
},
{
title: 'Image',
fields: ['imageWidth', 'imageHeight', 'orientation', 'colorSpace', 'whiteBalance']
},
{
title: 'Date/Time',
fields: ['dateTimeOriginal', 'dateTime']
},
{
title: 'Location',
fields: ['gpsLatitude', 'gpsLongitude', 'gpsAltitude']
},
{
title: 'Other',
fields: ['software', 'artist', 'copyright', 'imageDescription']
}
];
sections.forEach(section => {
const hasData = section.fields.some(field => (exifData as any)[field]);
if (!hasData) return;
const sectionDiv = document.createElement('div');
sectionDiv.style.marginBottom = '15px';
const title = document.createElement('h4');
// Use textContent for safe title insertion
title.textContent = section.title;
title.style.cssText = 'margin: 0 0 8px 0; color: #4CAF50;';
title.setAttribute('aria-label', `Section: ${section.title}`);
sectionDiv.appendChild(title);
section.fields.forEach(field => {
const value = (exifData as any)[field];
if (!value) return;
const row = document.createElement('div');
row.style.cssText = 'display: flex; justify-content: space-between; margin: 4px 0;';
const label = document.createElement('span');
// Use textContent for safe text insertion
label.textContent = this.formatFieldName(field) + ':';
label.style.color = '#aaa';
const val = document.createElement('span');
// Use textContent for safe value insertion
val.textContent = this.formatFieldValue(field, value);
val.style.textAlign = 'right';
row.appendChild(label);
row.appendChild(val);
sectionDiv.appendChild(row);
});
panel.appendChild(sectionDiv);
});
// Add GPS map link if coordinates available
if (exifData.gpsLatitude && exifData.gpsLongitude) {
const mapLink = document.createElement('a');
mapLink.href = `https://www.google.com/maps?q=${exifData.gpsLatitude},${exifData.gpsLongitude}`;
mapLink.target = '_blank';
mapLink.textContent = 'View on Map';
mapLink.style.cssText = `
display: inline-block;
margin-top: 10px;
padding: 8px 12px;
background: #4CAF50;
color: white;
text-decoration: none;
border-radius: 4px;
`;
panel.appendChild(mapLink);
}
return panel;
}
/**
* Format field name for display
*/
private formatFieldName(field: string): string {
const names: Record<string, string> = {
make: 'Camera Make',
model: 'Camera Model',
lensModel: 'Lens',
exposureTime: 'Shutter Speed',
fNumber: 'Aperture',
iso: 'ISO',
focalLength: 'Focal Length',
exposureProgram: 'Mode',
meteringMode: 'Metering',
flash: 'Flash',
imageWidth: 'Width',
imageHeight: 'Height',
orientation: 'Orientation',
colorSpace: 'Color Space',
whiteBalance: 'White Balance',
dateTimeOriginal: 'Date Taken',
dateTime: 'Date Modified',
gpsLatitude: 'Latitude',
gpsLongitude: 'Longitude',
gpsAltitude: 'Altitude',
software: 'Software',
artist: 'Artist',
copyright: 'Copyright',
imageDescription: 'Description'
};
return names[field] || field;
}
/**
* Format field value for display
*/
private formatFieldValue(field: string, value: any): string {
if (value instanceof Date) {
return value.toLocaleString();
}
switch (field) {
case 'fNumber':
return `f/${value}`;
case 'focalLength':
return `${value}mm`;
case 'gpsLatitude':
case 'gpsLongitude':
return value.toFixed(6) + '°';
case 'gpsAltitude':
return `${value.toFixed(1)}m`;
case 'imageWidth':
case 'imageHeight':
return `${value}px`;
default:
return String(value);
}
}
/**
* Add to cache with LRU eviction
*/
private addToCache(key: string, data: ExifData): void {
// Remove from order if exists
const existingIndex = this.cacheOrder.indexOf(key);
if (existingIndex !== -1) {
this.cacheOrder.splice(existingIndex, 1);
}
// Add to end
this.cacheOrder.push(key);
this.exifCache.set(key, data);
// Evict oldest if over limit
while (this.cacheOrder.length > this.MAX_CACHE_SIZE) {
const oldestKey = this.cacheOrder.shift();
if (oldestKey) {
this.exifCache.delete(oldestKey);
}
}
}
/**
* Update cache order for LRU
*/
private updateCacheOrder(key: string): void {
const index = this.cacheOrder.indexOf(key);
if (index !== -1) {
this.cacheOrder.splice(index, 1);
this.cacheOrder.push(key);
}
}
/**
* Clear EXIF cache
*/
clearCache(): void {
this.exifCache.clear();
this.cacheOrder = [];
}
}
export default ImageExifService.getInstance();

View File

@@ -0,0 +1,681 @@
/**
* Image Sharing and Export Module for Trilium Notes
* Provides functionality for sharing, downloading, and exporting images
*/
import server from './server.js';
import utils from './utils.js';
import toastService from './toast.js';
import type FNote from '../entities/fnote.js';
import { ImageValidator, withErrorBoundary, MemoryMonitor, ImageError, ImageErrorType } from './image_error_handler.js';
/**
* Export format options
*/
export type ExportFormat = 'original' | 'jpeg' | 'png' | 'webp';
/**
* Export size presets
*/
export type SizePreset = 'original' | 'thumbnail' | 'small' | 'medium' | 'large' | 'custom';
/**
* Export configuration
*/
export interface ExportConfig {
format: ExportFormat;
quality: number; // 0-100 for JPEG/WebP
size: SizePreset;
customWidth?: number;
customHeight?: number;
maintainAspectRatio: boolean;
addWatermark: boolean;
watermarkText?: string;
watermarkPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
watermarkOpacity?: number;
}
/**
* Share options
*/
export interface ShareOptions {
method: 'link' | 'email' | 'social';
expiresIn?: number; // Hours
password?: string;
allowDownload: boolean;
trackViews: boolean;
}
/**
* Share link data
*/
export interface ShareLink {
url: string;
shortUrl?: string;
expiresAt?: Date;
password?: string;
views: number;
maxViews?: number;
created: Date;
}
/**
* Size presets in pixels
*/
const SIZE_PRESETS = {
thumbnail: { width: 150, height: 150 },
small: { width: 400, height: 400 },
medium: { width: 800, height: 800 },
large: { width: 1600, height: 1600 }
};
/**
* ImageSharingService handles image sharing, downloading, and exporting
*/
class ImageSharingService {
private static instance: ImageSharingService;
private activeShares: Map<string, ShareLink> = new Map();
private downloadCanvas?: HTMLCanvasElement;
private downloadContext?: CanvasRenderingContext2D;
// Canvas size limits for security and memory management
private readonly MAX_CANVAS_SIZE = 8192; // Maximum width/height
private readonly MAX_CANVAS_AREA = 50000000; // 50 megapixels
private defaultExportConfig: ExportConfig = {
format: 'original',
quality: 90,
size: 'original',
maintainAspectRatio: true,
addWatermark: false,
watermarkPosition: 'bottom-right',
watermarkOpacity: 0.5
};
private constructor() {
// Initialize download canvas
this.downloadCanvas = document.createElement('canvas');
this.downloadContext = this.downloadCanvas.getContext('2d') || undefined;
}
static getInstance(): ImageSharingService {
if (!ImageSharingService.instance) {
ImageSharingService.instance = new ImageSharingService();
}
return ImageSharingService.instance;
}
/**
* Download image with options
*/
async downloadImage(
src: string,
filename: string,
config?: Partial<ExportConfig>
): Promise<void> {
await withErrorBoundary(async () => {
// Validate inputs
ImageValidator.validateUrl(src);
const sanitizedFilename = ImageValidator.sanitizeFilename(filename);
const finalConfig = { ...this.defaultExportConfig, ...config };
// Load image
const img = await this.loadImage(src);
// Process image based on config
const processedBlob = await this.processImage(img, finalConfig);
// Create download link
const url = URL.createObjectURL(processedBlob);
const link = document.createElement('a');
link.href = url;
// Determine filename with extension
const extension = finalConfig.format === 'original'
? this.getOriginalExtension(sanitizedFilename)
: finalConfig.format;
const finalFilename = this.ensureExtension(sanitizedFilename, extension);
link.download = finalFilename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// Cleanup
URL.revokeObjectURL(url);
toastService.showMessage(`Downloaded ${finalFilename}`);
});
}
/**
* Process image according to export configuration
*/
private async processImage(img: HTMLImageElement, config: ExportConfig): Promise<Blob> {
if (!this.downloadCanvas || !this.downloadContext) {
throw new Error('Canvas not initialized');
}
// Calculate dimensions
const { width, height } = this.calculateDimensions(
img.naturalWidth,
img.naturalHeight,
config
);
// Validate canvas dimensions
ImageValidator.validateDimensions(width, height);
// Check memory availability
const estimatedMemory = MemoryMonitor.estimateImageMemory(width, height);
if (!MemoryMonitor.checkMemoryAvailable(estimatedMemory)) {
throw new ImageError(
ImageErrorType.MEMORY_ERROR,
'Insufficient memory to process image',
{ width, height, estimatedMemory }
);
}
// Set canvas size
this.downloadCanvas.width = width;
this.downloadCanvas.height = height;
// Clear canvas
this.downloadContext.fillStyle = 'white';
this.downloadContext.fillRect(0, 0, width, height);
// Draw image
this.downloadContext.drawImage(img, 0, 0, width, height);
// Add watermark if enabled
if (config.addWatermark && config.watermarkText) {
this.addWatermark(this.downloadContext, width, height, config);
}
// Convert to blob
return new Promise((resolve, reject) => {
const mimeType = this.getMimeType(config.format);
const quality = config.quality / 100;
this.downloadCanvas!.toBlob(
(blob) => {
if (blob) {
resolve(blob);
} else {
reject(new Error('Failed to create blob'));
}
},
mimeType,
quality
);
});
}
/**
* Calculate dimensions based on size preset
*/
private calculateDimensions(
originalWidth: number,
originalHeight: number,
config: ExportConfig
): { width: number; height: number } {
if (config.size === 'original') {
return { width: originalWidth, height: originalHeight };
}
if (config.size === 'custom' && config.customWidth && config.customHeight) {
if (config.maintainAspectRatio) {
const aspectRatio = originalWidth / originalHeight;
const targetRatio = config.customWidth / config.customHeight;
if (aspectRatio > targetRatio) {
return {
width: config.customWidth,
height: Math.round(config.customWidth / aspectRatio)
};
} else {
return {
width: Math.round(config.customHeight * aspectRatio),
height: config.customHeight
};
}
}
return { width: config.customWidth, height: config.customHeight };
}
// Use preset
const preset = SIZE_PRESETS[config.size as keyof typeof SIZE_PRESETS];
if (!preset) {
return { width: originalWidth, height: originalHeight };
}
if (config.maintainAspectRatio) {
const aspectRatio = originalWidth / originalHeight;
const maxWidth = preset.width;
const maxHeight = preset.height;
let width = originalWidth;
let height = originalHeight;
if (width > maxWidth) {
width = maxWidth;
height = Math.round(width / aspectRatio);
}
if (height > maxHeight) {
height = maxHeight;
width = Math.round(height * aspectRatio);
}
return { width, height };
}
return preset;
}
/**
* Add watermark to canvas
*/
private addWatermark(
ctx: CanvasRenderingContext2D,
width: number,
height: number,
config: ExportConfig
): void {
if (!config.watermarkText) return;
ctx.save();
// Set watermark style
ctx.globalAlpha = config.watermarkOpacity || 0.5;
ctx.fillStyle = 'white';
ctx.strokeStyle = 'black';
ctx.lineWidth = 2;
ctx.font = `${Math.min(width, height) * 0.05}px Arial`;
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
// Calculate position
let x = width / 2;
let y = height / 2;
switch (config.watermarkPosition) {
case 'top-left':
x = width * 0.1;
y = height * 0.1;
ctx.textAlign = 'left';
break;
case 'top-right':
x = width * 0.9;
y = height * 0.1;
ctx.textAlign = 'right';
break;
case 'bottom-left':
x = width * 0.1;
y = height * 0.9;
ctx.textAlign = 'left';
break;
case 'bottom-right':
x = width * 0.9;
y = height * 0.9;
ctx.textAlign = 'right';
break;
}
// Draw watermark with outline
ctx.strokeText(config.watermarkText, x, y);
ctx.fillText(config.watermarkText, x, y);
ctx.restore();
}
/**
* Generate shareable link for image
*/
async generateShareLink(
noteId: string,
options?: Partial<ShareOptions>
): Promise<ShareLink> {
try {
const finalOptions = {
method: 'link' as const,
allowDownload: true,
trackViews: false,
...options
};
// Create share token on server
const response = await server.post(`notes/${noteId}/share`, {
type: 'image',
expiresIn: finalOptions.expiresIn,
password: finalOptions.password,
allowDownload: finalOptions.allowDownload,
trackViews: finalOptions.trackViews
});
const shareLink: ShareLink = {
url: `${window.location.origin}/share/${response.token}`,
shortUrl: response.shortUrl,
expiresAt: response.expiresAt ? new Date(response.expiresAt) : undefined,
password: finalOptions.password,
views: 0,
maxViews: response.maxViews,
created: new Date()
};
// Store in active shares
this.activeShares.set(response.token, shareLink);
return shareLink;
} catch (error) {
console.error('Failed to generate share link:', error);
throw error;
}
}
/**
* Copy image or link to clipboard
*/
async copyToClipboard(
src: string,
type: 'image' | 'link' = 'link'
): Promise<void> {
await withErrorBoundary(async () => {
// Validate URL
ImageValidator.validateUrl(src);
if (type === 'link') {
// Copy URL to clipboard
await navigator.clipboard.writeText(src);
toastService.showMessage('Link copied to clipboard');
} else {
// Copy image data to clipboard
const img = await this.loadImage(src);
if (!this.downloadCanvas || !this.downloadContext) {
throw new Error('Canvas not initialized');
}
// Validate dimensions before setting
ImageValidator.validateDimensions(img.naturalWidth, img.naturalHeight);
this.downloadCanvas.width = img.naturalWidth;
this.downloadCanvas.height = img.naturalHeight;
this.downloadContext.drawImage(img, 0, 0);
this.downloadCanvas.toBlob(async (blob) => {
if (blob) {
try {
const item = new ClipboardItem({ 'image/png': blob });
await navigator.clipboard.write([item]);
toastService.showMessage('Image copied to clipboard');
} catch (error) {
console.error('Failed to copy image to clipboard:', error);
// Fallback to copying link
await navigator.clipboard.writeText(src);
toastService.showMessage('Image link copied to clipboard');
}
}
});
}
});
}
/**
* Share via native share API (mobile)
*/
async shareNative(
src: string,
title: string,
text?: string
): Promise<void> {
if (!navigator.share) {
throw new Error('Native share not supported');
}
try {
// Try to share with file
const img = await this.loadImage(src);
const blob = await this.processImage(img, this.defaultExportConfig);
const file = new File([blob], `${title}.${this.defaultExportConfig.format}`, {
type: this.getMimeType(this.defaultExportConfig.format)
});
await navigator.share({
title,
text: text || `Check out this image: ${title}`,
files: [file]
});
} catch (error) {
// Fallback to sharing URL
try {
await navigator.share({
title,
text: text || `Check out this image: ${title}`,
url: src
});
} catch (shareError) {
console.error('Failed to share:', shareError);
throw shareError;
}
}
}
/**
* Export multiple images as ZIP
*/
async exportBatch(
images: Array<{ src: string; filename: string }>,
config?: Partial<ExportConfig>
): Promise<void> {
try {
// Dynamic import of JSZip
const JSZip = (await import('jszip')).default;
const zip = new JSZip();
const finalConfig = { ...this.defaultExportConfig, ...config };
// Process each image
for (const { src, filename } of images) {
try {
const img = await this.loadImage(src);
const blob = await this.processImage(img, finalConfig);
const extension = finalConfig.format === 'original'
? this.getOriginalExtension(filename)
: finalConfig.format;
const finalFilename = this.ensureExtension(filename, extension);
zip.file(finalFilename, blob);
} catch (error) {
console.error(`Failed to process image ${filename}:`, error);
}
}
// Generate and download ZIP
const zipBlob = await zip.generateAsync({ type: 'blob' });
const url = URL.createObjectURL(zipBlob);
const link = document.createElement('a');
link.href = url;
link.download = `images_${Date.now()}.zip`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
toastService.showMessage(`Exported ${images.length} images`);
} catch (error) {
console.error('Failed to export images:', error);
toastService.showError('Failed to export images');
throw error;
}
}
/**
* Open share dialog
*/
openShareDialog(
src: string,
title: string,
noteId?: string
): void {
// Create modal dialog
const dialog = document.createElement('div');
dialog.className = 'share-dialog-overlay';
dialog.style.cssText = `
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 10000;
`;
const content = document.createElement('div');
content.className = 'share-dialog';
content.style.cssText = `
background: white;
border-radius: 8px;
padding: 20px;
width: 400px;
max-width: 90%;
`;
content.innerHTML = `
<h3 style="margin: 0 0 15px 0;">Share Image</h3>
<div class="share-options" style="display: flex; flex-direction: column; gap: 10px;">
<button class="share-copy-link" style="padding: 10px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer;">
<i class="bx bx-link"></i> Copy Link
</button>
<button class="share-copy-image" style="padding: 10px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer;">
<i class="bx bx-copy"></i> Copy Image
</button>
<button class="share-download" style="padding: 10px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer;">
<i class="bx bx-download"></i> Download
</button>
${navigator.share ? `
<button class="share-native" style="padding: 10px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer;">
<i class="bx bx-share"></i> Share...
</button>
` : ''}
${noteId ? `
<button class="share-generate-link" style="padding: 10px; border: 1px solid #ddd; border-radius: 4px; cursor: pointer;">
<i class="bx bx-link-external"></i> Generate Share Link
</button>
` : ''}
</div>
<button class="close-dialog" style="margin-top: 15px; padding: 8px 16px; background: #f0f0f0; border: none; border-radius: 4px; cursor: pointer;">
Close
</button>
`;
// Add event handlers
content.querySelector('.share-copy-link')?.addEventListener('click', () => {
this.copyToClipboard(src, 'link');
dialog.remove();
});
content.querySelector('.share-copy-image')?.addEventListener('click', () => {
this.copyToClipboard(src, 'image');
dialog.remove();
});
content.querySelector('.share-download')?.addEventListener('click', () => {
this.downloadImage(src, title);
dialog.remove();
});
content.querySelector('.share-native')?.addEventListener('click', () => {
this.shareNative(src, title);
dialog.remove();
});
content.querySelector('.share-generate-link')?.addEventListener('click', async () => {
if (noteId) {
const link = await this.generateShareLink(noteId);
await this.copyToClipboard(link.url, 'link');
dialog.remove();
}
});
content.querySelector('.close-dialog')?.addEventListener('click', () => {
dialog.remove();
});
dialog.appendChild(content);
document.body.appendChild(dialog);
}
/**
* Load image from URL
*/
private loadImage(src: string): Promise<HTMLImageElement> {
return new Promise((resolve, reject) => {
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`Failed to load image: ${src}`));
img.src = src;
});
}
/**
* Get MIME type for format
*/
private getMimeType(format: ExportFormat): string {
switch (format) {
case 'jpeg':
return 'image/jpeg';
case 'png':
return 'image/png';
case 'webp':
return 'image/webp';
default:
return 'image/png';
}
}
/**
* Get original extension from filename
*/
private getOriginalExtension(filename: string): string {
const parts = filename.split('.');
if (parts.length > 1) {
return parts[parts.length - 1].toLowerCase();
}
return 'png';
}
/**
* Ensure filename has correct extension
*/
private ensureExtension(filename: string, extension: string): string {
const parts = filename.split('.');
if (parts.length > 1) {
parts[parts.length - 1] = extension;
return parts.join('.');
}
return `${filename}.${extension}`;
}
/**
* Cleanup resources
*/
cleanup(): void {
this.activeShares.clear();
// Clean up canvas memory
if (this.downloadCanvas && this.downloadContext) {
this.downloadContext.clearRect(0, 0, this.downloadCanvas.width, this.downloadCanvas.height);
this.downloadCanvas.width = 0;
this.downloadCanvas.height = 0;
}
this.downloadCanvas = undefined;
this.downloadContext = undefined;
}
}
export default ImageSharingService.getInstance();

View File

@@ -2,21 +2,15 @@ import server from "./server.js";
import appContext, { type CommandNames } from "../components/app_context.js";
import shortcutService from "./shortcuts.js";
import type Component from "../components/component.js";
import type { ActionKeyboardShortcut } from "@triliumnext/commons";
const keyboardActionRepo: Record<string, Action> = {};
const keyboardActionRepo: Record<string, ActionKeyboardShortcut> = {};
// TODO: Deduplicate with server.
export interface Action {
actionName: CommandNames;
effectiveShortcuts: string[];
scope: string;
}
const keyboardActionsLoaded = server.get<Action[]>("keyboard-actions").then((actions) => {
const keyboardActionsLoaded = server.get<ActionKeyboardShortcut[]>("keyboard-actions").then((actions) => {
actions = actions.filter((a) => !!a.actionName); // filter out separators
for (const action of actions) {
action.effectiveShortcuts = action.effectiveShortcuts.filter((shortcut) => !shortcut.startsWith("global:"));
action.effectiveShortcuts = (action.effectiveShortcuts ?? []).filter((shortcut) => !shortcut.startsWith("global:"));
keyboardActionRepo[action.actionName] = action;
}
@@ -38,7 +32,7 @@ async function setupActionsForElement(scope: string, $el: JQuery<HTMLElement>, c
const actions = await getActionsForScope(scope);
for (const action of actions) {
for (const shortcut of action.effectiveShortcuts) {
for (const shortcut of action.effectiveShortcuts ?? []) {
shortcutService.bindElShortcut($el, shortcut, () => component.triggerCommand(action.actionName, { ntxId: appContext.tabManager.activeNtxId }));
}
}
@@ -46,7 +40,7 @@ async function setupActionsForElement(scope: string, $el: JQuery<HTMLElement>, c
getActionsForScope("window").then((actions) => {
for (const action of actions) {
for (const shortcut of action.effectiveShortcuts) {
for (const shortcut of action.effectiveShortcuts ?? []) {
shortcutService.bindGlobalShortcut(shortcut, () => appContext.triggerCommand(action.actionName, { ntxId: appContext.tabManager.activeNtxId }));
}
}
@@ -80,7 +74,7 @@ function updateDisplayedShortcuts($container: JQuery<HTMLElement>) {
const action = await getAction(actionName, true);
if (action) {
const keyboardActions = action.effectiveShortcuts.join(", ");
const keyboardActions = (action.effectiveShortcuts ?? []).join(", ");
if (keyboardActions || $(el).text() !== "not set") {
$(el).text(keyboardActions);
@@ -99,7 +93,7 @@ function updateDisplayedShortcuts($container: JQuery<HTMLElement>) {
if (action) {
const title = $(el).attr("title");
const shortcuts = action.effectiveShortcuts.join(", ");
const shortcuts = (action.effectiveShortcuts ?? []).join(", ");
if (title?.includes(shortcuts)) {
return;

View File

@@ -231,6 +231,7 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
let ntxId: string | null = null;
let hoistedNoteId: string | null = null;
let searchString: string | null = null;
let openInPopup = false;
if (paramString) {
for (const pair of paramString.split("&")) {
@@ -246,6 +247,8 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
searchString = value; // supports triggering search from URL, e.g. #?searchString=blabla
} else if (["viewMode", "attachmentId"].includes(name)) {
(viewScope as any)[name] = value;
} else if (name === "popup") {
openInPopup = true;
} else {
console.warn(`Unrecognized hash parameter '${name}'.`);
}
@@ -266,7 +269,8 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
ntxId,
hoistedNoteId,
viewScope,
searchString
searchString,
openInPopup
};
}
@@ -299,11 +303,12 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent
}
}
const { notePath, viewScope } = parseNavigationStateFromUrl(hrefLink);
const { notePath, viewScope, openInPopup } = parseNavigationStateFromUrl(hrefLink);
const ctrlKey = evt && utils.isCtrlKey(evt);
const shiftKey = evt?.shiftKey;
const isLeftClick = !evt || ("which" in evt && evt.which === 1);
// Right click is handled separately.
const isMiddleClick = evt && "which" in evt && evt.which === 2;
const targetIsBlank = ($link?.attr("target") === "_blank");
const openInNewTab = (isLeftClick && ctrlKey) || isMiddleClick || targetIsBlank;
@@ -311,7 +316,9 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent
const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey;
if (notePath) {
if (openInNewWindow) {
if (isLeftClick && openInPopup) {
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath });
} else if (openInNewWindow) {
appContext.triggerCommand("openInWindow", { notePath, viewScope });
} else if (openInNewTab) {
appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
@@ -387,12 +394,18 @@ function linkContextMenu(e: PointerEvent) {
return;
}
if (utils.isCtrlKey(e) && e.button === 2) {
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath });
e.preventDefault();
return;
}
e.preventDefault();
linkContextMenuService.openContextMenu(notePath, e, viewScope, null);
}
export async function loadReferenceLinkTitle($el: JQuery<HTMLElement>, href: string | null | undefined = null) {
async function loadReferenceLinkTitle($el: JQuery<HTMLElement>, href: string | null | undefined = null) {
const $link = $el[0].tagName === "A" ? $el : $el.find("a");
href = href || $link.attr("href");

View File

@@ -0,0 +1,552 @@
import PhotoSwipe from 'photoswipe';
import type PhotoSwipeOptions from 'photoswipe';
import type { DataSource, SlideData } from 'photoswipe';
import 'photoswipe/style.css';
import '../styles/photoswipe-mobile-a11y.css';
import mobileA11yService, { type MobileA11yConfig } from './photoswipe_mobile_a11y.js';
// Define Content type locally since it's not exported by PhotoSwipe
interface Content {
width?: number;
height?: number;
[key: string]: any;
}
// Define AugmentedEvent type locally
interface AugmentedEvent<T extends string> {
content: Content;
slide?: any;
preventDefault?: () => void;
[key: string]: any;
}
/**
* Media item interface for PhotoSwipe gallery
*/
export interface MediaItem {
src: string;
width?: number;
height?: number;
alt?: string;
title?: string;
noteId?: string;
element?: HTMLElement;
msrc?: string; // Thumbnail source
}
/**
* Configuration options for the media viewer
*/
export interface MediaViewerConfig {
bgOpacity?: number;
showHideOpacity?: boolean;
showAnimationDuration?: number;
hideAnimationDuration?: number;
allowPanToNext?: boolean;
spacing?: number;
maxSpreadZoom?: number;
getThumbBoundsFn?: (index: number) => { x: number; y: number; w: number } | undefined;
pinchToClose?: boolean;
closeOnScroll?: boolean;
closeOnVerticalDrag?: boolean;
mouseMovePan?: boolean;
arrowKeys?: boolean;
returnFocus?: boolean;
escKey?: boolean;
errorMsg?: string;
preloadFirstSlide?: boolean;
preload?: [number, number];
loop?: boolean;
wheelToZoom?: boolean;
mobileA11y?: MobileA11yConfig; // Mobile and accessibility configuration
}
/**
* Event callbacks for media viewer
*/
export interface MediaViewerCallbacks {
onOpen?: () => void;
onClose?: () => void;
onChange?: (index: number) => void;
onImageLoad?: (index: number, item: MediaItem) => void;
onImageError?: (index: number, item: MediaItem, error?: Error) => void;
}
/**
* PhotoSwipe data item with original item reference
*/
interface PhotoSwipeDataItem extends SlideData {
_originalItem?: MediaItem;
}
/**
* Error handler for media viewer operations
*/
class MediaViewerError extends Error {
constructor(message: string, public readonly cause?: unknown) {
super(message);
this.name = 'MediaViewerError';
}
}
/**
* MediaViewerService manages the PhotoSwipe lightbox for viewing images and media
* in Trilium Notes. Implements singleton pattern for global access.
*/
class MediaViewerService {
private static instance: MediaViewerService;
private photoSwipe: PhotoSwipe | null = null;
private defaultConfig: MediaViewerConfig;
private currentItems: MediaItem[] = [];
private callbacks: MediaViewerCallbacks = {};
private cleanupHandlers: Array<() => void> = [];
private constructor() {
// Default configuration optimized for Trilium
this.defaultConfig = {
bgOpacity: 0.95,
showHideOpacity: true,
showAnimationDuration: 250,
hideAnimationDuration: 250,
allowPanToNext: true,
spacing: 0.12,
maxSpreadZoom: 4,
pinchToClose: true,
closeOnScroll: false,
closeOnVerticalDrag: true,
mouseMovePan: true,
arrowKeys: true,
returnFocus: true,
escKey: true,
errorMsg: 'The image could not be loaded',
preloadFirstSlide: true,
preload: [1, 2],
loop: true,
wheelToZoom: true
};
// Setup global cleanup on window unload
window.addEventListener('beforeunload', () => this.destroy());
}
/**
* Get singleton instance of MediaViewerService
*/
static getInstance(): MediaViewerService {
if (!MediaViewerService.instance) {
MediaViewerService.instance = new MediaViewerService();
}
return MediaViewerService.instance;
}
/**
* Open the media viewer with specified items
*/
open(items: MediaItem[], startIndex: number = 0, config?: Partial<MediaViewerConfig>, callbacks?: MediaViewerCallbacks): void {
try {
// Validate inputs
if (!items || items.length === 0) {
throw new MediaViewerError('No items provided to media viewer');
}
if (startIndex < 0 || startIndex >= items.length) {
console.warn(`Invalid start index ${startIndex}, using 0`);
startIndex = 0;
}
// Close any existing viewer
this.close();
this.currentItems = items;
this.callbacks = callbacks || {};
// Prepare data source for PhotoSwipe with error handling
const dataSource: DataSource = items.map((item, index) => {
try {
return this.prepareItem(item);
} catch (error) {
console.error(`Failed to prepare item at index ${index}:`, error);
// Return a minimal valid item as fallback
return {
src: item.src,
width: 800,
height: 600,
alt: item.alt || 'Error loading image'
} as PhotoSwipeDataItem;
}
});
// Merge configurations
const finalConfig = {
...this.defaultConfig,
...config,
dataSource,
index: startIndex,
errorMsg: config?.errorMsg || 'The image could not be loaded. Please try again.'
};
// Create and initialize PhotoSwipe
this.photoSwipe = new PhotoSwipe(finalConfig);
// Setup event handlers
this.setupEventHandlers();
// Apply mobile and accessibility enhancements
if (config?.mobileA11y || this.shouldAutoEnhance()) {
mobileA11yService.enhancePhotoSwipe(this.photoSwipe, config?.mobileA11y);
}
// Initialize the viewer
this.photoSwipe.init();
} catch (error) {
console.error('Failed to open media viewer:', error);
// Cleanup on error
this.close();
// Re-throw as MediaViewerError
throw error instanceof MediaViewerError ? error : new MediaViewerError('Failed to open media viewer', error);
}
}
/**
* Open a single image in the viewer
*/
openSingle(item: MediaItem, config?: Partial<MediaViewerConfig>, callbacks?: MediaViewerCallbacks): void {
this.open([item], 0, config, callbacks);
}
/**
* Close the media viewer
*/
close(): void {
if (this.photoSwipe) {
this.photoSwipe.destroy();
this.photoSwipe = null;
this.cleanupEventHandlers();
}
}
/**
* Navigate to next item
*/
next(): void {
if (this.photoSwipe) {
this.photoSwipe.next();
}
}
/**
* Navigate to previous item
*/
prev(): void {
if (this.photoSwipe) {
this.photoSwipe.prev();
}
}
/**
* Go to specific slide by index
*/
goTo(index: number): void {
if (this.photoSwipe && index >= 0 && index < this.currentItems.length) {
this.photoSwipe.goTo(index);
}
}
/**
* Get current slide index
*/
getCurrentIndex(): number {
return this.photoSwipe ? this.photoSwipe.currIndex : -1;
}
/**
* Check if viewer is open
*/
isOpen(): boolean {
return this.photoSwipe !== null;
}
/**
* Update configuration dynamically
*/
updateConfig(config: Partial<MediaViewerConfig>): void {
this.defaultConfig = {
...this.defaultConfig,
...config
};
}
/**
* Prepare item for PhotoSwipe
*/
private prepareItem(item: MediaItem): PhotoSwipeDataItem {
const prepared: PhotoSwipeDataItem = {
src: item.src,
alt: item.alt || '',
title: item.title
};
// If dimensions are provided, use them
if (item.width && item.height) {
prepared.width = item.width;
prepared.height = item.height;
} else {
// Default dimensions - will be updated when image loads
prepared.width = 0;
prepared.height = 0;
}
// Add thumbnail if provided
if (item.msrc) {
prepared.msrc = item.msrc;
}
// Store original item reference
prepared._originalItem = item;
return prepared;
}
/**
* Setup event handlers for PhotoSwipe
*/
private setupEventHandlers(): void {
if (!this.photoSwipe) return;
// Opening event
const openHandler = () => {
if (this.callbacks.onOpen) {
this.callbacks.onOpen();
}
};
this.photoSwipe.on('openingAnimationEnd', openHandler);
this.cleanupHandlers.push(() => this.photoSwipe?.off('openingAnimationEnd', openHandler));
// Closing event
const closeHandler = () => {
if (this.callbacks.onClose) {
this.callbacks.onClose();
}
};
this.photoSwipe.on('close', closeHandler);
this.cleanupHandlers.push(() => this.photoSwipe?.off('close', closeHandler));
// Change event
const changeHandler = () => {
if (this.callbacks.onChange && this.photoSwipe) {
this.callbacks.onChange(this.photoSwipe.currIndex);
}
};
this.photoSwipe.on('change', changeHandler);
this.cleanupHandlers.push(() => this.photoSwipe?.off('change', changeHandler));
// Image load event - also update dimensions if needed
const loadCompleteHandler = (e: any) => {
try {
const { content } = e;
const extContent = content as Content & { type?: string; data?: HTMLImageElement; index?: number; _originalItem?: MediaItem };
if (extContent.type === 'image' && extContent.data) {
// Update dimensions if they were not provided
if (content.width === 0 || content.height === 0) {
const img = extContent.data;
content.width = img.naturalWidth;
content.height = img.naturalHeight;
if (typeof extContent.index === 'number') {
this.photoSwipe?.refreshSlideContent(extContent.index);
}
}
if (this.callbacks.onImageLoad && typeof extContent.index === 'number' && extContent._originalItem) {
this.callbacks.onImageLoad(extContent.index, extContent._originalItem);
}
}
} catch (error) {
console.error('Error in loadComplete handler:', error);
}
};
this.photoSwipe.on('loadComplete', loadCompleteHandler);
this.cleanupHandlers.push(() => this.photoSwipe?.off('loadComplete', loadCompleteHandler));
// Image error event
const errorHandler = (e: any) => {
try {
const { content } = e;
const extContent = content as Content & { index?: number; _originalItem?: MediaItem };
if (this.callbacks.onImageError && typeof extContent.index === 'number' && extContent._originalItem) {
const error = new MediaViewerError(`Failed to load image at index ${extContent.index}`);
this.callbacks.onImageError(extContent.index, extContent._originalItem, error);
}
} catch (error) {
console.error('Error in errorHandler:', error);
}
};
this.photoSwipe.on('loadError', errorHandler);
this.cleanupHandlers.push(() => this.photoSwipe?.off('loadError', errorHandler));
}
/**
* Cleanup event handlers
*/
private cleanupEventHandlers(): void {
this.cleanupHandlers.forEach(handler => handler());
this.cleanupHandlers = [];
}
/**
* Destroy the service and cleanup resources
*/
destroy(): void {
this.close();
this.currentItems = [];
this.callbacks = {};
// Cleanup mobile and accessibility enhancements
mobileA11yService.cleanup();
}
/**
* Get dimensions from image element or URL with proper resource cleanup
*/
async getImageDimensions(src: string): Promise<{ width: number; height: number }> {
return new Promise((resolve, reject) => {
const img = new Image();
let resolved = false;
const cleanup = () => {
img.onload = null;
img.onerror = null;
// Clear the src to help with garbage collection
if (!resolved) {
img.src = '';
}
};
img.onload = () => {
resolved = true;
const dimensions = {
width: img.naturalWidth,
height: img.naturalHeight
};
cleanup();
resolve(dimensions);
};
img.onerror = () => {
const error = new MediaViewerError(`Failed to load image: ${src}`);
cleanup();
reject(error);
};
// Set a timeout for image loading
const timeoutId = setTimeout(() => {
if (!resolved) {
cleanup();
reject(new MediaViewerError(`Image loading timeout: ${src}`));
}
}, 30000); // 30 second timeout
img.src = src;
// Clear timeout on success or error
// Store the original handlers with timeout cleanup
const originalOnload = img.onload;
const originalOnerror = img.onerror;
img.onload = function(ev: Event) {
clearTimeout(timeoutId);
if (originalOnload) {
originalOnload.call(img, ev);
}
};
img.onerror = function(ev: Event | string) {
clearTimeout(timeoutId);
if (originalOnerror) {
originalOnerror.call(img, ev);
}
};
});
}
/**
* Create items from image elements in a container with error isolation
*/
async createItemsFromContainer(container: HTMLElement, selector: string = 'img'): Promise<MediaItem[]> {
const images = container.querySelectorAll<HTMLImageElement>(selector);
const items: MediaItem[] = [];
// Process each image with isolated error handling
const promises = Array.from(images).map(async (img) => {
try {
const item: MediaItem = {
src: img.src,
alt: img.alt || `Image ${items.length + 1}`,
title: img.title || img.alt || `Image ${items.length + 1}`,
element: img,
width: img.naturalWidth || undefined,
height: img.naturalHeight || undefined
};
// Try to get dimensions if not available
if (!item.width || !item.height) {
try {
const dimensions = await this.getImageDimensions(img.src);
item.width = dimensions.width;
item.height = dimensions.height;
} catch (error) {
// Log but don't fail - image will still be viewable
console.warn(`Failed to get dimensions for image: ${img.src}`, error);
// Set default dimensions as fallback
item.width = 800;
item.height = 600;
}
}
return item;
} catch (error) {
// Log error but continue processing other images
console.error(`Failed to process image: ${img.src}`, error);
return null;
}
});
// Wait for all promises and filter out nulls
const results = await Promise.allSettled(promises);
for (const result of results) {
if (result.status === 'fulfilled' && result.value !== null) {
items.push(result.value);
}
}
return items;
}
/**
* Apply theme-specific styles
*/
applyTheme(isDarkTheme: boolean): void {
// This will be expanded to modify PhotoSwipe's appearance based on Trilium's theme
const opacity = isDarkTheme ? 0.95 : 0.9;
this.updateConfig({ bgOpacity: opacity });
}
/**
* Check if mobile/accessibility enhancements should be auto-enabled
*/
private shouldAutoEnhance(): boolean {
// Auto-enable for touch devices
const isTouchDevice = 'ontouchstart' in window ||
navigator.maxTouchPoints > 0;
// Auto-enable if user has accessibility preferences
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const prefersHighContrast = window.matchMedia('(prefers-contrast: high)').matches;
return isTouchDevice || prefersReducedMotion || prefersHighContrast;
}
}
// Export singleton instance
export default MediaViewerService.getInstance();

View File

@@ -3,6 +3,7 @@ import appContext from "../components/app_context.js";
import noteCreateService from "./note_create.js";
import froca from "./froca.js";
import { t } from "./i18n.js";
import commandRegistry from "./command_registry.js";
import type { MentionFeedObjectItem } from "@triliumnext/ckeditor5";
// this key needs to have this value, so it's hit by the tooltip
@@ -29,18 +30,26 @@ export interface Suggestion {
notePathTitle?: string;
notePath?: string;
highlightedNotePathTitle?: string;
action?: string | "create-note" | "search-notes" | "external-link";
action?: string | "create-note" | "search-notes" | "external-link" | "command";
parentNoteId?: string;
icon?: string;
commandId?: string;
commandDescription?: string;
commandShortcut?: string;
}
interface Options {
container?: HTMLElement;
export interface Options {
container?: HTMLElement | null;
fastSearch?: boolean;
allowCreatingNotes?: boolean;
allowJumpToSearchNotes?: boolean;
allowExternalLinks?: boolean;
/** If set, hides the right-side button corresponding to go to selected note. */
hideGoToSelectedNoteButton?: boolean;
/** If set, hides all right-side buttons in the autocomplete dropdown */
hideAllButtons?: boolean;
/** If set, enables command palette mode */
isCommandPalette?: boolean;
}
async function autocompleteSourceForCKEditor(queryText: string) {
@@ -70,6 +79,31 @@ async function autocompleteSourceForCKEditor(queryText: string) {
}
async function autocompleteSource(term: string, cb: (rows: Suggestion[]) => void, options: Options = {}) {
// Check if we're in command mode
if (options.isCommandPalette && term.startsWith(">")) {
const commandQuery = term.substring(1).trim();
// Get commands (all if no query, filtered if query provided)
const commands = commandQuery.length === 0
? commandRegistry.getAllCommands()
: commandRegistry.searchCommands(commandQuery);
// Convert commands to suggestions
const commandSuggestions: Suggestion[] = commands.map(cmd => ({
action: "command",
commandId: cmd.id,
noteTitle: cmd.name,
notePathTitle: `>${cmd.name}`,
highlightedNotePathTitle: cmd.name,
commandDescription: cmd.description,
commandShortcut: cmd.shortcut,
icon: cmd.icon
}));
cb(commandSuggestions);
return;
}
const fastSearch = options.fastSearch === false ? false : true;
if (fastSearch === false) {
if (term.trim().length === 0) {
@@ -143,6 +177,12 @@ function showRecentNotes($el: JQuery<HTMLElement>) {
$el.trigger("focus");
}
function showAllCommands($el: JQuery<HTMLElement>) {
searchDelay = 0;
$el.setSelectedNotePath("");
$el.autocomplete("val", ">").autocomplete("open");
}
function fullTextSearch($el: JQuery<HTMLElement>, options: Options) {
const searchString = $el.autocomplete("val") as unknown as string;
if (options.fastSearch === false || searchString?.trim().length === 0) {
@@ -190,9 +230,11 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
const $goToSelectedNoteButton = $("<a>").addClass("input-group-text go-to-selected-note-button bx bx-arrow-to-right");
$el.after($clearTextButton).after($showRecentNotesButton).after($fullTextSearchButton);
if (!options.hideAllButtons) {
$el.after($clearTextButton).after($showRecentNotesButton).after($fullTextSearchButton);
}
if (!options.hideGoToSelectedNoteButton) {
if (!options.hideGoToSelectedNoteButton && !options.hideAllButtons) {
$el.after($goToSelectedNoteButton);
}
@@ -265,7 +307,24 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
},
displayKey: "notePathTitle",
templates: {
suggestion: (suggestion) => `<span class="${suggestion.icon ?? "bx bx-note"}"></span> ${suggestion.highlightedNotePathTitle}`
suggestion: (suggestion) => {
if (suggestion.action === "command") {
let html = `<div class="command-suggestion">`;
html += `<span class="command-icon ${suggestion.icon || "bx bx-terminal"}"></span>`;
html += `<div class="command-content">`;
html += `<div class="command-name">${suggestion.highlightedNotePathTitle}</div>`;
if (suggestion.commandDescription) {
html += `<div class="command-description">${suggestion.commandDescription}</div>`;
}
html += `</div>`;
if (suggestion.commandShortcut) {
html += `<kbd class="command-shortcut">${suggestion.commandShortcut}</kbd>`;
}
html += '</div>';
return html;
}
return `<span class="${suggestion.icon ?? "bx bx-note"}"></span> ${suggestion.highlightedNotePathTitle}`;
}
},
// we can't cache identical searches because notes can be created / renamed, new recent notes can be added
cache: false
@@ -275,6 +334,12 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
// TODO: Types fail due to "autocomplete:selected" not being registered in type definitions.
($el as any).on("autocomplete:selected", async (event: Event, suggestion: Suggestion) => {
if (suggestion.action === "command") {
$el.autocomplete("close");
$el.trigger("autocomplete:commandselected", [suggestion]);
return;
}
if (suggestion.action === "external-link") {
$el.setSelectedNotePath(null);
$el.setSelectedExternalLink(suggestion.externalLink);
@@ -387,10 +452,26 @@ function init() {
};
}
/**
* Convenience function which triggers the display of recent notes in the autocomplete input and focuses it.
*
* @param inputElement - The input element to trigger recent notes on.
*/
export function triggerRecentNotes(inputElement: HTMLInputElement | null | undefined) {
if (!inputElement) {
return;
}
const $el = $(inputElement);
showRecentNotes($el);
$el.trigger("focus").trigger("select");
}
export default {
autocompleteSourceForCKEditor,
initNoteAutocomplete,
showRecentNotes,
showAllCommands,
setText,
init
};

View File

@@ -11,7 +11,7 @@ import type FBranch from "../entities/fbranch.js";
import type { ChooseNoteTypeResponse } from "../widgets/dialogs/note_type_chooser.js";
import type { CKTextEditor } from "@triliumnext/ckeditor5";
interface CreateNoteOpts {
export interface CreateNoteOpts {
isProtected?: boolean;
saveSelection?: boolean;
title?: string | null;
@@ -109,8 +109,6 @@ async function createNote(parentNotePath: string | undefined, options: CreateNot
async function chooseNoteType() {
return new Promise<ChooseNoteTypeResponse>((res) => {
// TODO: Remove ignore after callback for chooseNoteType is defined in app_context.ts
//@ts-ignore
appContext.triggerCommand("chooseNoteType", { callback: res });
});
}

View File

@@ -1,4 +1,5 @@
import type FNote from "../entities/fnote.js";
import BoardView from "../widgets/view_widgets/board_view/index.js";
import CalendarView from "../widgets/view_widgets/calendar_view.js";
import GeoView from "../widgets/view_widgets/geo_view/index.js";
import ListOrGridView from "../widgets/view_widgets/list_or_grid_view.js";
@@ -6,39 +7,25 @@ import TableView from "../widgets/view_widgets/table_view/index.js";
import type { ViewModeArgs } from "../widgets/view_widgets/view_mode.js";
import type ViewMode from "../widgets/view_widgets/view_mode.js";
export type ViewTypeOptions = "list" | "grid" | "calendar" | "table" | "geoMap";
const allViewTypes = ["list", "grid", "calendar", "table", "geoMap", "board"] as const;
export type ArgsWithoutNoteId = Omit<ViewModeArgs, "noteIds">;
export type ViewTypeOptions = typeof allViewTypes[number];
export default class NoteListRenderer {
private viewType: ViewTypeOptions;
public viewMode: ViewMode<any> | null;
private args: ArgsWithoutNoteId;
public viewMode?: ViewMode<any>;
constructor(args: ViewModeArgs) {
constructor(args: ArgsWithoutNoteId) {
this.args = args;
this.viewType = this.#getViewType(args.parentNote);
switch (this.viewType) {
case "list":
case "grid":
this.viewMode = new ListOrGridView(this.viewType, args);
break;
case "calendar":
this.viewMode = new CalendarView(args);
break;
case "table":
this.viewMode = new TableView(args);
break;
case "geoMap":
this.viewMode = new GeoView(args);
break;
default:
this.viewMode = null;
}
}
#getViewType(parentNote: FNote): ViewTypeOptions {
const viewType = parentNote.getLabelValue("viewType");
if (!["list", "grid", "calendar", "table", "geoMap"].includes(viewType || "")) {
if (!(allViewTypes as readonly string[]).includes(viewType || "")) {
// when not explicitly set, decide based on the note type
return parentNote.type === "search" ? "list" : "grid";
} else {
@@ -47,15 +34,38 @@ export default class NoteListRenderer {
}
get isFullHeight() {
return this.viewMode?.isFullHeight;
switch (this.viewType) {
case "list":
case "grid":
return false;
default:
return true;
}
}
async renderList() {
if (!this.viewMode) {
return null;
}
const args = this.args;
const viewMode = this.#buildViewMode(args);
this.viewMode = viewMode;
await viewMode.beforeRender();
return await viewMode.renderList();
}
return await this.viewMode.renderList();
#buildViewMode(args: ViewModeArgs) {
switch (this.viewType) {
case "calendar":
return new CalendarView(args);
case "table":
return new TableView(args);
case "geoMap":
return new GeoView(args);
case "board":
return new BoardView(args);
case "list":
case "grid":
default:
return new ListOrGridView(this.viewType, args);
}
}
}

View File

@@ -13,8 +13,8 @@ let openTooltipElements: JQuery<HTMLElement>[] = [];
let dismissTimer: ReturnType<typeof setTimeout>;
function setupGlobalTooltip() {
$(document).on("mouseenter", "a", mouseEnterHandler);
$(document).on("mouseenter", "[data-href]", mouseEnterHandler);
$(document).on("mouseenter", "a:not(.no-tooltip-preview)", mouseEnterHandler);
$(document).on("mouseenter", "[data-href]:not(.no-tooltip-preview)", mouseEnterHandler);
// close any note tooltip after click, this fixes the problem that sometimes tooltips remained on the screen
$(document).on("click", (e) => {
@@ -168,7 +168,10 @@ async function renderTooltip(note: FNote | null) {
if (isContentEmpty) {
classes.push("note-no-content");
}
content = `<h5 class="${classes.join(" ")}"><a href="#${note.noteId}" data-no-context-menu="true">${noteTitleWithPathAsSuffix.prop("outerHTML")}</a></h5>`;
content = `\
<h5 class="${classes.join(" ")}">
<a href="#${note.noteId}" data-no-context-menu="true">${noteTitleWithPathAsSuffix.prop("outerHTML")}</a>
</h5>`;
}
content = `${content}<div class="note-tooltip-attributes">${$renderedAttributes[0].outerHTML}</div>`;
@@ -176,6 +179,7 @@ async function renderTooltip(note: FNote | null) {
content += $renderedContent[0].outerHTML;
}
content += `<a class="open-popup-button" title="${t("note_tooltip.quick-edit")}" href="#${note.noteId}?popup"><span class="bx bx-edit" /></a>`;
return content;
}

View File

@@ -81,7 +81,7 @@ let rootCreationDate: Date | undefined;
async function getNoteTypeItems(command?: TreeCommandNames) {
const items: MenuItem<TreeCommandNames>[] = [
...getBlankNoteTypes(command),
...await getBuiltInTemplates("Collections", command, true),
...await getBuiltInTemplates(t("note_types.collections"), command, true),
...await getBuiltInTemplates(null, command, false),
...await getUserTemplates(command)
];
@@ -89,26 +89,28 @@ async function getNoteTypeItems(command?: TreeCommandNames) {
return items;
}
function getBlankNoteTypes(command): MenuItem<TreeCommandNames>[] {
return NOTE_TYPES.filter((nt) => !nt.reserved).map((nt) => {
const menuItem: MenuCommandItem<TreeCommandNames> = {
title: nt.title,
command,
type: nt.type,
uiIcon: "bx " + nt.icon,
badges: []
}
function getBlankNoteTypes(command?: TreeCommandNames): MenuItem<TreeCommandNames>[] {
return NOTE_TYPES
.filter((nt) => !nt.reserved && nt.type !== "book")
.map((nt) => {
const menuItem: MenuCommandItem<TreeCommandNames> = {
title: nt.title,
command,
type: nt.type,
uiIcon: "bx " + nt.icon,
badges: []
}
if (nt.isNew) {
menuItem.badges?.push(NEW_BADGE);
}
if (nt.isNew) {
menuItem.badges?.push(NEW_BADGE);
}
if (nt.isBeta) {
menuItem.badges?.push(BETA_BADGE);
}
if (nt.isBeta) {
menuItem.badges?.push(BETA_BADGE);
}
return menuItem;
});
return menuItem;
});
}
async function getUserTemplates(command?: TreeCommandNames) {
@@ -152,15 +154,15 @@ async function getBuiltInTemplates(title: string | null, command: TreeCommandNam
return [];
}
const items: MenuItem<TreeCommandNames>[] = [
SEPARATOR
];
const items: MenuItem<TreeCommandNames>[] = [];
if (title) {
items.push({
title: title,
enabled: false
enabled: false,
uiIcon: "bx bx-empty"
});
} else {
items.push(SEPARATOR);
}
for (const templateNote of childNotes) {

View File

@@ -0,0 +1,541 @@
/**
* Tests for PhotoSwipe Mobile & Accessibility Enhancement Module
*/
import { describe, it, expect, beforeEach, afterEach, jest } from '@jest/globals';
import type PhotoSwipe from 'photoswipe';
import mobileA11yService from './photoswipe_mobile_a11y.js';
// Mock PhotoSwipe
const mockPhotoSwipe = {
template: document.createElement('div'),
currSlide: {
currZoomLevel: 1,
zoomTo: jest.fn(),
data: {
src: 'test.jpg',
alt: 'Test image',
title: 'Test',
width: 800,
height: 600
}
},
currIndex: 0,
viewportSize: { x: 800, y: 600 },
ui: { toggle: jest.fn() },
next: jest.fn(),
prev: jest.fn(),
goTo: jest.fn(),
close: jest.fn(),
getNumItems: () => 5,
on: jest.fn(),
off: jest.fn(),
options: {
showAnimationDuration: 250,
hideAnimationDuration: 250
}
} as unknown as PhotoSwipe;
describe('PhotoSwipeMobileA11yService', () => {
beforeEach(() => {
// Reset DOM
document.body.innerHTML = '';
// Reset mocks
jest.clearAllMocks();
});
afterEach(() => {
// Cleanup
mobileA11yService.cleanup();
});
describe('Device Capabilities Detection', () => {
it('should detect touch device capabilities', () => {
// Add touch support to window
Object.defineProperty(window, 'ontouchstart', {
value: () => {},
writable: true
});
// Service should detect touch support on initialization
const service = mobileA11yService;
expect(service).toBeDefined();
});
it('should detect accessibility preferences', () => {
// Mock matchMedia for reduced motion
const mockMatchMedia = jest.fn().mockImplementation(query => ({
matches: query === '(prefers-reduced-motion: reduce)',
media: query,
addListener: jest.fn(),
removeListener: jest.fn()
}));
Object.defineProperty(window, 'matchMedia', {
value: mockMatchMedia,
writable: true
});
const service = mobileA11yService;
expect(service).toBeDefined();
});
});
describe('ARIA Live Region', () => {
it('should create ARIA live region for announcements', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const liveRegion = document.querySelector('[aria-live]');
expect(liveRegion).toBeTruthy();
expect(liveRegion?.getAttribute('aria-live')).toBe('polite');
expect(liveRegion?.getAttribute('role')).toBe('status');
});
it('should announce changes to screen readers', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe, {
a11y: {
enableScreenReaderAnnouncements: true
}
});
const liveRegion = document.querySelector('[aria-live]');
// Trigger navigation
const changeHandler = (mockPhotoSwipe.on as jest.Mock).mock.calls
.find(call => call[0] === 'change')?.[1];
if (changeHandler) {
changeHandler();
// Check if announcement was made
expect(liveRegion?.textContent).toContain('Image 1 of 5');
}
});
});
describe('Keyboard Navigation', () => {
it('should handle arrow key navigation', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
// Simulate arrow key presses
const leftArrow = new KeyboardEvent('keydown', { key: 'ArrowLeft' });
const rightArrow = new KeyboardEvent('keydown', { key: 'ArrowRight' });
document.dispatchEvent(leftArrow);
expect(mockPhotoSwipe.prev).toHaveBeenCalled();
document.dispatchEvent(rightArrow);
expect(mockPhotoSwipe.next).toHaveBeenCalled();
});
it('should handle zoom with arrow keys', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const upArrow = new KeyboardEvent('keydown', { key: 'ArrowUp' });
const downArrow = new KeyboardEvent('keydown', { key: 'ArrowDown' });
document.dispatchEvent(upArrow);
expect(mockPhotoSwipe.currSlide?.zoomTo).toHaveBeenCalledWith(
expect.any(Number),
expect.any(Object),
333
);
document.dispatchEvent(downArrow);
expect(mockPhotoSwipe.currSlide?.zoomTo).toHaveBeenCalledTimes(2);
});
it('should show keyboard help on ? key', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const helpKey = new KeyboardEvent('keydown', { key: '?' });
document.dispatchEvent(helpKey);
const helpDialog = document.querySelector('.photoswipe-keyboard-help');
expect(helpDialog).toBeTruthy();
expect(helpDialog?.getAttribute('role')).toBe('dialog');
});
it('should support quick navigation with number keys', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const key3 = new KeyboardEvent('keydown', { key: '3' });
document.dispatchEvent(key3);
expect(mockPhotoSwipe.goTo).toHaveBeenCalledWith(2); // 0-indexed
});
});
describe('Touch Gestures', () => {
it('should handle pinch to zoom', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const element = mockPhotoSwipe.template;
// Simulate pinch gesture
const touch1 = { clientX: 100, clientY: 100, identifier: 0 };
const touch2 = { clientX: 200, clientY: 200, identifier: 1 };
const touchStart = new TouchEvent('touchstart', {
touches: [touch1, touch2] as any
});
element?.dispatchEvent(touchStart);
// Move touches apart (zoom in)
const touch1Move = { clientX: 50, clientY: 50, identifier: 0 };
const touch2Move = { clientX: 250, clientY: 250, identifier: 1 };
const touchMove = new TouchEvent('touchmove', {
touches: [touch1Move, touch2Move] as any
});
element?.dispatchEvent(touchMove);
// Zoom should be triggered
expect(mockPhotoSwipe.currSlide?.zoomTo).toHaveBeenCalled();
});
it('should handle double tap to zoom', (done) => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const element = mockPhotoSwipe.template;
const pos = { clientX: 400, clientY: 300 };
// First tap
const firstTap = new TouchEvent('touchend', {
changedTouches: [{ ...pos, identifier: 0 }] as any
});
element?.dispatchEvent(new TouchEvent('touchstart', {
touches: [{ ...pos, identifier: 0 }] as any
}));
element?.dispatchEvent(firstTap);
// Second tap within double tap delay
setTimeout(() => {
element?.dispatchEvent(new TouchEvent('touchstart', {
touches: [{ ...pos, identifier: 0 }] as any
}));
const secondTap = new TouchEvent('touchend', {
changedTouches: [{ ...pos, identifier: 0 }] as any
});
element?.dispatchEvent(secondTap);
// Check zoom was triggered
expect(mockPhotoSwipe.currSlide?.zoomTo).toHaveBeenCalled();
done();
}, 100);
});
it('should detect swipe gestures', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const element = mockPhotoSwipe.template;
// Simulate swipe left
const touchStart = new TouchEvent('touchstart', {
touches: [{ clientX: 300, clientY: 300, identifier: 0 }] as any
});
const touchEnd = new TouchEvent('touchend', {
changedTouches: [{ clientX: 100, clientY: 300, identifier: 0 }] as any
});
element?.dispatchEvent(touchStart);
element?.dispatchEvent(touchEnd);
// Should navigate to next image
expect(mockPhotoSwipe.next).toHaveBeenCalled();
});
});
describe('Focus Management', () => {
it('should trap focus within gallery', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const element = mockPhotoSwipe.template;
// Add focusable elements
const button1 = document.createElement('button');
const button2 = document.createElement('button');
element?.appendChild(button1);
element?.appendChild(button2);
// Focus first button
button1.focus();
// Simulate Tab on last focusable element
const tabEvent = new KeyboardEvent('keydown', {
key: 'Tab',
shiftKey: false
});
button2.focus();
element?.dispatchEvent(tabEvent);
// Focus should wrap to first element
expect(document.activeElement).toBe(button1);
});
it('should restore focus on close', () => {
const originalFocus = document.createElement('button');
document.body.appendChild(originalFocus);
originalFocus.focus();
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
// Trigger close handler
const closeHandler = (mockPhotoSwipe.on as jest.Mock).mock.calls
.find(call => call[0] === 'close')?.[1];
if (closeHandler) {
closeHandler();
// Focus should be restored
expect(document.activeElement).toBe(originalFocus);
}
});
});
describe('ARIA Attributes', () => {
it('should add proper ARIA attributes to gallery', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const element = mockPhotoSwipe.template;
expect(element?.getAttribute('role')).toBe('dialog');
expect(element?.getAttribute('aria-label')).toContain('Image gallery');
expect(element?.getAttribute('aria-modal')).toBe('true');
});
it('should label controls for screen readers', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const element = mockPhotoSwipe.template;
// Add mock controls
const prevBtn = document.createElement('button');
prevBtn.className = 'pswp__button--arrow--prev';
element?.appendChild(prevBtn);
const nextBtn = document.createElement('button');
nextBtn.className = 'pswp__button--arrow--next';
element?.appendChild(nextBtn);
// Enhance again to label the newly added controls
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
expect(prevBtn.getAttribute('aria-label')).toBe('Previous image');
expect(nextBtn.getAttribute('aria-label')).toBe('Next image');
});
});
describe('Mobile UI Adaptations', () => {
it('should ensure minimum touch target size', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe, {
mobileUI: {
minTouchTargetSize: 44
}
});
const element = mockPhotoSwipe.template;
// Add a button
const button = document.createElement('button');
button.className = 'pswp__button';
button.style.width = '30px';
button.style.height = '30px';
element?.appendChild(button);
// Enhance to apply minimum sizes
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
// Button should be resized to meet minimum
expect(button.style.minWidth).toBe('44px');
expect(button.style.minHeight).toBe('44px');
});
it('should add swipe indicators for mobile', () => {
// Mock as mobile device
Object.defineProperty(window, 'ontouchstart', {
value: () => {},
writable: true
});
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe, {
mobileUI: {
swipeIndicators: true
}
});
const indicators = document.querySelector('.photoswipe-swipe-indicators');
expect(indicators).toBeTruthy();
});
});
describe('Performance Optimizations', () => {
it('should adapt quality based on device capabilities', () => {
// Mock low memory device
Object.defineProperty(navigator, 'deviceMemory', {
value: 1,
writable: true
});
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe, {
performance: {
adaptiveQuality: true
}
});
// Service should detect low memory and adjust settings
expect(mobileA11yService).toBeDefined();
});
it('should apply reduced motion preferences', () => {
// Mock reduced motion preference
const mockMatchMedia = jest.fn().mockImplementation(query => ({
matches: query === '(prefers-reduced-motion: reduce)',
media: query,
addListener: jest.fn(),
removeListener: jest.fn()
}));
Object.defineProperty(window, 'matchMedia', {
value: mockMatchMedia,
writable: true
});
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
// Animations should be disabled
expect(mockPhotoSwipe.options.showAnimationDuration).toBe(0);
expect(mockPhotoSwipe.options.hideAnimationDuration).toBe(0);
});
it('should optimize for battery saving', () => {
// Mock battery API
const mockBattery = {
charging: false,
level: 0.15,
addEventListener: jest.fn()
};
(navigator as any).getBattery = jest.fn().mockResolvedValue(mockBattery);
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe, {
performance: {
batteryOptimization: true
}
});
// Battery optimization should be enabled
expect((navigator as any).getBattery).toHaveBeenCalled();
});
});
describe('High Contrast Mode', () => {
it('should apply high contrast styles when enabled', () => {
// Mock high contrast preference
const mockMatchMedia = jest.fn().mockImplementation(query => ({
matches: query === '(prefers-contrast: high)',
media: query,
addListener: jest.fn(),
removeListener: jest.fn()
}));
Object.defineProperty(window, 'matchMedia', {
value: mockMatchMedia,
writable: true
});
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
const element = mockPhotoSwipe.template;
// Should have high contrast styles
expect(element?.style.outline).toContain('2px solid white');
});
});
describe('Haptic Feedback', () => {
it('should trigger haptic feedback on supported devices', () => {
// Mock vibration API
const mockVibrate = jest.fn();
Object.defineProperty(navigator, 'vibrate', {
value: mockVibrate,
writable: true
});
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe, {
touch: {
hapticFeedback: true
}
});
// Trigger a gesture that should cause haptic feedback
const element = mockPhotoSwipe.template;
// Double tap
const tap = new TouchEvent('touchend', {
changedTouches: [{ clientX: 100, clientY: 100, identifier: 0 }] as any
});
element?.dispatchEvent(new TouchEvent('touchstart', {
touches: [{ clientX: 100, clientY: 100, identifier: 0 }] as any
}));
element?.dispatchEvent(tap);
// Quick second tap
setTimeout(() => {
element?.dispatchEvent(new TouchEvent('touchstart', {
touches: [{ clientX: 100, clientY: 100, identifier: 0 }] as any
}));
element?.dispatchEvent(tap);
// Haptic feedback should be triggered
expect(mockVibrate).toHaveBeenCalled();
}, 50);
});
});
describe('Configuration Updates', () => {
it('should update configuration dynamically', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
// Update configuration
mobileA11yService.updateConfig({
a11y: {
ariaLiveRegion: 'assertive'
},
touch: {
hapticFeedback: false
}
});
const liveRegion = document.querySelector('[aria-live]');
expect(liveRegion?.getAttribute('aria-live')).toBe('assertive');
});
});
describe('Cleanup', () => {
it('should properly cleanup resources', () => {
mobileA11yService.enhancePhotoSwipe(mockPhotoSwipe);
// Create some elements
const liveRegion = document.querySelector('[aria-live]');
const helpDialog = document.querySelector('.photoswipe-keyboard-help');
expect(liveRegion).toBeTruthy();
// Cleanup
mobileA11yService.cleanup();
// Elements should be removed
expect(document.querySelector('[aria-live]')).toBeFalsy();
expect(document.querySelector('.photoswipe-keyboard-help')).toBeFalsy();
});
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
export type LabelType = "text" | "number" | "boolean" | "date" | "datetime" | "time" | "url";
export type LabelType = "text" | "number" | "boolean" | "date" | "datetime" | "time" | "url" | "color";
type Multiplicity = "single" | "multi";
export interface DefinitionObject {
@@ -17,7 +17,7 @@ function parse(value: string) {
for (const token of tokens) {
if (token === "promoted") {
defObj.isPromoted = true;
} else if (["text", "number", "boolean", "date", "datetime", "time", "url"].includes(token)) {
} else if (["text", "number", "boolean", "date", "datetime", "time", "url", "color"].includes(token)) {
defObj.labelType = token as LabelType;
} else if (["single", "multi"].includes(token)) {
defObj.multiplicity = token as Multiplicity;

View File

@@ -0,0 +1,323 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import shortcuts, { keyMatches, matchesShortcut } from "./shortcuts.js";
// Mock utils module
vi.mock("./utils.js", () => ({
default: {
isDesktop: () => true
}
}));
// Mock jQuery globally since it's used in the shortcuts module
const mockElement = {
addEventListener: vi.fn(),
removeEventListener: vi.fn()
};
const mockJQuery = vi.fn(() => [mockElement]);
(mockJQuery as any).length = 1;
mockJQuery[0] = mockElement;
(global as any).$ = mockJQuery as any;
global.document = mockElement as any;
describe("shortcuts", () => {
beforeEach(() => {
vi.clearAllMocks();
});
afterEach(() => {
// Clean up any active bindings after each test
shortcuts.removeGlobalShortcut("test-namespace");
});
describe("normalizeShortcut", () => {
it("should normalize shortcut to lowercase and remove whitespace", () => {
expect(shortcuts.normalizeShortcut("Ctrl + A")).toBe("ctrl+a");
expect(shortcuts.normalizeShortcut(" SHIFT + F1 ")).toBe("shift+f1");
expect(shortcuts.normalizeShortcut("Alt+Space")).toBe("alt+space");
});
it("should handle empty or null shortcuts", () => {
expect(shortcuts.normalizeShortcut("")).toBe("");
expect(shortcuts.normalizeShortcut(null as any)).toBe(null);
expect(shortcuts.normalizeShortcut(undefined as any)).toBe(undefined);
});
it("should handle shortcuts with multiple spaces", () => {
expect(shortcuts.normalizeShortcut("Ctrl + Shift + A")).toBe("ctrl+shift+a");
});
it("should warn about malformed shortcuts", () => {
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
shortcuts.normalizeShortcut("ctrl+");
shortcuts.normalizeShortcut("+a");
shortcuts.normalizeShortcut("ctrl++a");
expect(consoleSpy).toHaveBeenCalledTimes(3);
consoleSpy.mockRestore();
});
});
describe("keyMatches", () => {
const createKeyboardEvent = (key: string, code?: string) => ({
key,
code: code || `Key${key.toUpperCase()}`
} as KeyboardEvent);
it("should match regular letter keys using key code", () => {
const event = createKeyboardEvent("a", "KeyA");
expect(keyMatches(event, "a")).toBe(true);
expect(keyMatches(event, "A")).toBe(true);
});
it("should match number keys using digit codes", () => {
const event = createKeyboardEvent("1", "Digit1");
expect(keyMatches(event, "1")).toBe(true);
});
it("should match special keys using key mapping", () => {
expect(keyMatches({ key: "Enter" } as KeyboardEvent, "return")).toBe(true);
expect(keyMatches({ key: "Enter" } as KeyboardEvent, "enter")).toBe(true);
expect(keyMatches({ key: "Delete" } as KeyboardEvent, "del")).toBe(true);
expect(keyMatches({ key: "Escape" } as KeyboardEvent, "esc")).toBe(true);
expect(keyMatches({ key: " " } as KeyboardEvent, "space")).toBe(true);
expect(keyMatches({ key: "ArrowUp" } as KeyboardEvent, "up")).toBe(true);
});
it("should match function keys", () => {
expect(keyMatches({ key: "F1" } as KeyboardEvent, "f1")).toBe(true);
expect(keyMatches({ key: "F12" } as KeyboardEvent, "f12")).toBe(true);
});
it("should handle undefined or null keys", () => {
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
expect(keyMatches({} as KeyboardEvent, null as any)).toBe(false);
expect(keyMatches({} as KeyboardEvent, undefined as any)).toBe(false);
expect(consoleSpy).toHaveBeenCalled();
consoleSpy.mockRestore();
});
});
describe("matchesShortcut", () => {
const createKeyboardEvent = (options: {
key: string;
code?: string;
ctrlKey?: boolean;
altKey?: boolean;
shiftKey?: boolean;
metaKey?: boolean;
}) => ({
key: options.key,
code: options.code || `Key${options.key.toUpperCase()}`,
ctrlKey: options.ctrlKey || false,
altKey: options.altKey || false,
shiftKey: options.shiftKey || false,
metaKey: options.metaKey || false
} as KeyboardEvent);
it("should match simple key shortcuts", () => {
const event = createKeyboardEvent({ key: "a", code: "KeyA" });
expect(matchesShortcut(event, "a")).toBe(true);
});
it("should match shortcuts with modifiers", () => {
const event = createKeyboardEvent({ key: "a", code: "KeyA", ctrlKey: true });
expect(matchesShortcut(event, "ctrl+a")).toBe(true);
const shiftEvent = createKeyboardEvent({ key: "a", code: "KeyA", shiftKey: true });
expect(matchesShortcut(shiftEvent, "shift+a")).toBe(true);
});
it("should match complex modifier combinations", () => {
const event = createKeyboardEvent({
key: "a",
code: "KeyA",
ctrlKey: true,
shiftKey: true
});
expect(matchesShortcut(event, "ctrl+shift+a")).toBe(true);
});
it("should not match when modifiers don't match", () => {
const event = createKeyboardEvent({ key: "a", code: "KeyA", ctrlKey: true });
expect(matchesShortcut(event, "alt+a")).toBe(false);
expect(matchesShortcut(event, "a")).toBe(false);
});
it("should handle alternative modifier names", () => {
const ctrlEvent = createKeyboardEvent({ key: "a", code: "KeyA", ctrlKey: true });
expect(matchesShortcut(ctrlEvent, "control+a")).toBe(true);
const metaEvent = createKeyboardEvent({ key: "a", code: "KeyA", metaKey: true });
expect(matchesShortcut(metaEvent, "cmd+a")).toBe(true);
expect(matchesShortcut(metaEvent, "command+a")).toBe(true);
});
it("should handle empty or invalid shortcuts", () => {
const event = createKeyboardEvent({ key: "a", code: "KeyA" });
expect(matchesShortcut(event, "")).toBe(false);
expect(matchesShortcut(event, null as any)).toBe(false);
});
it("should handle invalid events", () => {
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
expect(matchesShortcut(null as any, "a")).toBe(false);
expect(matchesShortcut({} as KeyboardEvent, "a")).toBe(false);
expect(consoleSpy).toHaveBeenCalled();
consoleSpy.mockRestore();
});
it("should warn about invalid shortcut formats", () => {
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
const event = createKeyboardEvent({ key: "a", code: "KeyA" });
matchesShortcut(event, "ctrl+");
matchesShortcut(event, "+");
expect(consoleSpy).toHaveBeenCalled();
consoleSpy.mockRestore();
});
});
describe("bindGlobalShortcut", () => {
it("should bind a global shortcut", () => {
const handler = vi.fn();
shortcuts.bindGlobalShortcut("ctrl+a", handler, "test-namespace");
expect(mockElement.addEventListener).toHaveBeenCalledWith("keydown", expect.any(Function));
});
it("should not bind shortcuts when handler is null", () => {
shortcuts.bindGlobalShortcut("ctrl+a", null, "test-namespace");
expect(mockElement.addEventListener).not.toHaveBeenCalled();
});
it("should remove previous bindings when namespace is reused", () => {
const handler1 = vi.fn();
const handler2 = vi.fn();
shortcuts.bindGlobalShortcut("ctrl+a", handler1, "test-namespace");
expect(mockElement.addEventListener).toHaveBeenCalledTimes(1);
shortcuts.bindGlobalShortcut("ctrl+b", handler2, "test-namespace");
expect(mockElement.removeEventListener).toHaveBeenCalledTimes(1);
expect(mockElement.addEventListener).toHaveBeenCalledTimes(2);
});
});
describe("bindElShortcut", () => {
it("should bind shortcut to specific element", () => {
const mockEl = { addEventListener: vi.fn(), removeEventListener: vi.fn() };
const mockJQueryEl = [mockEl] as any;
mockJQueryEl.length = 1;
const handler = vi.fn();
shortcuts.bindElShortcut(mockJQueryEl, "ctrl+a", handler, "test-namespace");
expect(mockEl.addEventListener).toHaveBeenCalledWith("keydown", expect.any(Function));
});
it("should fall back to document when element is empty", () => {
const emptyJQuery = [] as any;
emptyJQuery.length = 0;
const handler = vi.fn();
shortcuts.bindElShortcut(emptyJQuery, "ctrl+a", handler, "test-namespace");
expect(mockElement.addEventListener).toHaveBeenCalledWith("keydown", expect.any(Function));
});
});
describe("removeGlobalShortcut", () => {
it("should remove shortcuts for a specific namespace", () => {
const handler = vi.fn();
shortcuts.bindGlobalShortcut("ctrl+a", handler, "test-namespace");
shortcuts.removeGlobalShortcut("test-namespace");
expect(mockElement.removeEventListener).toHaveBeenCalledWith("keydown", expect.any(Function));
});
});
describe("event handling", () => {
it.skip("should call handler when shortcut matches", () => {
const handler = vi.fn();
shortcuts.bindGlobalShortcut("ctrl+a", handler, "test-namespace");
// Get the listener that was registered
expect(mockElement.addEventListener.mock.calls).toHaveLength(1);
const [, listener] = mockElement.addEventListener.mock.calls[0];
// First verify that matchesShortcut works directly
const testEvent = {
type: "keydown",
key: "a",
code: "KeyA",
ctrlKey: true,
altKey: false,
shiftKey: false,
metaKey: false,
preventDefault: vi.fn(),
stopPropagation: vi.fn()
} as any;
// Test matchesShortcut directly first
expect(matchesShortcut(testEvent, "ctrl+a")).toBe(true);
// Now test the actual listener
listener(testEvent);
expect(handler).toHaveBeenCalled();
expect(testEvent.preventDefault).toHaveBeenCalled();
expect(testEvent.stopPropagation).toHaveBeenCalled();
});
it("should not call handler for non-keyboard events", () => {
const handler = vi.fn();
shortcuts.bindGlobalShortcut("ctrl+a", handler, "test-namespace");
const [, listener] = mockElement.addEventListener.mock.calls[0];
// Simulate a non-keyboard event
const event = {
type: "click"
} as any;
listener(event);
expect(handler).not.toHaveBeenCalled();
});
it("should not call handler when shortcut doesn't match", () => {
const handler = vi.fn();
shortcuts.bindGlobalShortcut("ctrl+a", handler, "test-namespace");
const [, listener] = mockElement.addEventListener.mock.calls[0];
// Simulate a non-matching keydown event
const event = {
type: "keydown",
key: "b",
code: "KeyB",
ctrlKey: true,
altKey: false,
shiftKey: false,
metaKey: false,
preventDefault: vi.fn(),
stopPropagation: vi.fn()
} as any;
listener(event);
expect(handler).not.toHaveBeenCalled();
expect(event.preventDefault).not.toHaveBeenCalled();
});
});
});

View File

@@ -1,7 +1,18 @@
import utils from "./utils.js";
type ElementType = HTMLElement | Document;
type Handler = (e: JQuery.TriggeredEvent<ElementType | Element, string, ElementType | Element, ElementType | Element>) => void;
type Handler = (e: KeyboardEvent) => void;
interface ShortcutBinding {
element: HTMLElement | Document;
shortcut: string;
handler: Handler;
namespace: string | null;
listener: (evt: Event) => void;
}
// Store all active shortcut bindings for management
const activeBindings: Map<string, ShortcutBinding[]> = new Map();
function removeGlobalShortcut(namespace: string) {
bindGlobalShortcut("", null, namespace);
@@ -15,38 +26,167 @@ function bindElShortcut($el: JQuery<ElementType | Element>, keyboardShortcut: st
if (utils.isDesktop()) {
keyboardShortcut = normalizeShortcut(keyboardShortcut);
let eventName = "keydown";
// If namespace is provided, remove all previous bindings for this namespace
if (namespace) {
eventName += `.${namespace}`;
// if there's a namespace, then we replace the existing event handler with the new one
$el.off(eventName);
removeNamespaceBindings(namespace);
}
// method can be called to remove the shortcut (e.g. when keyboardShortcut label is deleted)
if (keyboardShortcut) {
$el.bind(eventName, keyboardShortcut, (e) => {
if (handler) {
handler(e);
// Method can be called to remove the shortcut (e.g. when keyboardShortcut label is deleted)
if (keyboardShortcut && handler) {
const element = $el.length > 0 ? $el[0] as (HTMLElement | Document) : document;
const listener = (evt: Event) => {
// Only handle keyboard events
if (evt.type !== 'keydown' || !(evt instanceof KeyboardEvent)) {
return;
}
e.preventDefault();
e.stopPropagation();
});
const e = evt as KeyboardEvent;
if (matchesShortcut(e, keyboardShortcut)) {
e.preventDefault();
e.stopPropagation();
handler(e);
}
};
// Add the event listener
element.addEventListener('keydown', listener);
// Store the binding for later cleanup
const binding: ShortcutBinding = {
element,
shortcut: keyboardShortcut,
handler,
namespace,
listener
};
const key = namespace || 'global';
if (!activeBindings.has(key)) {
activeBindings.set(key, []);
}
activeBindings.get(key)!.push(binding);
}
}
}
function removeNamespaceBindings(namespace: string) {
const bindings = activeBindings.get(namespace);
if (bindings) {
// Remove all event listeners for this namespace
bindings.forEach(binding => {
binding.element.removeEventListener('keydown', binding.listener);
});
activeBindings.delete(namespace);
}
}
export function matchesShortcut(e: KeyboardEvent, shortcut: string): boolean {
if (!shortcut) return false;
// Ensure we have a proper KeyboardEvent with key property
if (!e || typeof e.key !== 'string') {
console.warn('matchesShortcut called with invalid event:', e);
return false;
}
const parts = shortcut.toLowerCase().split('+');
const key = parts[parts.length - 1]; // Last part is the actual key
const modifiers = parts.slice(0, -1); // Everything before is modifiers
// Defensive check - ensure we have a valid key
if (!key || key.trim() === '') {
console.warn('Invalid shortcut format:', shortcut);
return false;
}
// Check if the main key matches
if (!keyMatches(e, key)) {
return false;
}
// Check modifiers
const expectedCtrl = modifiers.includes('ctrl') || modifiers.includes('control');
const expectedAlt = modifiers.includes('alt');
const expectedShift = modifiers.includes('shift');
const expectedMeta = modifiers.includes('meta') || modifiers.includes('cmd') || modifiers.includes('command');
return e.ctrlKey === expectedCtrl &&
e.altKey === expectedAlt &&
e.shiftKey === expectedShift &&
e.metaKey === expectedMeta;
}
export function keyMatches(e: KeyboardEvent, key: string): boolean {
// Defensive check for undefined/null key
if (!key) {
console.warn('keyMatches called with undefined/null key');
return false;
}
// Handle special key mappings and aliases
const keyMap: { [key: string]: string[] } = {
'return': ['Enter'],
'enter': ['Enter'], // alias for return
'del': ['Delete'],
'delete': ['Delete'], // alias for del
'esc': ['Escape'],
'escape': ['Escape'], // alias for esc
'space': [' ', 'Space'],
'tab': ['Tab'],
'backspace': ['Backspace'],
'home': ['Home'],
'end': ['End'],
'pageup': ['PageUp'],
'pagedown': ['PageDown'],
'up': ['ArrowUp'],
'down': ['ArrowDown'],
'left': ['ArrowLeft'],
'right': ['ArrowRight']
};
// Function keys
for (let i = 1; i <= 19; i++) {
keyMap[`f${i}`] = [`F${i}`];
}
const mappedKeys = keyMap[key.toLowerCase()];
if (mappedKeys) {
return mappedKeys.includes(e.key) || mappedKeys.includes(e.code);
}
// For number keys, use the physical key code regardless of modifiers
// This works across all keyboard layouts
if (key >= '0' && key <= '9') {
return e.code === `Digit${key}`;
}
// For letter keys, use the physical key code for consistency
if (key.length === 1 && key >= 'a' && key <= 'z') {
return e.code === `Key${key.toUpperCase()}`;
}
// For regular keys, check both key and code as fallback
return e.key.toLowerCase() === key.toLowerCase() ||
e.code.toLowerCase() === key.toLowerCase();
}
/**
* Normalize to the form expected by the jquery.hotkeys.js
* Simple normalization - just lowercase and trim whitespace
*/
function normalizeShortcut(shortcut: string): string {
if (!shortcut) {
return shortcut;
}
return shortcut.toLowerCase().replace("enter", "return").replace("delete", "del").replace("ctrl+alt", "alt+ctrl").replace("meta+alt", "alt+meta"); // alt needs to be first;
const normalized = shortcut.toLowerCase().trim().replace(/\s+/g, '');
// Warn about potentially problematic shortcuts
if (normalized.endsWith('+') || normalized.startsWith('+') || normalized.includes('++')) {
console.warn('Potentially malformed shortcut:', shortcut, '-> normalized to:', normalized);
}
return normalized;
}
export default {

View File

@@ -51,6 +51,14 @@ export default class SpacedUpdate {
this.lastUpdated = Date.now();
}
/**
* Sets the update interval for the spaced update.
* @param interval The update interval in milliseconds.
*/
setUpdateInterval(interval: number) {
this.updateInterval = interval;
}
triggerUpdate() {
if (!this.changed) {
return;

View File

@@ -36,7 +36,9 @@ export function applyCopyToClipboardButton($codeBlock: JQuery<HTMLElement>) {
const $copyButton = $("<button>")
.addClass("bx component icon-action tn-tool-button bx-copy copy-button")
.attr("title", t("code_block.copy_title"))
.on("click", () => {
.on("click", (e) => {
e.stopPropagation();
if (!isShare) {
copyTextWithToast($codeBlock.text());
} else {

View File

@@ -1,5 +1,4 @@
import "jquery";
import "jquery-hotkeys";
import utils from "./services/utils.js";
import ko from "knockout";
import "./stylesheets/bootstrap.scss";

View File

@@ -29,6 +29,14 @@ async function formatCodeBlocks() {
await formatCodeBlocks($("#content"));
}
async function setupTextNote() {
formatCodeBlocks();
applyMath();
const setupMermaid = (await import("./share/mermaid.js")).default;
setupMermaid();
}
/**
* Fetch note with given ID from backend
*
@@ -47,8 +55,11 @@ async function fetchNote(noteId: string | null = null) {
document.addEventListener(
"DOMContentLoaded",
() => {
formatCodeBlocks();
applyMath();
const noteType = determineNoteType();
if (noteType === "text") {
setupTextNote();
}
const toggleMenuButton = document.getElementById("toggleMenuButton");
const layout = document.getElementById("layout");
@@ -60,6 +71,12 @@ document.addEventListener(
false
);
function determineNoteType() {
const bodyClass = document.body.className;
const match = bodyClass.match(/type-([^\s]+)/);
return match ? match[1] : null;
}
// workaround to prevent webpack from removing "fetchNote" as dead code:
// add fetchNote as property to the window object
Object.defineProperty(window, "fetchNote", {

View File

@@ -0,0 +1,17 @@
import mermaid from "mermaid";
export default function setupMermaid() {
for (const codeBlock of document.querySelectorAll("#content pre code.language-mermaid")) {
const parentPre = codeBlock.parentElement;
if (!parentPre) {
continue;
}
const mermaidDiv = document.createElement("div");
mermaidDiv.classList.add("mermaid");
mermaidDiv.innerHTML = codeBlock.innerHTML;
parentPre.replaceWith(mermaidDiv);
}
mermaid.init();
}

View File

@@ -0,0 +1,284 @@
/**
* Gallery styles for PhotoSwipe integration
* Provides styling for gallery UI elements
*/
/* Gallery thumbnail strip */
.gallery-thumbnail-strip {
scrollbar-width: thin;
scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.gallery-thumbnail-strip::-webkit-scrollbar {
height: 6px;
}
.gallery-thumbnail-strip::-webkit-scrollbar-track {
background: transparent;
}
.gallery-thumbnail-strip::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 3px;
}
.gallery-thumbnail-strip::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
.gallery-thumbnail {
position: relative;
overflow: hidden;
}
.gallery-thumbnail.active::after {
content: '';
position: absolute;
inset: 0;
background: rgba(255, 255, 255, 0.1);
pointer-events: none;
}
/* Gallery controls animations */
.gallery-slideshow-controls button {
transition: transform 0.2s, background 0.2s;
}
.gallery-slideshow-controls button:hover {
transform: scale(1.1);
background: rgba(255, 255, 255, 1) !important;
}
.gallery-slideshow-controls button:active {
transform: scale(0.95);
}
/* Slideshow progress indicator */
.slideshow-progress {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 3px;
background: rgba(255, 255, 255, 0.2);
z-index: 101;
}
.slideshow-progress-bar {
height: 100%;
background: rgba(255, 255, 255, 0.8);
width: 0;
transition: width linear;
}
.slideshow-progress.active .slideshow-progress-bar {
animation: slideshow-progress var(--slideshow-interval) linear;
}
@keyframes slideshow-progress {
from { width: 0; }
to { width: 100%; }
}
/* Gallery counter styling */
.gallery-counter {
font-family: var(--font-family-monospace);
letter-spacing: 0.05em;
user-select: none;
}
.gallery-counter .current-index {
font-weight: bold;
color: #fff;
}
.gallery-counter .total-count {
opacity: 0.8;
}
/* Enhanced image hover effects */
.pswp__img {
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pswp__img.pswp__img--zoomed {
cursor: move;
}
/* Gallery navigation arrows */
.pswp__button--arrow--left,
.pswp__button--arrow--right {
background: rgba(0, 0, 0, 0.5) !important;
backdrop-filter: blur(10px);
border-radius: 50%;
width: 50px;
height: 50px;
margin: 20px;
}
.pswp__button--arrow--left:hover,
.pswp__button--arrow--right:hover {
background: rgba(0, 0, 0, 0.7) !important;
}
/* Touch-friendly tap areas */
@media (pointer: coarse) {
.gallery-thumbnail {
min-width: 60px;
min-height: 60px;
}
.gallery-slideshow-controls button {
min-width: 50px;
min-height: 50px;
}
}
/* Smooth transitions */
.pswp--animate_opacity {
transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.pswp__bg {
transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* Loading state */
.pswp__preloader {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.pswp__preloader__icn {
width: 30px;
height: 30px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-top-color: #fff;
border-radius: 50%;
animation: gallery-spin 1s linear infinite;
}
@keyframes gallery-spin {
to { transform: rotate(360deg); }
}
/* Error state */
.pswp__error-msg {
background: rgba(0, 0, 0, 0.8);
color: #ff6b6b;
padding: 20px;
border-radius: 8px;
max-width: 400px;
text-align: center;
}
/* Accessibility improvements */
.pswp__button:focus-visible {
outline: 2px solid #4a9eff;
outline-offset: 2px;
}
.gallery-thumbnail:focus-visible {
outline: 2px solid #4a9eff;
outline-offset: -2px;
}
/* Dark theme adjustments */
body.theme-dark .gallery-thumbnail-strip {
background: rgba(0, 0, 0, 0.8);
}
body.theme-dark .gallery-slideshow-controls button {
background: rgba(255, 255, 255, 0.8);
color: #000;
}
body.theme-dark .gallery-slideshow-controls button:hover {
background: rgba(255, 255, 255, 0.95);
}
/* Light theme adjustments */
body.theme-light .pswp__bg {
background: rgba(255, 255, 255, 0.95);
}
body.theme-light .gallery-counter,
body.theme-light .gallery-keyboard-hints {
background: rgba(0, 0, 0, 0.8);
color: white;
}
/* Mobile-specific styles */
@media (max-width: 768px) {
.gallery-thumbnail-strip {
bottom: 40px;
padding: 6px;
gap: 4px;
}
.gallery-thumbnail {
width: 50px !important;
height: 50px !important;
}
.gallery-slideshow-controls {
top: 10px;
right: 10px;
}
.gallery-counter {
font-size: 12px;
padding: 6px 10px;
}
.pswp__button--arrow--left,
.pswp__button--arrow--right {
width: 40px;
height: 40px;
margin: 10px;
}
}
/* Tablet-specific styles */
@media (min-width: 769px) and (max-width: 1024px) {
.gallery-thumbnail-strip {
max-width: 80%;
}
.gallery-thumbnail {
width: 70px !important;
height: 70px !important;
}
}
/* High-DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.gallery-thumbnail img {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
}
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
.gallery-thumbnail,
.gallery-slideshow-controls button,
.pswp__img,
.pswp--animate_opacity,
.pswp__bg {
transition: none !important;
animation: none !important;
}
}
/* Print styles */
@media print {
.gallery-thumbnail-strip,
.gallery-slideshow-controls,
.gallery-counter,
.gallery-keyboard-hints {
display: none !important;
}
}

View File

@@ -0,0 +1,528 @@
/**
* PhotoSwipe Mobile & Accessibility Styles
* Phase 6: Complete mobile optimization and WCAG 2.1 AA compliance
*/
/* ==========================================================================
Touch Target Optimization (WCAG 2.1 Success Criterion 2.5.5)
========================================================================== */
/* Ensure all interactive elements meet minimum 44x44px touch target */
.pswp__button,
.pswp__button--arrow--left,
.pswp__button--arrow--right,
.pswp__button--close,
.pswp__button--zoom,
.pswp__button--fs,
.gallery-thumbnail,
.photoswipe-bottom-sheet button {
min-width: 44px !important;
min-height: 44px !important;
display: flex;
align-items: center;
justify-content: center;
}
/* Increase touch target padding on mobile */
@media (pointer: coarse) {
.pswp__button {
padding: 12px;
}
/* Larger hit areas for navigation arrows */
.pswp__button--arrow--left,
.pswp__button--arrow--right {
width: 60px !important;
height: 100px !important;
}
}
/* ==========================================================================
Focus Indicators (WCAG 2.1 Success Criterion 2.4.7)
========================================================================== */
/* High visibility focus indicators */
.pswp__button:focus,
.pswp__button:focus-visible,
.gallery-thumbnail:focus,
.photoswipe-bottom-sheet button:focus,
.photoswipe-focused {
outline: 3px solid #4A90E2 !important;
outline-offset: 2px !important;
box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}
/* Remove default browser outline */
.pswp__button:focus:not(:focus-visible) {
outline: none;
}
/* Focus indicator for images */
.pswp__img:focus {
outline: 3px solid #4A90E2;
outline-offset: -3px;
}
/* Skip link styles */
.photoswipe-skip-link {
position: absolute;
left: -10000px;
top: 0;
background: #000;
color: #fff;
padding: 8px 16px;
text-decoration: none;
z-index: 100000;
border-radius: 4px;
}
.photoswipe-skip-link:focus {
left: 10px !important;
top: 10px !important;
width: auto !important;
height: auto !important;
}
/* ==========================================================================
Mobile UI Adaptations
========================================================================== */
/* Mobile-optimized toolbar */
@media (max-width: 768px) {
.pswp__top-bar {
height: 60px;
background: rgba(0, 0, 0, 0.8);
}
.pswp__button {
width: 50px;
height: 50px;
}
/* Reposition counter for mobile */
.pswp__counter {
top: auto;
bottom: 70px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.7);
padding: 8px 16px;
border-radius: 20px;
font-size: 14px;
}
}
/* Bottom sheet for mobile controls */
.photoswipe-bottom-sheet {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.95);
padding: env(safe-area-inset-bottom, 20px) 20px;
display: flex;
justify-content: space-around;
align-items: center;
z-index: 100;
transform: translateY(100%);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.photoswipe-bottom-sheet.active {
transform: translateY(0);
}
.photoswipe-bottom-sheet button {
background: none;
border: 2px solid transparent;
color: white;
font-size: 24px;
padding: 10px;
border-radius: 50%;
transition: all 0.2s;
}
.photoswipe-bottom-sheet button:active {
background: rgba(255, 255, 255, 0.1);
transform: scale(0.95);
}
/* Swipe indicators */
.photoswipe-swipe-indicators {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
pointer-events: none;
animation: fadeInOut 3s ease-in-out;
}
@keyframes fadeInOut {
0%, 100% { opacity: 0; }
20%, 80% { opacity: 0.7; }
}
/* Gesture hints */
.photoswipe-gesture-hints {
position: absolute;
top: 60px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.85);
color: white;
padding: 12px 24px;
border-radius: 24px;
font-size: 14px;
font-weight: 500;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
pointer-events: none;
}
/* Context menu for long press */
.photoswipe-context-menu {
background: var(--theme-background-color, white);
border: 1px solid var(--theme-border-color, #ccc);
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
overflow: hidden;
min-width: 200px;
}
.photoswipe-context-menu button {
display: block;
width: 100%;
padding: 12px 16px;
border: none;
background: none;
text-align: left;
cursor: pointer;
font-size: 16px;
transition: background 0.2s;
}
.photoswipe-context-menu button:hover,
.photoswipe-context-menu button:focus {
background: var(--theme-hover-background, rgba(0, 0, 0, 0.05));
}
/* ==========================================================================
Responsive Breakpoints
========================================================================== */
/* Small phones (< 375px) */
@media (max-width: 374px) {
.pswp__button {
width: 40px;
height: 40px;
}
.gallery-thumbnail-strip {
padding: 5px !important;
}
.gallery-thumbnail {
width: 60px !important;
height: 60px !important;
}
}
/* Tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
.pswp__button {
width: 48px;
height: 48px;
}
.gallery-thumbnail {
width: 90px !important;
height: 90px !important;
}
}
/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
.pswp__top-bar {
height: 44px;
}
.pswp__button {
width: 44px;
height: 44px;
}
.gallery-thumbnail-strip {
bottom: 40px !important;
max-height: 60px;
}
.gallery-thumbnail {
width: 50px !important;
height: 50px !important;
}
}
/* ==========================================================================
Accessibility Enhancements
========================================================================== */
/* Screen reader only content */
.photoswipe-sr-only,
.photoswipe-live-region,
.photoswipe-aria-live {
position: absolute !important;
left: -10000px !important;
width: 1px !important;
height: 1px !important;
overflow: hidden !important;
}
/* Keyboard help dialog */
.photoswipe-keyboard-help {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--theme-background-color, white);
color: var(--theme-text-color, black);
padding: 30px;
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
z-index: 10001;
max-width: 500px;
max-height: 80vh;
overflow-y: auto;
}
.photoswipe-keyboard-help h2 {
margin: 0 0 20px 0;
font-size: 20px;
font-weight: 600;
}
.photoswipe-keyboard-help dl {
margin: 0;
padding: 0;
}
.photoswipe-keyboard-help dt {
float: left;
clear: left;
width: 120px;
margin-bottom: 10px;
}
.photoswipe-keyboard-help dd {
margin-left: 140px;
margin-bottom: 10px;
}
.photoswipe-keyboard-help kbd {
display: inline-block;
padding: 3px 8px;
background: var(--theme-kbd-background, #f0f0f0);
border: 1px solid var(--theme-border-color, #ccc);
border-radius: 4px;
font-family: monospace;
font-size: 14px;
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}
.photoswipe-keyboard-help .close-help {
margin-top: 20px;
padding: 10px 20px;
background: var(--theme-primary-color, #4A90E2);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
transition: background 0.2s;
}
.photoswipe-keyboard-help .close-help:hover,
.photoswipe-keyboard-help .close-help:focus {
background: var(--theme-primary-hover, #357ABD);
}
/* ==========================================================================
High Contrast Mode Support
========================================================================== */
@media (prefers-contrast: high) {
.pswp__bg {
background: #000 !important;
}
.pswp__button {
background: #000 !important;
border: 2px solid #fff !important;
}
.pswp__button svg {
fill: #fff !important;
}
.pswp__counter {
background: #000 !important;
color: #fff !important;
border: 2px solid #fff !important;
}
.gallery-thumbnail {
border-width: 3px !important;
}
.photoswipe-keyboard-help {
background: #000 !important;
color: #fff !important;
border: 2px solid #fff !important;
}
.photoswipe-keyboard-help kbd {
background: #fff !important;
color: #000 !important;
border-color: #fff !important;
}
}
/* Windows High Contrast Mode */
@media (-ms-high-contrast: active) {
.pswp__button {
border: 2px solid WindowText !important;
}
.pswp__counter {
border: 2px solid WindowText !important;
}
}
/* ==========================================================================
Reduced Motion Support (WCAG 2.1 Success Criterion 2.3.3)
========================================================================== */
@media (prefers-reduced-motion: reduce) {
/* Disable all animations */
.pswp *,
.pswp *::before,
.pswp *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
/* Remove slide transitions */
.pswp__container {
transition: none !important;
}
/* Remove zoom animations */
.pswp__img {
transition: none !important;
}
/* Instant show/hide for indicators */
.photoswipe-swipe-indicators,
.photoswipe-gesture-hints {
animation: none !important;
transition: none !important;
}
}
/* ==========================================================================
Performance Optimizations
========================================================================== */
/* GPU acceleration for smooth animations */
.pswp__container,
.pswp__img,
.pswp__zoom-wrap {
will-change: transform;
transform: translateZ(0);
}
/* Optimize rendering for low-end devices */
@media (max-width: 768px) and (max-resolution: 2dppx) {
.pswp__img {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
}
/* Reduce visual complexity on low-end devices */
.low-performance-mode .pswp__button {
box-shadow: none !important;
}
.low-performance-mode .gallery-thumbnail {
box-shadow: none !important;
transition: none !important;
}
/* ==========================================================================
Battery Optimization Mode
========================================================================== */
.battery-saver-mode .pswp__img {
filter: brightness(0.9);
}
.battery-saver-mode .pswp__button {
opacity: 0.8;
}
.battery-saver-mode .gallery-thumbnail-strip {
display: none;
}
/* ==========================================================================
Print Styles
========================================================================== */
@media print {
.pswp {
display: none !important;
}
}
/* ==========================================================================
Custom Scrollbar for Mobile
========================================================================== */
.gallery-thumbnail-strip::-webkit-scrollbar {
height: 4px;
}
.gallery-thumbnail-strip::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.1);
border-radius: 2px;
}
.gallery-thumbnail-strip::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 2px;
}
.gallery-thumbnail-strip::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
/* ==========================================================================
Safe Area Insets (for devices with notches)
========================================================================== */
.pswp__top-bar {
padding-top: env(safe-area-inset-top);
}
.photoswipe-bottom-sheet {
padding-bottom: env(safe-area-inset-bottom);
}
.pswp__button--arrow--left {
left: env(safe-area-inset-left, 10px);
}
.pswp__button--arrow--right {
right: env(safe-area-inset-right, 10px);
}

View File

@@ -81,8 +81,8 @@ body {
/* -- Overrides the default colors used by the ckeditor5-image package. --------------------- */
--ck-color-image-caption-background: var(--main-background-color);
--ck-color-image-caption-text: var(--main-text-color);
--ck-content-color-image-caption-background: var(--main-background-color);
--ck-content-color-image-caption-text: var(--main-text-color);
/* -- Overrides the default colors used by the ckeditor5-widget package. -------------------- */

View File

@@ -0,0 +1,253 @@
/**
* Media Viewer Styles for Trilium Notes
* Customizes PhotoSwipe appearance to match Trilium's theme
*/
/* Base PhotoSwipe container customization */
.pswp {
--pswp-bg: rgba(0, 0, 0, 0.95);
--pswp-placeholder-bg: rgba(30, 30, 30, 0.9);
--pswp-icon-color: #fff;
--pswp-icon-color-secondary: rgba(255, 255, 255, 0.75);
--pswp-icon-stroke-color: #fff;
--pswp-icon-stroke-width: 1px;
--pswp-error-text-color: #f44336;
}
/* Dark theme adjustments */
body.theme-dark .pswp,
body.theme-next-dark .pswp {
--pswp-bg: rgba(0, 0, 0, 0.95);
--pswp-placeholder-bg: rgba(30, 30, 30, 0.9);
}
/* Light theme adjustments */
body.theme-light .pswp,
body.theme-next-light .pswp {
--pswp-bg: rgba(0, 0, 0, 0.9);
--pswp-placeholder-bg: rgba(50, 50, 50, 0.8);
}
/* Toolbar and controls styling */
.pswp__top-bar {
background-color: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(10px);
}
.pswp__button {
transition: opacity 0.2s ease-in-out;
}
.pswp__button:hover {
opacity: 1;
}
/* Counter styling */
.pswp__counter {
font-family: var(--main-font-family);
font-size: 14px;
color: rgba(255, 255, 255, 0.9);
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
/* Caption styling */
.pswp__caption {
background-color: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(10px);
}
.pswp__caption__center {
text-align: center;
font-family: var(--main-font-family);
font-size: 14px;
color: rgba(255, 255, 255, 0.9);
padding: 10px 20px;
}
/* Image styling */
.pswp__img {
cursor: zoom-in;
}
.pswp__img--placeholder {
background-color: var(--pswp-placeholder-bg);
}
.pswp--zoomed-in .pswp__img {
cursor: grab;
}
.pswp--dragging .pswp__img {
cursor: grabbing;
}
/* Loading indicator */
.pswp__preloader {
width: 44px;
height: 44px;
}
.pswp__preloader__icn {
width: 20px;
height: 20px;
}
/* Error message styling */
.pswp__error-msg {
font-family: var(--main-font-family);
font-size: 14px;
color: var(--pswp-error-text-color);
text-align: center;
padding: 20px;
}
/* Thumbnails strip (for future implementation) */
.pswp__thumbnails {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 80px;
background-color: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(10px);
display: flex;
align-items: center;
padding: 10px;
gap: 10px;
overflow-x: auto;
z-index: 1;
}
.pswp__thumbnail {
width: 60px;
height: 60px;
cursor: pointer;
opacity: 0.6;
transition: opacity 0.2s;
object-fit: cover;
border: 2px solid transparent;
}
.pswp__thumbnail:hover {
opacity: 0.9;
}
.pswp__thumbnail--active {
opacity: 1;
border-color: var(--main-border-color);
}
/* Animations */
.pswp--open {
animation: pswpFadeIn 0.25s ease-out;
}
.pswp--closing {
animation: pswpFadeOut 0.25s ease-out;
}
@keyframes pswpFadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes pswpFadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
/* Zoom animation */
.pswp__zoom-wrap {
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Mobile-specific adjustments */
@media (max-width: 768px) {
.pswp__caption__center {
font-size: 12px;
padding: 8px 16px;
}
.pswp__counter {
font-size: 12px;
}
.pswp__thumbnails {
height: 60px;
}
.pswp__thumbnail {
width: 45px;
height: 45px;
}
}
/* Integration with Trilium's note context */
.media-viewer-trigger {
cursor: zoom-in;
transition: opacity 0.2s;
}
.media-viewer-trigger:hover {
opacity: 0.9;
}
/* Gallery mode indicators */
.media-viewer-gallery-indicator {
position: absolute;
top: 10px;
right: 10px;
background-color: rgba(0, 0, 0, 0.6);
color: white;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
font-family: var(--main-font-family);
pointer-events: none;
z-index: 1;
}
/* Fullscreen mode adjustments */
.pswp--fs {
background-color: black;
}
.pswp--fs .pswp__top-bar {
background-color: rgba(0, 0, 0, 0.7);
}
/* Accessibility improvements */
.pswp__button:focus {
outline: 2px solid var(--main-border-color);
outline-offset: 2px;
}
.pswp__img:focus {
outline: none;
}
/* Custom toolbar buttons */
.pswp__button--download {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'%3E%3C/path%3E%3Cpolyline points='7 10 12 15 17 10'%3E%3C/polyline%3E%3Cline x1='12' y1='15' x2='12' y2='3'%3E%3C/line%3E%3C/svg%3E");
background-size: 24px 24px;
}
.pswp__button--info {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E");
background-size: 24px 24px;
}
/* Print styles */
@media print {
.pswp {
display: none !important;
}
}

View File

@@ -139,12 +139,6 @@ textarea,
color: var(--muted-text-color);
}
/* Restore default apperance */
input[type="number"],
input[type="checkbox"] {
appearance: auto !important;
}
/* Add a gap between consecutive radios / check boxes */
label.tn-radio + label.tn-radio,
label.tn-checkbox + label.tn-checkbox {
@@ -327,7 +321,8 @@ button kbd {
}
}
.dropdown-menu {
.dropdown-menu,
.tabulator-popup-container {
color: var(--menu-text-color) !important;
font-size: inherit;
background-color: var(--menu-background-color) !important;
@@ -337,7 +332,13 @@ button kbd {
--bs-dropdown-link-active-bg: var(--active-item-background-color) !important;
}
body.desktop .dropdown-menu {
.dropdown-menu .dropdown-divider {
break-before: avoid;
break-after: avoid;
}
body.desktop .dropdown-menu,
body.desktop .tabulator-popup-container {
border: 1px solid var(--dropdown-border-color);
box-shadow: 0px 10px 20px rgba(0, 0, 0, var(--dropdown-shadow-opacity));
animation: dropdown-menu-opening 100ms ease-in;
@@ -380,7 +381,8 @@ body.desktop .dropdown-menu {
}
.dropdown-menu a:hover:not(.disabled),
.dropdown-item:hover:not(.disabled, .dropdown-item-container) {
.dropdown-item:hover:not(.disabled, .dropdown-item-container),
.tabulator-menu-item:hover {
color: var(--hover-item-text-color) !important;
background-color: var(--hover-item-background-color) !important;
border-color: var(--hover-item-border-color) !important;
@@ -535,6 +537,7 @@ button.btn-sm {
/* Making this narrower because https://github.com/zadam/trilium/issues/502 (problem only in smaller font sizes) */
min-width: 0;
padding: 0;
z-index: 1000;
}
pre:not(.hljs) {
@@ -639,6 +642,10 @@ table.promoted-attributes-in-tooltip th {
z-index: calc(var(--ck-z-panel) - 1) !important;
}
.tooltip.tooltip-top {
z-index: 32767 !important;
}
.tooltip-trigger {
background: transparent;
pointer-events: none;
@@ -766,6 +773,14 @@ table.promoted-attributes-in-tooltip th {
font-size: small;
}
.note-tooltip-content .open-popup-button {
position: absolute;
right: 15px;
bottom: 8px;
font-size: 1.2em;
color: inherit;
}
.note-tooltip-attributes {
display: -webkit-box;
-webkit-box-orient: vertical;
@@ -907,6 +922,13 @@ div[data-notify="container"] {
font-family: var(--monospace-font-family);
}
.ck-content {
--ck-content-font-family: var(--detail-font-family);
--ck-content-font-size: 1.1em;
--ck-content-font-color: var(--main-text-color);
--ck-content-line-height: var(--bs-body-line-height);
}
.ck-content .table table th {
background-color: var(--accented-background-color);
}
@@ -1193,12 +1215,14 @@ body.mobile .dropdown-submenu > .dropdown-menu {
}
#context-menu-container,
#context-menu-container .dropdown-menu {
padding: 3px 0 0;
#context-menu-container .dropdown-menu,
.tabulator-popup-container {
padding: 3px 0;
z-index: 2000;
}
#context-menu-container .dropdown-item {
#context-menu-container .dropdown-item,
.tabulator-menu .tabulator-menu-item {
padding: 0 7px 0 10px;
cursor: pointer;
user-select: none;
@@ -1760,6 +1784,54 @@ textarea {
padding: 1rem;
}
/* Command palette styling */
.jump-to-note-dialog .command-suggestion {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 0.9em;
}
.jump-to-note-dialog .aa-suggestion .command-suggestion,
.jump-to-note-dialog .aa-suggestion .command-suggestion div {
padding: 0;
}
.jump-to-note-dialog .aa-cursor .command-suggestion,
.jump-to-note-dialog .aa-suggestion:hover .command-suggestion {
border-left-color: var(--link-color);
background-color: var(--hover-background-color);
}
.jump-to-note-dialog .command-icon {
color: var(--muted-text-color);
font-size: 1.125rem;
flex-shrink: 0;
margin-top: 0.125rem;
}
.jump-to-note-dialog .command-content {
flex-grow: 1;
min-width: 0;
}
.jump-to-note-dialog .command-name {
font-weight: bold;
}
.jump-to-note-dialog .command-description {
font-size: 0.8em;
line-height: 1.3;
opacity: 0.75;
}
.jump-to-note-dialog kbd.command-shortcut {
background-color: transparent;
color: inherit;
opacity: 0.75;
font-family: inherit !important;
}
.empty-table-placeholder {
text-align: center;
color: var(--muted-text-color);
@@ -1818,6 +1890,7 @@ body.zen #launcher-container,
body.zen #launcher-pane,
body.zen #left-pane,
body.zen #right-pane,
body.zen #mobile-sidebar-wrapper,
body.zen .tab-row-container,
body.zen .tab-row-widget,
body.zen .ribbon-container:not(:has(.classic-toolbar-widget.visible)),
@@ -1825,7 +1898,8 @@ body.zen .ribbon-container:has(.classic-toolbar-widget.visible) .ribbon-top-row,
body.zen .ribbon-container .ribbon-body:not(:has(.classic-toolbar-widget.visible)),
body.zen .note-icon-widget,
body.zen .title-row .button-widget,
body.zen .floating-buttons-children > *:not(.bx-edit-alt) {
body.zen .floating-buttons-children > *:not(.bx-edit-alt),
body.zen .action-button {
display: none !important;
}
@@ -1867,14 +1941,20 @@ body.zen .note-title-widget input {
background: transparent !important;
}
body.zen #detail-container {
width: 100%;
}
/* Content renderer */
footer.file-footer {
footer.file-footer,
footer.webview-footer {
display: flex;
justify-content: center;
}
footer.file-footer button {
footer.file-footer button,
footer.webview-footer button {
margin: 5px;
}
@@ -2175,6 +2255,13 @@ footer.file-footer button {
padding: 1px 10px 1px 10px;
}
/* Search result highlighting */
.search-result-title b,
.search-result-content b {
font-weight: 900;
color: var(--admonition-warning-accent-color);
}
/* Customized icons */
.bx-tn-toc::before {

View File

@@ -0,0 +1,199 @@
.tabulator {
--table-background-color: var(--main-background-color);
--col-header-background-color: var(--main-background-color);
--col-header-hover-background-color: var(--accented-background-color);
--col-header-text-color: var(--main-text-color);
--col-header-arrow-active-color: var(--main-text-color);
--col-header-arrow-inactive-color: var(--more-accented-background-color);
--col-header-separator-border: none;
--col-header-bottom-border: 2px solid var(--main-border-color);
--row-background-color: var(--main-background-color);
--row-alternate-background-color: var(--main-background-color);
--row-moving-background-color: var(--accented-background-color);
--row-text-color: var(--main-text-color);
--row-delimiter-color: var(--more-accented-background-color);
--cell-horiz-padding-size: 8px;
--cell-vert-padding-size: 8px;
--cell-editable-hover-outline-color: var(--main-border-color);
--cell-read-only-text-color: var(--muted-text-color);
--cell-editing-border-color: var(--main-border-color);
--cell-editing-border-width: 2px;
--cell-editing-background-color: var(--ck-color-selector-focused-cell-background);
--cell-editing-text-color: initial;
background: unset;
border: unset;
}
.tabulator .tabulator-tableholder .tabulator-table {
background: var(--table-background-color);
}
/* Column headers */
.tabulator div.tabulator-header {
border-bottom: var(--col-header-bottom-border);
background: var(--col-header-background-color);
color: var(--col-header-text-color);
}
.tabulator .tabulator-col-content {
padding: 8px 4px !important;
}
@media (hover: hover) and (pointer: fine) {
.tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover {
background-color: var(--col-header-hover-background-color);
}
}
.tabulator div.tabulator-header .tabulator-col.tabulator-moving {
border: none;
background: var(--col-header-hover-background-color);
}
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
border-bottom-color: var(--col-header-arrow-active-color);
border-top-color: var(--col-header-arrow-active-color);
}
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="none"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
border-bottom-color: var(--col-header-arrow-inactive-color);
}
.tabulator div.tabulator-header .tabulator-frozen.tabulator-frozen-left {
margin-left: var(--cell-editing-border-width);
}
.tabulator div.tabulator-header .tabulator-col,
.tabulator div.tabulator-header .tabulator-frozen.tabulator-frozen-left {
background: var(--col-header-background-color);
border-right: var(--col-header-separator-border);
}
/* Table body */
.tabulator-tableholder {
padding-top: 10px;
height: unset !important; /* Don't extend on the full height */
}
/* Rows */
.tabulator-row .tabulator-cell {
padding: var(--cell-vert-padding-size) var(--cell-horiz-padding-size);
}
.tabulator-row .tabulator-cell input {
padding-left: var(--cell-horiz-padding-size) !important;
padding-right: var(--cell-horiz-padding-size) !important;
}
.tabulator-row {
background: transparent;
border-top: none;
border-bottom: 1px solid var(--row-delimiter-color);
color: var(--row-text-color);
}
.tabulator-row.tabulator-row-odd {
background: var(--row-background-color);
}
.tabulator-row.tabulator-row-even {
background: var(--row-alternate-background-color);
}
.tabulator-row.tabulator-moving {
border-color: transparent;
background-color: var(--row-moving-background-color);
}
/* Cell */
.tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-left {
margin-right: var(--cell-editing-border-width);
}
.tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-left,
.tabulator-row .tabulator-cell {
border-right-color: transparent;
}
.tabulator-row .tabulator-cell:not(.tabulator-editable) {
color: var(--cell-read-only-text-color);
}
.tabulator:not(.tabulator-editing) .tabulator-row .tabulator-cell.tabulator-editable:hover {
outline: 2px solid var(--cell-editable-hover-outline-color);
outline-offset: -1px;
}
.tabulator-row .tabulator-cell.tabulator-editing {
border-color: transparent;
}
.tabulator-row:not(.tabulator-moving) .tabulator-cell.tabulator-editing {
outline: calc(var(--cell-editing-border-width) - 1px) solid var(--cell-editing-border-color);
border-color: var(--cell-editing-border-color);
background: var(--cell-editing-background-color);
}
.tabulator-row:not(.tabulator-moving) .tabulator-cell.tabulator-editing > * {
color: var(--cell-editing-text-color);
}
.tabulator .tree-collapse,
.tabulator .tree-expand {
color: var(--row-text-color);
}
/* Align items without children/expander to the ones with. */
.tabulator-cell[tabulator-field="title"] > span:first-child, /* 1st level */
.tabulator-cell[tabulator-field="title"] > div:first-child + span { /* sub-level */
padding-left: 21px;
}
/* Checkbox cells */
.tabulator .tabulator-cell:has(svg),
.tabulator .tabulator-cell:has(input[type="checkbox"]) {
padding-left: 8px;
display: inline-flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
}
.tabulator .tabulator-cell input[type="checkbox"] {
margin: 0;
}
.tabulator .tabulator-footer {
color: var(--main-text-color);
}
/* Context menus */
.tabulator-popup-container {
min-width: 10em;
border-radius: var(--bs-border-radius);
}
.tabulator-menu .tabulator-menu-item {
border: 1px solid transparent;
color: var(--menu-text-color);
font-size: 16px;
}
/* Footer */
:root .tabulator .tabulator-footer {
border-top: unset;
padding: 10px 0;
}

View File

@@ -4,6 +4,7 @@
@import url(./pages.css);
@import url(./ribbon.css);
@import url(./notes/text.css);
@import url(./notes/collections/table.css);
@font-face {
font-family: "Inter";
@@ -183,7 +184,7 @@ html body .dropdown-item[disabled] {
/* Menu item icon */
.dropdown-item .bx {
transform: translateY(var(--menu-item-icon-vert-offset));
translate: 0 var(--menu-item-icon-vert-offset);
color: var(--menu-item-icon-color) !important;
font-size: 1.1em;
}
@@ -457,6 +458,11 @@ body.mobile .dropdown-menu .dropdown-item.submenu-open .dropdown-toggle::after {
padding: 1rem;
}
.note-list-wrapper .note-book-card .note-book-content.type-image .rendered-content,
.note-list-wrapper .note-book-card .note-book-content.type-pdf .rendered-content {
padding: 0;
}
.note-list-wrapper .note-book-card .note-book-content .rendered-content.text-with-ellipsis {
padding: 1rem !important;
}

View File

@@ -128,10 +128,15 @@ div.tn-tool-dialog {
.jump-to-note-dialog .modal-header {
padding: unset !important;
padding-bottom: 26px !important;
}
.jump-to-note-dialog .modal-body {
padding: 26px 0 !important;
padding: 0 !important;
}
.jump-to-note-dialog .modal-footer {
padding-top: 26px;
}
/* Search box wrapper */
@@ -228,16 +233,16 @@ div.tn-tool-dialog {
/* Item title link */
.recent-changes-content ul li .note-title a {
.recent-changes-content ul li a {
color: currentColor;
}
.recent-changes-content ul li .note-title a:hover {
.recent-changes-content ul li a:hover {
text-decoration: underline;
}
/* Item title for deleted notes */
.recent-changes-content ul li.deleted-note .note-title > .note-title {
.recent-changes-content ul li.deleted-note .note-title {
text-decoration: line-through;
}

View File

@@ -0,0 +1,13 @@
:root .tabulator {
--col-header-hover-background-color: var(--hover-item-background-color);
--col-header-arrow-active-color: var(--active-item-text-color);
--col-header-arrow-inactive-color: var(--main-border-color);
--row-moving-background-color: var(--more-accented-background-color);
--cell-editable-hover-outline-color: var(--input-focus-outline-color);
--cell-editing-border-color: var(--input-focus-outline-color);
--cell-editing-background-color: var(--input-background-color);
--cell-editing-text-color: var(--input-text-color);
}

View File

@@ -1678,4 +1678,42 @@ div.find-replace-widget div.find-widget-found-wrapper > span {
#right-pane .highlights-list li:active {
background: transparent;
transition: none;
}
/** Canvas **/
.excalidraw {
--border-radius-lg: 6px;
}
.excalidraw .Island {
backdrop-filter: var(--dropdown-backdrop-filter);
}
.excalidraw .Island.App-toolbar {
--island-bg-color: var(--floating-button-background-color);
--shadow-island: 1px 1px 1px var(--floating-button-shadow-color);
}
.excalidraw .dropdown-menu {
border: unset !important;
box-shadow: unset !important;
background-color: transparent !important;
--island-bg-color: var(--menu-background-color);
--shadow-island: 0px 10px 20px rgba(0, 0, 0, var(--dropdown-shadow-opacity));
--default-border-color: var(--bs-dropdown-divider-bg);
--button-hover-bg: var(--hover-item-background-color);
}
.excalidraw .dropdown-menu .dropdown-menu-container {
border-radius: var(--dropdown-border-radius);
}
.excalidraw .dropdown-menu .dropdown-menu-container > div:not([class]):not(:last-child) {
margin-left: calc(var(--padding) * var(--space-factor) * -1) !important;
margin-right: calc(var(--padding) * var(--space-factor) * -1) !important;
}
.excalidraw .dropdown-menu:before {
content: unset !important;
}

View File

@@ -0,0 +1,185 @@
{
"about": {
"title": "Sobre Trilium Notes",
"homepage": "Pàgina principal:"
},
"add_link": {
"note": "Nota"
},
"branch_prefix": {
"prefix": "Prefix: ",
"save": "Desa"
},
"bulk_actions": {
"labels": "Etiquetes",
"relations": "Relacions",
"notes": "Notes",
"other": "Altres"
},
"confirm": {
"confirmation": "Confirmació",
"cancel": "Cancel·la",
"ok": "OK"
},
"delete_notes": {
"close": "Tanca",
"cancel": "Cancel·la",
"ok": "OK"
},
"export": {
"close": "Tanca",
"export": "Exporta"
},
"help": {
"troubleshooting": "Solució de problemes",
"other": "Altres"
},
"import": {
"options": "Opcions",
"import": "Importa"
},
"include_note": {
"label_note": "Nota"
},
"info": {
"closeButton": "Tanca",
"okButton": "OK"
},
"note_type_chooser": {
"templates": "Plantilles:"
},
"prompt": {
"title": "Sol·licitud",
"defaultTitle": "Sol·licitud"
},
"protected_session_password": {
"close_label": "Tanca"
},
"recent_changes": {
"undelete_link": "recuperar"
},
"revisions": {
"restore_button": "Restaura",
"delete_button": "Suprimeix",
"download_button": "Descarrega",
"mime": "MIME: ",
"preview": "Vista prèvia:"
},
"sort_child_notes": {
"title": "títol",
"ascending": "ascendent",
"descending": "descendent",
"folders": "Carpetes"
},
"upload_attachments": {
"options": "Opcions",
"upload": "Puja"
},
"attribute_detail": {
"name": "Nom",
"value": "Valor",
"promoted": "Destacat",
"promoted_alias": "Àlies",
"multiplicity": "Multiplicitat",
"label_type": "Tipus",
"text": "Text",
"number": "Número",
"boolean": "Booleà",
"date": "Data",
"time": "Hora",
"url": "URL",
"precision": "Precisió",
"digits": "dígits",
"inheritable": "Heretable",
"delete": "Suprimeix",
"color_type": "Color"
},
"rename_label": {
"to": "Per"
},
"move_note": {
"to": "a"
},
"add_relation": {
"to": "a"
},
"rename_relation": {
"to": "Per"
},
"update_relation_target": {
"to": "a"
},
"attachments_actions": {
"download": "Descarrega"
},
"calendar": {
"mon": "Dl",
"tue": "Dt",
"wed": "dc",
"thu": "Dj",
"fri": "Dv",
"sat": "Ds",
"sun": "Dg",
"january": "Gener",
"febuary": "Febrer",
"march": "Març",
"april": "Abril",
"may": "Maig",
"june": "Juny",
"july": "Juliol",
"august": "Agost",
"september": "Setembre",
"october": "Octubre",
"november": "Novembre",
"december": "Desembre"
},
"global_menu": {
"menu": "Menú",
"options": "Opcions",
"zoom": "Zoom",
"advanced": "Avançat",
"logout": "Tanca la sessió"
},
"zpetne_odkazy": {
"relation": "relació"
},
"note_icon": {
"category": "Categoria:",
"search": "Cerca:"
},
"basic_properties": {
"editable": "Editable",
"language": "Llengua"
},
"book_properties": {
"grid": "Graella",
"list": "Llista",
"collapse": "Replega",
"expand": "Desplega",
"calendar": "Calendari",
"table": "Taula",
"board": "Tauler"
},
"edited_notes": {
"deleted": "(suprimit)"
},
"file_properties": {
"download": "Descarrega",
"open": "Obre",
"title": "Fitxer"
},
"image_properties": {
"download": "Descarrega",
"open": "Obre",
"title": "Imatge"
},
"note_info_widget": {
"created": "Creat",
"modified": "Modificat",
"type": "Tipus",
"calculate": "calcula"
},
"note_paths": {
"archived": "Arxivat"
}
}

View File

@@ -1,7 +1,6 @@
{
"about": {
"title": "关于 Trilium Notes",
"close": "关闭",
"homepage": "项目主页:",
"app_version": "应用版本:",
"db_version": "数据库版本:",
@@ -28,25 +27,22 @@
"add_link": {
"add_link": "添加链接",
"help_on_links": "链接帮助",
"close": "关闭",
"note": "笔记",
"search_note": "按名称搜索笔记",
"link_title_mirrors": "链接标题跟随笔记标题变化",
"link_title_arbitrary": "链接标题可随意修改",
"link_title": "链接标题",
"button_add_link": "添加链接 <kbd>回车</kbd>"
"button_add_link": "添加链接"
},
"branch_prefix": {
"edit_branch_prefix": "编辑分支前缀",
"help_on_tree_prefix": "有关树前缀的帮助",
"close": "关闭",
"prefix": "前缀:",
"prefix": "前缀: ",
"save": "保存",
"branch_prefix_saved": "分支前缀已保存。"
},
"bulk_actions": {
"bulk_actions": "批量操作",
"close": "关闭",
"affected_notes": "受影响的笔记",
"include_descendants": "包括所选笔记的子笔记",
"available_actions": "可用操作",
@@ -61,23 +57,21 @@
},
"clone_to": {
"clone_notes_to": "克隆笔记到...",
"close": "关闭",
"help_on_links": "链接帮助",
"notes_to_clone": "要克隆的笔记",
"target_parent_note": "目标父笔记",
"search_for_note_by_its_name": "按名称搜索笔记",
"cloned_note_prefix_title": "克隆的笔记将在笔记树中显示给定的前缀",
"prefix_optional": "前缀(可选)",
"clone_to_selected_note": "克隆到选定的笔记 <kbd>回车</kbd>",
"clone_to_selected_note": "克隆到选定的笔记",
"no_path_to_clone_to": "没有克隆路径。",
"note_cloned": "笔记 \"{{clonedTitle}}\" 已克隆到 \"{{targetTitle}}\""
},
"confirm": {
"confirmation": "确认",
"close": "关闭",
"cancel": "取消",
"ok": "确定",
"are_you_sure_remove_note": "确定要从关系图中移除笔记 \"{{title}}\" ",
"are_you_sure_remove_note": "确定要从关系图中移除笔记 \"{{title}}\" ",
"if_you_dont_check": "如果不选中此项,笔记将仅从关系图中移除。",
"also_delete_note": "同时删除笔记"
},
@@ -87,9 +81,9 @@
"delete_all_clones_description": "同时删除所有克隆(可以在最近修改中撤消)",
"erase_notes_description": "通常(软)删除仅标记笔记为已删除,可以在一段时间内通过最近修改对话框撤消。选中此选项将立即擦除笔记,不可撤销。",
"erase_notes_warning": "永久擦除笔记(无法撤销),包括所有克隆。这将强制应用程序重载。",
"notes_to_be_deleted": "将删除以下笔记 ({{- noteCount}})",
"notes_to_be_deleted": "将删除以下笔记 ({{notesCount}})",
"no_note_to_delete": "没有笔记将被删除(仅克隆)。",
"broken_relations_to_be_deleted": "将删除以下关系并断开连接 ({{- relationCount}})",
"broken_relations_to_be_deleted": "将删除以下关系并断开连接 ({{ relationCount}})",
"cancel": "取消",
"ok": "确定",
"deleted_relation_text": "笔记 {{- note}} (将被删除的笔记) 被以下关系 {{- relation}} 引用, 来自 {{- source}}。"
@@ -113,20 +107,17 @@
"format_pdf": "PDF - 用于打印或共享目的。"
},
"help": {
"fullDocumentation": "帮助(完整<a class=\"external\" href=\"https://triliumnext.github.io/Docs/\">在线文档</a>)",
"close": "关闭",
"noteNavigation": "笔记导航",
"goUpDown": "<kbd>UP</kbd>, <kbd>DOWN</kbd> - 在笔记列表中向上/向下移动",
"collapseExpand": "<kbd>LEFT</kbd>, <kbd>RIGHT</kbd> - 折叠/展开节点",
"goUpDown": "在笔记列表中向上/向下移动",
"collapseExpand": "折叠/展开节点",
"notSet": "未设置",
"goBackForwards": "在历史记录中前后移动",
"showJumpToNoteDialog": "显示<a class=\"external\" href=\"https://triliumnext.github.io/Docs/Wiki/note-navigation.html#jump-to-note\">\"跳转到\" 对话框</a>",
"scrollToActiveNote": "滚动到活跃笔记",
"jumpToParentNote": "<kbd>Backspace</kbd> - 跳转到父笔记",
"jumpToParentNote": "跳转到父笔记",
"collapseWholeTree": "折叠整个笔记树",
"collapseSubTree": "折叠子树",
"tabShortcuts": "标签页快捷键",
"newTabNoteLink": "<kbd>CTRL+click</kbd> - 在笔记链接上使用CTRL+点击(或中键点击)在新标签页中打开笔记",
"onlyInDesktop": "仅在桌面版(电子构建)中",
"openEmptyTab": "打开空白标签页",
"closeActiveTab": "关闭活跃标签页",
@@ -141,14 +132,14 @@
"moveNoteUpHierarchy": "在层级结构中向上移动笔记",
"multiSelectNote": "多选上/下笔记",
"selectAllNotes": "选择当前级别的所有笔记",
"selectNote": "<kbd>Shift+click</kbd> - 选择笔记",
"selectNote": "选择笔记",
"copyNotes": "将活跃笔记(或当前选择)复制到剪贴板(用于<a class=\"external\" href=\"https://triliumnext.github.io/Docs/Wiki/cloning-notes.html#cloning-notes\">克隆</a>",
"cutNotes": "将当前笔记(或当前选择)剪切到剪贴板(用于移动笔记)",
"pasteNotes": "将笔记粘贴为活跃笔记的子笔记(根据是复制还是剪切到剪贴板来决定是移动还是克隆)",
"deleteNotes": "删除笔记/子树",
"editingNotes": "编辑笔记",
"editNoteTitle": "在树形笔记树中,焦点会从笔记树切换到笔记标题。按下 Enter 键会将焦点从笔记标题切换到文本编辑器。按下 <kbd>Ctrl+.</kbd> 会将焦点从编辑器切换回笔记树。",
"createEditLink": "<kbd>Ctrl+K</kbd> - 创建/编辑外部链接",
"createEditLink": "创建/编辑外部链接",
"createInternalLink": "创建内部链接",
"followLink": "跟随光标下的链接",
"insertDateTime": "在插入点插入当前日期和时间",
@@ -164,11 +155,13 @@
"showSQLConsole": "显示 SQL 控制台",
"other": "其他",
"quickSearch": "定位到快速搜索框",
"inPageSearch": "页面内搜索"
"inPageSearch": "页面内搜索",
"newTabWithActivationNoteLink": "在新标签页打开笔记链接并激活该标签页",
"title": "资料表",
"newTabNoteLink": "在新标签页开启链接"
},
"import": {
"importIntoNote": "导入到笔记",
"close": "关闭",
"chooseImportFile": "选择导入文件",
"importDescription": "所选文件的内容将作为子笔记导入到",
"options": "选项",
@@ -195,14 +188,13 @@
},
"include_note": {
"dialog_title": "包含笔记",
"close": "关闭",
"label_note": "笔记",
"placeholder_search": "按名称搜索笔记",
"box_size_prompt": "包含笔记的框大小:",
"box_size_small": "小型 (显示大约10行)",
"box_size_medium": "中型 (显示大约30行)",
"box_size_full": "完整显示(完整文本框)",
"button_include": "包含笔记 <kbd>回车</kbd>"
"button_include": "包含笔记"
},
"info": {
"modalTitle": "信息消息",
@@ -210,43 +202,41 @@
"okButton": "确定"
},
"jump_to_note": {
"search_placeholder": "按笔记名称搜索",
"close": "关闭",
"search_button": "全文搜索 <kbd>Ctrl+回车</kbd>"
"search_button": "全文搜索",
"search_placeholder": "按名称或类型搜索笔记 > 查看命令..."
},
"markdown_import": {
"dialog_title": "Markdown 导入",
"close": "关闭",
"modal_body_text": "由于浏览器沙箱的限制,无法直接从 JavaScript 读取剪贴板内容。请将要导入的 Markdown 文本粘贴到下面的文本框中,然后点击导入按钮",
"import_button": "导入 Ctrl+回车",
"import_button": "导入",
"import_success": "Markdown 内容已成功导入文档。"
},
"move_to": {
"dialog_title": "移动笔记到...",
"close": "关闭",
"notes_to_move": "需要移动的笔记",
"target_parent_note": "目标父笔记",
"search_placeholder": "通过名称搜索笔记",
"move_button": "移动到选定的笔记 <kbd>回车</kbd>",
"move_button": "移动到选定的笔记",
"error_no_path": "没有可以移动到的路径。",
"move_success_message": "所选笔记已移动到"
"move_success_message": "所选笔记已移动到 "
},
"note_type_chooser": {
"modal_title": "选择笔记类型",
"close": "关闭",
"modal_body": "选择新笔记的类型或模板:",
"templates": "模板:"
"templates": "模板",
"change_path_prompt": "更改创建新笔记的位置:",
"search_placeholder": "按名称搜索路径(默认为空)",
"builtin_templates": "内置模板"
},
"password_not_set": {
"title": "密码未设置",
"close": "关闭",
"body1": "受保护的笔记使用用户密码加密,但密码尚未设置。",
"body2": "点击<a class=\"open-password-options-button\" href=\"javascript:\">这里</a>打开选项对话框并设置您的密码。"
"body2": "若要保护笔记,请按一下下方按钮开启「选项对话框并设置密码。",
"go_to_password_options": "移动至密码选项"
},
"prompt": {
"title": "提示",
"close": "关闭",
"ok": "确定 <kbd>回车</kbd>",
"ok": "确定",
"defaultTitle": "提示"
},
"protected_session_password": {
@@ -254,12 +244,11 @@
"help_title": "关于保护笔记的帮助",
"close_label": "关闭",
"form_label": "输入密码进入保护会话以继续:",
"start_button": "开始保护会话 <kbd>回车</kbd>"
"start_button": "开始保护会话"
},
"recent_changes": {
"title": "最近修改",
"erase_notes_button": "立即清理已删除的笔记",
"close": "关闭",
"deleted_notes_message": "已删除的笔记已清理。",
"no_changes_message": "暂无修改...",
"undelete_link": "恢复删除",
@@ -270,7 +259,6 @@
"delete_all_revisions": "删除此笔记的所有修订版本",
"delete_all_button": "删除所有修订版本",
"help_title": "关于笔记修订版本的帮助",
"close": "关闭",
"revision_last_edited": "此修订版本上次编辑于 {{date}}",
"confirm_delete_all": "您是否要删除此笔记的所有修订版本?",
"no_revisions": "此笔记暂无修订版本...",
@@ -285,14 +273,13 @@
"maximum_revisions": "当前笔记的最大历史数量: {{number}}。",
"settings": "笔记修订设置",
"download_button": "下载",
"mime": "MIME 类型:",
"mime": "MIME 类型: ",
"file_size": "文件大小:",
"preview": "预览:",
"preview_not_available": "无法预览此类型的笔记。"
},
"sort_child_notes": {
"sort_children_by": "按...排序子笔记",
"close": "关闭",
"sorting_criteria": "排序条件",
"title": "标题",
"date_created": "创建日期",
@@ -306,13 +293,12 @@
"sort_with_respect_to_different_character_sorting": "根据不同语言或地区的字符排序和排序规则排序。",
"natural_sort_language": "自然排序语言",
"the_language_code_for_natural_sort": "自然排序的语言代码,例如中文的 \"zh-CN\"。",
"sort": "排序 <kbd>Enter</kbd>"
"sort": "排序"
},
"upload_attachments": {
"upload_attachments_to_note": "上传附件到笔记",
"close": "关闭",
"choose_files": "选择文件",
"files_will_be_uploaded": "文件将作为附件上传到",
"files_will_be_uploaded": "文件将作为附件上传到 {{noteTitle}}",
"options": "选项",
"shrink_images": "缩小图片",
"upload": "上传",
@@ -427,7 +413,7 @@
"run_on_branch_change": "在分支更新时执行。",
"run_on_branch_deletion": "在删除分支时执行。分支是父笔记和子笔记之间的链接,例如在移动笔记时删除(删除旧的分支/链接)。",
"run_on_attribute_creation": "在为定义此关系的笔记创建新属性时执行",
"run_on_attribute_change": "当修改定义此关系的笔记的属性时执行。删除属性时也会触发此操作。",
"run_on_attribute_change": " 当修改定义此关系的笔记的属性时执行。删除属性时也会触发此操作。",
"relation_template": "即使没有父子关系,笔记的属性也将继承。如果空,则笔记的内容和子树将添加到实例笔记中。有关详细信息,请参见文档。",
"inherit": "即使没有父子关系,笔记的属性也将继承。有关类似概念的模板关系,请参见模板关系。请参阅文档中的属性继承。",
"render_note": "“渲染 HTML 笔记”类型的笔记将使用代码笔记HTML 或脚本)进行呈现,因此需要指定要渲染的笔记",
@@ -438,14 +424,15 @@
"share_favicon": "在分享页面中设置的 favicon 笔记。一般需要将它设置为分享和可继承。Favicon 笔记也必须位于分享子树中。可以考虑一并使用 'share_hidden_from_tree'。",
"is_owned_by_note": "由此笔记所有",
"other_notes_with_name": "其它含有 {{attributeType}} 名为 \"{{attributeName}}\" 的的笔记",
"and_more": "... 以及另外 {{count}} 个",
"and_more": "... 以及另外 {{count}} 个",
"print_landscape": "导出为 PDF 时,将页面方向更改为横向而不是纵向。",
"print_page_size": "导出为 PDF 时,更改页面大小。支持的值:<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>。"
"print_page_size": "导出为 PDF 时,更改页面大小。支持的值:<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>。",
"color_type": "颜色"
},
"attribute_editor": {
"help_text_body1": "要添加标签,只需输入例如 <code>#rock</code> 或者如果您还想添加值,则例如 <code>#year = 2020</code>",
"help_text_body2": "对于关系,请输入 <code>~author = @</code>,这将显示一个自动完成列表,您可以查找所需的笔记。",
"help_text_body3": "您也可以使用右侧的 <code>+</code> 按钮添加标签和关系。</p>",
"help_text_body3": "您也可以使用右侧的 <code>+</code> 按钮添加标签和关系。",
"save_attributes": "保存属性 <enter>",
"add_a_new_attribute": "添加新属性",
"add_new_label": "添加新标签 <kbd data-command=\"addNewLabel\"></kbd>",
@@ -744,7 +731,8 @@
"basic_properties": {
"note_type": "笔记类型",
"editable": "可编辑",
"basic_properties": "基本属性"
"basic_properties": "基本属性",
"language": "语言"
},
"book_properties": {
"view_type": "视图类型",
@@ -754,9 +742,12 @@
"expand_all_children": "展开所有子项",
"collapse": "折叠",
"expand": "展开",
"book_properties": "书籍属性",
"invalid_view_type": "无效的查看类型 '{{type}}'",
"calendar": "日历"
"calendar": "日历",
"book_properties": "集合属性",
"table": "表格",
"geo-map": "地理地图",
"board": "看板"
},
"edited_notes": {
"no_edited_notes_found": "今天还没有编辑过的笔记...",
@@ -833,7 +824,8 @@
"unknown_label_type": "未知的标签类型 '{{type}}'",
"unknown_attribute_type": "未知的属性类型 '{{type}}'",
"add_new_attribute": "添加新属性",
"remove_this_attribute": "移除此属性"
"remove_this_attribute": "移除此属性",
"remove_color": "移除此颜色标签"
},
"script_executor": {
"query": "查询",
@@ -944,19 +936,19 @@
},
"attachment_detail": {
"open_help_page": "打开附件帮助页面",
"owning_note": "所属笔记:",
"you_can_also_open": ",您还可以打开",
"owning_note": "所属笔记: ",
"you_can_also_open": ",您还可以打开 ",
"list_of_all_attachments": "所有附件列表",
"attachment_deleted": "该附件已被删除。"
},
"attachment_list": {
"open_help_page": "打开附件帮助页面",
"owning_note": "所属笔记:",
"owning_note": "所属笔记: ",
"upload_attachments": "上传附件",
"no_attachments": "此笔记没有附件。"
},
"book": {
"no_children_help": "此类型为书籍的笔记没有任何子笔记,因此没有内容显示。请参阅 <a href=\"https://triliumnext.github.io/Docs/Wiki/book-note.html\">wiki</a> 了解详情"
"no_children_help": "此类型为书籍的笔记没有任何子笔记,因此没有内容显示。请参阅 <a href=\"https://triliumnext.github.io/Docs/Wiki/book-note.html\">wiki</a> 了解详情"
},
"editable_code": {
"placeholder": "在这里输入您的代码笔记内容..."
@@ -1092,7 +1084,8 @@
"max_width_label": "内容最大宽度(像素)",
"apply_changes_description": "要应用内容宽度更改,请点击",
"reload_button": "重载前端",
"reload_description": "来自外观选项的更改"
"reload_description": "来自外观选项的更改",
"max_width_unit": "像素"
},
"native_title_bar": {
"title": "原生标题栏(需要重新启动应用)",
@@ -1108,17 +1101,17 @@
"title": "主题",
"theme_label": "主题",
"override_theme_fonts_label": "覆盖主题字体",
"auto_theme": "自动",
"light_theme": "浅色",
"dark_theme": "深色",
"triliumnext": "TriliumNext Beta跟随系统颜色方案",
"triliumnext-light": "TriliumNext Beta浅色",
"triliumnext-dark": "TriliumNext Beta深色",
"triliumnext": "Trilium跟随系统颜色方案",
"triliumnext-light": "Trilium浅色",
"triliumnext-dark": "Trilium深色",
"layout": "布局",
"layout-vertical-title": "垂直",
"layout-horizontal-title": "水平",
"layout-vertical-description": "启动栏位于左侧(默认)",
"layout-horizontal-description": "启动栏位于标签页栏下方,标签页栏现在是全宽的。"
"layout-horizontal-description": "启动栏位于标签页栏下方,标签页栏现在是全宽的。",
"auto_theme": "传统(跟随系统配色方案)",
"light_theme": "传统(浅色)",
"dark_theme": "传统(深色)"
},
"zoom_factor": {
"title": "缩放系数(仅桌面客户端有效)",
@@ -1127,7 +1120,8 @@
"code_auto_read_only_size": {
"title": "自动只读大小",
"description": "自动只读大小是指笔记超过设置的大小后自动设置为只读模式(为性能考虑)。",
"label": "自动只读大小(代码笔记)"
"label": "自动只读大小(代码笔记)",
"unit": "字符"
},
"code_mime_types": {
"title": "下拉菜单可用的MIME文件类型"
@@ -1146,7 +1140,8 @@
"download_images_description": "粘贴的 HTML 可能包含在线图片的引用Trilium 会找到这些引用并下载图片,以便它们可以离线使用。",
"enable_image_compression": "启用图片压缩",
"max_image_dimensions": "图片的最大宽度/高度(超过此限制的图像将会被缩放)。",
"jpeg_quality_description": "JPEG 质量10 - 最差质量100 最佳质量,建议为 50 - 85"
"jpeg_quality_description": "JPEG 质量10 - 最差质量100 最佳质量,建议为 50 - 85",
"max_image_dimensions_unit": "像素"
},
"attachment_erasure_timeout": {
"attachment_erasure_timeout": "附件清理超时",
@@ -1178,7 +1173,8 @@
"note_revisions_snapshot_limit_description": "笔记修订快照数限制指的是每个笔记可以保存的最大历史记录数量。其中 -1 表示没有限制0 表示删除所有历史记录。您可以通过 #versioningLimit 标签设置单个笔记的最大修订记录数量。",
"snapshot_number_limit_label": "笔记修订快照数量限制:",
"erase_excess_revision_snapshots": "立即删除多余的修订快照",
"erase_excess_revision_snapshots_prompt": "多余的修订快照已被删除。"
"erase_excess_revision_snapshots_prompt": "多余的修订快照已被删除。",
"snapshot_number_limit_unit": "快照"
},
"search_engine": {
"title": "搜索引擎",
@@ -1220,12 +1216,14 @@
"title": "目录",
"description": "当笔记中有超过一定数量的标题时,显示目录。您可以自定义此数量:",
"disable_info": "您可以设置一个非常大的数来禁用目录。",
"shortcut_info": "您可以在 “选项” -> “快捷键” 中配置一个键盘快捷键,以便快速切换右侧面板(包括目录)(名称为 'toggleRightPane')。"
"shortcut_info": "您可以在 “选项” -> “快捷键” 中配置一个键盘快捷键,以便快速切换右侧面板(包括目录)(名称为 'toggleRightPane')。",
"unit": "标题"
},
"text_auto_read_only_size": {
"title": "自动只读大小",
"description": "自动只读笔记大小是超过该大小后,笔记将以只读模式显示(出于性能考虑)。",
"label": "自动只读大小(文本笔记)"
"label": "自动只读大小(文本笔记)",
"unit": "字符"
},
"i18n": {
"title": "本地化",
@@ -1376,7 +1374,8 @@
"test_title": "同步测试",
"test_description": "测试和同步服务器之间的连接。如果同步服务器没有初始化,会将本地文档同步到同步服务器上。",
"test_button": "测试同步",
"handshake_failed": "同步服务器握手失败,错误:{{message}}"
"handshake_failed": "同步服务器握手失败,错误:{{message}}",
"timeout_unit": "毫秒"
},
"api_log": {
"close": "关闭"
@@ -1431,12 +1430,13 @@
"move-to": "移动到...",
"paste-into": "粘贴到里面",
"paste-after": "粘贴到后面",
"duplicate-subtree": "复制子树",
"export": "导出",
"import-into-note": "导入到笔记",
"apply-bulk-actions": "应用批量操作",
"converted-to-attachments": "{{count}} 个笔记已被转换为附件。",
"convert-to-attachment-confirm": "确定要将选中的笔记转换为其父笔记的附件吗?"
"convert-to-attachment-confirm": "确定要将选中的笔记转换为其父笔记的附件吗?",
"duplicate": "复制",
"open-in-popup": "快速编辑"
},
"shared_info": {
"shared_publicly": "此笔记已公开分享于",
@@ -1450,7 +1450,6 @@
"relation-map": "关系图",
"note-map": "笔记地图",
"render-note": "渲染笔记",
"book": "书",
"mermaid-diagram": "Mermaid 图",
"canvas": "画布",
"web-view": "网页视图",
@@ -1463,7 +1462,11 @@
"confirm-change": "当笔记内容不为空时,不建议更改笔记类型。您仍然要继续吗?",
"geo-map": "地理地图",
"beta-feature": "测试版",
"task-list": "待办事项列表"
"task-list": "任务列表",
"ai-chat": "AI聊天",
"new-feature": "新建",
"collections": "集合",
"book": "集合"
},
"protect_note": {
"toggle-on": "保护笔记",
@@ -1573,7 +1576,9 @@
},
"clipboard": {
"cut": "笔记已剪切到剪贴板。",
"copied": "笔记已复制到剪贴板。"
"copied": "笔记已复制到剪贴板。",
"copy_failed": "由于权限问题,无法复制到剪贴板。",
"copy_success": "已复制到剪贴板。"
},
"entrypoints": {
"note-revision-created": "笔记修订已创建。",
@@ -1624,7 +1629,8 @@
"word_wrapping": "自动换行",
"theme_none": "无语法高亮",
"theme_group_light": "浅色主题",
"theme_group_dark": "深色主题"
"theme_group_dark": "深色主题",
"copy_title": "复制到剪贴板"
},
"classic_editor_toolbar": {
"title": "格式"
@@ -1662,7 +1668,8 @@
"link_context_menu": {
"open_note_in_new_tab": "在新标签页中打开笔记",
"open_note_in_new_split": "在新分屏中打开笔记",
"open_note_in_new_window": "在新窗口中打开笔记"
"open_note_in_new_window": "在新窗口中打开笔记",
"open_note_in_popup": "快速编辑"
},
"electron_integration": {
"desktop-application": "桌面应用程序",
@@ -1682,7 +1689,8 @@
"full-text-search": "全文搜索"
},
"note_tooltip": {
"note-has-been-deleted": "笔记已被删除。"
"note-has-been-deleted": "笔记已被删除。",
"quick-edit": "快速编辑"
},
"geo-map": {
"create-child-note-title": "创建一个新的子笔记并将其添加到地图中",
@@ -1691,7 +1699,8 @@
},
"geo-map-context": {
"open-location": "打开位置",
"remove-from-map": "从地图中移除"
"remove-from-map": "从地图中移除",
"add-note": "在这个位置添加一个标记"
},
"help-button": {
"title": "打开相关帮助页面"
@@ -1723,5 +1732,271 @@
"tomorrow": "明天",
"yesterday": "昨天"
}
},
"ai_llm": {
"not_started": "未开始",
"title": "AI设置",
"processed_notes": "已处理笔记",
"total_notes": "笔记总数",
"progress": "进度",
"queued_notes": "排队中笔记",
"failed_notes": "失败笔记",
"last_processed": "最后处理时间",
"refresh_stats": "刷新统计数据",
"enable_ai_features": "启用AI/LLM功能",
"enable_ai_description": "启用笔记摘要、内容生成等AI功能及其他LLM能力",
"openai_tab": "OpenAI",
"anthropic_tab": "Anthropic",
"voyage_tab": "Voyage AI",
"ollama_tab": "Ollama",
"enable_ai": "启用AI/LLM功能",
"enable_ai_desc": "启用笔记摘要、内容生成等AI功能及其他LLM能力",
"provider_configuration": "AI提供商配置",
"provider_precedence": "提供商优先级",
"provider_precedence_description": "按优先级排序的提供商列表(用逗号分隔,例如:'openai,anthropic,ollama'",
"temperature": "温度参数",
"temperature_description": "控制响应的随机性0 = 确定性输出2 = 最大随机性)",
"system_prompt": "系统提示词",
"system_prompt_description": "所有AI交互使用的默认系统提示词",
"openai_configuration": "OpenAI配置",
"openai_settings": "OpenAI设置",
"api_key": "API密钥",
"url": "基础URL",
"model": "模型",
"openai_api_key_description": "用于访问OpenAI服务的API密钥",
"anthropic_api_key_description": "用于访问Claude模型的Anthropic API密钥",
"default_model": "默认模型",
"openai_model_description": "示例gpt-4o、gpt-4-turbo、gpt-3.5-turbo",
"base_url": "基础URL",
"openai_url_description": "默认https://api.openai.com/v1",
"anthropic_settings": "Anthropic设置",
"anthropic_url_description": "Anthropic API的基础URL默认https://api.anthropic.com",
"anthropic_model_description": "用于聊天补全的Anthropic Claude模型",
"voyage_settings": "Voyage AI设置",
"ollama_settings": "Ollama设置",
"ollama_url_description": "Ollama API的URL默认http://localhost:11434",
"ollama_model_description": "用于聊天补全的 Ollama 模型",
"anthropic_configuration": "Anthropic配置",
"voyage_configuration": "Voyage AI配置",
"voyage_url_description": "默认https://api.voyageai.com/v1",
"ollama_configuration": "Ollama配置",
"enable_ollama": "启用Ollama",
"enable_ollama_description": "启用Ollama以使用本地AI模型",
"ollama_url": "Ollama URL",
"ollama_model": "Ollama模型",
"refresh_models": "刷新模型",
"refreshing_models": "刷新中...",
"enable_automatic_indexing": "启用自动索引",
"rebuild_index": "重建索引",
"rebuild_index_error": "启动索引重建失败。请查看日志了解详情。",
"note_title": "笔记标题",
"error": "错误",
"last_attempt": "最后尝试时间",
"actions": "操作",
"retry": "重试",
"partial": "{{ percentage }}% 已完成",
"retry_queued": "笔记已加入重试队列",
"retry_failed": "笔记加入重试队列失败",
"max_notes_per_llm_query": "每次查询的最大笔记数",
"max_notes_per_llm_query_description": "AI上下文包含的最大相似笔记数量",
"active_providers": "活跃提供商",
"disabled_providers": "已禁用提供商",
"remove_provider": "从搜索中移除提供商",
"restore_provider": "将提供商恢复到搜索中",
"similarity_threshold": "相似度阈值",
"similarity_threshold_description": "纳入LLM查询上下文的笔记最低相似度分数0-1",
"reprocess_index": "重建搜索索引",
"reprocessing_index": "重建中...",
"reprocess_index_started": "搜索索引优化已在后台启动",
"reprocess_index_error": "重建搜索索引失败",
"index_rebuild_progress": "索引重建进度",
"index_rebuilding": "正在优化索引({{percentage}}%",
"index_rebuild_complete": "索引优化完成",
"index_rebuild_status_error": "检查索引重建状态失败",
"never": "从未",
"processing": "处理中({{percentage}}%",
"incomplete": "未完成({{percentage}}%",
"complete": "已完成100%",
"refreshing": "刷新中...",
"auto_refresh_notice": "每 {{seconds}} 秒自动刷新",
"note_queued_for_retry": "笔记已加入重试队列",
"failed_to_retry_note": "重试笔记失败",
"all_notes_queued_for_retry": "所有失败笔记已加入重试队列",
"failed_to_retry_all": "重试笔记失败",
"ai_settings": "AI设置",
"api_key_tooltip": "用于访问服务的API密钥",
"empty_key_warning": {
"anthropic": "Anthropic API密钥为空。请输入有效的API密钥。",
"openai": "OpenAI API密钥为空。请输入有效的API密钥。",
"voyage": "Voyage API密钥为空。请输入有效的API密钥。",
"ollama": "Ollama API密钥为空。请输入有效的API密钥。"
},
"agent": {
"processing": "处理中...",
"thinking": "思考中...",
"loading": "加载中...",
"generating": "生成中..."
},
"name": "AI",
"openai": "OpenAI",
"use_enhanced_context": "使用增强上下文",
"enhanced_context_description": "为AI提供来自笔记及其相关笔记的更多上下文以获得更好的响应",
"show_thinking": "显示思考过程",
"show_thinking_description": "显示AI的思维链过程",
"enter_message": "输入你的消息...",
"error_contacting_provider": "联系AI提供商失败。请检查你的设置和网络连接。",
"error_generating_response": "生成AI响应失败",
"index_all_notes": "为所有笔记建立索引",
"index_status": "索引状态",
"indexed_notes": "已索引笔记",
"indexing_stopped": "索引已停止",
"indexing_in_progress": "索引进行中...",
"last_indexed": "最后索引时间",
"n_notes_queued_0": "{{ count }} 条笔记已加入索引队列",
"note_chat": "笔记聊天",
"notes_indexed_0": "{{ count }} 条笔记已索引",
"sources": "来源",
"start_indexing": "开始索引",
"use_advanced_context": "使用高级上下文",
"ollama_no_url": "Ollama 未配置。请输入有效的URL。",
"chat": {
"root_note_title": "AI聊天记录",
"root_note_content": "此笔记包含你保存的AI聊天对话。",
"new_chat_title": "新聊天",
"create_new_ai_chat": "创建新的AI聊天"
},
"create_new_ai_chat": "创建新的AI聊天",
"configuration_warnings": "你的AI配置存在一些问题。请检查你的设置。",
"experimental_warning": "LLM功能目前处于实验阶段 - 特此提醒。",
"selected_provider": "已选提供商",
"selected_provider_description": "选择用于聊天和补全功能的AI提供商",
"select_model": "选择模型...",
"select_provider": "选择提供商..."
},
"code-editor-options": {
"title": "编辑器"
},
"custom_date_time_format": {
"title": "自定义日期/时间格式",
"description": "通过<kbd></kbd>或工具栏的方式可自定义日期和时间格式,有关日期/时间格式字符串中各个字符的含义,请参阅<a href=\"https://day.js.org/docs/en/display/format\" target=\"_blank\" rel=\"noopener noreferrer\">Day.js docs</a>。",
"format_string": "日期/时间格式字符串:",
"formatted_time": "格式化后日期/时间:"
},
"content_widget": {
"unknown_widget": "未知组件:\"{{id}}\"."
},
"note_language": {
"not_set": "不设置",
"configure-languages": "设置语言..."
},
"content_language": {
"title": "内容语言",
"description": "选择一种或多种语言出现在只读或可编辑文本注释的基本属性,这将支持拼写检查或从右向左之类的功能。"
},
"switch_layout_button": {
"title_vertical": "将编辑面板移至底部",
"title_horizontal": "将编辑面板移至左侧"
},
"toggle_read_only_button": {
"unlock-editing": "解锁编辑",
"lock-editing": "锁定编辑"
},
"png_export_button": {
"button_title": "将图表导出为PNG"
},
"svg": {
"export_to_png": "无法将图表导出为PNG。"
},
"code_theme": {
"title": "外观",
"word_wrapping": "自动换行",
"color-scheme": "配色方案"
},
"cpu_arch_warning": {
"title": "请下载ARM64版本",
"message_macos": "TriliumNext当前正在通过Rosetta 2转译运行这意味着您在Apple Silicon芯片的Mac上使用的是Intelx64版本。这将显著影响性能和电池续航。",
"message_windows": "TriliumNext当前正在模拟环境中运行这意味着您在ARM架构的Windows设备上使用的是Intelx64版本。这将显著影响性能和电池续航。",
"recommendation": "为获得最佳体验请从我们的发布页面下载TriliumNext的原生ARM64版本。",
"download_link": "下载原生版本",
"continue_anyway": "仍然继续",
"dont_show_again": "不再显示此警告"
},
"editorfeatures": {
"title": "功能",
"emoji_completion_enabled": "启用表情自动补全",
"note_completion_enabled": "启用笔记自动补全"
},
"table_view": {
"new-row": "新增行",
"new-column": "新增列",
"sort-column-by": "按\"{{title}}\"排序",
"sort-column-ascending": "升序",
"sort-column-descending": "降序",
"sort-column-clear": "清除排序",
"hide-column": "隐藏\"{{title}}\"列",
"show-hide-columns": "显示/隐藏列",
"row-insert-above": "在上方插入行",
"row-insert-below": "在下方插入行",
"row-insert-child": "插入子笔记",
"add-column-to-the-left": "在左侧添加列",
"add-column-to-the-right": "在右侧添加列",
"edit-column": "编辑列",
"delete_column_confirmation": "确定要删除此列吗?所有笔记中对应的属性都将被移除。",
"delete-column": "删除列",
"new-column-label": "标签",
"new-column-relation": "关联"
},
"book_properties_config": {
"hide-weekends": "隐藏周末",
"display-week-numbers": "显示周数",
"map-style": "地图样式:",
"max-nesting-depth": "最大嵌套深度:",
"raster": "栅格",
"vector_light": "矢量(浅色)",
"vector_dark": "矢量(深色)",
"show-scale": "显示比例尺"
},
"table_context_menu": {
"delete_row": "删除行"
},
"board_view": {
"delete-note": "删除笔记",
"move-to": "移动到",
"insert-above": "在上方插入",
"insert-below": "在下方插入",
"delete-column": "删除列",
"delete-column-confirmation": "确定要删除此列吗?此列下所有笔记中对应的属性也将被删除。",
"new-item": "新增项目",
"add-column": "添加列"
},
"command_palette": {
"tree-action-name": "树形:{{name}}",
"export_note_title": "导出笔记",
"export_note_description": "导出当前笔记",
"show_attachments_title": "显示附件",
"show_attachments_description": "查看笔记附件",
"search_notes_title": "搜索笔记",
"search_notes_description": "打开高级搜索",
"search_subtree_title": "在子树中搜索",
"search_subtree_description": "在当前子树范围内搜索",
"search_history_title": "显示搜索历史",
"search_history_description": "查看之前的搜索记录",
"configure_launch_bar_title": "配置启动栏",
"configure_launch_bar_description": "打开启动栏配置,添加或移除项目。"
},
"content_renderer": {
"open_externally": "在外部打开"
},
"modal": {
"close": "关闭",
"help_title": "显示关于此画面的更多信息"
},
"call_to_action": {
"next_theme_title": "新的 Trilium 主题已进入稳定版",
"next_theme_message": "有一段时间,我们一直在设计新的主题,为了让应用程序看起来更加现代。",
"next_theme_button": "切换至新的 Trilium 主题",
"background_effects_title": "背景效果现已推出稳定版本",
"background_effects_message": "在 Windows 装置上,背景效果现在已完全稳定。背景效果通过模糊背后的背景,为使用者界面增添一抹色彩。此技术也用于其他应用程序,例如 Windows 资源管理器。",
"background_effects_button": "启用背景效果"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
{
"about": {
"title": "Πληροφορίες για το Trilium Notes",
"homepage": "Αρχική Σελίδα:",
"app_version": "Έκδοση εφαρμογής:",
"db_version": "Έκδοση βάσης δεδομένων:",
"sync_version": "Έκδοση πρωτοκόλου συγχρονισμού:",
"build_date": "Ημερομηνία χτισίματος εφαρμογής:",
"build_revision": "Αριθμός αναθεώρησης χτισίματος:",
"data_directory": "Φάκελος δεδομένων:"
},
"toast": {
"critical-error": {
"title": "Κρίσιμο σφάλμα",
"message": "Συνέβη κάποιο κρίσιμο σφάλμα, το οποίο δεν επιτρέπει στην εφαρμογή χρήστη να ξεκινήσει:\n\n{{message}}\n\nΤο πιθανότερο είναι να προκλήθηκε από κάποιο script που απέτυχε απρόοπτα. Δοκιμάστε να ξεκινήσετε την εφαρμογή σε ασφαλή λειτουργία για να λύσετε το πρόβλημα."
}
}
}

View File

@@ -1,7 +1,6 @@
{
"about": {
"title": "About Trilium Notes",
"close": "Close",
"homepage": "Homepage:",
"app_version": "App version:",
"db_version": "DB version:",
@@ -28,25 +27,22 @@
"add_link": {
"add_link": "Add link",
"help_on_links": "Help on links",
"close": "Close",
"note": "Note",
"search_note": "search for note by its name",
"link_title_mirrors": "link title mirrors the note's current title",
"link_title_arbitrary": "link title can be changed arbitrarily",
"link_title": "Link title",
"button_add_link": "Add link <kbd>enter</kbd>"
"button_add_link": "Add link"
},
"branch_prefix": {
"edit_branch_prefix": "Edit branch prefix",
"help_on_tree_prefix": "Help on Tree prefix",
"close": "Close",
"prefix": "Prefix: ",
"save": "Save",
"branch_prefix_saved": "Branch prefix has been saved."
},
"bulk_actions": {
"bulk_actions": "Bulk actions",
"close": "Close",
"affected_notes": "Affected notes",
"include_descendants": "Include descendants of the selected notes",
"available_actions": "Available actions",
@@ -61,20 +57,18 @@
},
"clone_to": {
"clone_notes_to": "Clone notes to...",
"close": "Close",
"help_on_links": "Help on links",
"notes_to_clone": "Notes to clone",
"target_parent_note": "Target parent note",
"search_for_note_by_its_name": "search for note by its name",
"cloned_note_prefix_title": "Cloned note will be shown in note tree with given prefix",
"prefix_optional": "Prefix (optional)",
"clone_to_selected_note": "Clone to selected note <kbd>enter</kbd>",
"clone_to_selected_note": "Clone to selected note",
"no_path_to_clone_to": "No path to clone to.",
"note_cloned": "Note \"{{clonedTitle}}\" has been cloned into \"{{targetTitle}}\""
},
"confirm": {
"confirmation": "Confirmation",
"close": "Close",
"cancel": "Cancel",
"ok": "OK",
"are_you_sure_remove_note": "Are you sure you want to remove the note \"{{title}}\" from relation map? ",
@@ -87,9 +81,9 @@
"delete_all_clones_description": "Delete also all clones (can be undone in recent changes)",
"erase_notes_description": "Normal (soft) deletion only marks the notes as deleted and they can be undeleted (in recent changes dialog) within a period of time. Checking this option will erase the notes immediately and it won't be possible to undelete the notes.",
"erase_notes_warning": "Erase notes permanently (can't be undone), including all clones. This will force application reload.",
"notes_to_be_deleted": "Following notes will be deleted ({{- noteCount}})",
"notes_to_be_deleted": "Following notes will be deleted ({{notesCount}})",
"no_note_to_delete": "No note will be deleted (only clones).",
"broken_relations_to_be_deleted": "Following relations will be broken and deleted ({{- relationCount}})",
"broken_relations_to_be_deleted": "Following relations will be broken and deleted ({{ relationCount}})",
"cancel": "Cancel",
"ok": "OK",
"deleted_relation_text": "Note {{- note}} (to be deleted) is referenced by relation {{- relation}} originating from {{- source}}."
@@ -113,21 +107,20 @@
"format_pdf": "PDF - for printing or sharing purposes."
},
"help": {
"fullDocumentation": "Help (full documentation is available <a class=\"external\" href=\"https://triliumnext.github.io/Docs/\">online</a>)",
"close": "Close",
"title": "Cheatsheet",
"noteNavigation": "Note navigation",
"goUpDown": "<kbd>UP</kbd>, <kbd>DOWN</kbd> - go up/down in the list of notes",
"collapseExpand": "<kbd>LEFT</kbd>, <kbd>RIGHT</kbd> - collapse/expand node",
"goUpDown": "go up/down in the list of notes",
"collapseExpand": "collapse/expand node",
"notSet": "not set",
"goBackForwards": "go back / forwards in the history",
"showJumpToNoteDialog": "show <a class=\"external\" href=\"https://triliumnext.github.io/Docs/Wiki/note-navigation.html#jump-to-note\">\"Jump to\" dialog</a>",
"scrollToActiveNote": "scroll to active note",
"jumpToParentNote": "<kbd>Backspace</kbd> - jump to parent note",
"jumpToParentNote": "jump to parent note",
"collapseWholeTree": "collapse whole note tree",
"collapseSubTree": "collapse sub-tree",
"tabShortcuts": "Tab shortcuts",
"newTabNoteLink": "<kbd>Ctrl+click</kbd> - (or <kbd>middle mouse click</kbd>) on note link opens note in a new tab",
"newTabWithActivationNoteLink": "<kbd>Ctrl+Shift+click</kbd> - (or <kbd>Shift+middle mouse click</kbd>) on note link opens and activates the note in a new tab",
"newTabNoteLink": "on note link opens note in a new tab",
"newTabWithActivationNoteLink": "on note link opens and activates the note in a new tab",
"onlyInDesktop": "Only in desktop (Electron build)",
"openEmptyTab": "open empty tab",
"closeActiveTab": "close active tab",
@@ -142,14 +135,14 @@
"moveNoteUpHierarchy": "move note up in the hierarchy",
"multiSelectNote": "multi-select note above/below",
"selectAllNotes": "select all notes in the current level",
"selectNote": "<kbd>Shift+click</kbd> - select note",
"selectNote": "select note",
"copyNotes": "copy active note (or current selection) into clipboard (used for <a class=\"external\" href=\"https://triliumnext.github.io/Docs/Wiki/cloning-notes.html#cloning-notes\">cloning</a>)",
"cutNotes": "cut current note (or current selection) into clipboard (used for moving notes)",
"pasteNotes": "paste note(s) as sub-note into active note (which is either move or clone depending on whether it was copied or cut into clipboard)",
"deleteNotes": "delete note / sub-tree",
"editingNotes": "Editing notes",
"editNoteTitle": "in tree pane will switch from tree pane into note title. Enter from note title will switch focus to text editor. <kbd>Ctrl+.</kbd> will switch back from editor to tree pane.",
"createEditLink": "<kbd>Ctrl+K</kbd> - create / edit external link",
"createEditLink": "create / edit external link",
"createInternalLink": "create internal link",
"followLink": "follow link under cursor",
"insertDateTime": "insert current date and time at caret position",
@@ -169,7 +162,6 @@
},
"import": {
"importIntoNote": "Import into note",
"close": "Close",
"chooseImportFile": "Choose import file",
"importDescription": "Content of the selected file(s) will be imported as child note(s) into",
"options": "Options",
@@ -196,14 +188,13 @@
},
"include_note": {
"dialog_title": "Include note",
"close": "Close",
"label_note": "Note",
"placeholder_search": "search for note by its name",
"box_size_prompt": "Box size of the included note:",
"box_size_small": "small (~ 10 lines)",
"box_size_medium": "medium (~ 30 lines)",
"box_size_full": "full (box shows complete text)",
"button_include": "Include note <kbd>enter</kbd>"
"button_include": "Include note"
},
"info": {
"modalTitle": "Info message",
@@ -211,24 +202,21 @@
"okButton": "OK"
},
"jump_to_note": {
"search_placeholder": "search for note by its name",
"close": "Close",
"search_button": "Search in full text <kbd>Ctrl+Enter</kbd>"
"search_placeholder": "Search for note by its name or type > for commands...",
"search_button": "Search in full text"
},
"markdown_import": {
"dialog_title": "Markdown import",
"close": "Close",
"modal_body_text": "Because of browser sandbox it's not possible to directly read clipboard from JavaScript. Please paste the Markdown to import to textarea below and click on Import button",
"import_button": "Import Ctrl+Enter",
"import_button": "Import",
"import_success": "Markdown content has been imported into the document."
},
"move_to": {
"dialog_title": "Move notes to ...",
"close": "Close",
"notes_to_move": "Notes to move",
"target_parent_note": "Target parent note",
"search_placeholder": "search for note by its name",
"move_button": "Move to selected note <kbd>enter</kbd>",
"move_button": "Move to selected note",
"error_no_path": "No path to move to.",
"move_success_message": "Selected notes have been moved into "
},
@@ -236,20 +224,19 @@
"change_path_prompt": "Change where to create the new note:",
"search_placeholder": "search path by name (default if empty)",
"modal_title": "Choose note type",
"close": "Close",
"modal_body": "Choose note type / template of the new note:",
"templates": "Templates:"
"templates": "Templates",
"builtin_templates": "Built-in Templates"
},
"password_not_set": {
"title": "Password is not set",
"close": "Close",
"body1": "Protected notes are encrypted using a user password, but password has not been set yet.",
"body2": "To be able to protect notes, click <a class=\"open-password-options-button\" href=\"javascript:\">here</a> to open the Options dialog and set your password."
"body2": "To be able to protect notes, click the button below to open the Options dialog and set your password.",
"go_to_password_options": "Go to Password options"
},
"prompt": {
"title": "Prompt",
"close": "Close",
"ok": "OK <kbd>enter</kbd>",
"ok": "OK",
"defaultTitle": "Prompt"
},
"protected_session_password": {
@@ -257,12 +244,11 @@
"help_title": "Help on Protected notes",
"close_label": "Close",
"form_label": "To proceed with requested action you need to start protected session by entering password:",
"start_button": "Start protected session <kbd>enter</kbd>"
"start_button": "Start protected session"
},
"recent_changes": {
"title": "Recent changes",
"erase_notes_button": "Erase deleted notes now",
"close": "Close",
"deleted_notes_message": "Deleted notes have been erased.",
"no_changes_message": "No changes yet...",
"undelete_link": "undelete",
@@ -273,7 +259,6 @@
"delete_all_revisions": "Delete all revisions of this note",
"delete_all_button": "Delete all revisions",
"help_title": "Help on Note Revisions",
"close": "Close",
"revision_last_edited": "This revision was last edited on {{date}}",
"confirm_delete_all": "Do you want to delete all revisions of this note?",
"no_revisions": "No revisions for this note yet...",
@@ -295,7 +280,6 @@
},
"sort_child_notes": {
"sort_children_by": "Sort children by...",
"close": "Close",
"sorting_criteria": "Sorting criteria",
"title": "title",
"date_created": "date created",
@@ -309,13 +293,12 @@
"sort_with_respect_to_different_character_sorting": "sort with respect to different character sorting and collation rules in different languages or regions.",
"natural_sort_language": "Natural sort language",
"the_language_code_for_natural_sort": "The language code for natural sort, e.g. \"zh-CN\" for Chinese.",
"sort": "Sort <kbd>enter</kbd>"
"sort": "Sort"
},
"upload_attachments": {
"upload_attachments_to_note": "Upload attachments to note",
"close": "Close",
"choose_files": "Choose files",
"files_will_be_uploaded": "Files will be uploaded as attachments into",
"files_will_be_uploaded": "Files will be uploaded as attachments into {{noteTitle}}",
"options": "Options",
"shrink_images": "Shrink images",
"upload": "Upload",
@@ -443,7 +426,8 @@
"other_notes_with_name": "Other notes with {{attributeType}} name \"{{attributeName}}\"",
"and_more": "... and {{count}} more.",
"print_landscape": "When exporting to PDF, changes the orientation of the page to landscape instead of portrait.",
"print_page_size": "When exporting to PDF, changes the size of the page. Supported 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>."
"print_page_size": "When exporting to PDF, changes the size of the page. Supported 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>.",
"color_type": "Color"
},
"attribute_editor": {
"help_text_body1": "To add label, just type e.g. <code>#rock</code> or if you want to add also value then e.g. <code>#year = 2020</code>",
@@ -758,11 +742,12 @@
"expand_all_children": "Expand all children",
"collapse": "Collapse",
"expand": "Expand",
"book_properties": "Book Properties",
"book_properties": "Collection Properties",
"invalid_view_type": "Invalid view type '{{type}}'",
"calendar": "Calendar",
"table": "Table",
"geo-map": "Geo Map"
"geo-map": "Geo Map",
"board": "Board"
},
"edited_notes": {
"no_edited_notes_found": "No edited notes on this day yet...",
@@ -839,7 +824,8 @@
"unknown_label_type": "Unknown label type '{{type}}'",
"unknown_attribute_type": "Unknown attribute type '{{type}}'",
"add_new_attribute": "Add new attribute",
"remove_this_attribute": "Remove this attribute"
"remove_this_attribute": "Remove this attribute",
"remove_color": "Remove the color label"
},
"script_executor": {
"query": "Query",
@@ -962,7 +948,7 @@
"no_attachments": "This note has no attachments."
},
"book": {
"no_children_help": "This note of type Book doesn't have any child notes so there's nothing to display. See <a href=\"https://triliumnext.github.io/Docs/Wiki/book-note.html\">wiki</a> for details."
"no_children_help": "This collection doesn't have any child notes so there's nothing to display. See <a href=\"https://triliumnext.github.io/Docs/Wiki/book-note.html\">wiki</a> for details."
},
"editable_code": {
"placeholder": "Type the content of your code note here..."
@@ -1025,7 +1011,7 @@
"title": "Consistency Checks",
"find_and_fix_button": "Find and fix consistency issues",
"finding_and_fixing_message": "Finding and fixing consistency issues...",
"issues_fixed_message": "Consistency issues should be fixed."
"issues_fixed_message": "Any consistency issue which may have been found is now fixed."
},
"database_anonymization": {
"title": "Database Anonymization",
@@ -1115,12 +1101,12 @@
"title": "Application Theme",
"theme_label": "Theme",
"override_theme_fonts_label": "Override theme fonts",
"auto_theme": "Auto",
"light_theme": "Light",
"dark_theme": "Dark",
"triliumnext": "TriliumNext Beta (Follow system color scheme)",
"triliumnext-light": "TriliumNext Beta (Light)",
"triliumnext-dark": "TriliumNext Beta (Dark)",
"auto_theme": "Legacy (Follow system color scheme)",
"light_theme": "Legacy (Light)",
"dark_theme": "Legacy (Dark)",
"triliumnext": "Trilium (Follow system color scheme)",
"triliumnext-light": "Trilium (Light)",
"triliumnext-dark": "Trilium (Dark)",
"layout": "Layout",
"layout-vertical-title": "Vertical",
"layout-horizontal-title": "Horizontal",
@@ -1595,12 +1581,13 @@
"move-to": "Move to...",
"paste-into": "Paste into",
"paste-after": "Paste after",
"duplicate-subtree": "Duplicate subtree",
"duplicate": "Duplicate",
"export": "Export",
"import-into-note": "Import into note",
"apply-bulk-actions": "Apply bulk actions",
"converted-to-attachments": "{{count}} notes have been converted to attachments.",
"convert-to-attachment-confirm": "Are you sure you want to convert note selected notes into attachments of their parent notes?"
"convert-to-attachment-confirm": "Are you sure you want to convert note selected notes into attachments of their parent notes?",
"open-in-popup": "Quick edit"
},
"shared_info": {
"shared_publicly": "This note is shared publicly on",
@@ -1614,7 +1601,7 @@
"relation-map": "Relation Map",
"note-map": "Note Map",
"render-note": "Render Note",
"book": "Book",
"book": "Collection",
"mermaid-diagram": "Mermaid Diagram",
"canvas": "Canvas",
"web-view": "Web View",
@@ -1629,7 +1616,8 @@
"beta-feature": "Beta",
"ai-chat": "AI Chat",
"task-list": "Task List",
"new-feature": "New"
"new-feature": "New",
"collections": "Collections"
},
"protect_note": {
"toggle-on": "Protect the note",
@@ -1831,7 +1819,8 @@
"link_context_menu": {
"open_note_in_new_tab": "Open note in a new tab",
"open_note_in_new_split": "Open note in a new split",
"open_note_in_new_window": "Open note in a new window"
"open_note_in_new_window": "Open note in a new window",
"open_note_in_popup": "Quick edit"
},
"electron_integration": {
"desktop-application": "Desktop Application",
@@ -1851,7 +1840,8 @@
"full-text-search": "Full text search"
},
"note_tooltip": {
"note-has-been-deleted": "Note has been deleted."
"note-has-been-deleted": "Note has been deleted.",
"quick-edit": "Quick edit"
},
"geo-map": {
"create-child-note-title": "Create a new child note and add it to the map",
@@ -1940,6 +1930,75 @@
},
"table_view": {
"new-row": "New row",
"new-column": "New column"
"new-column": "New column",
"sort-column-by": "Sort by \"{{title}}\"",
"sort-column-ascending": "Ascending",
"sort-column-descending": "Descending",
"sort-column-clear": "Clear sorting",
"hide-column": "Hide column \"{{title}}\"",
"show-hide-columns": "Show/hide columns",
"row-insert-above": "Insert row above",
"row-insert-below": "Insert row below",
"row-insert-child": "Insert child note",
"add-column-to-the-left": "Add column to the left",
"add-column-to-the-right": "Add column to the right",
"edit-column": "Edit column",
"delete_column_confirmation": "Are you sure you want to delete this column? The corresponding attribute will be removed from all notes.",
"delete-column": "Delete column",
"new-column-label": "Label",
"new-column-relation": "Relation"
},
"book_properties_config": {
"hide-weekends": "Hide weekends",
"display-week-numbers": "Display week numbers",
"map-style": "Map style:",
"max-nesting-depth": "Max nesting depth:",
"raster": "Raster",
"vector_light": "Vector (Light)",
"vector_dark": "Vector (Dark)",
"show-scale": "Show scale"
},
"table_context_menu": {
"delete_row": "Delete row"
},
"board_view": {
"delete-note": "Delete Note",
"move-to": "Move to",
"insert-above": "Insert above",
"insert-below": "Insert below",
"delete-column": "Delete column",
"delete-column-confirmation": "Are you sure you want to delete this column? The corresponding attribute will be deleted in the notes under this column as well.",
"new-item": "New item",
"add-column": "Add Column"
},
"command_palette": {
"tree-action-name": "Tree: {{name}}",
"export_note_title": "Export Note",
"export_note_description": "Export current note",
"show_attachments_title": "Show Attachments",
"show_attachments_description": "View note attachments",
"search_notes_title": "Search Notes",
"search_notes_description": "Open advanced search",
"search_subtree_title": "Search in Subtree",
"search_subtree_description": "Search within current subtree",
"search_history_title": "Show Search History",
"search_history_description": "View previous searches",
"configure_launch_bar_title": "Configure Launch Bar",
"configure_launch_bar_description": "Open the launch bar configuration, to add or remove items."
},
"content_renderer": {
"open_externally": "Open externally"
},
"modal": {
"close": "Close",
"help_title": "Display more information about this screen"
},
"call_to_action": {
"next_theme_title": "The new Trilium theme is now stable",
"next_theme_message": "For a while now, we've been working on a new theme to give the application a more modern look.",
"next_theme_button": "Switch to the new Trilium theme",
"background_effects_title": "Background effects are now stable",
"background_effects_message": "On Windows devices, background effects are now fully stable. The background effects adds a touch of color to the user interface by blurring the background behind it. This technique is also used in other applications such as Windows Explorer.",
"background_effects_button": "Enable background effects"
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,345 @@
{
"about": {
"app_version": "Versione dell'app:",
"db_version": "Versione DB:",
"sync_version": "Versione Sync:",
"data_directory": "Cartella dati:",
"title": "Informazioni su Trilium Notes",
"build_date": "Data della build:",
"build_revision": "Revisione della build:",
"homepage": "Homepage:"
},
"toast": {
"critical-error": {
"title": "Errore critico",
"message": "Si è verificato un errore critico che impedisce l'avvio dell'applicazione client:\n\n{{message}}\n\nQuesto è probabilmente causato da un errore di script inaspettato. Prova a avviare l'applicazione in modo sicuro e controlla il problema."
},
"bundle-error": {
"title": "Non si è riusciti a caricare uno script personalizzato",
"message": "Lo script della nota con ID \"{{id}}\", dal titolo \"{{title}}\" non è stato inizializzato a causa di:\n\n{{message}}"
},
"widget-error": {
"title": "Impossibile inizializzare un widget",
"message-custom": "Il widget personalizzato della nota con ID \"{{id}}\", dal titolo \"{{title}}\" non è stato inizializzato a causa di:\n\n{{message}}",
"message-unknown": "Un widget sconosciuto non è stato inizializzato a causa di:\n\n{{message}}"
}
},
"add_link": {
"add_link": "Aggiungi un collegamento",
"note": "Nota",
"search_note": "cerca una nota per nome",
"link_title_mirrors": "il titolo del collegamento rispecchia il titolo della nota corrente",
"link_title_arbitrary": "il titolo del collegamento può essere modificato arbitrariamente",
"link_title": "Titolo del collegamento",
"button_add_link": "Aggiungi il collegamento <kbd>invio</kbd>",
"help_on_links": "Aiuto sui collegamenti"
},
"branch_prefix": {
"edit_branch_prefix": "Modifica il prefisso del ramo",
"help_on_tree_prefix": "Aiuto sui prefissi dell'Albero",
"prefix": "Prefisso: ",
"save": "Salva",
"branch_prefix_saved": "Il prefisso del ramo è stato salvato."
},
"bulk_actions": {
"bulk_actions": "Azioni massive",
"affected_notes": "Note influenzate",
"include_descendants": "Includi i discendenti della nota selezionata",
"available_actions": "Azioni disponibili",
"chosen_actions": "Azioni scelte",
"execute_bulk_actions": "Esegui le azioni massive",
"bulk_actions_executed": "Le azioni massive sono state eseguite con successo.",
"none_yet": "Ancora nessuna... aggiungi una azione cliccando su una di quelle disponibili sopra.",
"labels": "Etichette",
"relations": "Relazioni",
"notes": "Note",
"other": "Altro"
},
"clone_to": {
"clone_notes_to": "Clona note in...",
"help_on_links": "Aiuto sui collegamenti",
"notes_to_clone": "Note da clonare",
"target_parent_note": "Nodo padre obiettivo",
"search_for_note_by_its_name": "cerca una nota per nome",
"cloned_note_prefix_title": "Le note clonate saranno mostrate nell'albero delle note con il dato prefisso",
"prefix_optional": "Prefisso (opzionale)",
"clone_to_selected_note": "Clona sotto la nota selezionata <kbd>invio</kbd>",
"no_path_to_clone_to": "Nessun percorso per clonare dentro.",
"note_cloned": "La nota \"{{clonedTitle}}\" è stata clonata in \"{{targetTitle}}\""
},
"confirm": {
"cancel": "Annulla",
"ok": "OK",
"confirmation": "Conferma",
"are_you_sure_remove_note": "Sei sicuro di voler rimuovere la nota \"{{title}}\" dalla mappa delle relazioni? ",
"if_you_dont_check": "Se non lo selezioni, la nota sarà rimossa solamente dalla mappa delle relazioni.",
"also_delete_note": "Rimuove anche la nota"
},
"delete_notes": {
"ok": "OK",
"close": "Chiudi",
"delete_notes_preview": "Anteprima di eliminazione delle note",
"delete_all_clones_description": "Elimina anche tutti i cloni (può essere disfatto tramite i cambiamenti recenti)",
"erase_notes_description": "L'eliminazione normale (soft) marca le note come eliminate e potranno essere recuperate entro un certo lasso di tempo (dalla finestra dei cambiamenti recenti). Selezionando questa opzione le note si elimineranno immediatamente e non sarà possibile recuperarle.",
"erase_notes_warning": "Elimina le note in modo permanente (non potrà essere disfatto), compresi tutti i cloni. Ciò forzerà un nuovo caricamento dell'applicazione.",
"cancel": "Annulla",
"notes_to_be_deleted": "Le seguenti note saranno eliminate ({{- noteCount}})",
"no_note_to_delete": "Nessuna nota sarà eliminata (solo i cloni).",
"broken_relations_to_be_deleted": "Le seguenti relazioni saranno interrotte ed eliminate ({{- relationCount}})",
"deleted_relation_text": "La nota {{- note}} (da eliminare) è referenziata dalla relazione {{- relation}} originata da {{- source}}."
},
"info": {
"okButton": "OK",
"closeButton": "Chiudi"
},
"export": {
"close": "Chiudi",
"export_note_title": "Esporta la nota",
"export_status": "Stato dell'esportazione",
"export": "Esporta",
"choose_export_type": "Scegli prima il tipo di esportazione, per favore",
"export_in_progress": "Esportazione in corso: {{progressCount}}",
"export_finished_successfully": "Esportazione terminata con successo.",
"format_pdf": "PDF- allo scopo di stampa o esportazione.",
"export_type_subtree": "Questa nota e tutti i suoi discendenti",
"format_html": "HTML - raccomandato in quanto mantiene tutti i formati",
"format_html_zip": "HTML in archivio ZIP - questo è raccomandato in quanto conserva tutta la formattazione.",
"format_markdown": "MArkdown - questo conserva la maggior parte della formattazione."
},
"password_not_set": {
"body1": "Le note protette sono crittografate utilizzando una password utente, ma la password non è stata ancora impostata.",
"body2": "Per proteggere le note, fare clic su <a class=\"open-password-options-button\" href=\"javascript:\">qui</a> per aprire la finestra di dialogo Opzioni e impostare la password."
},
"protected_session_password": {
"close_label": "Chiudi"
},
"abstract_bulk_action": {
"remove_this_search_action": "Rimuovi questa azione di ricerca"
},
"etapi": {
"new_token_title": "Nuovo token ETAPI",
"new_token_message": "Inserire il nuovo nome del token"
},
"electron_integration": {
"zoom-factor": "Fattore di ingrandimento",
"desktop-application": "Applicazione Desktop"
},
"note_autocomplete": {
"search-for": "Cerca \"{{term}}\"",
"create-note": "Crea e collega la nota figlia \"{{term}}\"",
"insert-external-link": "Inserisci il collegamento esterno a \"{{term}}\"",
"clear-text-field": "Pulisci il campo di testo",
"show-recent-notes": "Mostra le note recenti",
"full-text-search": "Ricerca full text"
},
"note_tooltip": {
"note-has-been-deleted": "La nota è stata eliminata.",
"quick-edit": "Modifica veloce"
},
"geo-map": {
"create-child-note-title": "Crea una nota figlia e aggiungila alla mappa",
"create-child-note-instruction": "Clicca sulla mappa per creare una nuova nota qui o premi Escape per uscire.",
"unable-to-load-map": "Impossibile caricare la mappa."
},
"geo-map-context": {
"open-location": "Apri la posizione",
"remove-from-map": "Rimuovi dalla mappa",
"add-note": "Aggiungi un marcatore in questa posizione"
},
"debug": {
"debug": "Debug"
},
"database_anonymization": {
"light_anonymization": "Anonimizzazione parziale",
"title": "Anonimizzazione del Database",
"full_anonymization": "Anonimizzazione completa",
"full_anonymization_description": "Questa azione creerà una nuova copia del database e lo anonimizzerà (rimuove tutti i contenuti delle note, lasciando solo la struttura e qualche metadato non sensibile) per condividerlo online allo scopo di debugging, senza paura di far trapelare i tuoi dati personali.",
"save_fully_anonymized_database": "Salva il database completamente anonimizzato",
"light_anonymization_description": "Questa azione creerà una nuova copia del database e lo anonimizzerà in parzialmente — in particolare, solo il contenuto delle note sarà rimosso, ma i titoli e gli attributi rimarranno. Inoltre, note con script personalizzati JS di frontend/backend e widget personalizzati lasciando rimarranno. Ciò mette a disposizione più contesto per il debug dei problemi.",
"choose_anonymization": "Puoi decidere da solo se fornire un database completamente o parzialmente anonimizzato. Anche un database completamente anonimizzato è molto utile, sebbene in alcuni casi i database parzialmente anonimizzati possono accelerare il processo di identificazione dei bug e la loro correzione.",
"no_anonymized_database_yet": "Nessun database ancora anonimizzato.",
"save_lightly_anonymized_database": "Salva il database parzialmente anonimizzato",
"successfully_created_fully_anonymized_database": "Database completamente anonimizzato creato in {{anonymizedFilePath}}",
"successfully_created_lightly_anonymized_database": "Database parzialmente anonimizzato creato in {{anonymizedFilePath}}"
},
"cpu_arch_warning": {
"title": "Per favore scarica la versione ARM64",
"continue_anyway": "Continua Comunque",
"dont_show_again": "Non mostrare più questo avviso",
"download_link": "Scarica la Versione Nativa"
},
"editorfeatures": {
"title": "Caratteristiche",
"emoji_completion_enabled": "Abilita il completamento automatico delle Emoji",
"note_completion_enabled": "Abilita il completamento automatico delle note"
},
"table_view": {
"new-row": "Nuova riga",
"new-column": "Nuova colonna",
"sort-column-by": "Ordina per \"{{title}}\"",
"sort-column-ascending": "Ascendente",
"sort-column-descending": "Discendente",
"sort-column-clear": "Cancella l'ordinamento",
"hide-column": "Nascondi la colonna \"{{title}}\"",
"show-hide-columns": "Mostra/nascondi le colonne",
"row-insert-above": "Inserisci una riga sopra",
"row-insert-below": "Inserisci una riga sotto"
},
"abstract_search_option": {
"remove_this_search_option": "Rimuovi questa opzione di ricerca",
"failed_rendering": "Opzione di ricerca di rendering non riuscita: {{dto}} con errore: {{error}} {{stack}}"
},
"ancestor": {
"label": "Antenato"
},
"add_label": {
"add_label": "Aggiungi etichetta",
"label_name_placeholder": "nome dell'etichetta",
"new_value_placeholder": "nuovo valore",
"to_value": "al valore"
},
"update_label_value": {
"to_value": "al valore",
"label_name_placeholder": "nome dell'etichetta"
},
"delete_label": {
"delete_label": "Elimina etichetta",
"label_name_placeholder": "nome dell'etichetta",
"label_name_title": "Sono ammessi i caratteri alfanumerici, il carattere di sottolineato e i due punti."
},
"tree-context-menu": {
"move-to": "Muovi in...",
"cut": "Taglia"
},
"electron_context_menu": {
"cut": "Taglia",
"copy": "Copia",
"paste": "Incolla",
"copy-link": "Copia collegamento",
"paste-as-plain-text": "Incolla come testo semplice"
},
"editing": {
"editor_type": {
"multiline-toolbar": "Mostra la barra degli strumenti su più linee se non entra."
}
},
"edit_button": {
"edit_this_note": "Modifica questa nota"
},
"shortcuts": {
"shortcuts": "Scorciatoie"
},
"shared_switch": {
"toggle-on-title": "Condividi la nota",
"toggle-off-title": "Non condividere la nota"
},
"search_string": {
"search_prefix": "Cerca:"
},
"attachment_detail": {
"open_help_page": "Apri la pagina di aiuto sugli allegati"
},
"search_definition": {
"ancestor": "antenato",
"debug": "debug",
"action": "azione",
"add_search_option": "Aggiungi un opzione di ricerca:",
"search_string": "cerca la stringa",
"limit": "limite"
},
"modal": {
"close": "Chiudi"
},
"board_view": {
"insert-below": "Inserisci sotto",
"delete-column": "Elimina la colonna",
"delete-column-confirmation": "Sei sicuro di vole eliminare questa colonna? Il corrispondente attributo sarà eliminato anche nelle note sotto questa colonna."
},
"backup": {
"enable_weekly_backup": "Abilita le archiviazioni settimanali",
"enable_monthly_backup": "Abilita le archiviazioni mensili",
"backup_recommendation": "Si raccomanda di mantenere attive le archiviazioni, sebbene ciò possa rendere l'avvio dell'applicazione lento con database grandi e/o dispositivi di archiviazione lenti.",
"backup_now": "Archivia adesso",
"backup_database_now": "Archivia il database adesso",
"existing_backups": "Backup esistenti",
"date-and-time": "Data e ora",
"path": "Percorso",
"database_backed_up_to": "Il database è stato archiviato in {{backupFilePath}}",
"enable_daily_backup": "Abilita le archiviazioni giornaliere",
"no_backup_yet": "Ancora nessuna archiviazione"
},
"backend_log": {
"refresh": "Aggiorna"
},
"consistency_checks": {
"find_and_fix_button": "Trova e correggi i problemi di coerenza",
"finding_and_fixing_message": "In cerca e correzione dei problemi di coerenza...",
"issues_fixed_message": "Qualsiasi problema di coerenza che possa essere stato trovato ora è corretto."
},
"database_integrity_check": {
"check_button": "Controllo dell'integrità del database",
"checking_integrity": "Controllo dell'integrità del database in corso...",
"title": "Controllo di Integrità del database",
"description": "Controllerà che il database non sia corrotto a livello SQLite. Può durare un po' di tempo, a seconda della grandezza del DB.",
"integrity_check_failed": "Controllo di integrità fallito: {{results}}"
},
"sync": {
"title": "Sincronizza",
"force_full_sync_button": "Forza una sincronizzazione completa",
"failed": "Sincronizzazione fallita: {{message}}"
},
"sync_2": {
"config_title": "Configurazione per la Sincronizzazione",
"proxy_label": "Server Proxy per la sincronizzazione (opzionale)",
"test_title": "Test di sincronizzazione",
"timeout": "Timeout per la sincronizzazione",
"timeout_unit": "millisecondi",
"save": "Salva",
"help": "Aiuto"
},
"search_engine": {
"save_button": "Salva"
},
"sql_table_schemas": {
"tables": "Tabelle"
},
"tab_row": {
"close_tab": "Chiudi la scheda",
"add_new_tab": "Aggiungi una nuova scheda",
"close": "Chiudi",
"close_other_tabs": "Chiudi le altre schede",
"close_right_tabs": "Chiudi le schede a destra",
"close_all_tabs": "Chiudi tutte le schede",
"reopen_last_tab": "Riapri l'ultima scheda chiusa",
"move_tab_to_new_window": "Sposta questa scheda in una nuova finestra",
"copy_tab_to_new_window": "Copia questa scheda in una nuova finestra",
"new_tab": "Nuova scheda"
},
"toc": {
"table_of_contents": "Sommario"
},
"table_of_contents": {
"title": "Sommario"
},
"tray": {
"title": "Vassoio di Sistema",
"enable_tray": "Abilita il vassoio (Trilium necessita di essere riavviato affinché la modifica abbia effetto)"
},
"heading_style": {
"title": "Stile dell'Intestazione",
"plain": "Normale",
"underline": "Sottolineato",
"markdown": "Stile Markdown"
},
"highlights_list": {
"title": "Punti salienti"
},
"highlights_list_2": {
"title": "Punti salienti",
"options": "Opzioni"
},
"quick-search": {
"placeholder": "Ricerca rapida",
"searching": "Ricerca in corso..."
}
}

Some files were not shown because too many files have changed in this diff Show More