Compare commits

...

353 Commits

Author SHA1 Message Date
perf3ct
912bc61730 feat(search): also limit note content that can be searched, but keep searchability of titles 2025-08-28 18:56:06 +00:00
perf3ct
93e8459d4b feat(quick_search): remove some old variables that are no longer used now 2025-08-27 22:33:38 +00:00
perf3ct
6c26fa709e feat(quick_search): just fuzzy match note titles for larger notes, while still matching on exact strings 2025-08-27 21:11:44 +00:00
Elian Doran
f3416fa03e Translations update from Hosted Weblate (#6807) 2025-08-27 20:31:34 +03:00
rodrigomescua
3e5ab2b1e1 Translated using Weblate (Portuguese (Brazil))
Currently translated at 82.0% (1284 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-27 17:15:24 +00:00
Newcomer1989
5c0bc9a7c2 Translated using Weblate (German)
Currently translated at 91.8% (1437 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-27 17:15:23 +00:00
Elian Doran
2adfa55acd React context-aware widgets (ribbon, note actions, note title) (#6731) 2025-08-27 20:15:04 +03:00
Elian Doran
8125e8afcd fix(react/options): plain text not disabled 2025-08-27 20:14:33 +03:00
Elian Doran
e328f18558 feat(react/ribbon): edit content languages in modal 2025-08-27 19:56:14 +03:00
Elian Doran
cbdfa9079c fix(react/ribbon): bad right margin of note type 2025-08-27 19:51:24 +03:00
Elian Doran
e08c4515a7 fix(react/ribbon): note type not always updating 2025-08-27 19:49:22 +03:00
Elian Doran
650aa16b89 feat(react/ribbon): improve style of note type modal 2025-08-27 19:46:26 +03:00
Elian Doran
11d908218b feat(react/ribbon): allow editing code types directly 2025-08-27 19:42:20 +03:00
Elian Doran
3627a7dc93 refactor(react/dialogs): allow modals in sub-components 2025-08-27 19:35:47 +03:00
Elian Doran
1e1c8cc4ff fix(ribbon): code note types not refreshing 2025-08-27 19:13:30 +03:00
Elian Doran
d616bc09c9 chore(e2e): remove test that is no longer relevant 2025-08-27 18:55:52 +03:00
Elian Doran
f1cef44d5d Merge remote-tracking branch 'origin/main' into react/note_context_aware
; Conflicts:
;	pnpm-lock.yaml
2025-08-27 18:30:19 +03:00
Elian Doran
3795be4750 Translations update from Hosted Weblate (#6802) 2025-08-27 18:29:13 +03:00
Elian Doran
2bb66a7526 chore(react): fix some more type errors 2025-08-27 18:27:47 +03:00
Elian Doran
28a472782f chore(react): remove debug log 2025-08-27 18:26:27 +03:00
Elian Doran
a4da002352 fix(react/ribbon): saving from attribute dialog not working 2025-08-27 18:25:54 +03:00
Elian Doran
94fdc2beee fix(react/dialogs): formatting toolbar shown in code notes in quick edit 2025-08-27 18:12:39 +03:00
Elian Doran
dd4a01d9f8 fix(react/dialogs): jump to note sometimes showing empty list 2025-08-27 17:59:37 +03:00
Elian Doran
a2a6c67350 fix(react): alignment and size of search/bulk action buttons 2025-08-27 17:53:27 +03:00
Elian Doran
2152ca7ba6 fix(react): search crashing due to bad rendering mechanism 2025-08-27 17:46:20 +03:00
Elian Doran
40e4d236f4 fix(react): owned attributes not showing up the first time 2025-08-27 17:42:38 +03:00
Elian Doran
0450cd080d fix(react): note context sometimes not working on mobile 2025-08-27 17:37:28 +03:00
Elian Doran
1eaac79d63 fix(react/ribbon): note context menu button looking off 2025-08-27 16:58:01 +03:00
Elian Doran
19c0305ed9 fix(react/revisions): revision list overflowing when too many 2025-08-27 16:41:42 +03:00
Elian Doran
f0d14a966a fix(react/revisions): wrong selection when navigating between notes 2025-08-27 16:39:48 +03:00
Elian Doran
37e6ccdc1a fix(react/revisions): selection not possible due to new hierarchy 2025-08-27 16:37:07 +03:00
Elian Doran
06cea99b40 fix(react): note title not selecting text 2025-08-27 16:28:07 +03:00
Elian Doran
1851336862 fix(react/ribbon): solve some type errors 2025-08-27 16:17:19 +03:00
Elian Doran
461eb273d9 fix(react/ribbon): attribute editor sometimes not clearing between notes 2025-08-27 15:53:27 +03:00
Elian Doran
470edc4d70 fix(react/ribbon): attribute editor saving unnecessarily 2025-08-27 15:35:44 +03:00
Elian Doran
26132a2a56 fix(react/ribbon): crash due to misuse of component rendering 2025-08-27 15:19:31 +03:00
Elian Doran
d92bd16042 chore(react/ribbon): react to note type changes 2025-08-27 14:56:18 +03:00
Elian Doran
1c7dfa6c91 chore(react/ribbon): fix activation of add new label to all tabs 2025-08-27 13:19:52 +03:00
Elian Doran
3a3fed4314 chore(react/ribbon): fix 3px height of the ribbon when collapsed 2025-08-27 13:13:02 +03:00
Elian Doran
82bdb76d75 chore(react/ribbon): simplify useNoteContext & handle setNoteContext 2025-08-27 13:06:57 +03:00
Elian Doran
066f3ea078 chore(react/ribbon): react to add new label/relation even when not shown 2025-08-27 13:05:51 +03:00
Elian Doran
9d760a21d5 chore(react/ribbon): disable when view mode is not good 2025-08-27 12:20:11 +03:00
Elian Doran
976c795ac6 chore(react/ribbon): add tooltip with keyboard shortcut 2025-08-27 12:16:40 +03:00
Elian Doran
ed320e4e24 chore(client): fix type error due to React integration 2025-08-27 11:59:07 +03:00
Newcomer1989
3111738700 Translated using Weblate (German)
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/de/
2025-08-27 10:28:44 +02:00
rodrigomescua
1fa0bada23 Translated using Weblate (Portuguese (Brazil))
Currently translated at 62.5% (978 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-27 10:28:44 +02:00
Newcomer1989
11eca7e58b Translated using Weblate (German)
Currently translated at 90.3% (1413 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-27 10:28:44 +02:00
toaik
4b50e2f14d Translated using Weblate (German)
Currently translated at 90.3% (1413 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-27 10:28:43 +02:00
Newcomer1989
63faba9603 Translated using Weblate (German)
Currently translated at 90.3% (1413 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-27 10:28:43 +02:00
Elian Doran
3e213699e0 chore(client): fix type error due to React integration 2025-08-27 11:27:49 +03:00
Elian Doran
c88ff07691 chore(deps): update dependency typedoc to v0.28.11 (#6792) 2025-08-27 11:25:52 +03:00
Elian Doran
b53aa5cf6e chore(deps): update svelte monorepo (#6793) 2025-08-27 11:25:44 +03:00
Elian Doran
2641b9b3fe fix(deps): update dependency bootstrap to v5.3.8 (#6794) 2025-08-27 11:25:35 +03:00
Elian Doran
3a2a73992c chore(deps): update dependency @types/node to v22.18.0 (#6795) 2025-08-27 11:24:39 +03:00
Elian Doran
b82b17a701 chore(deps): update typescript-eslint monorepo to v8.41.0 (#6796) 2025-08-27 11:24:27 +03:00
renovate[bot]
a6202edcd1 chore(deps): update typescript-eslint monorepo to v8.41.0 2025-08-27 02:40:21 +00:00
renovate[bot]
6eac0cb75d chore(deps): update dependency @types/node to v22.18.0 2025-08-27 02:38:43 +00:00
renovate[bot]
83672d6138 fix(deps): update dependency bootstrap to v5.3.8 2025-08-27 02:38:15 +00:00
renovate[bot]
51dadf72d0 chore(deps): update svelte monorepo 2025-08-27 02:37:45 +00:00
renovate[bot]
0cbf61acb3 chore(deps): update dependency typedoc to v0.28.11 2025-08-27 02:37:12 +00:00
Elian Doran
399c7435ac Merge remote-tracking branch 'origin/main' into react/note_context_aware 2025-08-26 23:49:00 +03:00
Elian Doran
d51fae7878 fix(mobile): file properties not displayed 2025-08-26 23:23:45 +03:00
Elian Doran
9750e25ad5 fix(mobile): note title not working 2025-08-26 22:21:42 +03:00
Elian Doran
2f9b2f0e8f refactor(react): rename formatting toolbar for clarity 2025-08-26 21:57:28 +03:00
Elian Doran
8deaf22544 fix(quick_edit): classic toolbar not shown 2025-08-26 21:45:22 +03:00
Elian Doran
b192f43187 chore(release): prepare for 0.98.1 2025-08-26 20:35:41 +03:00
Elian Doran
8cb8d1303c docs(release): v0.98.1 2025-08-26 20:34:36 +03:00
Elian Doran
5237348975 chore(docs): fix quick search documentation not in meta 2025-08-26 19:44:01 +03:00
Elian Doran
72e2f6757e fix(client): autocomplete looking off in new tab 2025-08-26 19:15:36 +03:00
Elian Doran
cf059e7f86 Translations update from Hosted Weblate (#6787) 2025-08-26 15:36:21 +03:00
Elian Doran
44d69216b6 Translated using Weblate (Romanian)
Currently translated at 100.0% (1564 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ro/
2025-08-26 14:35:50 +02:00
Elian Doran
c38bf09af0 chore(client): fix a table nesting issue 2025-08-26 11:53:58 +03:00
Elian Doran
9373d47e86 fix: log same error message on api 401 as on login error to allow fail2ban blocking (#6782) 2025-08-26 08:53:55 +03:00
hulmgulm
29350628c3 Merge branch 'main' into main 2025-08-26 06:26:41 +02:00
Elian Doran
83d1a68879 fix(i18n): pt_BR still not working 2025-08-25 23:32:20 +03:00
hulmgulm
f188408099 Merge branch 'main' into main 2025-08-25 21:22:07 +02:00
Elian Doran
449ab3a798 fix(client/about): directory not displayed on desktop 2025-08-25 22:19:17 +03:00
hulmgulm
21504d1417 Logout same error message on api 401 as on login error 2025-08-25 21:18:01 +02:00
Elian Doran
3060b496e3 chore(client): remove redundant log 2025-08-25 22:09:29 +03:00
Elian Doran
bd35539fa1 fix(i18n): electron locale for pt_BR 2025-08-25 21:34:59 +03:00
Elian Doran
df6447e3ad feat(quick_search): also allow for the equals operator in note title's quick search (#6769) 2025-08-25 20:49:45 +03:00
Elian Doran
24fd898f0d fix(add_link): inserting link to selection not working properly (closes #6776) 2025-08-25 20:48:15 +03:00
Elian Doran
1aa6238288 chore(deps): update dependency @types/jquery to v3.5.33 (#6748) 2025-08-25 20:22:33 +03:00
Elian Doran
c16c4788da fix(client): type error 2025-08-25 20:18:51 +03:00
Elian Doran
0c35daab85 Merge remote-tracking branch 'origin/main' into renovate/jquery-3.x 2025-08-25 20:01:59 +03:00
Elian Doran
4a19639e92 fix(deps): update dependency tsx to v4.20.5 (#6775) 2025-08-25 20:00:55 +03:00
renovate[bot]
36cceea677 fix(deps): update dependency tsx to v4.20.5 2025-08-25 16:33:16 +00:00
Elian Doran
4dbc76790a Merge remote-tracking branch 'origin/main' into react/note_context_aware 2025-08-25 19:33:14 +03:00
Elian Doran
b32a344a21 chore(deps): update dependency tsx to v4.20.5 (#6772) 2025-08-25 19:31:04 +03:00
Elian Doran
3896ab822f Translations update from Hosted Weblate (#6778) 2025-08-25 19:30:49 +03:00
OKiU Network
cfa4ba57d4 Translated using Weblate (Dutch)
Currently translated at 1.8% (7 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/nl/
2025-08-25 18:29:51 +02:00
OKiU Network
da051e0269 Translated using Weblate (Dutch)
Currently translated at 0.3% (5 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/nl/
2025-08-25 18:29:50 +02:00
Cédric MARCOUX
3eda77a91f Translated using Weblate (French)
Currently translated at 88.3% (334 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/fr/
2025-08-25 18:29:49 +02:00
OKiU Network
5c2f4be5dd Added translation using Weblate (Dutch) 2025-08-25 18:29:49 +02:00
OKiU Network
435b501db9 Added translation using Weblate (Dutch) 2025-08-25 18:29:48 +02:00
Newcomer1989
5a27ffef5f Translated using Weblate (German)
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/de/
2025-08-25 18:29:47 +02:00
Luis Rebhan
02256d9a45 Translated using Weblate (German)
Currently translated at 82.9% (1297 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-25 18:29:47 +02:00
Newcomer1989
7e069009d6 Translated using Weblate (German)
Currently translated at 82.9% (1297 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/de/
2025-08-25 18:29:46 +02:00
Elian Doran
3c25cda4c0 feat(docs): also improve how environment variables are shown in docs (#6727) 2025-08-25 19:29:40 +03:00
Elian Doran
70d7ad0b1a fix(jump_to): fix issue where attributes/tags don't show in results (#6752) 2025-08-25 19:26:48 +03:00
Elian Doran
e793b2f661 feat(config): fix previously documented env var formula not working (#6726) 2025-08-25 19:23:35 +03:00
Elian Doran
917ea3e401 feat(react): set up ESLint 2025-08-25 18:42:07 +03:00
Elian Doran
5a54dd666f refactor(react): fix a few more rules of hooks violations 2025-08-25 18:41:48 +03:00
Elian Doran
733ec2c145 refactor(react): fix a few rules of hooks violations 2025-08-25 18:00:10 +03:00
Elian Doran
e386b03b90 refactor(react): fix all eslint issues in .tsx files 2025-08-25 17:20:47 +03:00
Elian Doran
25d5d51085 chore(react): fix note path when empty 2025-08-25 16:15:13 +03:00
Elian Doran
50c4301a34 chore(react): fix height of title bar 2025-08-25 16:05:09 +03:00
Elian Doran
0f60c0696b chore(react): fix leak in content widget 2025-08-25 15:53:21 +03:00
Elian Doran
3ec2947c4f chore(react): fix configure languages open in background 2025-08-25 14:48:13 +03:00
Elian Doran
e89162838e chore(react): fix events not updating properly 2025-08-25 14:48:00 +03:00
Elian Doran
72181090a5 refactor(react): get rid of ReactBasicWidget 2025-08-25 14:36:17 +03:00
Elian Doran
72b2a5cc0d chore(react): use effects for event handlers to prevent leaks 2025-08-25 14:27:32 +03:00
Elian Doran
1eaeec8100 Revert "chore(react): prototype for note context"
This reverts commit 660db3b3ab.
2025-08-25 13:51:43 +03:00
Elian Doran
660db3b3ab chore(react): prototype for note context 2025-08-25 11:48:56 +03:00
Elian Doran
89d2fcb81e refactor(react): add debug information for devtools 2025-08-25 11:01:12 +03:00
Elian Doran
ccda623840 refactor(react/ribbon): remove unnecessary hook 2025-08-25 10:32:11 +03:00
renovate[bot]
a6e7dff61e chore(deps): update dependency tsx to v4.20.5 2025-08-25 06:59:19 +00:00
Elian Doran
86d1bbe8ff chore(deps): update dependency webdriverio to v9.19.2 (#6773) 2025-08-25 09:54:52 +03:00
Elian Doran
a10cb06f14 fix(deps): update dependency i18next to v25.4.2 (#6774) 2025-08-25 09:54:41 +03:00
renovate[bot]
dd9a62818b fix(deps): update dependency i18next to v25.4.2 2025-08-25 00:34:50 +00:00
renovate[bot]
c0e936675c chore(deps): update dependency webdriverio to v9.19.2 2025-08-25 00:34:18 +00:00
Jon Fuller
b0b788b7dc Merge branch 'main' into fix/quick-search-equals-operator 2025-08-24 14:47:31 -07:00
Jon Fuller
18f0f3ecac Fix for casing and formatting in i18n.ts which was causing compile errors (#6770) 2025-08-24 14:47:18 -07:00
Sky Swimmer
e7d745ac94 Update calendar_view.ts
Same as the previous, another casing error
2025-08-24 23:22:54 +02:00
Sky Swimmer
24abf7f0ed Update i18n.ts
Another casing error throwing off tests
2025-08-24 23:22:24 +02:00
Elian Doran
36fb097d1d chore(react/ribbon): add CSS for context menu 2025-08-25 00:21:44 +03:00
Elian Doran
35ef5fd0d3 chore(react/ribbon): add disable rules for context menu 2025-08-25 00:19:12 +03:00
Sky Swimmer
9a08f6534b Fix casing and formatting in i18n.ts which was causing compile errors 2025-08-24 23:14:45 +02:00
Elian Doran
885dd2053b chore(react/ribbon): add rest of the note action items 2025-08-25 00:08:40 +03:00
Elian Doran
6f6f280bdd chore(react/ribbon): add part of the note actions menu 2025-08-24 23:56:05 +03:00
Elian Doran
a3e8fd374f chore(react/ribbon): port convert to attachment 2025-08-24 23:21:28 +03:00
Elian Doran
f91c1f4180 chore(react/ribbon): port revisions button 2025-08-24 22:56:47 +03:00
Elian Doran
d85746c1b9 Revert "refactor(react/ribbon): use effects for event handling"
This reverts commit 5a17075eef.
2025-08-24 22:43:20 +03:00
Elian Doran
5a17075eef refactor(react/ribbon): use effects for event handling 2025-08-24 22:21:11 +03:00
Elian Doran
6cab47fb55 feat(react/ribbon): bring back toggling tabs via keyboard shortcut 2025-08-24 22:14:42 +03:00
perf3ct
93c5413790 feat(quick_search): also allow for the equals operator in note title's quick search 2025-08-24 18:53:05 +00:00
Elian Doran
f2db7baeba refactor(react): use beta approach for handling events everywhere 2025-08-24 21:18:48 +03:00
Elian Doran
a507991808 refactor(react/modals): use classless components 2025-08-24 20:57:23 +03:00
Elian Doran
7c86f90ac6 chore(react/ribbon): fix some more crashes when rapidly switching tabs 2025-08-24 20:31:39 +03:00
Elian Doran
1e9b772692 chore(react/ribbon): fix cannot set style when switching attributes 2025-08-24 20:25:11 +03:00
Elian Doran
096ab52216 refactor(react/ribbon): solve type errors 2025-08-24 20:23:00 +03:00
Elian Doran
88c3cd5cdd refactor(react/ribbon): move files around & remove imports 2025-08-24 20:16:58 +03:00
Elian Doran
99a911a220 chore(react/ribbon): port bulk actions for search 2025-08-24 20:12:22 +03:00
Elian Doran
3218ab971b chore(react/ribbon): fix alignment of help/close buttons 2025-08-24 19:03:19 +03:00
Elian Doran
274e3c1f7f refactor(react/ribbon): split into two files 2025-08-24 18:40:05 +03:00
Elian Doran
f8916a6e35 chore(react/ribbon): port limit 2025-08-24 18:34:29 +03:00
Elian Doran
73f20d01e4 chore(react/ribbon): port order by 2025-08-24 18:29:47 +03:00
Elian Doran
2fd3a875b6 chore(react/ribbon): port include archived notes 2025-08-24 18:11:29 +03:00
Elian Doran
68cba8d3b2 chore(react/ribbon): port debug 2025-08-24 18:09:33 +03:00
Elian Doran
6b28fd405e chore(react/ribbon): port fast search 2025-08-24 18:07:16 +03:00
Elian Doran
3bccbabe53 chore(react/ribbon): port ancestor depth 2025-08-24 18:02:18 +03:00
Elian Doran
c97c66ed8a Translations update from Hosted Weblate (#6767) 2025-08-24 17:30:55 +03:00
Elian Doran
4b212232c8 chore(react/ribbon): port ancestor (without depth) 2025-08-24 17:29:48 +03:00
Elian Doran
ac3a8edf2b chore(react/ribbon): add search script 2025-08-24 17:20:40 +03:00
Sleepy0Duck5
b581025bbe Translated using Weblate (Korean)
Currently translated at 10.0% (38 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ko/
2025-08-24 16:02:09 +02:00
Sleepy0Duck5
7bc5331747 Translated using Weblate (Korean)
Currently translated at 0.9% (15 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ko/
2025-08-24 16:02:07 +02:00
Kuzma Simonov
2415976475 Translated using Weblate (Russian)
Currently translated at 100.0% (1564 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-24 16:02:06 +02:00
Francis C
8d0d0f0449 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-24 16:02:02 +02:00
Francis C
16b00ed160 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 100.0% (1564 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hant/
2025-08-24 16:02:01 +02:00
chdagenais
df73a420f9 Translated using Weblate (French)
Currently translated at 83.5% (316 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/fr/
2025-08-24 16:01:59 +02:00
Newcomer1989
1e4d57f275 Translated using Weblate (German)
Currently translated at 92.8% (351 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/de/
2025-08-24 16:01:56 +02:00
chdagenais
19a238c8d3 Translated using Weblate (French)
Currently translated at 82.2% (1287 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/fr/
2025-08-24 16:01:54 +02:00
Francis C
5ffd8a79eb Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (1564 of 1564 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hans/
2025-08-24 16:01:53 +02:00
Elian Doran
04fbc82d7c chore(react/ribbon): save search to note 2025-08-24 16:58:10 +03:00
Elian Doran
3f105f7b8b chore(react/ribbon): focus on search textbox 2025-08-24 16:45:17 +03:00
Elian Doran
b9193a5562 chore(react/ribbon): handle search error 2025-08-24 16:41:44 +03:00
Elian Doran
e1fa188244 chore(react/ribbon): refresh options 2025-08-24 16:17:10 +03:00
Elian Doran
80ad87671a chore(react/ribbon): search & execute button 2025-08-24 16:02:15 +03:00
Elian Doran
b6d5a6ec2e chore(react/ribbon): dynamic rendering of search options 2025-08-24 15:59:22 +03:00
Elian Doran
759398d804 chore(react/ribbon): working execute search button 2025-08-24 15:48:53 +03:00
Elian Doran
c1b30db3d1 chore(react/ribbon): port search string 2025-08-24 15:29:07 +03:00
Elian Doran
0c8bfc39ef refactor(react/ribbon): bring back tab activation 2025-08-24 12:23:25 +03:00
Elian Doran
3815fddb27 Merge branch 'react/note_context_aware' of https://github.com/TriliumNext/trilium into react/note_context_aware 2025-08-24 12:22:16 +03:00
Elian Doran
b585a64a38 Merge remote-tracking branch 'origin/main' into react/note_context_aware 2025-08-24 12:05:05 +03:00
Elian Doran
58e58c192f Merge branch 'main' of https://github.com/TriliumNext/trilium 2025-08-24 11:58:56 +03:00
Elian Doran
5939344378 fix(deps): update dependency i18next to v25.4.1 (#6754) 2025-08-24 11:49:48 +03:00
Elian Doran
ad85ee3531 feat(react/ribbon): start porting search definitions (buttons) 2025-08-24 11:42:25 +03:00
renovate[bot]
349f19fef7 fix(deps): update dependency i18next to v25.4.1 2025-08-24 08:18:50 +00:00
Elian Doran
d5777a024e chore(deps): update svelte monorepo (#6753) 2025-08-24 11:17:52 +03:00
Elian Doran
b7f4ee6171 fix(deps): update dependency react-i18next to v15.7.2 (#6755) 2025-08-24 11:17:05 +03:00
Elian Doran
a83c4e3970 fix(deps): update dependency eslint-linter-browserify to v9.34.0 (#6756) 2025-08-24 11:16:53 +03:00
Elian Doran
5a767dae34 feat(i18n): add support for Brazilian Portuguese 2025-08-24 11:05:52 +03:00
Elian Doran
9f93d30b99 feat(i18n): add support for Ukrainian 2025-08-24 10:53:21 +03:00
Elian Doran
dff525edc6 Translations update from Hosted Weblate (#6743) 2025-08-24 10:52:42 +03:00
renovate[bot]
26da431320 fix(deps): update dependency react-i18next to v15.7.2 2025-08-24 07:32:43 +00:00
renovate[bot]
cde4622693 fix(deps): update dependency eslint-linter-browserify to v9.34.0 2025-08-24 07:30:44 +00:00
renovate[bot]
5ede7ecc69 chore(deps): update svelte monorepo 2025-08-24 01:36:13 +00:00
Elian Doran
b607d1e628 refactor(react/ribbon): shared component for labelled entry 2025-08-23 23:59:41 +03:00
Elian Doran
d7e36bdf93 feat(react/ribbon): reintroduce combobox collection properties 2025-08-23 23:54:14 +03:00
Elian Doran
2b8b185b5b feat(react/ribbon): reintroduce number collection properties 2025-08-23 23:39:47 +03:00
Elian Doran
927ebcbec9 feat(react/ribbon): reintroduce checkbox collection properties 2025-08-23 23:32:12 +03:00
Elian Doran
ea1397de63 feat(react/ribbon): reintroduce button collection properties 2025-08-23 23:25:25 +03:00
Elian Doran
ce1f5c6204 feat(react/ribbon): port view type 2025-08-23 22:49:32 +03:00
Elian Doran
652114c7b5 feat(react/ribbon): finalize port of inherited attributes tab 2025-08-23 22:18:04 +03:00
Elian Doran
17cd2128fd chore(react): add editorconfig for .tsx 2025-08-23 22:02:41 +03:00
Elian Doran
bc4378cb3e chore(react/ribbon): port inherited attributes partially 2025-08-23 22:02:33 +03:00
perf3ct
513878dfef feat(jump_to): got the styling to look exactly how we were hoping for 2025-08-23 18:58:18 +00:00
perf3ct
753d5529b2 feat(jump_to): get the styling very close to what we want it to look like... 2025-08-23 18:40:11 +00:00
Elian Doran
9f217b88e4 refactor(react/ribbon): set up keyboard shortcuts 2025-08-23 20:59:21 +03:00
Elian Doran
d53faa8c01 refactor(react/ribbon): imperative api for saving, reloading, updating attributes 2025-08-23 20:49:54 +03:00
Elian Doran
a934760960 refactor(react/ribbon): use custom method for injecting handlers 2025-08-23 20:44:03 +03:00
Elian Doran
82914fc2aa chore(react/ribbon): unable to create notes in attribute editor 2025-08-23 20:35:19 +03:00
Elian Doran
db687197de chore(react/ribbon): add focus to attribute editor 2025-08-23 20:31:00 +03:00
Elian Doran
efd713dc61 chore(react/ribbon): add blur & keydown events 2025-08-23 19:54:02 +03:00
Elian Doran
3f3c7cfe88 chore(react/ribbon): add menu 2025-08-23 19:48:01 +03:00
Elian Doran
73ca285b7a chore(react/ribbon): support reference links in attributes 2025-08-23 19:26:23 +03:00
Elian Doran
168d25c020 chore(react/ribbon): fix save icon displayed when it shouldn't 2025-08-23 19:13:48 +03:00
Elian Doran
e8ae5486c8 chore(react/ribbon): display attribute errors 2025-08-23 18:28:42 +03:00
Elian Doran
f049b8b915 chore(react/ribbon): save attribute changes 2025-08-23 18:23:38 +03:00
Микола Копитін
4e755dc537 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/uk/
2025-08-23 14:16:31 +02:00
Francis C
5351310a38 Translated using Weblate (Japanese)
Currently translated at 67.9% (1060 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ja/
2025-08-23 14:16:31 +02:00
Микола Копитін
211ca43a82 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/uk/
2025-08-23 14:16:31 +02:00
Микола Копитін
e5235e7f22 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/uk/
2025-08-23 14:16:31 +02:00
Astryd Park
e72298f0b4 Translated using Weblate (Korean)
Currently translated at 0.2% (1 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ko/
2025-08-23 14:16:31 +02:00
Микола Копитін
3abf5c65c6 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/uk/
2025-08-23 14:16:31 +02:00
Микола Копитін
268acb0b88 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/uk/
2025-08-23 14:16:30 +02:00
Kuzma Simonov
196b3b873f Translated using Weblate (Russian)
Currently translated at 100.0% (378 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ru/
2025-08-23 14:16:30 +02:00
Микола Копитін
4d9801a372 Translated using Weblate (Russian)
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-23 14:16:30 +02:00
Kuzma Simonov
bd710ba665 Translated using Weblate (Russian)
Currently translated at 100.0% (1560 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ru/
2025-08-23 14:16:30 +02:00
Francis C
afe369c876 Translated using Weblate (Chinese (Traditional 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_Hant/
2025-08-23 14:16:30 +02:00
Newcomer1989
206007bbce Translated using Weblate (German)
Currently translated at 81.7% (309 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/de/
2025-08-23 14:16:30 +02:00
rodrigomescua
8ad05b92c0 Translated using Weblate (Portuguese (Brazil))
Currently translated at 60.8% (950 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-23 14:16:30 +02:00
Francis C
735da2a855 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-23 14:16:30 +02:00
Elian Doran
980077f559 Add UI performance-related settings (#6747) 2025-08-23 15:16:22 +03:00
Elian Doran
12053e75bb chore(react/ribbon): fix size of attribute widget 2025-08-23 13:13:01 +03:00
Elian Doran
62372ed4c5 chore(react/ribbon): add logic for displaying attribute detail 2025-08-23 12:55:48 +03:00
Elian Doran
e5caf37697 chore(react/ribbon): load current attributes in editor 2025-08-23 12:39:49 +03:00
Elian Doran
befc5a9530 feat(react/ribbon): display help tooltip in attribute editor 2025-08-23 12:31:54 +03:00
Elian Doran
1e00407864 chore(react/ribbon): use separate component for editor 2025-08-23 12:05:03 +03:00
Elian Doran
73038efccf chore(react/ribbon): add some CKEditor events 2025-08-23 11:52:40 +03:00
Elian Doran
6d37e19b40 chore(react/ribbon): start implementing attribute editor 2025-08-23 11:44:51 +03:00
Elian Doran
2c33ef2b0d chore(react/ribbon): similar notes style 2025-08-23 11:28:10 +03:00
Elian Doran
6c30e0836f chore(react/ribbon): also react to width, not just height 2025-08-23 11:21:05 +03:00
Elian Doran
5f77ca31bd chore(react/ribbon): react note map to height changes 2025-08-23 11:12:14 +03:00
Elian Doran
f7c82d6b09 chore(react/ribbon): watch note map size 2025-08-23 11:00:25 +03:00
Elian Doran
86dd9aa42a chore(react/ribbon): integrate expand/collapse button 2025-08-23 10:47:46 +03:00
Elian Doran
5daca270e4 fix(deps): update dependency mermaid to v11.10.1 (#6749) 2025-08-23 08:47:35 +03:00
Elian Doran
e18813a4bf fix(deps): update eslint monorepo to v9.34.0 (#6750) 2025-08-23 08:47:16 +03:00
renovate[bot]
4aa7e211f3 fix(deps): update eslint monorepo to v9.34.0 2025-08-23 00:25:46 +00:00
renovate[bot]
419dc7edfb fix(deps): update dependency mermaid to v11.10.1 2025-08-23 00:24:33 +00:00
renovate[bot]
eaa84a6b39 chore(deps): update dependency @types/jquery to v3.5.33 2025-08-23 00:23:57 +00:00
Adorian Doran
1d0503d0e4 client/settings/ui-performance-settings: remove form groups 2025-08-23 03:22:59 +03:00
Adorian Doran
f7f98aa9a3 client/settings/ui-performance-settings: improve code formatting 2025-08-23 03:10:51 +03:00
Adorian Doran
575d14261a Merge branch 'main' of https://github.com/TriliumNext/Trilium into client/settings/ui-performance-settings 2025-08-23 02:20:37 +03:00
Adorian Doran
9aab606deb style: improve the support of disabled backdrop effects 2025-08-23 02:15:06 +03:00
Adorian Doran
2e11681b52 client/settings/disable backdrop effects: add the CSS implementation 2025-08-23 01:26:21 +03:00
Adorian Doran
8cca6637f7 client/settings/disable backdrop effects: react to the option change 2025-08-23 01:23:20 +03:00
Adorian Doran
82e076378c client/settings/disable backdrop effects: add the corresponding checkbox in the Appearance settings page 2025-08-23 01:20:54 +03:00
Adorian Doran
94ddad3c49 client/settings/disable backdrop effects: add an option to enable or disable backdrop effects 2025-08-23 01:15:00 +03:00
Adorian Doran
d35dbca18b client/settings/disable shadows: add the CSS implementation 2025-08-23 00:58:50 +03:00
Adorian Doran
7468d6147a client/settings/disable shadows: react to the option change 2025-08-23 00:55:46 +03:00
Adorian Doran
7c78d749de client/settings/disable shadows: add the corresponding checkbox in the Appearance settings page 2025-08-23 00:49:35 +03:00
Adorian Doran
85dd99a3c4 client/settings/disable shadows: add an option to enable or disable shadows 2025-08-23 00:43:49 +03:00
Adorian Doran
0a9c0234e2 client/settings/disable motion: update translation 2025-08-23 00:38:06 +03:00
JYC333
fad77ba5a0 chore(deps): update dependency vite-plugin-static-copy to v3.1.2 [security] (#6735) 2025-08-22 23:30:13 +02:00
JYC333
12723f3216 fix(deps): update dependency react-i18next to v15.7.1 (#6739) 2025-08-22 23:29:38 +02:00
JYC333
a43140515f chore(deps): update ckeditor5 config packages to v12.1.1 (#6738) 2025-08-22 23:29:26 +02:00
Adorian Doran
3e3cc8c541 client/settings/disable motion: refactor 2025-08-23 00:19:26 +03:00
Elian Doran
a85141ace2 feat(react/ribbon): port note map partially 2025-08-22 23:47:02 +03:00
Elian Doran
c33280bbb2 chore(react): fix leak & adjustable class name 2025-08-22 23:45:31 +03:00
Elian Doran
df3aa04787 chore(react): proper legacy widget injection & event handling 2025-08-22 23:33:02 +03:00
Elian Doran
4bd25a0d4a chore(react): use different injection mechanism 2025-08-22 23:24:00 +03:00
Elian Doran
7fadf4c6e1 chore(react): prototype hook to render legacy widgets 2025-08-22 23:12:14 +03:00
Adorian Doran
d1538508e8 client/settings/disable motion: turn off jQuery animations if motion is disabled 2025-08-22 22:20:57 +03:00
Elian Doran
b24d786933 chore(react/ribbon): fix a few type errors 2025-08-22 21:58:35 +03:00
Elian Doran
8f69b87dd1 feat(react/ribbon): port note paths tab 2025-08-22 21:45:03 +03:00
Adorian Doran
9b1da8c311 Settings/Appearance: improve CSS selector specificity 2025-08-22 21:37:56 +03:00
Elian Doran
8287063aab feat(react/ribbon): port image properties 2025-08-22 21:09:51 +03:00
Adorian Doran
e4a8258acf client/settings/disable motion: fix submenus not opening 2025-08-22 20:52:31 +03:00
Adorian Doran
5e88043c7b client/settings/disable motion: add the CSS implementation 2025-08-22 20:48:26 +03:00
Adorian Doran
bedf9112fb client/settings/disable motion: add localization support 2025-08-22 20:42:17 +03:00
Adorian Doran
03681d23c5 client/settings/disable motion: add an option to allow transitions and animations to be disabled 2025-08-22 20:32:08 +03:00
Elian Doran
21683db0b8 refactor(react/ribbon): dedicated component for file upload 2025-08-22 20:25:15 +03:00
Elian Doran
978d829150 feat(react/ribbon): port file notes 2025-08-22 20:17:00 +03:00
Elian Doran
cc05572a35 feat(react/ribbon): port similar notes 2025-08-22 19:27:58 +03:00
Elian Doran
c5bb310613 chore(react/ribbon): bring back note info auto-refresh 2025-08-22 19:07:04 +03:00
Elian Doran
77551b1fed feat(react/ribbon): port note info tab 2025-08-22 18:23:54 +03:00
Elian Doran
70728c274e feat(react/ribbon): port note properties 2025-08-22 17:41:45 +03:00
Elian Doran
cee4714665 feat(react/ribbon): port edited notes 2025-08-22 17:31:15 +03:00
Elian Doran
c3eca3b626 feat(react/ribbon): port script tab 2025-08-22 16:58:44 +03:00
Elian Doran
01e4cd2e78 chore(react/ribbon): set up formatting toolbar 2025-08-22 16:34:16 +03:00
Elian Doran
b99d01ad7b chore(react/ribbon): bring back tab filtering 2025-08-22 16:07:30 +03:00
Elian Doran
bf0213907e chore(react/ribbon): finalize language switcher 2025-08-22 15:40:36 +03:00
Elian Doran
eff5b6459d chore(react/ribbon): fix event 2025-08-22 15:11:12 +03:00
Elian Doran
8e29b5eed6 feat(react/ribbon): port note language 2025-08-22 12:34:21 +03:00
Elian Doran
c91748da15 feat(react/ribbon): port template switch 2025-08-22 12:15:03 +03:00
Elian Doran
f04f9dc262 feat(react/ribbon): port shared switch 2025-08-22 11:57:45 +03:00
Elian Doran
e873cdab7e chore(react/ribbon): fix width of editability select 2025-08-22 11:42:07 +03:00
Elian Doran
f9b6fd6ac5 feat(react): port bookmark switch 2025-08-22 11:40:27 +03:00
renovate[bot]
aa191e110c fix(deps): update dependency react-i18next to v15.7.1 2025-08-22 02:44:08 +00:00
renovate[bot]
dd09907925 chore(deps): update ckeditor5 config packages to v12.1.1 2025-08-22 02:43:31 +00:00
Elian Doran
da4810672d feat(react/ribbon): improve editability select 2025-08-21 22:24:35 +03:00
Elian Doran
f772f59d7c feat(react/ribbon): port editability select 2025-08-21 22:19:26 +03:00
Elian Doran
1964fb90d5 feat(react/ribbon): port toggle protected note 2025-08-21 21:26:45 +03:00
Elian Doran
5945f2860a chore(react/ribbon): finalize note type selection 2025-08-21 21:01:57 +03:00
Elian Doran
f45da049b9 chore(react/ribbon): change note type 2025-08-21 20:56:37 +03:00
Elian Doran
c0beab8a5d chore(react/ribbon): display current note type 2025-08-21 20:38:19 +03:00
Elian Doran
cabeb13adb chore(react/ribbon): add note types 2025-08-21 20:30:12 +03:00
Elian Doran
e2e9721d5f chore(react/ribbon): add basic note types & badges 2025-08-21 20:16:06 +03:00
Elian Doran
4e9deab605 chore(react/ribbon): make content work 2025-08-21 19:59:56 +03:00
Elian Doran
9bb048fb01 chore(react/ribbon): toggleable tabs 2025-08-21 19:48:07 +03:00
Elian Doran
6849f80506 chore(react/ribbon): make tabs activable 2025-08-21 19:35:21 +03:00
Elian Doran
5597f4e2e0 chore(react/ribbon): add all ribbon tab titles & icon 2025-08-21 19:27:18 +03:00
renovate[bot]
35e9508bde chore(deps): update dependency vite-plugin-static-copy to v3.1.2 [security] 2025-08-21 15:41:25 +00:00
Elian Doran
45fbcec805 feat(react/ribbon): port base structure 2025-08-21 18:29:13 +03:00
Elian Doran
4c8da70ef3 chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.4 (#6721) 2025-08-21 17:49:28 +03:00
Elian Doran
ed5da5cd4a Translations update from Hosted Weblate (#6732) 2025-08-21 17:49:10 +03:00
Astryd Park
dc5fccdbcd Added translation using Weblate (Korean) 2025-08-21 16:32:31 +02:00
Astryd Park
91aea333c7 Added translation using Weblate (Korean) 2025-08-21 16:32:31 +02:00
Микола Копитін
a0de01cff1 Translated using Weblate (Ukrainian)
Currently translated at 99.4% (376 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/uk/
2025-08-21 16:32:30 +02:00
Микола Копитін
a41ed34193 Translated using Weblate (Ukrainian)
Currently translated at 37.0% (578 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/uk/
2025-08-21 16:32:30 +02:00
Newcomer1989
49e8811c18 Translated using Weblate (German)
Currently translated at 77.7% (294 of 378 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/de/
2025-08-21 16:32:29 +02:00
Lucas Fernandes de Camargo
488563a82e Translated using Weblate (Portuguese (Brazil))
Currently translated at 22.5% (351 of 1560 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/pt_BR/
2025-08-21 16:32:29 +02:00
Elian Doran
d76d50f30e chore(react): fix a type error 2025-08-21 17:16:03 +03:00
Elian Doran
4685aef88d chore(react/note_icon): reset to default icon 2025-08-21 16:19:18 +03:00
Elian Doran
a106510924 chore(react/note_icon): react to icon changes 2025-08-21 15:50:14 +03:00
Elian Doran
9d54503ef7 chore(react/note_icon): reintroduce setting the icon 2025-08-21 15:21:32 +03:00
Elian Doran
b1449eebf3 chore(react/note_icon): reintroduce read-only 2025-08-21 15:14:19 +03:00
Elian Doran
b213453062 refactor(react/note_icon): introduce autofocus at text box level 2025-08-21 15:11:08 +03:00
Elian Doran
076c0321cf chore(react/note_icon): focus search by default 2025-08-21 15:09:25 +03:00
Elian Doran
4d71b73f38 chore(react/note_icon): case insensitive search 2025-08-21 15:07:41 +03:00
Elian Doran
b20ffdf7db chore(react/note_icon): sort by count 2025-08-21 15:05:55 +03:00
Elian Doran
ef018e22d6 feat(react/note_icon): render dropdown only when needed 2025-08-21 15:03:54 +03:00
Elian Doran
3fa290a257 chore(react/note_icon): add back filter by category 2025-08-21 14:57:54 +03:00
Elian Doran
cdde530b60 chore(react/note_icon): add back filter by text 2025-08-21 14:45:19 +03:00
Elian Doran
aa608510d0 feat(react): port note icon 2025-08-21 14:41:59 +03:00
Elian Doran
009fd63ce9 chore(react): finalize note title porting 2025-08-21 13:18:39 +03:00
Elian Doran
bea352855a refactor(react): allow binding multiple events at once 2025-08-21 13:17:28 +03:00
Elian Doran
51e8a80ca3 chore(react/note_title): delete new notes on escape 2025-08-21 13:13:48 +03:00
Elian Doran
8a543d4513 chore(react/note_title): focus content on enter 2025-08-21 13:00:08 +03:00
Elian Doran
945e180a6f chore(react/note_title): add before unload listener 2025-08-21 12:55:33 +03:00
Elian Doran
b93fa332d3 fix(client): please wait for save showing up multiple times 2025-08-21 12:49:03 +03:00
Elian Doran
9e947f742d fix(react/note_title): title shown on empty widget pane 2025-08-21 12:15:12 +03:00
Elian Doran
033e90f8b7 fix(react/note_title): not refreshing on protected session 2025-08-21 12:13:30 +03:00
Elian Doran
be576176c5 feat(react/note_title): bring back navigation title 2025-08-21 11:08:33 +03:00
Elian Doran
4da3e8a4d8 refactor(react/note_title): use note property for title as well 2025-08-21 10:54:38 +03:00
Elian Doran
db2bf537ea refactor(react/note_title): use hook for listening to note property 2025-08-21 10:44:58 +03:00
Elian Doran
9a4fdcaef2 chore(react/note_title): bring back styles 2025-08-21 10:34:30 +03:00
Elian Doran
ca40360f7d feat(react): basic implementation of note title 2025-08-21 10:08:49 +03:00
Elian Doran
799e705ff8 fix(react): note context not always updated 2025-08-21 09:18:52 +03:00
Elian Doran
a1b18c7f97 chore(deps): update dependency @sveltejs/kit to v2.36.1 (#6723) 2025-08-21 08:22:09 +03:00
Elian Doran
9958a6e1bf fix(deps): update dependency i18next to v25.4.0 (#6724) 2025-08-21 08:21:24 +03:00
renovate[bot]
1fc6d8aca7 fix(deps): update dependency i18next to v25.4.0 2025-08-21 05:21:13 +00:00
Elian Doran
3e9ec2d943 chore(deps): update dependency @playwright/test to v1.55.0 (#6722) 2025-08-21 08:20:47 +03:00
Elian Doran
1420def1c3 fix(deps): update dependency react-i18next to v15.7.0 (#6725) 2025-08-21 08:19:38 +03:00
renovate[bot]
3b4184e765 chore(deps): update dependency @sveltejs/kit to v2.36.1 2025-08-21 02:22:23 +00:00
perf3ct
4ce9102f93 feat(docs): try to also improve how environment variables are shown in docs 2025-08-21 02:21:00 +00:00
perf3ct
eb27ec2234 feat(config): fix previously documented env var formula not working
asdf
2025-08-21 02:18:08 +00:00
renovate[bot]
b70e25d348 fix(deps): update dependency react-i18next to v15.7.0 2025-08-21 00:05:32 +00:00
renovate[bot]
772c0bbe1a chore(deps): update dependency @playwright/test to v1.55.0 2025-08-21 00:04:01 +00:00
renovate[bot]
144021c053 chore(deps): update dependency rollup-plugin-webpack-stats to v2.1.4 2025-08-21 00:03:29 +00:00
Elian Doran
59486cd55d feat(react): basic handling of note context aware 2025-08-20 23:53:13 +03:00
Elian Doran
afe3904ea3 feat(react): render raw react components 2025-08-20 22:13:52 +03:00
238 changed files with 12792 additions and 7586 deletions

View File

@@ -1,6 +1,6 @@
root = true
[*.{js,ts}]
[*.{js,ts,.tsx}]
charset = utf-8
end_of_line = lf
indent_size = 4

View File

@@ -20,5 +20,10 @@
"scope": "typescript",
"prefix": "jqf",
"body": ["private $${1:name}!: JQuery<HTMLElement>;"]
},
"region": {
"scope": "css",
"prefix": "region",
"body": ["/* #region ${1:name} */\n$0\n/* #endregion */"]
}
}

View File

@@ -35,13 +35,13 @@
"chore:generate-openapi": "tsx bin/generate-openapi.js"
},
"devDependencies": {
"@playwright/test": "1.54.2",
"@playwright/test": "1.55.0",
"@stylistic/eslint-plugin": "5.2.3",
"@types/express": "5.0.3",
"@types/node": "22.17.2",
"@types/node": "22.18.0",
"@types/yargs": "17.0.33",
"@vitest/coverage-v8": "3.2.4",
"eslint": "9.33.0",
"eslint": "9.34.0",
"eslint-plugin-simple-import-sort": "12.1.1",
"esm": "3.2.25",
"jsdoc": "4.0.4",
@@ -49,7 +49,7 @@
"rcedit": "4.0.1",
"rimraf": "6.0.1",
"tslib": "2.8.1",
"typedoc": "0.28.10",
"typedoc": "0.28.11",
"typedoc-plugin-missing-exports": "4.1.0"
},
"optionalDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@triliumnext/client",
"version": "0.98.0",
"version": "0.98.1",
"description": "JQuery-based client for TriliumNext, used for both web and desktop (via Electron)",
"private": true,
"license": "AGPL-3.0-only",
@@ -10,7 +10,7 @@
"url": "https://github.com/TriliumNext/Notes"
},
"dependencies": {
"@eslint/js": "9.33.0",
"@eslint/js": "9.34.0",
"@excalidraw/excalidraw": "0.18.0",
"@fullcalendar/core": "6.1.19",
"@fullcalendar/daygrid": "6.1.19",
@@ -28,7 +28,7 @@
"@triliumnext/highlightjs": "workspace:*",
"@triliumnext/share-theme": "workspace:*",
"autocomplete.js": "0.38.1",
"bootstrap": "5.3.7",
"bootstrap": "5.3.8",
"boxicons": "2.1.4",
"dayjs": "1.11.13",
"dayjs-plugin-utc": "0.1.2",
@@ -36,7 +36,7 @@
"draggabilly": "3.0.0",
"force-graph": "1.50.1",
"globals": "16.3.0",
"i18next": "25.3.6",
"i18next": "25.4.2",
"i18next-http-backend": "3.0.2",
"jquery": "3.7.1",
"jquery.fancytree": "2.38.5",
@@ -47,12 +47,12 @@
"leaflet-gpx": "2.2.0",
"mark.js": "8.11.1",
"marked": "16.2.0",
"mermaid": "11.10.0",
"mermaid": "11.10.1",
"mind-elixir": "5.0.6",
"normalize.css": "8.0.1",
"panzoom": "9.4.3",
"preact": "10.27.1",
"react-i18next": "15.6.1",
"react-i18next": "15.7.2",
"split.js": "1.6.5",
"svg-pan-zoom": "3.6.2",
"tabulator-tables": "6.3.1",
@@ -62,7 +62,7 @@
"@ckeditor/ckeditor5-inspector": "5.0.0",
"@preact/preset-vite": "2.10.2",
"@types/bootstrap": "5.2.10",
"@types/jquery": "3.5.32",
"@types/jquery": "3.5.33",
"@types/leaflet": "1.9.20",
"@types/leaflet-gpx": "1.3.7",
"@types/mark.js": "8.11.12",
@@ -70,7 +70,7 @@
"copy-webpack-plugin": "13.0.1",
"happy-dom": "18.0.1",
"script-loader": "0.7.2",
"vite-plugin-static-copy": "3.1.1"
"vite-plugin-static-copy": "3.1.2"
},
"nx": {
"name": "client",

View File

@@ -31,16 +31,13 @@ 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";
import type RootContainer from "../widgets/containers/root_container.js";
interface Layout {
getRootWidget: (appContext: AppContext) => RootWidget;
getRootWidget: (appContext: AppContext) => RootContainer;
}
interface RootWidget extends Component {
render: () => JQuery<HTMLElement>;
}
interface BeforeUploadListener extends Component {
export interface BeforeUploadListener extends Component {
beforeUnloadEvent(): boolean;
}
@@ -85,7 +82,6 @@ export type CommandMappings = {
focusTree: CommandData;
focusOnTitle: CommandData;
focusOnDetail: CommandData;
focusOnSearchDefinition: Required<CommandData>;
searchNotes: CommandData & {
searchString?: string;
ancestorNoteId?: string | null;
@@ -323,6 +319,7 @@ export type CommandMappings = {
printActiveNote: CommandData;
exportAsPdf: CommandData;
openNoteExternally: CommandData;
openNoteCustom: CommandData;
renderActiveNote: CommandData;
unhoist: CommandData;
reloadFrontendApp: CommandData;
@@ -526,7 +523,7 @@ export type FilteredCommandNames<T extends CommandData> = keyof Pick<CommandMapp
export class AppContext extends Component {
isMainWindow: boolean;
components: Component[];
beforeUnloadListeners: WeakRef<BeforeUploadListener>[];
beforeUnloadListeners: (WeakRef<BeforeUploadListener> | (() => boolean))[];
tabManager!: TabManager;
layout?: Layout;
noteTreeWidget?: NoteTreeWidget;
@@ -619,7 +616,7 @@ export class AppContext extends Component {
component.triggerCommand(commandName, { $el: $(this) });
});
this.child(rootWidget);
this.child(rootWidget as Component);
this.triggerEvent("initialRenderComplete", {});
}
@@ -649,13 +646,17 @@ export class AppContext extends Component {
return $(el).closest(".component").prop("component");
}
addBeforeUnloadListener(obj: BeforeUploadListener) {
addBeforeUnloadListener(obj: BeforeUploadListener | (() => boolean)) {
if (typeof WeakRef !== "function") {
// older browsers don't support WeakRef
return;
}
this.beforeUnloadListeners.push(new WeakRef<BeforeUploadListener>(obj));
if (typeof obj === "object") {
this.beforeUnloadListeners.push(new WeakRef<BeforeUploadListener>(obj));
} else {
this.beforeUnloadListeners.push(obj);
}
}
}
@@ -665,25 +666,29 @@ const appContext = new AppContext(window.glob.isMainWindow);
$(window).on("beforeunload", () => {
let allSaved = true;
appContext.beforeUnloadListeners = appContext.beforeUnloadListeners.filter((wr) => !!wr.deref());
appContext.beforeUnloadListeners = appContext.beforeUnloadListeners.filter((wr) => typeof wr === "function" || !!wr.deref());
for (const weakRef of appContext.beforeUnloadListeners) {
const component = weakRef.deref();
for (const listener of appContext.beforeUnloadListeners) {
if (typeof listener === "object") {
const component = listener.deref();
if (!component) {
continue;
}
if (!component) {
continue;
}
if (!component.beforeUnloadEvent()) {
console.log(`Component ${component.componentId} is not finished saving its state.`);
toast.showMessage(t("app_context.please_wait_for_save"), 10000);
allSaved = false;
if (!component.beforeUnloadEvent()) {
console.log(`Component ${component.componentId} is not finished saving its state.`);
allSaved = false;
}
} else {
if (!listener()) {
allSaved = false;
}
}
}
if (!allSaved) {
toast.showMessage(t("app_context.please_wait_for_save"), 10000);
return "some string";
}
});

View File

@@ -1,6 +1,8 @@
import utils from "../services/utils.js";
import type { CommandMappings, CommandNames, EventData, EventNames } from "./app_context.js";
type EventHandler = ((data: any) => void);
/**
* Abstract class for all components in the Trilium's frontend.
*
@@ -19,6 +21,7 @@ export class TypedComponent<ChildT extends TypedComponent<ChildT>> {
initialized: Promise<void> | null;
parent?: TypedComponent<any>;
_position!: number;
private listeners: Record<string, EventHandler[]> | null = {};
constructor() {
this.componentId = `${this.sanitizedClassName}-${utils.randomString(8)}`;
@@ -76,6 +79,14 @@ export class TypedComponent<ChildT extends TypedComponent<ChildT>> {
handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null {
const promises: Promise<unknown>[] = [];
// Handle React children.
if (this.listeners?.[name]) {
for (const listener of this.listeners[name]) {
listener(data);
}
}
// Handle legacy children.
for (const child of this.children) {
const ret = child.handleEvent(name, data) as Promise<void>;
@@ -120,6 +131,35 @@ export class TypedComponent<ChildT extends TypedComponent<ChildT>> {
return promise;
}
registerHandler<T extends EventNames>(name: T, handler: EventHandler) {
if (!this.listeners) {
this.listeners = {};
}
if (!this.listeners[name]) {
this.listeners[name] = [];
}
if (this.listeners[name].includes(handler)) {
return;
}
this.listeners[name].push(handler);
}
removeHandler<T extends EventNames>(name: T, handler: EventHandler) {
if (!this.listeners?.[name]?.includes(handler)) {
return;
}
this.listeners[name] = this.listeners[name]
.filter(listener => listener !== handler);
if (!this.listeners[name].length) {
delete this.listeners[name];
}
}
}
export default class Component extends TypedComponent<Component> {}

View File

@@ -43,8 +43,6 @@ export default class RootCommandExecutor extends Component {
const noteContext = await appContext.tabManager.openTabWithNoteWithHoisting(searchNote.noteId, {
activate: true
});
appContext.triggerCommand("focusOnSearchDefinition", { ntxId: noteContext.ntxId });
}
async searchInSubtreeCommand({ notePath }: CommandListenerData<"searchInSubtree">) {

View File

@@ -8,7 +8,6 @@ import electronContextMenu from "./menus/electron_context_menu.js";
import glob from "./services/glob.js";
import { t } from "./services/i18n.js";
import options from "./services/options.js";
import server from "./services/server.js";
import type ElectronRemote from "@electron/remote";
import type Electron from "electron";
import "./stylesheets/bootstrap.scss";

View File

@@ -1020,6 +1020,14 @@ class FNote {
return this.noteId.startsWith("_options");
}
isTriliumSqlite() {
return this.mime === "text/x-sqlite;schema=trilium";
}
isTriliumScript() {
return this.mime.startsWith("application/javascript");
}
/**
* Provides note's date metadata.
*/

View File

@@ -4,21 +4,13 @@ import TabRowWidget from "../widgets/tab_row.js";
import TitleBarButtonsWidget from "../widgets/title_bar_buttons.js";
import LeftPaneContainer from "../widgets/containers/left_pane_container.js";
import NoteTreeWidget from "../widgets/note_tree.js";
import NoteTitleWidget from "../widgets/note_title.js";
import OwnedAttributeListWidget from "../widgets/ribbon_widgets/owned_attribute_list.js";
import NoteActionsWidget from "../widgets/buttons/note_actions.js";
import NoteTitleWidget from "../widgets/note_title.jsx";
import NoteDetailWidget from "../widgets/note_detail.js";
import RibbonContainer from "../widgets/containers/ribbon_container.js";
import PromotedAttributesWidget from "../widgets/ribbon_widgets/promoted_attributes.js";
import InheritedAttributesWidget from "../widgets/ribbon_widgets/inherited_attribute_list.js";
import PromotedAttributesWidget from "../widgets/promoted_attributes.js";
import NoteListWidget from "../widgets/note_list.js";
import SearchDefinitionWidget from "../widgets/ribbon_widgets/search_definition.js";
import SqlResultWidget from "../widgets/sql_result.js";
import SqlTableSchemasWidget from "../widgets/sql_table_schemas.js";
import FilePropertiesWidget from "../widgets/ribbon_widgets/file_properties.js";
import ImagePropertiesWidget from "../widgets/ribbon_widgets/image_properties.js";
import NotePropertiesWidget from "../widgets/ribbon_widgets/note_properties.js";
import NoteIconWidget from "../widgets/note_icon.js";
import NoteIconWidget from "../widgets/note_icon.jsx";
import SearchResultWidget from "../widgets/search_result.js";
import ScrollingContainer from "../widgets/containers/scrolling_container.js";
import RootContainer from "../widgets/containers/root_container.js";
@@ -29,15 +21,8 @@ import SplitNoteContainer from "../widgets/containers/split_note_container.js";
import LeftPaneToggleWidget from "../widgets/buttons/left_pane_toggle.js";
import CreatePaneButton from "../widgets/buttons/create_pane_button.js";
import ClosePaneButton from "../widgets/buttons/close_pane_button.js";
import BasicPropertiesWidget from "../widgets/ribbon_widgets/basic_properties.js";
import NoteInfoWidget from "../widgets/ribbon_widgets/note_info_widget.js";
import BookPropertiesWidget from "../widgets/ribbon_widgets/book_properties.js";
import NoteMapRibbonWidget from "../widgets/ribbon_widgets/note_map.js";
import NotePathsWidget from "../widgets/ribbon_widgets/note_paths.js";
import SimilarNotesWidget from "../widgets/ribbon_widgets/similar_notes.js";
import RightPaneContainer from "../widgets/containers/right_pane_container.js";
import EditButton from "../widgets/floating_buttons/edit_button.js";
import EditedNotesWidget from "../widgets/ribbon_widgets/edited_notes.js";
import ShowTocWidgetButton from "../widgets/buttons/show_toc_widget_button.js";
import ShowHighlightsListWidgetButton from "../widgets/buttons/show_highlights_list_widget_button.js";
import NoteWrapperWidget from "../widgets/note_wrapper.js";
@@ -51,16 +36,13 @@ 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";
import LauncherContainer from "../widgets/containers/launcher_container.js";
import RevisionsButton from "../widgets/buttons/revisions_button.js";
import CodeButtonsWidget from "../widgets/floating_buttons/code_buttons.js";
import ApiLogWidget from "../widgets/api_log.js";
import HideFloatingButtonsButton from "../widgets/floating_buttons/hide_floating_buttons_button.js";
import ScriptExecutorWidget from "../widgets/ribbon_widgets/script_executor.js";
import MovePaneButton from "../widgets/buttons/move_pane_button.js";
import UploadAttachmentsDialog from "../widgets/dialogs/upload_attachments.js";
import CopyImageReferenceButton from "../widgets/floating_buttons/copy_image_reference_button.js";
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 from "../services/utils.js";
import GeoMapButtons from "../widgets/floating_buttons/geo_map_button.js";
@@ -73,6 +55,7 @@ import ToggleReadOnlyButton from "../widgets/floating_buttons/toggle_read_only_b
import PngExportButton from "../widgets/floating_buttons/png_export_button.js";
import RefreshButton from "../widgets/floating_buttons/refresh_button.js";
import { applyModals } from "./layout_commons.js";
import Ribbon from "../widgets/ribbon/Ribbon.jsx";
export default class DesktopLayout {
@@ -151,37 +134,15 @@ export default class DesktopLayout {
.css("min-height", "50px")
.css("align-items", "center")
.cssBlock(".title-row > * { margin: 5px; }")
.child(new NoteIconWidget())
.child(new NoteTitleWidget())
.child(<NoteIconWidget />)
.child(<NoteTitleWidget />)
.child(new SpacerWidget(0, 1))
.child(new MovePaneButton(true))
.child(new MovePaneButton(false))
.child(new ClosePaneButton())
.child(new CreatePaneButton())
)
.child(
new RibbonContainer()
// the order of the widgets matter. Some of these want to "activate" themselves
// when visible. When this happens to multiple of them, the first one "wins".
// promoted attributes should always win.
.ribbon(new ClassicEditorToolbar())
.ribbon(new ScriptExecutorWidget())
.ribbon(new SearchDefinitionWidget())
.ribbon(new EditedNotesWidget())
.ribbon(new BookPropertiesWidget())
.ribbon(new NotePropertiesWidget())
.ribbon(new FilePropertiesWidget())
.ribbon(new ImagePropertiesWidget())
.ribbon(new BasicPropertiesWidget())
.ribbon(new OwnedAttributeListWidget())
.ribbon(new InheritedAttributesWidget())
.ribbon(new NotePathsWidget())
.ribbon(new NoteMapRibbonWidget())
.ribbon(new SimilarNotesWidget())
.ribbon(new NoteInfoWidget())
.button(new RevisionsButton())
.button(new NoteActionsWidget())
)
.child(<Ribbon />)
.child(new SharedInfoWidget())
.child(new WatchedFileUpdateStatusWidget())
.child(
@@ -235,8 +196,8 @@ export default class DesktopLayout {
.child(new CloseZenButton())
// Desktop-specific dialogs.
.child(new PasswordNoteSetDialog())
.child(new UploadAttachmentsDialog());
.child(<PasswordNoteSetDialog />)
.child(<UploadAttachmentsDialog />);
applyModals(rootContainer);
return rootContainer;

View File

@@ -24,48 +24,48 @@ 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 NoteIconWidget from "../widgets/note_icon";
import PromotedAttributesWidget from "../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";
import CallToActionDialog from "../widgets/dialogs/call_to_action.jsx";
import NoteTitleWidget from "../widgets/note_title.jsx";
import { PopupEditorFormattingToolbar } from "../widgets/ribbon/FormattingToolbar.js";
export function applyModals(rootContainer: RootContainer) {
rootContainer
.child(new BulkActionsDialog())
.child(new AboutDialog())
.child(new HelpDialog())
.child(new RecentChangesDialog())
.child(new BranchPrefixDialog())
.child(new SortChildNotesDialog())
.child(new IncludeNoteDialog())
.child(new NoteTypeChooserDialog())
.child(new JumpToNoteDialog())
.child(new AddLinkDialog())
.child(new CloneToDialog())
.child(new MoveToDialog())
.child(new ImportDialog())
.child(new ExportDialog())
.child(new MarkdownImportDialog())
.child(new ProtectedSessionPasswordDialog())
.child(new RevisionsDialog())
.child(new DeleteNotesDialog())
.child(new InfoDialog())
.child(new ConfirmDialog())
.child(new PromptDialog())
.child(new IncorrectCpuArchDialog())
.child(<BulkActionsDialog />)
.child(<AboutDialog />)
.child(<HelpDialog />)
.child(<RecentChangesDialog />)
.child(<BranchPrefixDialog />)
.child(<SortChildNotesDialog />)
.child(<IncludeNoteDialog />)
.child(<NoteTypeChooserDialog />)
.child(<JumpToNoteDialog />)
.child(<AddLinkDialog />)
.child(<CloneToDialog />)
.child(<MoveToDialog />)
.child(<ImportDialog />)
.child(<ExportDialog />)
.child(<MarkdownImportDialog />)
.child(<ProtectedSessionPasswordDialog />)
.child(<RevisionsDialog />)
.child(<DeleteNotesDialog />)
.child(<InfoDialog />)
.child(<ConfirmDialog />)
.child(<PromptDialog />)
.child(<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(<NoteIconWidget />)
.child(<NoteTitleWidget />))
.child(<PopupEditorFormattingToolbar />)
.child(new PromotedAttributesWidget())
.child(new NoteDetailWidget())
.child(new NoteListWidget(true)))
.child(new CallToActionDialog());
.child(<CallToActionDialog />);
}

View File

@@ -7,7 +7,6 @@ import ToggleSidebarButtonWidget from "../widgets/mobile_widgets/toggle_sidebar_
import MobileDetailMenuWidget from "../widgets/mobile_widgets/mobile_detail_menu.js";
import ScreenContainer from "../widgets/mobile_widgets/screen_container.js";
import ScrollingContainer from "../widgets/containers/scrolling_container.js";
import FilePropertiesWidget from "../widgets/ribbon_widgets/file_properties.js";
import FloatingButtons from "../widgets/floating_buttons/floating_buttons.js";
import EditButton from "../widgets/floating_buttons/edit_button.js";
import RelationMapButtons from "../widgets/floating_buttons/relation_map_buttons.js";
@@ -19,14 +18,18 @@ import GlobalMenuWidget from "../widgets/buttons/global_menu.js";
import LauncherContainer from "../widgets/containers/launcher_container.js";
import RootContainer from "../widgets/containers/root_container.js";
import SharedInfoWidget from "../widgets/shared_info.js";
import PromotedAttributesWidget from "../widgets/ribbon_widgets/promoted_attributes.js";
import PromotedAttributesWidget from "../widgets/promoted_attributes.js";
import SidebarContainer from "../widgets/mobile_widgets/sidebar_container.js";
import type AppContext from "../components/app_context.js";
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 MobileEditorToolbar from "../widgets/type_widgets/ckeditor/mobile_editor_toolbar.js";
import { applyModals } from "./layout_commons.js";
import CloseZenButton from "../widgets/close_zen_button.js";
import FilePropertiesTab from "../widgets/ribbon/FilePropertiesTab.jsx";
import { useNoteContext } from "../widgets/react/hooks.jsx";
import { useContext } from "preact/hooks";
import { ParentComponent } from "../widgets/react/react_utils.jsx";
const MOBILE_CSS = `
<style>
@@ -144,7 +147,7 @@ export default class MobileLayout {
.css("font-size", "larger")
.css("align-items", "center")
.child(new ToggleSidebarButtonWidget().contentSized())
.child(new NoteTitleWidget().contentSized().css("position", "relative").css("padding-left", "0.5em"))
.child(<NoteTitleWidget />)
.child(new MobileDetailMenuWidget(true).contentSized())
)
.child(new SharedInfoWidget())
@@ -164,7 +167,7 @@ export default class MobileLayout {
.contentSized()
.child(new NoteDetailWidget())
.child(new NoteListWidget(false))
.child(new FilePropertiesWidget().css("font-size", "smaller"))
.child(<FilePropertiesWrapper />)
)
.child(new MobileEditorToolbar())
)
@@ -181,3 +184,13 @@ export default class MobileLayout {
return rootContainer;
}
}
function FilePropertiesWrapper() {
const { note } = useNoteContext();
return (
<div>
{note?.type === "file" && <FilePropertiesTab note={note} />}
</div>
);
}

View File

@@ -2,6 +2,7 @@ import server from "./server.js";
import froca from "./froca.js";
import type FNote from "../entities/fnote.js";
import type { AttributeRow } from "./load_results.js";
import { AttributeType } from "@triliumnext/commons";
async function addLabel(noteId: string, name: string, value: string = "", isInheritable = false) {
await server.put(`notes/${noteId}/attribute`, {
@@ -25,6 +26,14 @@ async function removeAttributeById(noteId: string, attributeId: string) {
await server.remove(`notes/${noteId}/attributes/${attributeId}`);
}
export async function removeOwnedAttributesByNameOrType(note: FNote, type: AttributeType, name: string) {
for (const attr of note.getOwnedAttributes()) {
if (attr.type === type && attr.name === name) {
await server.remove(`notes/${note.noteId}/attributes/${attr.attributeId}`);
}
}
}
/**
* Removes a label identified by its name from the given note, if it exists. Note that the label must be owned, i.e.
* it will not remove inherited attributes.
@@ -52,7 +61,7 @@ function removeOwnedLabelByName(note: FNote, labelName: string) {
* @param value the value of the attribute to set.
*/
export async function setAttribute(note: FNote, type: "label" | "relation", name: string, value: string | null | undefined) {
if (value) {
if (value !== null && value !== undefined) {
// Create or update the attribute.
await server.put(`notes/${note.noteId}/set-attribute`, { type, name, value });
} else {

View File

@@ -18,7 +18,7 @@ import type FNote from "../entities/fnote.js";
import toast from "./toast.js";
import { BulkAction } from "@triliumnext/commons";
const ACTION_GROUPS = [
export const ACTION_GROUPS = [
{
title: t("bulk_actions.labels"),
actions: [AddLabelBulkAction, UpdateLabelValueBulkAction, RenameLabelBulkAction, DeleteLabelBulkAction]

View File

@@ -36,6 +36,8 @@ export interface Suggestion {
commandId?: string;
commandDescription?: string;
commandShortcut?: string;
attributeSnippet?: string;
highlightedAttributeSnippet?: string;
}
export interface Options {
@@ -323,7 +325,33 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
html += '</div>';
return html;
}
return `<span class="${suggestion.icon ?? "bx bx-note"}"></span> ${suggestion.highlightedNotePathTitle}`;
// Add special class for search-notes action
const actionClass = suggestion.action === "search-notes" ? "search-notes-action" : "";
// Choose appropriate icon based on action
let iconClass = suggestion.icon ?? "bx bx-note";
if (suggestion.action === "search-notes") {
iconClass = "bx bx-search";
} else if (suggestion.action === "create-note") {
iconClass = "bx bx-plus";
} else if (suggestion.action === "external-link") {
iconClass = "bx bx-link-external";
}
// Simplified HTML structure without nested divs
let html = `<div class="note-suggestion ${actionClass}">`;
html += `<span class="icon ${iconClass}"></span>`;
html += `<span class="text">`;
html += `<span class="search-result-title">${suggestion.highlightedNotePathTitle}</span>`;
// Add attribute snippet inline if available
if (suggestion.highlightedAttributeSnippet) {
html += `<span class="search-result-attributes">${suggestion.highlightedAttributeSnippet}</span>`;
}
html += `</span>`;
html += `</div>`;
return html;
}
},
// we can't cache identical searches because notes can be created / renamed, new recent notes can be added

View File

@@ -35,7 +35,7 @@ function download(url: string) {
}
}
function downloadFileNote(noteId: string) {
export function downloadFileNote(noteId: string) {
const url = `${getFileUrl("notes", noteId)}?${Date.now()}`; // don't use cache
download(url);
@@ -163,7 +163,7 @@ async function openExternally(type: string, entityId: string, mime: string) {
}
}
const openNoteExternally = async (noteId: string, mime: string) => await openExternally("notes", noteId, mime);
export const openNoteExternally = async (noteId: string, mime: string) => await openExternally("notes", noteId, mime);
const openAttachmentExternally = async (attachmentId: string, mime: string) => await openExternally("attachments", attachmentId, mime);
function getHost() {

View File

@@ -148,7 +148,7 @@ export function isElectron() {
return !!(window && window.process && window.process.type);
}
function isMac() {
export function isMac() {
return navigator.platform.indexOf("Mac") > -1;
}
@@ -185,7 +185,11 @@ export function escapeQuotes(value: string) {
return value.replaceAll('"', "&quot;");
}
function formatSize(size: number) {
export function formatSize(size: number | null | undefined) {
if (size === null || size === undefined) {
return "";
}
size = Math.max(Math.round(size / 1024), 1);
if (size < 1024) {
@@ -292,7 +296,7 @@ function isHtmlEmpty(html: string) {
);
}
async function clearBrowserCache() {
export async function clearBrowserCache() {
if (isElectron()) {
const win = dynamicRequire("@electron/remote").getCurrentWindow();
await win.webContents.session.clearCache();
@@ -740,7 +744,7 @@ function isUpdateAvailable(latestVersion: string | null | undefined, currentVers
return compareVersions(latestVersion, currentVersion) > 0;
}
function isLaunchBarConfig(noteId: string) {
export function isLaunchBarConfig(noteId: string) {
return ["_lbRoot", "_lbAvailableLaunchers", "_lbVisibleLaunchers", "_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers"].includes(noteId);
}
@@ -788,6 +792,38 @@ export function arrayEqual<T>(a: T[], b: T[]) {
return true;
}
type Indexed<T extends object> = T & { index: number };
/**
* Given an object array, alters every object in the array to have an index field assigned to it.
*
* @param items the objects to be numbered.
* @returns the same object for convenience, with the type changed to indicate the new index field.
*/
export function numberObjectsInPlace<T extends object>(items: T[]): Indexed<T>[] {
let index = 0;
for (const item of items) {
(item as Indexed<T>).index = index++;
}
return items as Indexed<T>[];
}
export function mapToKeyValueArray<K extends string | number | symbol, V>(map: Record<K, V>) {
const values: { key: K, value: V }[] = [];
for (const [ key, value ] of Object.entries(map)) {
values.push({ key: key as K, value: value as V });
}
return values;
}
export function getErrorMessage(e: unknown) {
if (e && typeof e === "object" && "message" in e && typeof e.message === "string") {
return e.message;
} else {
return "Unknown error";
}
}
export default {
reloadFrontendApp,
restartDesktopApp,

View File

@@ -28,6 +28,28 @@
--ck-mention-list-max-height: 500px;
}
body#trilium-app.motion-disabled *,
body#trilium-app.motion-disabled *::before,
body#trilium-app.motion-disabled *::after {
/* Disable transitions and animations */
transition: none !important;
animation: none !important;
}
body#trilium-app.shadows-disabled *,
body#trilium-app.shadows-disabled *::before,
body#trilium-app.shadows-disabled *::after {
/* Disable shadows */
box-shadow: none !important;
}
body#trilium-app.backdrop-effects-disabled *,
body#trilium-app.backdrop-effects-disabled *::before,
body#trilium-app.backdrop-effects-disabled *::after {
/* Disable backdrop effects */
backdrop-filter: none !important;
}
.table {
--bs-table-bg: transparent !important;
}
@@ -355,7 +377,7 @@ body.desktop .tabulator-popup-container {
@supports (animation-fill-mode: forwards) {
/* Delay the opening of submenus */
body.desktop .dropdown-submenu .dropdown-menu {
body.desktop:not(.motion-disabled) .dropdown-submenu .dropdown-menu {
opacity: 0;
animation-fill-mode: forwards;
animation-delay: var(--submenu-opening-delay);
@@ -840,10 +862,34 @@ table.promoted-attributes-in-tooltip th {
.aa-dropdown-menu .aa-suggestion {
cursor: pointer;
padding: 5px;
padding: 6px 16px;
margin: 0;
}
.aa-dropdown-menu .aa-suggestion .icon {
display: inline-block;
line-height: inherit;
vertical-align: top;
}
.aa-dropdown-menu .aa-suggestion .text {
display: inline-block;
width: calc(100% - 20px);
padding-left: 4px;
}
.aa-dropdown-menu .aa-suggestion .search-result-title {
display: block;
}
.aa-dropdown-menu .aa-suggestion .search-result-attributes {
display: block;
font-size: 0.8em;
color: var(--muted-text-color);
opacity: 0.6;
line-height: 1;
}
.aa-dropdown-menu .aa-suggestion p {
padding: 0;
margin: 0;
@@ -1773,20 +1819,42 @@ textarea {
font-size: 1em;
}
.jump-to-note-dialog .modal-dialog {
max-width: 900px;
width: 90%;
}
.jump-to-note-dialog .modal-header {
align-items: center;
}
.jump-to-note-dialog .modal-body {
padding: 0;
min-height: 200px;
}
.jump-to-note-results .aa-dropdown-menu {
max-height: 40vh;
max-height: calc(80vh - 200px);
width: 100%;
max-width: none;
overflow-y: auto;
overflow-x: hidden;
text-overflow: ellipsis;
box-shadow: none;
}
.jump-to-note-results {
width: 100%;
}
.jump-to-note-results .aa-suggestions {
padding: 1rem;
padding: 0;
width: 100%;
}
.jump-to-note-results .aa-dropdown-menu .aa-suggestion:hover,
.jump-to-note-results .aa-dropdown-menu .aa-cursor {
background-color: var(--hover-item-background-color, #f8f9fa);
}
/* Command palette styling */
@@ -1804,8 +1872,24 @@ textarea {
.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);
background-color: transparent;
}
.jump-to-note-dialog .show-in-full-search,
.jump-to-note-results .show-in-full-search {
border-top: 1px solid var(--main-border-color);
padding-top: 12px;
margin-top: 12px;
}
.jump-to-note-results .aa-suggestion .search-notes-action {
border-top: 1px solid var(--main-border-color);
margin-top: 8px;
padding-top: 8px;
}
.jump-to-note-results .aa-suggestion:has(.search-notes-action)::after {
display: none;
}
.jump-to-note-dialog .command-icon {
@@ -2262,7 +2346,8 @@ footer.webview-footer button {
/* Search result highlighting */
.search-result-title b,
.search-result-content b {
.search-result-content b,
.search-result-attributes b {
font-weight: 900;
color: var(--admonition-warning-accent-color);
}

View File

@@ -89,6 +89,7 @@
--menu-text-color: #e3e3e3;
--menu-background-color: #222222d9;
--menu-background-color-no-backdrop: #1b1b1b;
--menu-item-icon-color: #8c8c8c;
--menu-item-disabled-opacity: 0.5;
--menu-item-keyboard-shortcut-color: #ffffff8f;

View File

@@ -83,6 +83,7 @@
--menu-text-color: #272727;
--menu-background-color: #ffffffd9;
--menu-background-color-no-backdrop: #fdfdfd;
--menu-item-icon-color: #727272;
--menu-item-disabled-opacity: 0.6;
--menu-item-keyboard-shortcut-color: #666666a8;

View File

@@ -83,6 +83,12 @@
--tab-note-icons: true;
}
body.backdrop-effects-disabled {
/* Backdrop effects are disabled, replace the menu background color with the
* no-backdrop fallback color */
--menu-background-color: var(--menu-background-color-no-backdrop);
}
/*
* MENUS
*
@@ -530,10 +536,9 @@ body.mobile .dropdown-menu .dropdown-item.submenu-open .dropdown-toggle::after {
}
/* List item */
.jump-to-note-dialog .aa-suggestions div,
.note-detail-empty .aa-suggestions div {
.jump-to-note-dialog .aa-suggestion,
.note-detail-empty .aa-suggestion {
border-radius: 6px;
padding: 6px 12px;
color: var(--menu-text-color);
cursor: default;
}

View File

@@ -848,7 +848,7 @@
"debug": "调试",
"debug_description": "调试将打印额外的调试信息到控制台,以帮助调试复杂查询",
"action": "操作",
"search_button": "搜索 <kbd>回车</kbd>",
"search_button": "搜索",
"search_execute": "搜索并执行操作",
"save_to_note": "保存到笔记",
"search_parameters": "搜索参数",
@@ -1871,7 +1871,12 @@
"selected_provider": "已选提供商",
"selected_provider_description": "选择用于聊天和补全功能的AI提供商",
"select_model": "选择模型...",
"select_provider": "选择提供商..."
"select_provider": "选择提供商...",
"ai_enabled": "已启用 AI 功能",
"ai_disabled": "已禁用 AI 功能",
"no_models_found_online": "找不到模型。请检查您的 API 密钥及设置。",
"no_models_found_ollama": "找不到 Ollama 模型。请确认 Ollama 是否正在运行。",
"error_fetching": "获取模型失败:{{error}}"
},
"code-editor-options": {
"title": "编辑器"
@@ -1999,5 +2004,21 @@
"next_theme_message": "当前使用旧版主题,要试用新主题吗?",
"next_theme_button": "试用新主题",
"dismiss": "关闭"
},
"settings": {
"related_settings": "相关设置"
},
"settings_appearance": {
"related_code_blocks": "文本笔记中代码块的色彩方案",
"related_code_notes": "代码笔记的色彩方案"
},
"units": {
"percentage": "%"
},
"ui-performance": {
"title": "性能",
"enable-motion": "启用过渡和动画",
"enable-shadows": "启用阴影",
"enable-backdrop-effects": "启用菜单、弹窗和面板的背景效果"
}
}

View File

@@ -202,11 +202,12 @@
"okButton": "OK"
},
"jump_to_note": {
"search_button": "Suche im Volltext"
"search_button": "Suche im Volltext",
"search_placeholder": "Suche nach Notiz anhand ihres Titels oder gib > ein für Kommandos..."
},
"markdown_import": {
"dialog_title": "Markdown-Import",
"modal_body_text": "Aufgrund der Browser-Sandbox ist es nicht möglich, die Zwischenablage direkt aus JavaScript zu lesen. Bitte füge den zu importierenden Markdown in den Textbereich unten ein und klicke auf die Schaltfläche „Importieren“.",
"modal_body_text": "Aufgrund der Browser-Sandbox ist es nicht möglich, die Zwischenablage direkt aus JavaScript zu lesen. Bitte füge den zu importierenden Markdown in den Textbereich unten ein und klicke auf die Schaltfläche „Importieren“",
"import_button": "Importieren",
"import_success": "Markdown-Inhalt wurde in das Dokument importiert."
},
@@ -217,21 +218,26 @@
"search_placeholder": "Suche nach einer Notiz anhand ihres Namens",
"move_button": "Zur ausgewählten Notiz wechseln",
"error_no_path": "Kein Weg, auf den man sich bewegen kann.",
"move_success_message": "Ausgewählte Notizen wurden verschoben"
"move_success_message": "Ausgewählte Notizen wurden verschoben in "
},
"note_type_chooser": {
"modal_title": "Wähle den Notiztyp aus",
"modal_body": "Wähle den Notiztyp / die Vorlage der neuen Notiz:",
"templates": "Vorlagen"
"templates": "Vorlagen",
"change_path_prompt": "Ändern wo die neue Notiz erzeugt wird:",
"search_placeholder": "Durchsuche Pfad nach Namen (Standard falls leer)",
"builtin_templates": "Eingebaute Vorlage"
},
"password_not_set": {
"title": "Das Passwort ist nicht festgelegt",
"body1": "Geschützte Notizen werden mit einem Benutzerpasswort verschlüsselt, es wurde jedoch noch kein Passwort festgelegt."
"body1": "Geschützte Notizen werden mit einem Benutzerpasswort verschlüsselt, es wurde jedoch noch kein Passwort festgelegt.",
"body2": "Um Notizen zu schützen, klicke den unteren Button um den Optionsdialog zu öffnen und dein Passwort festzulegen.",
"go_to_password_options": "Gehe zu Passwortoptionen"
},
"prompt": {
"title": "Prompt",
"title": "Eingabeaufforderung",
"ok": "OK",
"defaultTitle": "Prompt"
"defaultTitle": "Eingabeaufforderung"
},
"protected_session_password": {
"modal_title": "Geschützte Sitzung",
@@ -265,10 +271,12 @@
"maximum_revisions": "Maximale Revisionen für aktuelle Notiz: {{number}}.",
"settings": "Einstellungen für Notizrevisionen",
"download_button": "Herunterladen",
"mime": "MIME:",
"mime": "MIME: ",
"file_size": "Dateigröße:",
"preview": "Vorschau:",
"preview_not_available": "Für diesen Notiztyp ist keine Vorschau verfügbar."
"preview_not_available": "Für diesen Notiztyp ist keine Vorschau verfügbar.",
"restore_button": "Wiederherstellen",
"delete_button": "Löschen"
},
"sort_child_notes": {
"sort_children_by": "Unternotizen sortieren nach...",
@@ -348,7 +356,7 @@
"sorted": "Hält untergeordnete Notizen alphabetisch nach Titel sortiert",
"sort_direction": "ASC (Standard) oder DESC",
"sort_folders_first": "Ordner (Notizen mit Unternotizen) sollten oben sortiert werden",
"top": "Behalte die angegebene Notiz oben in der übergeordneten Notiz (gilt nur für sortierte übergeordnete Notizen).",
"top": "Behalte die angegebene Notiz oben in der übergeordneten Notiz (gilt nur für sortierte übergeordnete Notizen)",
"hide_promoted_attributes": "Heraufgestufte Attribute für diese Notiz ausblenden",
"read_only": "Der Editor befindet sich im schreibgeschützten Modus. Funktioniert nur für Text- und Codenotizen.",
"auto_read_only_disabled": "Text-/Codenotizen können automatisch in den Lesemodus versetzt werden, wenn sie zu groß sind. Du kannst dieses Verhalten für jede einzelne Notiz deaktivieren, indem du diese Beschriftung zur Notiz hinzufügst",
@@ -371,10 +379,10 @@
"inbox": "Standard-Inbox-Position für neue Notizen wenn du eine Notiz über den \"Neue Notiz\"-Button in der Seitenleiste erstellst, wird die Notiz als untergeordnete Notiz der Notiz erstellt, die mit dem <code>#inbox</code>-Label markiert ist.",
"workspace_inbox": "Standard-Posteingangsspeicherort für neue Notizen, wenn sie zu einem Vorgänger dieser Arbeitsbereichsnotiz verschoben werden",
"sql_console_home": "Standardspeicherort der SQL-Konsolennotizen",
"bookmark_folder": "Notizen mit dieser Bezeichnung werden in den Lesezeichen als Ordner angezeigt (und ermöglichen den Zugriff auf ihre untergeordneten Ordner).",
"bookmark_folder": "Notizen mit dieser Bezeichnung werden in den Lesezeichen als Ordner angezeigt (und ermöglichen den Zugriff auf ihre untergeordneten Ordner)",
"share_hidden_from_tree": "Diese Notiz ist im linken Navigationsbaum ausgeblendet, kann aber weiterhin über ihre URL aufgerufen werden",
"share_external_link": "Die Notiz dient als Link zu einer externen Website im Freigabebaum",
"share_alias": "Lege einen Alias fest, unter dem die Notiz unter https://your_trilium_host/share/[dein_alias] verfügbar sein wird.",
"share_alias": "Lege einen Alias fest, mit dem die Notiz unter https://your_trilium_host/share/[dein_alias] verfügbar sein wird",
"share_omit_default_css": "Das Standard-CSS für die Freigabeseite wird weggelassen. Verwende es, wenn du umfangreiche Stylingänderungen vornimmst.",
"share_root": "Markiert eine Notiz, die im /share-Root bereitgestellt wird.",
"share_description": "Definiere Text, der dem HTML-Meta-Tag zur Beschreibung hinzugefügt werden soll",
@@ -390,7 +398,7 @@
"color": "Definiert die Farbe der Notiz im Notizbaum, in Links usw. Verwende einen beliebigen gültigen CSS-Farbwert wie „rot“ oder #a13d5f",
"keyboard_shortcut": "Definiert eine Tastenkombination, die sofort zu dieser Notiz springt. Beispiel: „Strg+Alt+E“. Erfordert ein Neuladen des Frontends, damit die Änderung wirksam wird.",
"keep_current_hoisting": "Das Öffnen dieses Links ändert das Hochziehen nicht, selbst wenn die Notiz im aktuell hochgezogenen Unterbaum nicht angezeigt werden kann.",
"execute_button": "Titel der Schaltfläche, die die aktuelle Codenotiz ausführt",
"execute_button": "Titel der Schaltfläche, welche die aktuelle Codenotiz ausführt",
"execute_description": "Längere Beschreibung der aktuellen Codenotiz, die zusammen mit der Schaltfläche „Ausführen“ angezeigt wird",
"exclude_from_note_map": "Notizen mit dieser Bezeichnung werden in der Notizenkarte ausgeblendet",
"new_notes_on_top": "Neue Notizen werden oben in der übergeordneten Notiz erstellt, nicht unten.",
@@ -405,10 +413,10 @@
"run_on_branch_change": "wird ausgeführt, wenn ein Zweig aktualisiert wird.",
"run_on_branch_deletion": "wird ausgeführt, wenn ein Zweig gelöscht wird. Der Zweig ist eine Verknüpfung zwischen der übergeordneten Notiz und der untergeordneten Notiz und wird z. B. gelöscht. beim Verschieben der Notiz (alter Zweig/Link wird gelöscht).",
"run_on_attribute_creation": "wird ausgeführt, wenn für die Notiz ein neues Attribut erstellt wird, das diese Beziehung definiert",
"run_on_attribute_change": "wird ausgeführt, wenn das Attribut einer Notiz geändert wird, die diese Beziehung definiert. Dies wird auch ausgelöst, wenn das Attribut gelöscht wird",
"run_on_attribute_change": " wird ausgeführt, wenn das Attribut einer Notiz geändert wird, die diese Beziehung definiert. Dies wird auch ausgelöst, wenn das Attribut gelöscht wird",
"relation_template": "Die Attribute der Notiz werden auch ohne eine Eltern-Kind-Beziehung vererbt. Der Inhalt und der Unterbaum der Notiz werden den Instanznotizen hinzugefügt, wenn sie leer sind. Einzelheiten findest du in der Dokumentation.",
"inherit": "Die Attribute einer Notiz werden auch ohne eine Eltern-Kind-Beziehung vererbt. Ein ähnliches Konzept findest du unter Vorlagenbeziehung. Siehe Attributvererbung in der Dokumentation.",
"render_note": "Notizen vom Typ \"HTML-Notiz rendern\" werden mit einer Code-Notiz (HTML oder Skript) gerendert, und es ist notwendig, über diese Beziehung anzugeben, welche Notiz gerendert werden soll.",
"render_note": "Notizen vom Typ \"HTML-Notiz rendern\" werden mit einer Code-Notiz (HTML oder Skript) gerendert, und es ist notwendig, über diese Beziehung anzugeben, welche Notiz gerendert werden soll",
"widget_relation": "Das Ziel dieser Beziehung wird ausgeführt und als Widget in der Seitenleiste gerendert",
"share_css": "CSS-Hinweis, der in die Freigabeseite eingefügt wird. Die CSS-Notiz muss sich ebenfalls im gemeinsamen Unterbaum befinden. Erwäge auch die Verwendung von „share_hidden_from_tree“ und „share_omit_default_css“.",
"share_js": "JavaScript-Hinweis, der in die Freigabeseite eingefügt wird. Die JS-Notiz muss sich ebenfalls im gemeinsamen Unterbaum befinden. Erwäge die Verwendung von „share_hidden_from_tree“.",
@@ -418,7 +426,8 @@
"other_notes_with_name": "Other notes with {{attributeType}} name \"{{attributeName}}\"",
"and_more": "... und {{count}} mehr.",
"print_landscape": "Beim Export als PDF, wird die Seitenausrichtung Querformat anstatt Hochformat verwendet.",
"print_page_size": "Beim Export als PDF, wird die Größe der Seite angepasst. Unterstützte Größen: <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": "Beim Export als PDF, wird die Größe der Seite angepasst. Unterstützte Größen: <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": "Farbe"
},
"attribute_editor": {
"help_text_body1": "Um ein Label hinzuzufügen, gebe einfach z.B. ein. <code>#rock</code> oder wenn du auch einen Wert hinzufügen möchten, dann z.B. <code>#year = 2024</code>",
@@ -490,9 +499,9 @@
"to": "nach",
"target_parent_note": "Ziel-Übergeordnetenotiz",
"on_all_matched_notes": "Auf allen übereinstimmenden Notizen",
"move_note_new_parent": "Verschiebe die Notiz in die neue übergeordnete Notiz, wenn die Notiz nur eine übergeordnete Notiz hat (d. h. der alte Zweig wird entfernt und ein neuer Zweig in die neue übergeordnete Notiz erstellt).",
"move_note_new_parent": "Verschiebe die Notiz in die neue übergeordnete Notiz, wenn die Notiz nur eine übergeordnete Notiz hat (d. h. der alte Zweig wird entfernt und ein neuer Zweig in die neue übergeordnete Notiz erstellt)",
"clone_note_new_parent": "Notiz auf die neue übergeordnete Notiz klonen, wenn die Notiz mehrere Klone/Zweige hat (es ist nicht klar, welcher Zweig entfernt werden soll)",
"nothing_will_happen": "Es passiert nichts, wenn die Notiz nicht zur Zielnotiz verschoben werden kann (d. h. dies würde einen Baumzyklus erzeugen)."
"nothing_will_happen": "Es passiert nichts, wenn die Notiz nicht zur Zielnotiz verschoben werden kann (z.B. wenn dies einen Kreislauf in der Baumstruktur erzeugen würde)"
},
"rename_note": {
"rename_note": "Notiz umbenennen",
@@ -500,10 +509,10 @@
"new_note_title": "neuer Notiztitel",
"click_help_icon": "Klicke rechts auf das Hilfesymbol, um alle Optionen anzuzeigen",
"evaluated_as_js_string": "Der angegebene Wert wird als JavaScript-String ausgewertet und kann somit über die injizierte <code>note</code>-Variable mit dynamischem Inhalt angereichert werden (Notiz wird umbenannt). Beispiele:",
"example_note": "<code>Notiz</code> alle übereinstimmenden Notizen werden in „Notiz“ umbenannt.",
"example_note": "<code>Notiz</code> alle übereinstimmenden Notizen werden in „Notiz“ umbenannt",
"example_new_title": "<code>NEU: ${note.title}</code> Übereinstimmende Notiztitel erhalten das Präfix „NEU:“",
"example_date_prefix": "<code>${note.dateCreatedObj.format('MM-DD:')}: ${note.title}</code> übereinstimmende Notizen werden mit dem Erstellungsmonat und -datum der Notiz vorangestellt",
"api_docs": "Siehe API-Dokumente für <a hrefu003d'https://zadam.github.io/trilium/backend_api/Note.html'>Notiz</a> und seinen <a hrefu003d'https://day.js.org/ docs/en/display/format'>dateCreatedObj / utcDateCreatedObj-Eigenschaften</a> für Details."
"api_docs": "Siehe API-Dokumente für <a href='https://zadam.github.io/trilium/backend_api/Note.html'>Notiz</a> und seinen <a href='https://day.js.org/ docs/en/display/format'>dateCreatedObj / utcDateCreatedObj properties</a> für Details."
},
"add_relation": {
"add_relation": "Beziehung hinzufügen",
@@ -577,7 +586,8 @@
"september": "September",
"october": "Oktober",
"november": "November",
"december": "Dezember"
"december": "Dezember",
"cannot_find_week_note": "Wochennotiz kann nicht gefunden werden"
},
"close_pane_button": {
"close_this_pane": "Schließe diesen Bereich"
@@ -699,14 +709,14 @@
"zoom_out_title": "Herauszoomen"
},
"zpetne_odkazy": {
"backlink": "{{count}} Backlink",
"backlinks": "{{count}} Backlinks",
"backlink": "{{count}} Rückverlinkung",
"backlinks": "{{count}} Rückverlinkungen",
"relation": "Beziehung"
},
"mobile_detail_menu": {
"insert_child_note": "Untergeordnete Notiz einfügen",
"delete_this_note": "Diese Notiz löschen",
"error_cannot_get_branch_id": "BranchId für notePath „{{notePath}}“ kann nicht abgerufen werden.",
"error_cannot_get_branch_id": "BranchId für notePath „{{notePath}}“ kann nicht abgerufen werden",
"error_unrecognized_command": "Unbekannter Befehl {{command}}"
},
"note_icon": {
@@ -718,7 +728,8 @@
"basic_properties": {
"note_type": "Notiztyp",
"editable": "Bearbeitbar",
"basic_properties": "Grundlegende Eigenschaften"
"basic_properties": "Grundlegende Eigenschaften",
"language": "Sprache"
},
"book_properties": {
"view_type": "Ansichtstyp",
@@ -729,7 +740,11 @@
"collapse": "Einklappen",
"expand": "Ausklappen",
"invalid_view_type": "Ungültiger Ansichtstyp „{{type}}“",
"calendar": "Kalender"
"calendar": "Kalender",
"book_properties": "Sammlungseigenschaften",
"table": "Tabelle",
"geo-map": "Weltkarte",
"board": "Tafel"
},
"edited_notes": {
"no_edited_notes_found": "An diesem Tag wurden noch keine Notizen bearbeitet...",
@@ -805,7 +820,9 @@
"unknown_label_type": "Unbekannter Labeltyp „{{type}}“",
"unknown_attribute_type": "Unbekannter Attributtyp „{{type}}“",
"add_new_attribute": "Neues Attribut hinzufügen",
"remove_this_attribute": "Entferne dieses Attribut"
"remove_this_attribute": "Entferne dieses Attribut",
"unset-field-placeholder": "nicht gesetzt",
"remove_color": "Entferne Farblabel"
},
"script_executor": {
"query": "Abfrage",
@@ -828,7 +845,7 @@
"debug": "debuggen",
"debug_description": "Debug gibt zusätzliche Debuginformationen in die Konsole aus, um das Debuggen komplexer Abfragen zu erleichtern",
"action": "Aktion",
"search_button": "Suchen <kbd>Eingabetaste</kbd>",
"search_button": "Suchen",
"search_execute": "Aktionen suchen und ausführen",
"save_to_note": "Als Notiz speichern",
"search_parameters": "Suchparameter",
@@ -867,7 +884,7 @@
"include_archived_notes": "Füge archivierte Notizen hinzu"
},
"limit": {
"limit": "Limit",
"limit": "Limitierung",
"take_first_x_results": "Nehmen Sie nur die ersten X angegebenen Ergebnisse."
},
"order_by": {
@@ -917,7 +934,7 @@
"attachment_detail": {
"open_help_page": "Hilfeseite zu Anhängen öffnen",
"owning_note": "Eigentümernotiz: ",
"you_can_also_open": ", Du kannst auch das öffnen",
"you_can_also_open": ", Du kannst auch das öffnen ",
"list_of_all_attachments": "Liste aller Anhänge",
"attachment_deleted": "Dieser Anhang wurde gelöscht."
},
@@ -942,7 +959,8 @@
"enter_workspace": "Betrete den Arbeitsbereich {{title}}"
},
"file": {
"file_preview_not_available": "Für dieses Dateiformat ist keine Dateivorschau verfügbar."
"file_preview_not_available": "Für dieses Dateiformat ist keine Dateivorschau verfügbar.",
"too_big": "Die Vorschau zeigt aus Effizienzgründen nur die ersten {{maxNumChars}} Zeichen der Datei an. Lade die Datei herunter und öffne sie extern um den gesamten Inhalt zu sehen."
},
"protected_session": {
"enter_password_instruction": "Um die geschützte Notiz anzuzeigen, musst du dein Passwort eingeben:",
@@ -981,7 +999,7 @@
"web_view": {
"web_view": "Webansicht",
"embed_websites": "Notiz vom Typ Web View ermöglicht das Einbetten von Websites in Trilium.",
"create_label": "To start, please create a label with a URL address you want to embed, e.g. #webViewSrc=\"https://www.google.com\""
"create_label": "Um zu beginnen, erstelle bitte ein Label mit einer URL-Adresse, die eingebettet werden soll, z. B. #webViewSrc=\"https://www.google.com\""
},
"backend_log": {
"refresh": "Aktualisieren"
@@ -1007,7 +1025,7 @@
"error_creating_anonymized_database": "Die anonymisierte Datenbank konnte nicht erstellt werden. Überprüfe die Backend-Protokolle auf Details",
"successfully_created_fully_anonymized_database": "Vollständig anonymisierte Datenbank in {{anonymizedFilePath}} erstellt",
"successfully_created_lightly_anonymized_database": "Leicht anonymisierte Datenbank in {{anonymizedFilePath}} erstellt",
"no_anonymized_database_yet": "Noch keine anonymisierte Datenbank"
"no_anonymized_database_yet": "Noch keine anonymisierte Datenbank."
},
"database_integrity_check": {
"title": "Datenbankintegritätsprüfung",
@@ -1028,7 +1046,7 @@
"failed": "Synchronisierung fehlgeschlagen: {{message}}"
},
"vacuum_database": {
"title": "Vakuumdatenbank",
"title": "Datenbank aufräumen",
"description": "Dadurch wird die Datenbank neu erstellt, was normalerweise zu einer kleineren Datenbankdatei führt. Es werden keine Daten tatsächlich geändert.",
"button_text": "Vakuumdatenbank",
"vacuuming_database": "Datenbank wird geleert...",
@@ -1063,7 +1081,8 @@
"max_width_label": "Maximale Inhaltsbreite in Pixel",
"apply_changes_description": "Um Änderungen an der Inhaltsbreite anzuwenden, klicke auf",
"reload_button": "Frontend neu laden",
"reload_description": "Änderungen an den Darstellungsoptionen"
"reload_description": "Änderungen an den Darstellungsoptionen",
"max_width_unit": "Pixel"
},
"native_title_bar": {
"title": "Native Titelleiste (App-Neustart erforderlich)",
@@ -1086,7 +1105,10 @@
"layout-vertical-title": "Vertikal",
"layout-horizontal-title": "Horizontal",
"layout-vertical-description": "Startleiste ist auf der linken Seite (standard)",
"layout-horizontal-description": "Startleiste ist unter der Tableiste. Die Tableiste wird dadurch auf die ganze Breite erweitert."
"layout-horizontal-description": "Startleiste ist unter der Tableiste. Die Tableiste wird dadurch auf die ganze Breite erweitert.",
"auto_theme": "Alt (Folge dem Farbschema des Systems)",
"light_theme": "Alt (Hell)",
"dark_theme": "Alt (Dunkel)"
},
"zoom_factor": {
"title": "Zoomfaktor (nur Desktop-Build)",
@@ -1095,7 +1117,8 @@
"code_auto_read_only_size": {
"title": "Automatische schreibgeschützte Größe",
"description": "Die automatische schreibgeschützte Notizgröße ist die Größe, ab der Notizen im schreibgeschützten Modus angezeigt werden (aus Leistungsgründen).",
"label": "Automatische schreibgeschützte Größe (Codenotizen)"
"label": "Automatische schreibgeschützte Größe (Codenotizen)",
"unit": "Zeichen"
},
"code_mime_types": {
"title": "Verfügbare MIME-Typen im Dropdown-Menü"
@@ -1114,12 +1137,13 @@
"download_images_description": "Eingefügter HTML-Code kann Verweise auf Online-Bilder enthalten. Trilium findet diese Verweise und lädt die Bilder herunter, sodass sie offline verfügbar sind.",
"enable_image_compression": "Bildkomprimierung aktivieren",
"max_image_dimensions": "Maximale Breite/Höhe eines Bildes in Pixel (die Größe des Bildes wird geändert, wenn es diese Einstellung überschreitet).",
"jpeg_quality_description": "JPEG-Qualität (10 schlechteste Qualität, 100 beste Qualität, 50 85 wird empfohlen)"
"jpeg_quality_description": "JPEG-Qualität (10 schlechteste Qualität, 100 beste Qualität, 50 85 wird empfohlen)",
"max_image_dimensions_unit": "Pixel"
},
"attachment_erasure_timeout": {
"attachment_erasure_timeout": "Zeitüberschreitung beim Löschen von Anhängen",
"attachment_auto_deletion_description": "Anhänge werden automatisch gelöscht (und gelöscht), wenn sie nach einer definierten Zeitspanne nicht mehr in ihrer Notiz referenziert werden.",
"erase_attachments_after": "Erase unused attachments after:",
"erase_attachments_after": "Nicht verwendete Anhänge löschen nach:",
"manual_erasing_description": "Du kannst das Löschen auch manuell auslösen (ohne Berücksichtigung des oben definierten Timeouts):",
"erase_unused_attachments_now": "Lösche jetzt nicht verwendete Anhangnotizen",
"unused_attachments_erased": "Nicht verwendete Anhänge wurden gelöscht."
@@ -1130,7 +1154,7 @@
},
"note_erasure_timeout": {
"note_erasure_timeout_title": "Beachte das Zeitlimit für die Löschung",
"note_erasure_description": "Deleted notes (and attributes, revisions...) are at first only marked as deleted and it is possible to recover them from Recent Notes dialog. After a period of time, deleted notes are \"erased\" which means their content is not recoverable anymore. This setting allows you to configure the length of the period between deleting and erasing the note.",
"note_erasure_description": "Gelöschte Notizen (und Attribute, Notizrevisionen...) werden zunächst nur als gelöscht markiert und können über den Dialog „Zuletzt verwendete Notizen” wiederhergestellt werden. Nach einer bestimmten Zeit werden gelöschte Notizen „gelöscht”, was bedeutet, dass ihr Inhalt nicht mehr wiederhergestellt werden kann. Mit dieser Einstellung können Sie die Zeitspanne zwischen dem Löschen und dem endgültigen Löschen der Notiz festlegen.",
"erase_notes_after": "Notizen löschen nach:",
"manual_erasing_description": "Du kannst das Löschen auch manuell auslösen (ohne Berücksichtigung des oben definierten Timeouts):",
"erase_deleted_notes_now": "Jetzt gelöschte Notizen löschen",
@@ -1146,7 +1170,8 @@
"note_revisions_snapshot_limit_description": "Das Limit für Notizrevision-Snapshots bezieht sich auf die maximale Anzahl von Revisionen, die für jede Notiz gespeichert werden können. Dabei bedeutet -1, dass es kein Limit gibt, und 0 bedeutet, dass alle Revisionen gelöscht werden. Du kannst das maximale Limit für Revisionen einer einzelnen Notiz über das Label #versioningLimit festlegen.",
"snapshot_number_limit_label": "Limit der Notizrevision-Snapshots:",
"erase_excess_revision_snapshots": "Überschüssige Revision-Snapshots jetzt löschen",
"erase_excess_revision_snapshots_prompt": "Überschüssige Revision-Snapshots wurden gelöscht."
"erase_excess_revision_snapshots_prompt": "Überschüssige Revision-Snapshots wurden gelöscht.",
"snapshot_number_limit_unit": "Momentaufnahmen"
},
"search_engine": {
"title": "Suchmaschine",
@@ -1188,19 +1213,29 @@
"title": "Inhaltsverzeichnis",
"description": "Das Inhaltsverzeichnis wird in Textnotizen angezeigt, wenn die Notiz mehr als eine definierte Anzahl von Überschriften enthält. Du kannst diese Nummer anpassen:",
"disable_info": "Du kannst diese Option auch verwenden, um TOC effektiv zu deaktivieren, indem du eine sehr hohe Zahl festlegst.",
"shortcut_info": "Du kannst eine Tastenkombination zum schnellen Umschalten des rechten Bereichs (einschließlich Inhaltsverzeichnis) unter Optionen -> Tastenkombinationen konfigurieren (Name „toggleRightPane“)."
"shortcut_info": "Du kannst eine Tastenkombination zum schnellen Umschalten des rechten Bereichs (einschließlich Inhaltsverzeichnis) unter Optionen -> Tastenkombinationen konfigurieren (Name „toggleRightPane“).",
"unit": "Überschriften"
},
"text_auto_read_only_size": {
"title": "Automatische schreibgeschützte Größe",
"description": "Die automatische schreibgeschützte Notizgröße ist die Größe, ab der Notizen im schreibgeschützten Modus angezeigt werden (aus Leistungsgründen).",
"label": "Automatische schreibgeschützte Größe (Textnotizen)"
"label": "Automatische schreibgeschützte Größe (Textnotizen)",
"unit": "Zeichen"
},
"i18n": {
"title": "Lokalisierung",
"language": "Sprache",
"first-day-of-the-week": "Erster Tag der Woche",
"sunday": "Sonntag",
"monday": "Montag"
"monday": "Montag",
"first-week-of-the-year": "Erste Woche des Jahres",
"first-week-contains-first-day": "Erste Woche enthält den ersten Tag des Jahres",
"first-week-contains-first-thursday": "Erste Woche enthält den ersten Donnerstag des Jahres",
"first-week-has-minimum-days": "Erste Woche hat Mindestanzahl an Tagen",
"min-days-in-first-week": "Mindestanzahl an Tagen in erster Woche",
"first-week-info": "Die erste Woche, die den ersten Donnerstag des Jahres enthält, basiert auf dem Standard <a href=\"https://en.wikipedia.org/wiki/ISO_week_date#First_week\">ISO 8601</a>.",
"first-week-warning": "Das Ändern der Optionen für die erste Woche kann zu Duplikaten mit bestehenden Wochen-Notizen führen. Bestehende Wochen-Notizen werden nicht entsprechend aktualisiert.",
"formatting-locale": "Datums- und Zahlenformat"
},
"backup": {
"automatic_backup": "Automatische Sicherung",
@@ -1361,7 +1396,7 @@
"duplicate": "Duplizieren",
"export": "Exportieren",
"import-into-note": "In Notiz importieren",
"apply-bulk-actions": "Massenaktionen ausführen",
"apply-bulk-actions": "Massenaktionen anwenden",
"converted-to-attachments": "{{count}} Notizen wurden als Anhang konvertiert.",
"convert-to-attachment-confirm": "Bist du sicher, dass du die ausgewählten Notizen in Anhänge ihrer übergeordneten Notizen umwandeln möchtest?"
},
@@ -1377,7 +1412,7 @@
"relation-map": "Beziehungskarte",
"note-map": "Notizkarte",
"render-note": "Render Notiz",
"mermaid-diagram": "Mermaid Diagram",
"mermaid-diagram": "Mermaid Diagramm",
"canvas": "Canvas",
"web-view": "Webansicht",
"mind-map": "Mind Map",
@@ -1387,7 +1422,7 @@
"doc": "Dokument",
"widget": "Widget",
"confirm-change": "Es is nicht empfehlenswert den Notiz-Typ zu ändern, wenn der Inhalt der Notiz nicht leer ist. Möchtest du dennoch fortfahren?",
"geo-map": "Geo Map",
"geo-map": "Geo-Karte",
"beta-feature": "Beta"
},
"protect_note": {
@@ -1561,11 +1596,11 @@
"label": "Format Toolbar",
"floating": {
"title": "Schwebend",
"description": "Werkzeuge erscheinen in Cursornähe"
"description": "Werkzeuge erscheinen in Cursornähe;"
},
"fixed": {
"title": "Fixiert",
"description": "Werkzeuge erscheinen im \"Format\" Tab"
"description": "Werkzeuge erscheinen im \"Format\" Tab."
},
"multiline-toolbar": "Toolbar wenn nötig in mehreren Zeilen darstellen."
}
@@ -1631,5 +1666,188 @@
},
"modal": {
"close": "Schließen"
},
"ai_llm": {
"n_notes_queued": "{{ count }} Notiz zur Indizierung vorgemerkt",
"n_notes_queued_plural": "{{ count }} Notizen zur Indizierung vorgemerkt",
"notes_indexed": "{{ count }} Notiz indiziert",
"notes_indexed_plural": "{{ count }} Notizen indiziert",
"not_started": "Nicht gestartet",
"title": "KI Einstellungen",
"processed_notes": "Verarbeitete Notizen",
"total_notes": "Gesamt Notizen",
"progress": "Fortschritt",
"queued_notes": "Eingereihte Notizen",
"failed_notes": "Fehlgeschlagenen Notizen",
"last_processed": "Zuletzt verarbeitet",
"refresh_stats": "Statistiken neu laden",
"enable_ai_features": "Aktiviere KI/LLM Funktionen",
"enable_ai_description": "Aktiviere KI-Funktionen wie Notizzusammenfassungen, Inhaltserzeugung und andere LLM-Funktionen",
"openai_tab": "OpenAI",
"anthropic_tab": "Anthropic",
"voyage_tab": "Voyage AI",
"ollama_tab": "Ollama",
"enable_ai": "Aktiviere KI/LLM Funktionen",
"enable_ai_desc": "Aktiviere KI-Funktionen wie Notizzusammenfassungen, Inhaltserzeugung und andere LLM-Funktionen",
"provider_configuration": "KI-Anbieterkonfiguration",
"provider_precedence": "Anbieter Priorität",
"provider_precedence_description": "Komma-getrennte Liste von Anbieter in der Reihenfolge ihrer Priorität (z.B. 'openai, anthropic,ollama')",
"temperature": "Temperatur",
"temperature_description": "Regelt die Zufälligkeit in Antworten (0 = deterministisch, 2 = maximale Zufälligkeit)",
"system_prompt": "Systemaufforderung",
"system_prompt_description": "Standard Systemaufforderung für alle KI-Interaktionen",
"openai_configuration": "OpenAI Konfiguration",
"openai_settings": "OpenAI Einstellungen",
"api_key": "API Schlüssel",
"url": "Basis-URL",
"model": "Modell",
"anthropic_settings": "Anthropic Einstellungen",
"partial": "{{ percentage }}% verarbeitet",
"anthropic_api_key_description": "Dein Anthropic API-Key für den Zugriff auf Claude Modelle",
"anthropic_model_description": "Anthropic Claude Modell für Chat-Vervollständigung",
"voyage_settings": "Einstellungen für Voyage AI",
"ollama_url_description": "URL für die Ollama API (Standard: http://localhost:11434)",
"ollama_model_description": "Ollama Modell für Chat-Vervollständigung",
"anthropic_configuration": "Anthropic Konfiguration",
"voyage_configuration": "Voyage AI Konfiguration",
"voyage_url_description": "Standard: https://api.voyageai.com/v1",
"ollama_configuration": "Ollama Konfiguration",
"enable_ollama": "Aktiviere Ollama",
"enable_ollama_description": "Aktiviere Ollama für lokale KI Modell Nutzung",
"ollama_url": "Ollama URL",
"ollama_model": "Ollama Modell",
"refresh_models": "Aktualisiere Modelle",
"refreshing_models": "Aktualisiere...",
"enable_automatic_indexing": "Aktiviere automatische Indizierung",
"rebuild_index": "Index neu aufbauen",
"rebuild_index_error": "Fehler beim Neuaufbau des Index. Prüfe Log für mehr Informationen.",
"retry_failed": "Fehler: Notiz konnte nicht erneut eingereiht werden",
"max_notes_per_llm_query": "Max. Notizen je Abfrage",
"max_notes_per_llm_query_description": "Maximale Anzahl ähnlicher Notizen zum Einbinden als KI Kontext",
"active_providers": "Aktive Anbieter",
"disabled_providers": "Inaktive Anbieter",
"remove_provider": "Entferne Anbieter von Suche",
"restore_provider": "Anbieter zur Suche wiederherstellen",
"similarity_threshold": "Ähnlichkeitsschwelle",
"similarity_threshold_description": "Mindestähnlichkeitswert (0-1) für Notizen, die im Kontext für LLM-Abfragen berücksichtigt werden sollen",
"reprocess_index": "Suchindex neu erstellen",
"reprocessing_index": "Neuerstellung...",
"reprocess_index_started": "Suchindex-Optimierung wurde im Hintergrund gestartet",
"reprocess_index_error": "Fehler beim Wiederaufbau des Suchindex",
"index_rebuild_progress": "Fortschritt der Index-Neuerstellung",
"index_rebuilding": "Optimierung Index ({{percentage}}%)",
"index_rebuild_complete": "Index Optimierung abgeschlossen",
"index_rebuild_status_error": "Fehler bei Überprüfung Status Index Neuerstellung",
"never": "Niemals",
"processing": "Verarbeitung ({{percentage}}%)",
"refreshing": "Aktualisiere...",
"incomplete": "Unvollständig ({{percentage}}%)",
"complete": "Abgeschlossen (100%)",
"auto_refresh_notice": "Auto-Aktualisierung alle {{seconds}} Sekunden",
"note_queued_for_retry": "Notiz in Warteschlange für erneuten Versuch hinzugefügt",
"failed_to_retry_note": "Wiederholungsversuch fehlgeschlagen für Notiz",
"ai_settings": "KI Einstellungen",
"agent": {
"processing": "Verarbeite...",
"thinking": "Nachdenken...",
"loading": "Lade...",
"generating": "Generiere..."
},
"name": "KI",
"openai": "OpenAI",
"use_enhanced_context": "Benutze verbesserten Kontext",
"openai_api_key_description": "Dein OpenAPI-Key für den Zugriff auf den KI-Dienst",
"default_model": "Standardmodell",
"openai_model_description": "Beispiele: gpt-4o, gpt-4-turbo, gpt-3.5-turbo",
"base_url": "Basis URL",
"openai_url_description": "Standard: https://api.openai.com/v1",
"anthropic_url_description": "Basis URL für Anthropic API (Standard: https://api.anthropic.com)",
"ollama_settings": "Ollama Einstellungen",
"note_title": "Notiz Titel",
"error": "Fehler",
"last_attempt": "Letzter Versuch",
"actions": "Aktionen",
"retry": "Erneut versuchen",
"retry_queued": "Notiz für weiteren Versuch eingereiht",
"empty_key_warning": {
"anthropic": "Anthropic API-Key ist leer. Bitte gültigen API-Key eingeben.",
"openai": "OpenAI API-Key ist leer. Bitte gültigen API-Key eingeben.",
"voyage": "Voyage API-Key ist leer. Bitte gültigen API-Key eingeben.",
"ollama": "Ollama API-Key ist leer. Bitte gültigen API-Key eingeben."
},
"api_key_tooltip": "API-Key für den Zugriff auf den Dienst",
"failed_to_retry_all": "Wiederholungsversuch für Notizen fehlgeschlagen",
"all_notes_queued_for_retry": "Alle fehlgeschlagenen Notizen wurden zur Wiederholung in die Warteschlange gestellt",
"enhanced_context_description": "Versorgt die KI mit mehr Kontext aus der Notiz und den zugehörigen Notizen, um bessere Antworten zu ermöglichen",
"show_thinking": "Zeige Denkprozess",
"show_thinking_description": "Zeige den Denkprozess der KI",
"enter_message": "Geben Sie Ihre Nachricht ein...",
"error_contacting_provider": "Fehler beim Kontaktieren des KI-Anbieters. Bitte überprüfe die Einstellungen und die Internetverbindung.",
"error_generating_response": "Fehler beim Generieren der KI Antwort",
"index_all_notes": "Indiziere alle Notizen",
"index_status": "Indizierungsstatus",
"indexed_notes": "Indizierte Notizen",
"indexing_stopped": "Indizierung gestoppt",
"indexing_in_progress": "Indizierung in Bearbeitung...",
"last_indexed": "Zuletzt Indiziert",
"note_chat": "Notizen-Chat",
"sources": "Quellen",
"start_indexing": "Starte Indizierung",
"use_advanced_context": "Benutze erweiterten Kontext",
"ollama_no_url": "Ollama ist nicht konfiguriert. Bitte trage eine gültige URL ein.",
"chat": {
"root_note_title": "KI Chats",
"root_note_content": "Diese Notiz enthält gespeicherte KI-Chat-Unterhaltungen.",
"new_chat_title": "Neuer Chat",
"create_new_ai_chat": "Erstelle neuen KI Chat"
},
"create_new_ai_chat": "Erstelle neuen KI Chat",
"configuration_warnings": "Es wurden Probleme mit der KI Konfiguration festgestellt. Bitte überprüfe die Einstellungen.",
"experimental_warning": "Die LLM-Funktionen sind aktuell experimentell - sei an dieser Stelle gewarnt.",
"selected_provider": "Ausgewählter Anbieter",
"selected_provider_description": "Wähle einen KI-Anbieter für Chat- und Vervollständigungsfunktionen",
"select_model": "Wähle Modell...",
"select_provider": "Wähle Anbieter...",
"ai_enabled": "KI Funktionen aktiviert",
"ai_disabled": "KI Funktionen deaktiviert",
"no_models_found_online": "Keine Modelle gefunden. Bitte überprüfe den API-Key und die Einstellungen.",
"no_models_found_ollama": "Kein Ollama Modell gefunden. Bitte prüfe, ob Ollama gerade läuft.",
"error_fetching": "Fehler beim Abrufen der Modelle: {{error}}"
},
"zen_mode": {
"button_exit": "Verlasse Zen Modus"
},
"ui-performance": {
"title": "Leistung",
"enable-motion": "Aktiviere Übergänge und Animationen",
"enable-shadows": "Aktiviere Schatten",
"enable-backdrop-effects": "Aktiviere Hintergrundeffekte für Menüs, Pop-up Fenster und Panele"
},
"code-editor-options": {
"title": "Editor"
},
"custom_date_time_format": {
"title": "Benutzerdefiniertes Datums-/Zeitformat",
"description": "Passe das Format des Datums und der Uhrzeit an, die über <shortcut /> oder die Symbolleiste eingefügt werden. Die verfügbaren Format-Tokens sind unter <doc>Day.js docs</doc> zu finden.",
"format_string": "Format Zeichenfolge:",
"formatted_time": "Formatiertes Datum/Uhrzeit:"
},
"multi_factor_authentication": {
"title": "Multi-Faktor-Authentifizierung",
"description": "Die Multi-Faktor-Authentifizierung (MFA) bietet Ihrem Konto eine zusätzliche Sicherheitsebene. Anstatt sich lediglich mit einem Passwort anzumelden, müssen bei der MFA ein oder mehrere zusätzliche Nachweise erbracht werden, um die Identität zu bestätigen. Auf diese Weise kann selbst bei Bekanntwerden des Passworts, ohne die zweite Information nicht auf Ihr Konto zugegriffen werden. Das ist so, als würden Sie ein zusätzliches Schloss an einer Tür anbringen, wodurch es für andere viel schwieriger wird, einzubrechen.<br><br>Befolgen Sie bitte die nachstehenden Anweisungen, um MFA zu aktivieren. Wenn Sie die Konfiguration nicht korrekt vornehmen, erfolgt die Anmeldung weiterhin nur mit dem Passwort.",
"mfa_enabled": "Aktiviere Multi-Faktor-Authentifizierung",
"mfa_method": "MFA Methode",
"electron_disabled": "Multi-Faktor-Authentifizierung wird aktuell nicht in der Desktop-Version unterstützt.",
"totp_title": "Zeitbasiertes Einmalpasswort (TOTP)",
"totp_description": "TOTP (Zeitbasiertes Einmalpasswort) ist eine Sicherheitsfunktion, die einen einzigartigen, temporären Code generiert, der sich alle 30 Sekunden ändert. Sie verwenden diesen Code zusammen mit Ihrem Passwort, um sich bei Ihrem Konto anzumelden, wodurch es für andere Personen wesentlich schwieriger wird, darauf unbefugt zuzugreifen.",
"totp_secret_title": "Generiere TOTP Geheimnis",
"totp_secret_generate": "Generiere TOTP Geheimnis",
"totp_secret_regenerate": "TOTP-Geheimnis neu generieren",
"no_totp_secret_warning": "Um TOTP zu aktivieren, muss zunächst ein TOTP Geheimnis generiert werden.",
"totp_secret_description_warning": "Nach der Generierung des TOTP Geheimnisses ist eine Neuanmeldung mit dem TOTP Geheimnis erforderlich.",
"totp_secret_generated": "TOTP Geheimnis generiert",
"totp_secret_warning": "Bitte speichere das TOTP Geheimnis an einem sicheren Ort. Es wird nicht noch einmal angezeigt.",
"totp_secret_regenerate_confirm": "Möchten Sie das TOTP-Geheimnis wirklich neu generieren? Dadurch werden das bisherige TOTP-Geheimnis und alle vorhandenen Wiederherstellungscodes ungültig.",
"recovery_keys_title": "Einmalige Wiederherstellungsschlüssel"
}
}

View File

@@ -732,7 +732,8 @@
"note_type": "Note type",
"editable": "Editable",
"basic_properties": "Basic Properties",
"language": "Language"
"language": "Language",
"configure_code_notes": "Configure code notes..."
},
"book_properties": {
"view_type": "View type",
@@ -848,7 +849,7 @@
"debug": "debug",
"debug_description": "Debug will print extra debugging information into the console to aid in debugging complex queries",
"action": "action",
"search_button": "Search <kbd>enter</kbd>",
"search_button": "Search",
"search_execute": "Search & Execute actions",
"save_to_note": "Save to note",
"search_parameters": "Search Parameters",
@@ -1113,6 +1114,12 @@
"layout-vertical-description": "launcher bar is on the left (default)",
"layout-horizontal-description": "launcher bar is underneath the tab bar, the tab bar is now full width."
},
"ui-performance": {
"title": "Performance",
"enable-motion": "Enable transitions and animations",
"enable-shadows": "Enable shadows",
"enable-backdrop-effects": "Enable background effects for menus, popups and panels"
},
"ai_llm": {
"not_started": "Not started",
"title": "AI Settings",

View File

@@ -848,7 +848,7 @@
"debug": "depurar",
"debug_description": "La depuración imprimirá información de depuración adicional en la consola para ayudar a depurar consultas complejas",
"action": "acción",
"search_button": "Buscar <kbd>Enter</kbd>",
"search_button": "Buscar",
"search_execute": "Buscar y ejecutar acciones",
"save_to_note": "Guardar en nota",
"search_parameters": "Parámetros de búsqueda",

View File

@@ -848,7 +848,7 @@
"debug": "debug",
"debug_description": "Debug imprimera des informations supplémentaires dans la console pour faciliter le débogage des requêtes complexes",
"action": "action",
"search_button": "Recherche <kbd>Entrée</kbd>",
"search_button": "Recherche",
"search_execute": "Rechercher et exécuter des actions",
"save_to_note": "Enregistrer dans la note",
"search_parameters": "Paramètres de recherche",
@@ -1680,6 +1680,16 @@
"n_notes_queued_2": "",
"notes_indexed_0": "{{ count }} note indexée",
"notes_indexed_1": "{{ count }} notes indexées",
"notes_indexed_2": ""
"notes_indexed_2": "",
"anthropic_url_description": "URL de base pour l'API Anthropic (par défaut : https ://api.anthropic.com)",
"anthropic_model_description": "Modèles Anthropic Claude pour la complétion",
"voyage_settings": "Réglages d'IA Voyage",
"ollama_settings": "Réglages Ollama",
"ollama_url_description": "URL pour l'API Ollama (par défaut: http://localhost:11434)",
"ollama_model_description": "Model Ollama utilisé pour la complétion",
"anthropic_configuration": "Configuration Anthropic",
"voyage_configuration": "Configuration IA Voyage",
"voyage_url_description": "Défaut: https://api.voyageai.com/v1",
"ollama_configuration": "Configuration Ollama"
}
}

View File

@@ -185,7 +185,7 @@
"debug": "デバッグ",
"debug_description": "デバッグは複雑なクエリのデバッグを支援するために、追加のデバッグ情報をコンソールに出力します",
"action": "アクション",
"search_button": "検索 <kbd>Enter</kbd>",
"search_button": "検索",
"search_execute": "検索とアクションの実行",
"save_to_note": "ノートに保存",
"search_parameters": "検索パラメータ",
@@ -692,7 +692,8 @@
"placeholder_search": "ノート名で検索",
"dialog_title": "埋め込みノート",
"box_size_prompt": "埋め込みノート枠のサイズ:",
"button_include": "埋め込みノート"
"button_include": "埋め込みノート",
"label_note": "ノート"
},
"ancestor": {
"placeholder": "ノート名で検索"

View File

@@ -0,0 +1,29 @@
{
"about": {
"title": "Trilium Notes에 대해서",
"homepage": "홈페이지:",
"app_version": "앱 버전:",
"db_version": "DB 버전:",
"sync_version": "동기화 버전:",
"build_date": "빌드 날짜:",
"build_revision": "빌드 리비전:",
"data_directory": "데이터 경로:"
},
"toast": {
"critical-error": {
"title": "심각한 오류",
"message": "클라이언트 애플리케이션 시작 도중 심각한 오류가 발생했습니다:\n\n{{message}}\n\n이는 스크립트가 예기치 않게 실패하면서 발생한 것일 수 있습니다. 애플리케이션을 안전 모드로 시작한 뒤 문제를 해결해 보세요."
},
"widget-error": {
"title": "위젯 초기화 실패"
}
},
"add_link": {
"add_link": "링크 추가",
"note": "노트",
"search_note": "이름으로 노트 검색하기"
},
"branch_prefix": {
"save": "저장"
}
}

View File

@@ -0,0 +1,9 @@
{
"about": {
"title": "Over Trilium Notes",
"homepage": "Homepagina:",
"app_version": "App versie:",
"db_version": "DB Versie:",
"sync_version": "Sync Versie:"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -40,7 +40,7 @@
"add_relation": {
"add_relation": "Adaugă relație",
"allowed_characters": "Sunt permise doar caractere alfanumerice, underline și două puncte.",
"create_relation_on_all_matched_notes": "Crează relația pentru toate notițele găsite",
"create_relation_on_all_matched_notes": "Creează relația pentru toate notițele găsite.",
"relation_name": "denumirea relației",
"target_note": "notița destinație",
"to": "către"
@@ -76,9 +76,9 @@
"attachment_erasure_timeout": {
"attachment_auto_deletion_description": "Atașamentele se șterg automat (permanent) dacă nu sunt referențiate de către notița lor părinte după un timp prestabilit de timp.",
"attachment_erasure_timeout": "Perioadă de ștergere a atașamentelor",
"erase_attachments_after": "Erase unused attachments after:",
"erase_attachments_after": "Șterge atașamentele neutilizate după:",
"erase_unused_attachments_now": "Elimină atașamentele șterse acum",
"manual_erasing_description": "Șterge acum toate atașamentele nefolosite din notițe",
"manual_erasing_description": "Puteți șterge atașamentele nefolosite manual (fără a lua în considerare timpul de mai sus):",
"unused_attachments_erased": "Atașamentele nefolosite au fost șterse."
},
"attachment_list": {
@@ -141,7 +141,7 @@
"hide_promoted_attributes": "Ascunde lista atributelor promovate pentru această notiță",
"hide_relations": "lista denumirilor relațiilor ce trebuie ascunse, delimitate prin virgulă. Toate celelalte vor fi afișate.",
"icon_class": "valoarea acestei etichete este adăugată ca o clasă CSS la iconița notiței din ierarhia notițelor, fapt ce poate ajuta la identificarea vizuală mai rapidă a notițelor. Un exemplu ar fi „bx bx-home” pentru iconițe preluate din boxicons. Poate fi folosită în notițe de tip șablon.",
"inbox": "locația implicită în care vor apărea noile notițe atunci când se crează o noitiță utilizând butonul „Crează notiță” din bara laterală, notițele vor fi create în interiorul notiței cu această etichetă.",
"inbox": "locația implicită în care vor apărea noile notițe atunci când se crează o noitiță utilizând butonul „Crează notiță” din bara laterală, notițele vor fi create în interiorul notiței marcată cu eticheta <code>#inbox</code>.",
"inherit": "atributele acestei notițe vor fi moștenite chiar dacă nu există o relație părinte-copil între notițe. A se vedea relația de tip șablon pentru un concept similar. De asemenea, a se vedea moștenirea atributelor în documentație.",
"inheritable": "Moștenibilă",
"inheritable_title": "Atributele moștenibile vor fi moștenite de către toți descendenții acestei notițe.",
@@ -177,7 +177,7 @@
"render_note": "relație ce definește notița (de tip notiță de cod HTML sau script) ce trebuie randată pentru notițele de tip „Randare notiță HTML”",
"run": "definește evenimentele la care să ruleze scriptul. Valori acceptate:\n<ul>\n<li>frontendStartup - când pornește interfața Trilium (sau este reîncărcată), dar nu pe mobil.</li>\n<li>mobileStartup - când pornește interfața Trilium (sau este reîncărcată), doar pe mobil.</li>\n<li>backendStartup - când pornește serverul Trilium</li>\n<li>hourly - o dată pe oră. Se poate utiliza adițional eticheta <code>runAtHour</code> pentru a specifica ora.</li>\n<li>daily - o dată pe zi</li>\n</ul>",
"run_at_hour": "La ce oră ar trebui să ruleze. Trebuie folosit împreună cu <code>#run=hourly</code>. Poate fi definit de mai multe ori pentru a rula de mai multe ori în cadrul aceleași zile.",
"run_on_attribute_change": "se execută atunci când atributele unei notițe care definește această relație se schimbă. Se apelează și atunci când un atribut este șters",
"run_on_attribute_change": " se execută atunci când atributele unei notițe care definește această relație se schimbă. Se apelează și atunci când un atribut este șters",
"run_on_attribute_creation": "se execută atunci când un nou atribut este creat pentru notița care definește această relație",
"run_on_branch_change": "se execută atunci când o ramură este actualizată.",
"run_on_branch_creation": "se execută când o ramură este creată. O ramură este o legătură dintre o notiță părinte și o notiță copil și este creată, spre exemplu, la clonarea sau mutarea unei notițe.",
@@ -198,7 +198,7 @@
"share_disallow_robot_indexing": "împiedică indexarea conținutului de către roboți utilizând antetul <code>X-Robots-Tag: noindex</code>",
"share_external_link": "notița va funcționa drept o legătură către un site web extern în ierarhia de partajare",
"share_favicon": "Notiță ce conține pictograma favicon pentru a fi setată în paginile partajate. De obicei se poate seta în rădăcina ierarhiei de partajare și se poate face moștenibilă. Notița ce conține favicon-ul trebuie să fie și ea în ierarhia de partajare. Considerați și utilizarea „share_hidden_from_tree”.",
"share_hidden_from_tree": "notița este ascunsă din arborele de navigație din stânga, dar încă este accesibilă prin intermediul unui URL.",
"share_hidden_from_tree": "notița este ascunsă din arborele de navigație din stânga, dar încă este accesibilă prin intermediul unui URL",
"share_index": "notițele cu această etichetă vor afișa lista tuturor rădăcilor notițelor partajate",
"share_js": "Notiță JavaScript ce va fi injectată în pagina de partajare. Notița respectivă trebuie să fie și ea în ierarhia de partajare. Considerați utilizarea 'share_hidden_from_tree'.",
"share_omit_default_css": "CSS-ul implicit pentru pagina de partajare va fi omis. Se poate folosi atunci când se fac schimbări majore de stil la pagină.",
@@ -214,7 +214,7 @@
"target_note_title": "Relația este o conexiune numită dintre o notiță sursă și o notiță țintă.",
"template": "Șablon",
"text": "Text",
"title_template": "titlul implicit al notițelor create în interiorul acestei notițe. Valoarea este evaluată ca un șir de caractere JavaScript\n și poate fi astfel îmbogățită cu un conținut dinamic prin intermediul variabilelow <code>now</code> și <code>parentNote</code>. Exemple:\n \n <ul>\n <li><code>Lucrările lui ${parentNote.getLabelValue('autor')}</code></li>\n <li><code>Jurnal pentru ${now.format('YYYY-MM-DD HH:mm:ss')}</code></li>\n </ul>\n \n A se vedea <a href=\"https://triliumnext.github.io/Docs/Wiki/default-note-title.html\">wiki-ul pentru detalii</a>, documentația API pentru <a href=\"https://zadam.github.io/trilium/backend_api/Note.html\">parentNote</a> și <a href=\"https://day.js.org/docs/en/display/format\">now</a> pentru mai multe informații",
"title_template": "titlul implicit al notițelor create în interiorul acestei notițe. Valoarea este evaluată ca un șir de caractere JavaScript\n și poate fi astfel îmbogățită cu un conținut dinamic prin intermediul variabilelor <code>now</code> și <code>parentNote</code>. Exemple:\n \n <ul>\n <li><code>Lucrările lui ${parentNote.getLabelValue('autor')}</code></li>\n <li><code>Jurnal pentru ${now.format('YYYY-MM-DD HH:mm:ss')}</code></li>\n </ul>\n \n A se vedea <a href=\"https://triliumnext.github.io/Docs/Wiki/default-note-title.html\">wiki-ul pentru detalii</a>, documentația API pentru <a href=\"https://zadam.github.io/trilium/backend_api/Note.html\">parentNote</a> și <a href=\"https://day.js.org/docs/en/display/format\">now</a> pentru mai multe informații.",
"toc": "<code>#toc</code> sau <code>#toc=show</code> forțează afișarea tabelei de conținut, <code>#toc=hide</code> forțează ascunderea ei. Dacă eticheta nu există, se utilizează setările globale",
"top": "păstrează notița la începutul listei (se aplică doar pentru notițe sortate automat)",
"url": "URL",
@@ -369,7 +369,7 @@
},
"confirm": {
"also_delete_note": "Șterge și notița",
"are_you_sure_remove_note": "Doriți ștergerea notiței „{{title}}” din harta de relații?",
"are_you_sure_remove_note": "Doriți ștergerea notiței „{{title}}” din harta de relații? ",
"cancel": "Anulează",
"confirmation": "Confirm",
"if_you_dont_check": "Dacă această opțiune nu este bifată, notița va fi ștearsă doar din harta de relații.",
@@ -519,8 +519,8 @@
"export_status": "Starea exportului",
"export_type_single": "Doar această notiță fără descendenții ei",
"export_type_subtree": "Această notiță și toți descendenții ei",
"format_html_zip": "HTML în arhivă ZIP - recomandat deoarece păstrează toată formatarea",
"format_markdown": "Markdown - păstrează majoritatea formatării",
"format_html_zip": "HTML în arhivă ZIP - recomandat deoarece păstrează toată formatarea.",
"format_markdown": "Markdown - păstrează majoritatea formatării.",
"format_opml": "OPML - format de interschimbare pentru editoare cu structură ierarhică (outline). Formatarea, imaginile și fișierele nu vor fi incluse.",
"opml_version_1": "OPML v1.0 - text simplu",
"opml_version_2": "OPML v2.0 - permite și HTML",
@@ -640,7 +640,7 @@
"newTabNoteLink": "pe o legătură către o notiță va deschide notița într-un tab nou",
"notSet": "nesetat",
"noteNavigation": "Navigarea printre notițe",
"numberedList": "<kbd>1.</code> sau <code>1)</code> urmat de spațiu pentru o listă numerotată",
"numberedList": "<code>1.</code> sau <code>1)</code> urmat de spațiu pentru o listă numerotată",
"onlyInDesktop": "Doar pentru desktop (aplicația Electron)",
"openEmptyTab": "deschide un tab nou",
"other": "Altele",
@@ -807,7 +807,7 @@
"dialog_title": "Mută notițele în...",
"error_no_path": "Nicio cale la care să poată fi mutate.",
"move_button": "Mută la notița selectată",
"move_success_message": "Notițele selectate au fost mutate în",
"move_success_message": "Notițele selectate au fost mutate în ",
"notes_to_move": "Notițe de mutat",
"search_placeholder": "căutați notița după denumirea ei",
"target_parent_note": "Notița părinte destinație"
@@ -1058,7 +1058,7 @@
"download_button": "Descarcă",
"file_size": "Dimensiune fișier:",
"help_title": "Informații despre reviziile notițelor",
"mime": "MIME:",
"mime": "MIME: ",
"no_revisions": "Nu există încă nicio revizie pentru această notiță...",
"note_revisions": "Revizii ale notiței",
"preview": "Previzualizare:",
@@ -1106,7 +1106,7 @@
"limit_description": "Limitează numărul de rezultate",
"order_by": "ordonează după",
"save_to_note": "Salvează în notiță",
"search_button": "Căutare <kbd>Enter</kbd>",
"search_button": "Căutare",
"search_execute": "Caută și execută acțiunile",
"search_note_saved": "Notița de căutare a fost salvată în {{- notePathTitle}}",
"search_parameters": "Parametrii de căutare",
@@ -1193,7 +1193,7 @@
"enable": "Activează corectorul ortografic",
"language_code_label": "Codurile de limbă",
"language_code_placeholder": "de exemplu „en-US”, „de-AT”",
"multiple_languages_info": "Mai multe limbi pot fi separate prin virgulă, e.g. \"en-US, de-DE, cs\".",
"multiple_languages_info": "Mai multe limbi pot fi separate prin virgulă, e.g. \"en-US, de-DE, cs\". ",
"title": "Corector ortografic",
"restart-required": "Schimbările asupra setărilor corectorului ortografic vor fi aplicate după restartarea aplicației."
},
@@ -1286,7 +1286,7 @@
"update_relation_target": {
"allowed_characters": "Sunt permise doar caractere alfanumerice, underline și două puncte.",
"change_target_note": "schimbă notița-țintă a unei relații existente",
"on_all_matched_notes": "Pentru toate notițele găsite:",
"on_all_matched_notes": "Pentru toate notițele găsite",
"relation_name": "denumirea relației",
"target_note": "notița destinație",
"to": "la",
@@ -1314,7 +1314,7 @@
"use_vim_keybindings_in_code_notes": "Combinații de taste Vim"
},
"web_view": {
"create_label": "Pentru a începe, creați o etichetă cu adresa URL de încorporat, e.g. #webViewSrc=\"https://www.google.com\"",
"create_label": "Pentru a începe, creați o etichetă cu adresa URL de încorporat, e.g. #webViewSrc=\"https://www.google.com\"",
"embed_websites": "Notițele de tip „Vizualizare web” permit încorporarea site-urilor web în Trilium.",
"web_view": "Vizualizare web"
},
@@ -1863,11 +1863,16 @@
},
"create_new_ai_chat": "Crează o nouă discuție cu AI-ul",
"configuration_warnings": "Sunt câteva probleme la configurația AI-ului. Verificați setările.",
"experimental_warning": "Funcția LLM este experimentală!",
"experimental_warning": "Funcția LLM este experimentală.",
"selected_provider": "Furnizor selectat",
"selected_provider_description": "Selectați furnizorul de AI pentru funcțiile de discuție și completare",
"select_model": "Selectați modelul...",
"select_provider": "Selectați furnizorul..."
"select_provider": "Selectați furnizorul...",
"ai_enabled": "Funcționalitățile AI au fost activate",
"ai_disabled": "Funcționalitățile AI au fost dezactivate",
"no_models_found_online": "Nu s-a găsit niciun model. Verificați cheia API și configurația.",
"no_models_found_ollama": "Nu s-a găsit niciun model Ollama. Verificați dacă Ollama rulează.",
"error_fetching": "Eroare la obținerea modelelor: {{error}}"
},
"custom_date_time_format": {
"title": "Format dată/timp personalizat",
@@ -1998,6 +2003,26 @@
"call_to_action": {
"background_effects_title": "Efectele de fundal sunt acum stabile",
"background_effects_message": "Pe dispozitive cu Windows, efectele de fundal sunt complet stabile. Acestea adaugă un strop de culoare interfeței grafice prin estomparea fundalului din spatele ferestrei. Această tehnică este folosită și în alte aplicații precum Windows Explorer.",
"background_effects_button": "Activează efectele de fundal"
"background_effects_button": "Activează efectele de fundal",
"next_theme_title": "Încercați noua temă Trilium",
"next_theme_message": "Utilizați tema clasică, doriți să încercați noua temă?",
"next_theme_button": "Testează noua temă",
"dismiss": "Treci peste"
},
"ui-performance": {
"title": "Setări de performanță",
"enable-motion": "Activează tranzițiile și animațiile",
"enable-shadows": "Activează umbrirea elementelor",
"enable-backdrop-effects": "Activează efectele de fundal pentru meniuri, popup-uri și panouri"
},
"settings": {
"related_settings": "Setări similare"
},
"settings_appearance": {
"related_code_blocks": "Tema de culori pentru blocuri de cod în notițe de tip text",
"related_code_notes": "Tema de culori pentru notițele de tip cod"
},
"units": {
"percentage": "%"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -845,7 +845,7 @@
"debug": "除錯",
"debug_description": "除錯將顯示額外的除錯資訊至控制台,以幫助除錯複雜查詢",
"action": "操作",
"search_button": "搜尋 <kbd>Enter</kbd>",
"search_button": "搜尋",
"search_execute": "搜尋並執行操作",
"save_to_note": "儲存至筆記",
"search_parameters": "搜尋參數",
@@ -1643,13 +1643,13 @@
"failed_notes": "失敗筆記",
"last_processed": "最後處理時間",
"refresh_stats": "更新統計資料",
"enable_ai_features": "啟用 AI / LLM 功能",
"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": "啟用 AI/LLM 功能",
"enable_ai_desc": "啟用筆記摘要、內容生成等 AI 功能及其他 LLM 能力",
"provider_configuration": "AI 提供者設定",
"provider_precedence": "提供者優先級",
@@ -1771,7 +1771,12 @@
"selected_provider": "已選提供者",
"selected_provider_description": "選擇用於聊天和補全功能的 AI 提供者",
"select_model": "選擇模型…",
"select_provider": "選擇提供者…"
"select_provider": "選擇提供者…",
"ai_enabled": "已啟用 AI 功能",
"ai_disabled": "已禁用 AI 功能",
"no_models_found_online": "找不到模型。請檢查您的 API 金鑰及設定。",
"no_models_found_ollama": "找不到 Ollama 模型。請確認 Ollama 是否正在執行。",
"error_fetching": "獲取模型失敗:{{error}}"
},
"code-editor-options": {
"title": "編輯器"
@@ -1999,5 +2004,21 @@
"next_theme_message": "您正在使用舊版主題,要試用新主題嗎?",
"next_theme_button": "試用新主題",
"dismiss": "關閉"
},
"settings": {
"related_settings": "相關設定"
},
"settings_appearance": {
"related_code_blocks": "文字筆記中程式碼區塊的配色方案",
"related_code_notes": "程式碼筆記的配色方案"
},
"units": {
"percentage": "%"
},
"ui-performance": {
"title": "效能",
"enable-motion": "啟用轉場與動畫",
"enable-shadows": "啟用陰影",
"enable-backdrop-effects": "啟用選單、彈出視窗和面板的背景特效"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,11 @@ type DateTimeStyle = "full" | "long" | "medium" | "short" | "none" | undefined;
/**
* Formats the given date and time to a string based on the current locale.
*/
export function formatDateTime(date: string | Date | number, dateStyle: DateTimeStyle = "medium", timeStyle: DateTimeStyle = "medium") {
export function formatDateTime(date: string | Date | number | null | undefined, dateStyle: DateTimeStyle = "medium", timeStyle: DateTimeStyle = "medium") {
if (!date) {
return "";
}
const locale = navigator.language;
let parsedDate;

View File

@@ -1,504 +0,0 @@
import { t } from "../../services/i18n.js";
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import noteAutocompleteService, { type Suggestion } from "../../services/note_autocomplete.js";
import server from "../../services/server.js";
import contextMenuService from "../../menus/context_menu.js";
import attributeParser, { type Attribute } from "../../services/attribute_parser.js";
import { AttributeEditor, type EditorConfig, type ModelElement, type MentionFeed, type ModelNode, type ModelPosition } from "@triliumnext/ckeditor5";
import froca from "../../services/froca.js";
import attributeRenderer from "../../services/attribute_renderer.js";
import noteCreateService from "../../services/note_create.js";
import attributeService from "../../services/attributes.js";
import linkService from "../../services/link.js";
import type AttributeDetailWidget from "./attribute_detail.js";
import type { CommandData, EventData, EventListener, FilteredCommandNames } from "../../components/app_context.js";
import type { default as FAttribute, AttributeType } from "../../entities/fattribute.js";
import type FNote from "../../entities/fnote.js";
import { escapeQuotes } from "../../services/utils.js";
const HELP_TEXT = `
<p>${t("attribute_editor.help_text_body1")}</p>
<p>${t("attribute_editor.help_text_body2")}</p>
<p>${t("attribute_editor.help_text_body3")}</p>`;
const TPL = /*html*/`
<div style="position: relative; padding-top: 10px; padding-bottom: 10px">
<style>
.attribute-list-editor {
border: 0 !important;
outline: 0 !important;
box-shadow: none !important;
padding: 0 0 0 5px !important;
margin: 0 !important;
max-height: 100px;
overflow: auto;
transition: opacity .1s linear;
}
.attribute-list-editor.ck-content .mention {
color: var(--muted-text-color) !important;
background: transparent !important;
}
.save-attributes-button {
color: var(--muted-text-color);
position: absolute;
bottom: 14px;
right: 25px;
cursor: pointer;
border: 1px solid transparent;
font-size: 130%;
}
.add-new-attribute-button {
color: var(--muted-text-color);
position: absolute;
bottom: 13px;
right: 0;
cursor: pointer;
border: 1px solid transparent;
font-size: 130%;
}
.add-new-attribute-button:hover, .save-attributes-button:hover {
border: 1px solid var(--button-border-color);
border-radius: var(--button-border-radius);
background: var(--button-background-color);
color: var(--button-text-color);
}
.attribute-errors {
color: red;
padding: 5px 50px 0px 5px; /* large right padding to avoid buttons */
}
</style>
<div class="attribute-list-editor" tabindex="200"></div>
<div class="bx bx-save save-attributes-button tn-tool-button" title="${escapeQuotes(t("attribute_editor.save_attributes"))}"></div>
<div class="bx bx-plus add-new-attribute-button tn-tool-button" title="${escapeQuotes(t("attribute_editor.add_a_new_attribute"))}"></div>
<div class="attribute-errors" style="display: none;"></div>
</div>
`;
const mentionSetup: MentionFeed[] = [
{
marker: "@",
feed: (queryText) => noteAutocompleteService.autocompleteSourceForCKEditor(queryText),
itemRenderer: (_item) => {
const item = _item as Suggestion;
const itemElement = document.createElement("button");
itemElement.innerHTML = `${item.highlightedNotePathTitle} `;
return itemElement;
},
minimumCharacters: 0
},
{
marker: "#",
feed: async (queryText) => {
const names = await server.get<string[]>(`attribute-names/?type=label&query=${encodeURIComponent(queryText)}`);
return names.map((name) => {
return {
id: `#${name}`,
name: name
};
});
},
minimumCharacters: 0
},
{
marker: "~",
feed: async (queryText) => {
const names = await server.get<string[]>(`attribute-names/?type=relation&query=${encodeURIComponent(queryText)}`);
return names.map((name) => {
return {
id: `~${name}`,
name: name
};
});
},
minimumCharacters: 0
}
];
const editorConfig: EditorConfig = {
toolbar: {
items: []
},
placeholder: t("attribute_editor.placeholder"),
mention: {
feeds: mentionSetup
},
licenseKey: "GPL"
};
type AttributeCommandNames = FilteredCommandNames<CommandData>;
export default class AttributeEditorWidget extends NoteContextAwareWidget implements EventListener<"entitiesReloaded">, EventListener<"addNewLabel">, EventListener<"addNewRelation"> {
private attributeDetailWidget: AttributeDetailWidget;
private $editor!: JQuery<HTMLElement>;
private $addNewAttributeButton!: JQuery<HTMLElement>;
private $saveAttributesButton!: JQuery<HTMLElement>;
private $errors!: JQuery<HTMLElement>;
private textEditor!: AttributeEditor;
private lastUpdatedNoteId!: string | undefined;
private lastSavedContent!: string;
constructor(attributeDetailWidget: AttributeDetailWidget) {
super();
this.attributeDetailWidget = attributeDetailWidget;
}
doRender() {
this.$widget = $(TPL);
this.$editor = this.$widget.find(".attribute-list-editor");
this.initialized = this.initEditor();
this.$editor.on("keydown", async (e) => {
if (e.which === 13) {
// allow autocomplete to fill the result textarea
setTimeout(() => this.save(), 100);
}
this.attributeDetailWidget.hide();
});
this.$editor.on("blur", () => setTimeout(() => this.save(), 100)); // Timeout to fix https://github.com/zadam/trilium/issues/4160
this.$addNewAttributeButton = this.$widget.find(".add-new-attribute-button");
this.$addNewAttributeButton.on("click", (e) => this.addNewAttribute(e));
this.$saveAttributesButton = this.$widget.find(".save-attributes-button");
this.$saveAttributesButton.on("click", () => this.save());
this.$errors = this.$widget.find(".attribute-errors");
}
addNewAttribute(e: JQuery.ClickEvent) {
contextMenuService.show<AttributeCommandNames>({
x: e.pageX,
y: e.pageY,
orientation: "left",
items: [
{ title: t("attribute_editor.add_new_label"), command: "addNewLabel", uiIcon: "bx bx-hash" },
{ title: t("attribute_editor.add_new_relation"), command: "addNewRelation", uiIcon: "bx bx-transfer" },
{ title: "----" },
{ title: t("attribute_editor.add_new_label_definition"), command: "addNewLabelDefinition", uiIcon: "bx bx-empty" },
{ title: t("attribute_editor.add_new_relation_definition"), command: "addNewRelationDefinition", uiIcon: "bx bx-empty" }
],
selectMenuItemHandler: ({ command }) => this.handleAddNewAttributeCommand(command)
});
// Prevent automatic hiding of the context menu due to the button being clicked.
e.stopPropagation();
}
// triggered from keyboard shortcut
async addNewLabelEvent({ ntxId }: EventData<"addNewLabel">) {
if (this.isNoteContext(ntxId)) {
await this.refresh();
this.handleAddNewAttributeCommand("addNewLabel");
}
}
// triggered from keyboard shortcut
async addNewRelationEvent({ ntxId }: EventData<"addNewRelation">) {
if (this.isNoteContext(ntxId)) {
await this.refresh();
this.handleAddNewAttributeCommand("addNewRelation");
}
}
async handleAddNewAttributeCommand(command: AttributeCommandNames | undefined) {
// TODO: Not sure what the relation between FAttribute[] and Attribute[] is.
const attrs = this.parseAttributes() as FAttribute[];
if (!attrs) {
return;
}
let type: AttributeType;
let name;
let value;
if (command === "addNewLabel") {
type = "label";
name = "myLabel";
value = "";
} else if (command === "addNewRelation") {
type = "relation";
name = "myRelation";
value = "";
} else if (command === "addNewLabelDefinition") {
type = "label";
name = "label:myLabel";
value = "promoted,single,text";
} else if (command === "addNewRelationDefinition") {
type = "label";
name = "relation:myRelation";
value = "promoted,single";
} else {
return;
}
// TODO: Incomplete type
//@ts-ignore
attrs.push({
type,
name,
value,
isInheritable: false
});
await this.renderOwnedAttributes(attrs, false);
this.$editor.scrollTop(this.$editor[0].scrollHeight);
const rect = this.$editor[0].getBoundingClientRect();
setTimeout(() => {
// showing a little bit later because there's a conflict with outside click closing the attr detail
this.attributeDetailWidget.showAttributeDetail({
allAttributes: attrs,
attribute: attrs[attrs.length - 1],
isOwned: true,
x: (rect.left + rect.right) / 2,
y: rect.bottom,
focus: "name"
});
}, 100);
}
async save() {
if (this.lastUpdatedNoteId !== this.noteId) {
// https://github.com/zadam/trilium/issues/3090
console.warn("Ignoring blur event because a different note is loaded.");
return;
}
const attributes = this.parseAttributes();
if (attributes) {
await server.put(`notes/${this.noteId}/attributes`, attributes, this.componentId);
this.$saveAttributesButton.fadeOut();
// blink the attribute text to give a visual hint that save has been executed
this.$editor.css("opacity", 0);
// revert back
setTimeout(() => this.$editor.css("opacity", 1), 100);
}
}
parseAttributes() {
try {
return attributeParser.lexAndParse(this.getPreprocessedData());
} catch (e: any) {
this.$errors.text(e.message).slideDown();
}
}
getPreprocessedData() {
const str = this.textEditor
.getData()
.replace(/<a[^>]+href="(#[A-Za-z0-9_/]*)"[^>]*>[^<]*<\/a>/g, "$1")
.replace(/&nbsp;/g, " "); // otherwise .text() below outputs non-breaking space in unicode
return $("<div>").html(str).text();
}
async initEditor() {
this.$widget.show();
this.$editor.on("click", (e) => this.handleEditorClick(e));
this.textEditor = await AttributeEditor.create(this.$editor[0], editorConfig);
this.textEditor.model.document.on("change:data", () => this.dataChanged());
this.textEditor.editing.view.document.on(
"enter",
(event, data) => {
// disable entering new line - see https://github.com/ckeditor/ckeditor5/issues/9422
data.preventDefault();
event.stop();
},
{ priority: "high" }
);
// disable spellcheck for attribute editor
const documentRoot = this.textEditor.editing.view.document.getRoot();
if (documentRoot) {
this.textEditor.editing.view.change((writer) => writer.setAttribute("spellcheck", "false", documentRoot));
}
}
dataChanged() {
this.lastUpdatedNoteId = this.noteId;
if (this.lastSavedContent === this.textEditor.getData()) {
this.$saveAttributesButton.fadeOut();
} else {
this.$saveAttributesButton.fadeIn();
}
if (this.$errors.is(":visible")) {
// using .hide() instead of .slideUp() since this will also hide the error after confirming
// mention for relation name which suits up. When using.slideUp() error will appear and the slideUp which is weird
this.$errors.hide();
}
}
async handleEditorClick(e: JQuery.ClickEvent) {
const pos = this.textEditor.model.document.selection.getFirstPosition();
if (pos && pos.textNode && pos.textNode.data) {
const clickIndex = this.getClickIndex(pos);
let parsedAttrs;
try {
parsedAttrs = attributeParser.lexAndParse(this.getPreprocessedData(), true);
} catch (e) {
// the input is incorrect because the user messed up with it and now needs to fix it manually
return null;
}
let matchedAttr: Attribute | null = null;
for (const attr of parsedAttrs) {
if (attr.startIndex && clickIndex > attr.startIndex && attr.endIndex && clickIndex <= attr.endIndex) {
matchedAttr = attr;
break;
}
}
setTimeout(() => {
if (matchedAttr) {
this.$editor.tooltip("hide");
this.attributeDetailWidget.showAttributeDetail({
allAttributes: parsedAttrs,
attribute: matchedAttr,
isOwned: true,
x: e.pageX,
y: e.pageY
});
} else {
this.showHelpTooltip();
}
}, 100);
} else {
this.showHelpTooltip();
}
}
showHelpTooltip() {
this.attributeDetailWidget.hide();
this.$editor.tooltip({
trigger: "focus",
html: true,
title: HELP_TEXT,
placement: "bottom",
offset: "0,30"
});
this.$editor.tooltip("show");
}
getClickIndex(pos: ModelPosition) {
let clickIndex = pos.offset - (pos.textNode?.startOffset ?? 0);
let curNode: ModelNode | Text | ModelElement | null = pos.textNode;
while (curNode?.previousSibling) {
curNode = curNode.previousSibling;
if ((curNode as ModelElement).name === "reference") {
clickIndex += (curNode.getAttribute("href") as string).length + 1;
} else if ("data" in curNode) {
clickIndex += (curNode.data as string).length;
}
}
return clickIndex;
}
async loadReferenceLinkTitle($el: JQuery<HTMLElement>, href: string) {
const { noteId } = linkService.parseNavigationStateFromUrl(href);
const note = noteId ? await froca.getNote(noteId, true) : null;
const title = note ? note.title : "[missing]";
$el.text(title);
}
async refreshWithNote(note: FNote) {
await this.renderOwnedAttributes(note.getOwnedAttributes(), true);
}
async renderOwnedAttributes(ownedAttributes: FAttribute[], saved: boolean) {
// attrs are not resorted if position changes after the initial load
ownedAttributes.sort((a, b) => a.position - b.position);
let htmlAttrs = (await attributeRenderer.renderAttributes(ownedAttributes, true)).html();
if (htmlAttrs.length > 0) {
htmlAttrs += "&nbsp;";
}
this.textEditor.setData(htmlAttrs);
if (saved) {
this.lastSavedContent = this.textEditor.getData();
this.$saveAttributesButton.fadeOut(0);
}
}
async createNoteForReferenceLink(title: string) {
let result;
if (this.notePath) {
result = await noteCreateService.createNoteWithTypePrompt(this.notePath, {
activate: false,
title: title
});
}
return result?.note?.getBestNotePathString();
}
async updateAttributeList(attributes: FAttribute[]) {
await this.renderOwnedAttributes(attributes, false);
}
focus() {
this.$editor.trigger("focus");
this.textEditor.model.change((writer) => {
const documentRoot = this.textEditor.editing.model.document.getRoot();
if (!documentRoot) {
return;
}
const positionAt = writer.createPositionAt(documentRoot, "end");
writer.setSelection(positionAt);
});
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.getAttributeRows(this.componentId).find((attr) => attributeService.isAffecting(attr, this.note))) {
this.refresh();
}
}
}

View File

@@ -1,7 +1,11 @@
import { isValidElement, VNode } from "preact";
import Component, { TypedComponent } from "../components/component.js";
import froca from "../services/froca.js";
import { t } from "../services/i18n.js";
import toastService from "../services/toast.js";
import { renderReactWidget } from "./react/react_utils.jsx";
import { EventNames, EventData } from "../components/app_context.js";
import { Handler } from "leaflet";
export class TypedBasicWidget<T extends TypedComponent<any>> extends TypedComponent<T> {
protected attrs: Record<string, string>;
@@ -22,11 +26,14 @@ export class TypedBasicWidget<T extends TypedComponent<any>> extends TypedCompon
this.childPositionCounter = 10;
}
child(...components: T[]) {
if (!components) {
child(..._components: (T | VNode)[]) {
if (!_components) {
return this;
}
// Convert any React components to legacy wrapped components.
const components = wrapReactWidgets(_components);
super.child(...components);
for (const component of components) {
@@ -258,3 +265,30 @@ export class TypedBasicWidget<T extends TypedComponent<any>> extends TypedCompon
* For information on using widgets, see the tutorial {@tutorial widget_basics}.
*/
export default class BasicWidget extends TypedBasicWidget<Component> {}
export function wrapReactWidgets<T extends TypedComponent<any>>(components: (T | VNode)[]) {
const wrappedResult: T[] = [];
for (const component of components) {
if (isValidElement(component)) {
wrappedResult.push(new ReactWrappedWidget(component) as unknown as T);
} else {
wrappedResult.push(component);
}
}
return wrappedResult;
}
export class ReactWrappedWidget extends BasicWidget {
private el: VNode;
constructor(el: VNode) {
super();
this.el = el;
}
doRender() {
this.$widget = renderReactWidget(this, this.el);
}
}

View File

@@ -1,54 +0,0 @@
import SwitchWidget from "./switch.js";
import server from "../services/server.js";
import toastService from "../services/toast.js";
import { t } from "../services/i18n.js";
import type FNote from "../entities/fnote.js";
import type { EventData } from "../components/app_context.js";
// TODO: Deduplicate
type Response = {
success: true;
} | {
success: false;
message: string;
}
export default class BookmarkSwitchWidget extends SwitchWidget {
isEnabled() {
return (
super.isEnabled() &&
// it's not possible to bookmark root because that would clone it under bookmarks and thus create a cycle
!["root", "_hidden"].includes(this.noteId ?? "")
);
}
doRender() {
super.doRender();
this.switchOnName = t("bookmark_switch.bookmark");
this.switchOnTooltip = t("bookmark_switch.bookmark_this_note");
this.switchOffName = t("bookmark_switch.bookmark");
this.switchOffTooltip = t("bookmark_switch.remove_bookmark");
}
async toggle(state: boolean | null | undefined) {
const resp = await server.put<Response>(`notes/${this.noteId}/toggle-in-parent/_lbBookmarks/${!!state}`);
if (!resp.success && "message" in resp) {
toastService.showError(resp.message);
}
}
async refreshWithNote(note: FNote) {
const isBookmarked = !!note.getParentBranches().find((b) => b.parentNoteId === "_lbBookmarks");
this.isToggled = isBookmarked;
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.getBranchRows().find((b) => b.noteId === this.noteId)) {
this.refresh();
}
}
}

View File

@@ -1,6 +1,7 @@
import { ComponentChildren } from "preact";
import { memo } from "preact/compat";
import AbstractBulkAction from "./abstract_bulk_action";
import HelpRemoveButtons from "../react/HelpRemoveButtons";
interface BulkActionProps {
label: string | ComponentChildren;
@@ -24,19 +25,11 @@ const BulkAction = memo(({ label, children, helpText, bulkAction }: BulkActionPr
{children}
</div>
</td>
<td className="button-column">
{helpText && <div className="dropdown help-dropdown">
<span className="bx bx-help-circle icon-action" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div className="dropdown-menu dropdown-menu-right p-4">
{helpText}
</div>
</div>}
<span
className="bx bx-x icon-action action-conf-del"
onClick={() => bulkAction?.deleteAction()}
/>
</td>
<HelpRemoveButtons
help={helpText}
removeText="Delete"
onRemove={() => bulkAction?.deleteAction()}
/>
</tr>
);
});

View File

@@ -1,11 +1,11 @@
import { t } from "../../../services/i18n.js";
import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";
import AbstractBulkAction from "../abstract_bulk_action.js";
import BulkAction, { BulkActionText } from "../BulkAction.jsx";
import NoteAutocomplete from "../../react/NoteAutocomplete.jsx";
import { useEffect, useState } from "preact/hooks";
import { useSpacedUpdate } from "../../react/hooks.jsx";
function MoveNoteBulkActionComponent({ bulkAction, actionDef }: { bulkAction: AbstractBulkAction, actionDef: ActionDefinition }) {
function MoveNoteBulkActionComponent({ bulkAction }: { bulkAction: AbstractBulkAction }) {
const [ targetParentNoteId, setTargetParentNoteId ] = useState<string>();
const spacedUpdate = useSpacedUpdate(() => {
return bulkAction.saveAction({ targetParentNoteId: targetParentNoteId })
@@ -45,6 +45,6 @@ export default class MoveNoteBulkAction extends AbstractBulkAction {
}
doRender() {
return <MoveNoteBulkActionComponent bulkAction={this} actionDef={this.actionDef} />
return <MoveNoteBulkActionComponent bulkAction={this} />
}
}

View File

@@ -1,4 +1,3 @@
import SpacedUpdate from "../../../services/spaced_update.js";
import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";
import { t } from "../../../services/i18n.js";
import BulkAction from "../BulkAction.jsx";

View File

@@ -1,6 +1,4 @@
import SpacedUpdate from "../../../services/spaced_update.js";
import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";
import noteAutocompleteService from "../../../services/note_autocomplete.js";
import { t } from "../../../services/i18n.js";
import BulkAction, { BulkActionText } from "../BulkAction.jsx";
import NoteAutocomplete from "../../react/NoteAutocomplete.jsx";

View File

@@ -1,252 +0,0 @@
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import utils from "../../services/utils.js";
import branchService from "../../services/branches.js";
import dialogService from "../../services/dialog.js";
import server from "../../services/server.js";
import toastService from "../../services/toast.js";
import ws from "../../services/ws.js";
import appContext, { type EventData } from "../../components/app_context.js";
import { t } from "../../services/i18n.js";
import type FNote from "../../entities/fnote.js";
import type { FAttachmentRow } from "../../entities/fattachment.js";
// TODO: Deduplicate with server
interface ConvertToAttachmentResponse {
attachment: FAttachmentRow;
}
const TPL = /*html*/`
<div class="dropdown note-actions">
<style>
.note-actions {
width: 35px;
height: 35px;
}
.note-actions .dropdown-menu {
min-width: 15em;
}
.note-actions .dropdown-item .bx {
position: relative;
top: 3px;
font-size: 120%;
margin-right: 5px;
}
.note-actions .dropdown-item[disabled], .note-actions .dropdown-item[disabled]:hover {
color: var(--muted-text-color) !important;
background-color: transparent !important;
pointer-events: none; /* makes it unclickable */
}
</style>
<button type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
class="icon-action bx bx-dots-vertical-rounded"></button>
<div class="dropdown-menu dropdown-menu-right">
<li data-trigger-command="convertNoteIntoAttachment" class="dropdown-item">
<span class="bx bx-paperclip"></span> ${t("note_actions.convert_into_attachment")}
</li>
<li data-trigger-command="renderActiveNote" class="dropdown-item render-note-button">
<span class="bx bx-extension"></span> ${t("note_actions.re_render_note")}<kbd data-command="renderActiveNote"></kbd>
</li>
<li data-trigger-command="findInText" class="dropdown-item find-in-text-button">
<span class='bx bx-search'></span> ${t("note_actions.search_in_note")}<kbd data-command="findInText"></kbd>
</li>
<li data-trigger-command="printActiveNote" class="dropdown-item print-active-note-button">
<span class="bx bx-printer"></span> ${t("note_actions.print_note")}<kbd data-command="printActiveNote"></kbd>
</li>
<li data-trigger-command="exportAsPdf" class="dropdown-item export-as-pdf-button">
<span class="bx bxs-file-pdf"></span> ${t("note_actions.print_pdf")}<kbd data-command="exportAsPdf"></kbd>
</li>
<div class="dropdown-divider"></div>
<li class="dropdown-item import-files-button"><span class="bx bx-import"></span> ${t("note_actions.import_files")}</li>
<li class="dropdown-item export-note-button"><span class="bx bx-export"></span> ${t("note_actions.export_note")}</li>
<div class="dropdown-divider"></div>
<li data-trigger-command="openNoteExternally" class="dropdown-item open-note-externally-button" title="${t("note_actions.open_note_externally_title")}">
<span class="bx bx-file-find"></span> ${t("note_actions.open_note_externally")}<kbd data-command="openNoteExternally"></kbd>
</li>
<li data-trigger-command="openNoteCustom" class="dropdown-item open-note-custom-button">
<span class="bx bx-customize"></span> ${t("note_actions.open_note_custom")}<kbd data-command="openNoteCustom"></kbd>
</li>
<li data-trigger-command="showNoteSource" class="dropdown-item show-source-button">
<span class="bx bx-code"></span> ${t("note_actions.note_source")}<kbd data-command="showNoteSource"></kbd>
</li>
<div class="dropdown-divider"></div>
<li data-trigger-command="forceSaveRevision" class="dropdown-item save-revision-button">
<span class="bx bx-save"></span> ${t("note_actions.save_revision")}<kbd data-command="forceSaveRevision"></kbd>
</li>
<li class="dropdown-item delete-note-button"><span class="bx bx-trash destructive-action-icon"></span> ${t("note_actions.delete_note")}</li>
<div class="dropdown-divider"></div>
<li data-trigger-command="showAttachments" class="dropdown-item show-attachments-button">
<span class="bx bx-paperclip"></span> ${t("note_actions.note_attachments")}<kbd data-command="showAttachments"></kbd>
</li>
</div>
</div>`;
export default class NoteActionsWidget extends NoteContextAwareWidget {
private $convertNoteIntoAttachmentButton!: JQuery<HTMLElement>;
private $findInTextButton!: JQuery<HTMLElement>;
private $printActiveNoteButton!: JQuery<HTMLElement>;
private $exportAsPdfButton!: JQuery<HTMLElement>;
private $showSourceButton!: JQuery<HTMLElement>;
private $showAttachmentsButton!: JQuery<HTMLElement>;
private $renderNoteButton!: JQuery<HTMLElement>;
private $saveRevisionButton!: JQuery<HTMLElement>;
private $exportNoteButton!: JQuery<HTMLElement>;
private $importNoteButton!: JQuery<HTMLElement>;
private $openNoteExternallyButton!: JQuery<HTMLElement>;
private $openNoteCustomButton!: JQuery<HTMLElement>;
private $deleteNoteButton!: JQuery<HTMLElement>;
isEnabled() {
return this.note?.type !== "launcher";
}
doRender() {
this.$widget = $(TPL);
this.$widget.on("show.bs.dropdown", () => {
if (this.note) {
this.refreshVisibility(this.note);
}
});
this.$convertNoteIntoAttachmentButton = this.$widget.find("[data-trigger-command='convertNoteIntoAttachment']");
this.$findInTextButton = this.$widget.find(".find-in-text-button");
this.$printActiveNoteButton = this.$widget.find(".print-active-note-button");
this.$exportAsPdfButton = this.$widget.find(".export-as-pdf-button");
this.$showSourceButton = this.$widget.find(".show-source-button");
this.$showAttachmentsButton = this.$widget.find(".show-attachments-button");
this.$renderNoteButton = this.$widget.find(".render-note-button");
this.$saveRevisionButton = this.$widget.find(".save-revision-button");
this.$exportNoteButton = this.$widget.find(".export-note-button");
this.$exportNoteButton.on("click", () => {
if (this.$exportNoteButton.hasClass("disabled") || !this.noteContext?.notePath) {
return;
}
this.triggerCommand("showExportDialog", {
notePath: this.noteContext.notePath,
defaultType: "single"
});
});
this.$importNoteButton = this.$widget.find(".import-files-button");
this.$importNoteButton.on("click", () => {
if (this.noteId) {
this.triggerCommand("showImportDialog", { noteId: this.noteId });
}
});
this.$widget.on("click", ".dropdown-item", () => this.$widget.find("[data-bs-toggle='dropdown']").dropdown("toggle"));
this.$openNoteExternallyButton = this.$widget.find(".open-note-externally-button");
this.$openNoteCustomButton = this.$widget.find(".open-note-custom-button");
this.$deleteNoteButton = this.$widget.find(".delete-note-button");
this.$deleteNoteButton.on("click", () => {
if (!this.note || this.note.noteId === "root") {
return;
}
branchService.deleteNotes([this.note.getParentBranches()[0].branchId], true);
});
}
async refreshVisibility(note: FNote) {
const isInOptions = note.noteId.startsWith("_options");
this.$convertNoteIntoAttachmentButton.toggle(note.isEligibleForConversionToAttachment());
this.toggleDisabled(this.$findInTextButton, ["text", "code", "book", "mindMap", "doc"].includes(note.type));
this.toggleDisabled(this.$showAttachmentsButton, !isInOptions);
this.toggleDisabled(this.$showSourceButton, ["text", "code", "relationMap", "mermaid", "canvas", "mindMap"].includes(note.type));
const canPrint = ["text", "code"].includes(note.type);
this.toggleDisabled(this.$printActiveNoteButton, canPrint);
this.toggleDisabled(this.$exportAsPdfButton, canPrint);
this.$exportAsPdfButton.toggleClass("hidden-ext", !utils.isElectron());
this.$renderNoteButton.toggle(note.type === "render");
this.toggleDisabled(this.$openNoteExternallyButton, utils.isElectron() && !["search", "book"].includes(note.type));
this.toggleDisabled(
this.$openNoteCustomButton,
utils.isElectron() &&
!utils.isMac() && // no implementation for Mac yet
!["search", "book"].includes(note.type)
);
// I don't want to handle all special notes like this, but intuitively user might want to export content of backend log
this.toggleDisabled(this.$exportNoteButton, !["_backendLog"].includes(note.noteId) && !isInOptions);
this.toggleDisabled(this.$importNoteButton, !["search"].includes(note.type) && !isInOptions);
this.toggleDisabled(this.$deleteNoteButton, !isInOptions);
this.toggleDisabled(this.$saveRevisionButton, !isInOptions);
}
async convertNoteIntoAttachmentCommand() {
if (!this.note || !(await dialogService.confirm(t("note_actions.convert_into_attachment_prompt", { title: this.note.title })))) {
return;
}
const { attachment: newAttachment } = await server.post<ConvertToAttachmentResponse>(`notes/${this.noteId}/convert-to-attachment`);
if (!newAttachment) {
toastService.showMessage(t("note_actions.convert_into_attachment_failed", { title: this.note.title }));
return;
}
toastService.showMessage(t("note_actions.convert_into_attachment_successful", { title: newAttachment.title }));
await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.getActiveContext()?.setNote(newAttachment.ownerId, {
viewScope: {
viewMode: "attachments",
attachmentId: newAttachment.attachmentId
}
});
}
toggleDisabled($el: JQuery<HTMLElement>, enable: boolean) {
if (enable) {
$el.removeAttr("disabled");
} else {
$el.attr("disabled", "disabled");
}
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.isNoteReloaded(this.noteId)) {
this.refresh();
}
}
}

View File

@@ -1,14 +0,0 @@
import { t } from "../../services/i18n.js";
import CommandButtonWidget from "./command_button.js";
export default class RevisionsButton extends CommandButtonWidget {
constructor() {
super();
this.icon("bx-history").title(t("revisions_button.note_revisions")).command("showRevisions").titlePlacement("bottom").class("icon-action");
}
isEnabled() {
return super.isEnabled() && !["launcher", "doc"].includes(this.note?.type ?? "");
}
}

View File

@@ -1,388 +0,0 @@
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import keyboardActionsService from "../../services/keyboard_actions.js";
import attributeService from "../../services/attributes.js";
import type CommandButtonWidget from "../buttons/command_button.js";
import type FNote from "../../entities/fnote.js";
import type { NoteType } from "../../entities/fnote.js";
import type { EventData, EventNames } from "../../components/app_context.js";
import type NoteActionsWidget from "../buttons/note_actions.js";
const TPL = /*html*/`
<div class="ribbon-container">
<style>
.ribbon-container {
margin-bottom: 5px;
}
.ribbon-top-row {
display: flex;
}
.ribbon-tab-container {
display: flex;
flex-direction: row;
justify-content: center;
margin-left: 10px;
flex-grow: 1;
flex-flow: row wrap;
}
.ribbon-tab-title {
color: var(--muted-text-color);
border-bottom: 1px solid var(--main-border-color);
min-width: 24px;
flex-basis: 24px;
max-width: max-content;
flex-grow: 10;
}
.ribbon-tab-title .bx {
font-size: 150%;
position: relative;
top: 3px;
}
.ribbon-tab-title.active {
color: var(--main-text-color);
border-bottom: 3px solid var(--main-text-color);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ribbon-tab-title:hover {
cursor: pointer;
}
.ribbon-tab-title:hover {
color: var(--main-text-color);
}
.ribbon-tab-title:first-of-type {
padding-left: 10px;
}
.ribbon-tab-spacer {
flex-basis: 0;
min-width: 0;
max-width: 35px;
flex-grow: 1;
border-bottom: 1px solid var(--main-border-color);
}
.ribbon-tab-spacer:last-of-type {
flex-grow: 1;
flex-basis: 0;
min-width: 0;
max-width: 10000px;
}
.ribbon-button-container {
display: flex;
border-bottom: 1px solid var(--main-border-color);
margin-right: 5px;
}
.ribbon-button-container > * {
position: relative;
top: -3px;
margin-left: 10px;
}
.ribbon-body {
display: none;
border-bottom: 1px solid var(--main-border-color);
margin-left: 10px;
margin-right: 5px; /* needs to have this value so that the bottom border is the same width as the top one */
}
.ribbon-body.active {
display: block;
}
.ribbon-tab-title-label {
display: none;
}
.ribbon-tab-title.active .ribbon-tab-title-label {
display: inline;
}
</style>
<div class="ribbon-top-row">
<div class="ribbon-tab-container"></div>
<div class="ribbon-button-container"></div>
</div>
<div class="ribbon-body-container"></div>
</div>`;
type ButtonWidget = (CommandButtonWidget | NoteActionsWidget);
export default class RibbonContainer extends NoteContextAwareWidget {
private lastActiveComponentId?: string | null;
private lastNoteType?: NoteType;
private ribbonWidgets: NoteContextAwareWidget[];
private buttonWidgets: ButtonWidget[];
private $tabContainer!: JQuery<HTMLElement>;
private $buttonContainer!: JQuery<HTMLElement>;
private $bodyContainer!: JQuery<HTMLElement>;
constructor() {
super();
this.contentSized();
this.ribbonWidgets = [];
this.buttonWidgets = [];
}
isEnabled() {
return super.isEnabled() && this.noteContext?.viewScope?.viewMode === "default";
}
ribbon(widget: NoteContextAwareWidget) {
// TODO: Base class
super.child(widget);
this.ribbonWidgets.push(widget);
return this;
}
button(widget: ButtonWidget) {
super.child(widget);
this.buttonWidgets.push(widget);
return this;
}
doRender() {
this.$widget = $(TPL);
this.$tabContainer = this.$widget.find(".ribbon-tab-container");
this.$buttonContainer = this.$widget.find(".ribbon-button-container");
this.$bodyContainer = this.$widget.find(".ribbon-body-container");
for (const ribbonWidget of this.ribbonWidgets) {
this.$bodyContainer.append($('<div class="ribbon-body">').attr("data-ribbon-component-id", ribbonWidget.componentId).append(ribbonWidget.render()));
}
for (const buttonWidget of this.buttonWidgets) {
this.$buttonContainer.append(buttonWidget.render());
}
this.$tabContainer.on("click", ".ribbon-tab-title", (e) => {
const $ribbonTitle = $(e.target).closest(".ribbon-tab-title");
this.toggleRibbonTab($ribbonTitle);
});
}
toggleRibbonTab($ribbonTitle: JQuery<HTMLElement>, refreshActiveTab = true) {
const activate = !$ribbonTitle.hasClass("active");
this.$tabContainer.find(".ribbon-tab-title").removeClass("active");
this.$bodyContainer.find(".ribbon-body").removeClass("active");
if (activate) {
const ribbonComponendId = $ribbonTitle.attr("data-ribbon-component-id");
const wasAlreadyActive = this.lastActiveComponentId === ribbonComponendId;
this.lastActiveComponentId = ribbonComponendId;
this.$tabContainer.find(`.ribbon-tab-title[data-ribbon-component-id="${ribbonComponendId}"]`).addClass("active");
this.$bodyContainer.find(`.ribbon-body[data-ribbon-component-id="${ribbonComponendId}"]`).addClass("active");
const activeChild = this.getActiveRibbonWidget();
if (activeChild && (refreshActiveTab || !wasAlreadyActive) && this.noteContext && this.notePath) {
const handleEventPromise = activeChild.handleEvent("noteSwitched", { noteContext: this.noteContext, notePath: this.notePath });
if (refreshActiveTab) {
if (handleEventPromise) {
handleEventPromise.then(() => (activeChild as any).focus?.()); // TODO: Base class
} else {
// TODO: Base class
(activeChild as any).focus?.();
}
}
}
} else {
this.lastActiveComponentId = null;
}
}
async noteSwitched() {
this.lastActiveComponentId = null;
await super.noteSwitched();
}
async refreshWithNote(note: FNote, noExplicitActivation = false) {
this.lastNoteType = note.type;
let $ribbonTabToActivate, $lastActiveRibbon;
this.$tabContainer.empty();
for (const ribbonWidget of this.ribbonWidgets) {
// TODO: Base class for ribbon widget
const ret = await (ribbonWidget as any).getTitle(note);
if (!ret.show) {
continue;
}
const $ribbonTitle = $('<div class="ribbon-tab-title">')
.attr("data-ribbon-component-id", ribbonWidget.componentId)
.attr("data-ribbon-component-name", (ribbonWidget as any).name as string) // TODO: base class for ribbon widgets
.append(
$('<span class="ribbon-tab-title-icon">')
.addClass(ret.icon)
.attr("title", ret.title)
.attr("data-toggle-command", (ribbonWidget as any).toggleCommand)
) // TODO: base class
.append(" ")
.append($('<span class="ribbon-tab-title-label">').text(ret.title));
this.$tabContainer.append($ribbonTitle);
this.$tabContainer.append('<div class="ribbon-tab-spacer">');
if (ret.activate && !this.lastActiveComponentId && !$ribbonTabToActivate && !noExplicitActivation) {
$ribbonTabToActivate = $ribbonTitle;
}
if (this.lastActiveComponentId === ribbonWidget.componentId) {
$lastActiveRibbon = $ribbonTitle;
}
}
keyboardActionsService.getActions().then((actions) => {
this.$tabContainer.find(".ribbon-tab-title-icon").tooltip({
title: () => {
const toggleCommandName = $(this).attr("data-toggle-command");
const action = actions.find((act) => act.actionName === toggleCommandName);
const title = $(this).attr("data-title");
if (action?.effectiveShortcuts && action.effectiveShortcuts.length > 0) {
return `${title} (${action.effectiveShortcuts.join(", ")})`;
} else {
return title ?? "";
}
}
});
});
if (!$ribbonTabToActivate) {
$ribbonTabToActivate = $lastActiveRibbon;
}
if ($ribbonTabToActivate) {
this.toggleRibbonTab($ribbonTabToActivate, false);
} else {
this.$bodyContainer.find(".ribbon-body").removeClass("active");
}
}
isRibbonTabActive(name: string) {
const $ribbonComponent = this.$widget.find(`.ribbon-tab-title[data-ribbon-component-name='${name}']`);
return $ribbonComponent.hasClass("active");
}
ensureOwnedAttributesAreOpen(ntxId: string | null | undefined) {
if (ntxId && this.isNoteContext(ntxId) && !this.isRibbonTabActive("ownedAttributes")) {
this.toggleRibbonTabWithName("ownedAttributes", ntxId);
}
}
addNewLabelEvent({ ntxId }: EventData<"addNewLabel">) {
this.ensureOwnedAttributesAreOpen(ntxId);
}
addNewRelationEvent({ ntxId }: EventData<"addNewRelation">) {
this.ensureOwnedAttributesAreOpen(ntxId);
}
toggleRibbonTabWithName(name: string, ntxId?: string) {
if (!this.isNoteContext(ntxId)) {
return false;
}
const $ribbonComponent = this.$widget.find(`.ribbon-tab-title[data-ribbon-component-name='${name}']`);
if ($ribbonComponent) {
this.toggleRibbonTab($ribbonComponent);
}
}
handleEvent<T extends EventNames>(name: T, data: EventData<T>) {
const PREFIX = "toggleRibbonTab";
if (name.startsWith(PREFIX)) {
let componentName = name.substr(PREFIX.length);
componentName = componentName[0].toLowerCase() + componentName.substr(1);
this.toggleRibbonTabWithName(componentName, (data as any).ntxId);
} else {
return super.handleEvent(name, data);
}
}
async handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>) {
if (["activeContextChanged", "setNoteContext"].includes(name)) {
// won't trigger .refresh();
await super.handleEventInChildren("setNoteContext", data as EventData<"activeContextChanged" | "setNoteContext">);
} else if (this.isEnabled() || name === "initialRenderComplete") {
const activeRibbonWidget = this.getActiveRibbonWidget();
// forward events only to active ribbon tab, inactive ones don't need to be updated
if (activeRibbonWidget) {
await activeRibbonWidget.handleEvent(name, data);
}
for (const buttonWidget of this.buttonWidgets) {
await buttonWidget.handleEvent(name, data);
}
}
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (!this.note) {
return;
}
if (this.noteId && loadResults.isNoteReloaded(this.noteId) && this.lastNoteType !== this.note.type) {
// note type influences the list of available ribbon tabs the most
// check for the type is so that we don't update on each title rename
this.lastNoteType = this.note.type;
this.refresh();
} else if (loadResults.getAttributeRows(this.componentId).find((attr) => attributeService.isAffecting(attr, this.note))) {
this.refreshWithNote(this.note, true);
}
}
async noteTypeMimeChangedEvent() {
// We are ignoring the event which triggers a refresh since it is usually already done by a different
// event and causing a race condition in which the items appear twice.
}
/**
* Executed as soon as the user presses the "Edit" floating button in a read-only text note.
*
* <p>
* We need to refresh the ribbon for cases such as the classic editor which relies on the read-only state.
*/
readOnlyTemporarilyDisabledEvent() {
this.refresh();
}
getActiveRibbonWidget() {
return this.ribbonWidgets.find((ch) => ch.componentId === this.lastActiveComponentId);
}
}

View File

@@ -1,6 +1,8 @@
import utils from "../../services/utils.js";
import type BasicWidget from "../basic_widget.js";
import { EventData } from "../../components/app_context.js";
import FlexContainer from "./flex_container.js";
import options from "../../services/options.js";
import type BasicWidget from "../basic_widget.js";
import utils from "../../services/utils.js";
/**
* The root container is the top-most widget/container, from which the entire layout derives.
@@ -27,15 +29,45 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
window.visualViewport?.addEventListener("resize", () => this.#onMobileResize());
}
this.#setMotion(options.is("motionEnabled"));
this.#setShadows(options.is("shadowsEnabled"));
this.#setBackdropEffects(options.is("backdropEffectsEnabled"));
return super.render();
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.isOptionReloaded("motionEnabled")) {
this.#setMotion(options.is("motionEnabled"));
}
if (loadResults.isOptionReloaded("shadowsEnabled")) {
this.#setShadows(options.is("shadowsEnabled"));
}
if (loadResults.isOptionReloaded("backdropEffectsEnabled")) {
this.#setBackdropEffects(options.is("backdropEffectsEnabled"));
}
}
#onMobileResize() {
const currentViewportHeight = getViewportHeight();
const isKeyboardOpened = (currentViewportHeight < this.originalViewportHeight);
this.$widget.toggleClass("virtual-keyboard-opened", isKeyboardOpened);
}
#setMotion(enabled: boolean) {
document.body.classList.toggle("motion-disabled", !enabled);
jQuery.fx.off = !enabled;
}
#setShadows(enabled: boolean) {
document.body.classList.toggle("shadows-disabled", !enabled);
}
#setBackdropEffects(enabled: boolean) {
document.body.classList.toggle("backdrop-effects-disabled", !enabled);
}
}
function getViewportHeight() {

View File

@@ -1,4 +1,3 @@
import ReactBasicWidget from "../react/ReactBasicWidget.js";
import Modal from "../react/Modal.js";
import { t } from "../../services/i18n.js";
import { formatDateTime } from "../../utils/formatters.js";
@@ -8,11 +7,11 @@ import openService from "../../services/open.js";
import { useState } from "preact/hooks";
import type { CSSProperties } from "preact/compat";
import type { AppInfo } from "@triliumnext/commons";
import useTriliumEvent from "../react/hooks.jsx";
import { useTriliumEvent } from "../react/hooks.jsx";
function AboutDialogComponent() {
let [appInfo, setAppInfo] = useState<AppInfo | null>(null);
let [shown, setShown] = useState(false);
export default function AboutDialog() {
const [appInfo, setAppInfo] = useState<AppInfo | null>(null);
const [shown, setShown] = useState(false);
const forceWordBreak: CSSProperties = { wordBreak: "break-all" };
useTriliumEvent("openAboutDialog", () => setShown(true));
@@ -77,16 +76,8 @@ function DirectoryLink({ directory, style }: { directory: string, style?: CSSPro
openService.openDirectory(directory);
};
return <a className="tn-link" href="#" onClick={onClick} style={style}></a>
return <a className="tn-link" href="#" onClick={onClick} style={style}>{directory}</a>
} else {
return <span style={style}>{directory}</span>;
}
}
export default class AboutDialog extends ReactBasicWidget {
get component() {
return <AboutDialogComponent />;
}
}

View File

@@ -1,6 +1,5 @@
import { t } from "../../services/i18n";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import Button from "../react/Button";
import FormRadioGroup from "../react/FormRadioGroup";
import NoteAutocomplete from "../react/NoteAutocomplete";
@@ -11,11 +10,11 @@ import { default as TextTypeWidget } from "../type_widgets/editable_text.js";
import { logError } from "../../services/ws";
import FormGroup from "../react/FormGroup.js";
import { refToJQuerySelector } from "../react/react_utils";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
type LinkType = "reference-link" | "external-link" | "hyper-link";
function AddLinkDialogComponent() {
export default function AddLinkDialog() {
const [ textTypeWidget, setTextTypeWidget ] = useState<TextTypeWidget>();
const initialText = useRef<string>();
const [ linkTitle, setLinkTitle ] = useState("");
@@ -30,6 +29,14 @@ function AddLinkDialogComponent() {
setShown(true);
});
useEffect(() => {
if (hasSelection) {
setLinkType("hyper-link");
} else {
setLinkType("reference-link");
}
}, [ hasSelection ])
async function setDefaultLinkTitle(noteId: string) {
const noteTitle = await tree.getNoteTitle(noteId);
setLinkTitle(noteTitle);
@@ -152,11 +159,3 @@ function AddLinkDialogComponent() {
</Modal>
);
}
export default class AddLinkDialog extends ReactBasicWidget {
get component() {
return <AddLinkDialogComponent />;
}
}

View File

@@ -4,15 +4,14 @@ import { t } from "../../services/i18n.js";
import server from "../../services/server.js";
import toast from "../../services/toast.js";
import Modal from "../react/Modal.jsx";
import ReactBasicWidget from "../react/ReactBasicWidget.js";
import froca from "../../services/froca.js";
import tree from "../../services/tree.js";
import Button from "../react/Button.jsx";
import FormGroup from "../react/FormGroup.js";
import useTriliumEvent from "../react/hooks.jsx";
import { useTriliumEvent } from "../react/hooks.jsx";
import FBranch from "../../entities/fbranch.js";
function BranchPrefixDialogComponent() {
export default function BranchPrefixDialog() {
const [ shown, setShown ] = useState(false);
const [ branch, setBranch ] = useState<FBranch>();
const [ prefix, setPrefix ] = useState(branch?.prefix ?? "");
@@ -75,14 +74,6 @@ function BranchPrefixDialogComponent() {
);
}
export default class BranchPrefixDialog extends ReactBasicWidget {
get component() {
return <BranchPrefixDialogComponent />;
}
}
async function savePrefix(branchId: string, prefix: string) {
await server.put(`branches/${branchId}/set-prefix`, { prefix: prefix });
toast.showMessage(t("branch_prefix.branch_prefix_saved"));

View File

@@ -1,7 +1,6 @@
import { useEffect, useState, useCallback } from "preact/hooks";
import { t } from "../../services/i18n";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import "./bulk_actions.css";
import { BulkActionAffectedNotes } from "@triliumnext/commons";
import server from "../../services/server";
@@ -12,9 +11,9 @@ import toast from "../../services/toast";
import RenameNoteBulkAction from "../bulk_actions/note/rename_note";
import FNote from "../../entities/fnote";
import froca from "../../services/froca";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function BulkActionComponent() {
export default function BulkActionsDialog() {
const [ selectedOrActiveNoteIds, setSelectedOrActiveNoteIds ] = useState<string[]>();
const [ bulkActionNote, setBulkActionNote ] = useState<FNote | null>();
const [ includeDescendants, setIncludeDescendants ] = useState(false);
@@ -51,7 +50,7 @@ function BulkActionComponent() {
row.type === "label" && row.name === "action" && row.noteId === "_bulkAction")) {
refreshExistingActions();
}
}, shown);
});
return (
<Modal
@@ -117,11 +116,3 @@ function ExistingActionsList({ existingActions }: { existingActions?: RenameNote
</table>
);
}
export default class BulkActionsDialog extends ReactBasicWidget {
get component() {
return <BulkActionComponent />
}
}

View File

@@ -1,15 +1,11 @@
import { useState } from "preact/hooks";
import { useMemo, useState } from "preact/hooks";
import Button from "../react/Button";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import { CallToAction, dismissCallToAction, getCallToActions } from "./call_to_action_definitions";
import { dismissCallToAction, getCallToActions } from "./call_to_action_definitions";
import { t } from "../../services/i18n";
function CallToActionDialogComponent({ activeCallToActions }: { activeCallToActions: CallToAction[] }) {
if (!activeCallToActions.length) {
return <></>;
}
export default function CallToActionDialog() {
const activeCallToActions = useMemo(() => getCallToActions(), []);
const [ activeIndex, setActiveIndex ] = useState(0);
const [ shown, setShown ] = useState(true);
const activeItem = activeCallToActions[activeIndex];
@@ -22,7 +18,7 @@ function CallToActionDialogComponent({ activeCallToActions }: { activeCallToActi
}
}
return (
return (activeCallToActions.length &&
<Modal
className="call-to-action"
size="md"
@@ -48,11 +44,3 @@ function CallToActionDialogComponent({ activeCallToActions }: { activeCallToActi
</Modal>
)
}
export class CallToActionDialog extends ReactBasicWidget {
get component() {
return <CallToActionDialogComponent activeCallToActions={getCallToActions()} />
}
}

View File

@@ -2,7 +2,6 @@ import { useRef, useState } from "preact/hooks";
import appContext from "../../components/app_context";
import { t } from "../../services/i18n";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import NoteAutocomplete from "../react/NoteAutocomplete";
import froca from "../../services/froca";
import FormGroup from "../react/FormGroup";
@@ -14,9 +13,9 @@ import tree from "../../services/tree";
import branches from "../../services/branches";
import toast from "../../services/toast";
import NoteList from "../react/NoteList";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function CloneToDialogComponent() {
export default function CloneToDialog() {
const [ clonedNoteIds, setClonedNoteIds ] = useState<string[]>();
const [ prefix, setPrefix ] = useState("");
const [ suggestion, setSuggestion ] = useState<Suggestion | null>(null);
@@ -83,14 +82,6 @@ function CloneToDialogComponent() {
)
}
export default class CloneToDialog extends ReactBasicWidget {
get component() {
return <CloneToDialogComponent />;
}
}
async function cloneNotesTo(notePath: string, clonedNoteIds: string[], prefix?: string) {
const { noteId, parentNoteId } = tree.getNoteIdAndParentIdFromUrl(notePath);
if (!noteId || !parentNoteId) {

View File

@@ -1,10 +1,9 @@
import ReactBasicWidget from "../react/ReactBasicWidget";
import Modal from "../react/Modal";
import Button from "../react/Button";
import { t } from "../../services/i18n";
import { useState } from "preact/hooks";
import FormCheckbox from "../react/FormCheckbox";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
interface ConfirmDialogProps {
title?: string;
@@ -13,7 +12,7 @@ interface ConfirmDialogProps {
isConfirmDeleteNoteBox?: boolean;
}
function ConfirmDialogComponent() {
export default function ConfirmDialog() {
const [ opts, setOpts ] = useState<ConfirmDialogProps>();
const [ isDeleteNoteChecked, setIsDeleteNoteChecked ] = useState(false);
const [ shown, setShown ] = useState(false);
@@ -92,11 +91,3 @@ export interface ConfirmWithTitleOptions {
title: string;
callback: ConfirmDialogCallback;
}
export default class ConfirmDialog extends ReactBasicWidget {
get component() {
return <ConfirmDialogComponent />;
}
}

View File

@@ -2,7 +2,6 @@ import { useRef, useState, useEffect } from "preact/hooks";
import { t } from "../../services/i18n.js";
import FormCheckbox from "../react/FormCheckbox.js";
import Modal from "../react/Modal.js";
import ReactBasicWidget from "../react/ReactBasicWidget.js";
import type { DeleteNotesPreview } from "@triliumnext/commons";
import server from "../../services/server.js";
import froca from "../../services/froca.js";
@@ -10,7 +9,7 @@ import FNote from "../../entities/fnote.js";
import link from "../../services/link.js";
import Button from "../react/Button.jsx";
import Alert from "../react/Alert.jsx";
import useTriliumEvent from "../react/hooks.jsx";
import { useTriliumEvent } from "../react/hooks.jsx";
export interface ResolveOptions {
proceed: boolean;
@@ -30,7 +29,7 @@ interface BrokenRelationData {
source: string;
}
function DeleteNotesDialogComponent() {
export default function DeleteNotesDialog() {
const [ opts, setOpts ] = useState<ShowDeleteNotesDialogOpts>({});
const [ deleteAllClones, setDeleteAllClones ] = useState(false);
const [ eraseNotes, setEraseNotes ] = useState(!!opts.forceDeleteAllClones);
@@ -140,7 +139,7 @@ function BrokenRelations({ brokenRelations }: { brokenRelations: DeleteNotesPrev
const noteIds = brokenRelations
.map(relation => relation.noteId)
.filter(noteId => noteId) as string[];
froca.getNotes(noteIds).then(async (notes) => {
froca.getNotes(noteIds).then(async () => {
const notesWithBrokenRelations: BrokenRelationData[] = [];
for (const attr of brokenRelations) {
notesWithBrokenRelations.push({
@@ -171,11 +170,3 @@ function BrokenRelations({ brokenRelations }: { brokenRelations: DeleteNotesPrev
return <></>;
}
}
export default class DeleteNotesDialog extends ReactBasicWidget {
get component() {
return <DeleteNotesDialogComponent />;
}
}

View File

@@ -4,14 +4,13 @@ import tree from "../../services/tree";
import Button from "../react/Button";
import FormRadioGroup from "../react/FormRadioGroup";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import "./export.css";
import ws from "../../services/ws";
import toastService, { ToastOptions } from "../../services/toast";
import utils from "../../services/utils";
import open from "../../services/open";
import froca from "../../services/froca";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
interface ExportDialogProps {
branchId?: string | null;
@@ -19,7 +18,7 @@ interface ExportDialogProps {
defaultType?: "subtree" | "single";
}
function ExportDialogComponent() {
export default function ExportDialog() {
const [ opts, setOpts ] = useState<ExportDialogProps>();
const [ exportType, setExportType ] = useState<string>(opts?.defaultType ?? "subtree");
const [ subtreeFormat, setSubtreeFormat ] = useState("html");
@@ -125,14 +124,6 @@ function ExportDialogComponent() {
);
}
export default class ExportDialog extends ReactBasicWidget {
get component() {
return <ExportDialogComponent />
}
}
function exportBranch(branchId: string, type: string, format: string, version: string) {
const taskId = utils.randomString(10);
const url = open.getUrlForDownload(`api/branches/${branchId}/export/${type}/${format}/${version}/${taskId}`);

View File

@@ -1,4 +1,3 @@
import ReactBasicWidget from "../react/ReactBasicWidget.js";
import Modal from "../react/Modal.jsx";
import { t } from "../../services/i18n.js";
import { ComponentChildren } from "preact";
@@ -6,9 +5,9 @@ import { CommandNames } from "../../components/app_context.js";
import RawHtml from "../react/RawHtml.jsx";
import { useEffect, useState } from "preact/hooks";
import keyboard_actions from "../../services/keyboard_actions.js";
import useTriliumEvent from "../react/hooks.jsx";
import { useTriliumEvent } from "../react/hooks.jsx";
function HelpDialogComponent() {
export default function HelpDialog() {
const [ shown, setShown ] = useState(false);
useTriliumEvent("showCheatsheet", () => setShown(true));
@@ -161,11 +160,3 @@ function Card({ title, children }: { title: string, children: ComponentChildren
</div>
)
}
export default class HelpDialog extends ReactBasicWidget {
get component() {
return <HelpDialogComponent />;
}
}

View File

@@ -7,11 +7,10 @@ import FormFileUpload from "../react/FormFileUpload";
import FormGroup, { FormMultiGroup } from "../react/FormGroup";
import Modal from "../react/Modal";
import RawHtml from "../react/RawHtml";
import ReactBasicWidget from "../react/ReactBasicWidget";
import importService, { UploadFilesOptions } from "../../services/import";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function ImportDialogComponent() {
export default function ImportDialog() {
const [ parentNoteId, setParentNoteId ] = useState<string>();
const [ noteTitle, setNoteTitle ] = useState<string>();
const [ files, setFiles ] = useState<FileList | null>(null);
@@ -89,14 +88,6 @@ function ImportDialogComponent() {
);
}
export default class ImportDialog extends ReactBasicWidget {
get component() {
return <ImportDialogComponent />
}
}
function boolToString(value: boolean) {
return value ? "true" : "false";
}

View File

@@ -4,15 +4,14 @@ import FormGroup from "../react/FormGroup";
import FormRadioGroup from "../react/FormRadioGroup";
import Modal from "../react/Modal";
import NoteAutocomplete from "../react/NoteAutocomplete";
import ReactBasicWidget from "../react/ReactBasicWidget";
import Button from "../react/Button";
import { Suggestion, triggerRecentNotes } from "../../services/note_autocomplete";
import tree from "../../services/tree";
import froca from "../../services/froca";
import EditableTextTypeWidget from "../type_widgets/editable_text";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function IncludeNoteDialogComponent() {
export default function IncludeNoteDialog() {
const [textTypeWidget, setTextTypeWidget] = useState<EditableTextTypeWidget>();
const [suggestion, setSuggestion] = useState<Suggestion | null>(null);
const [boxSize, setBoxSize] = useState("medium");
@@ -70,14 +69,6 @@ function IncludeNoteDialogComponent() {
)
}
export default class IncludeNoteDialog extends ReactBasicWidget {
get component() {
return <IncludeNoteDialogComponent />;
}
}
async function includeNote(notePath: string, textTypeWidget: EditableTextTypeWidget) {
const noteId = tree.getNoteIdFromUrl(notePath);
if (!noteId) {

View File

@@ -3,11 +3,10 @@ import { t } from "../../services/i18n.js";
import utils from "../../services/utils.js";
import Button from "../react/Button.js";
import Modal from "../react/Modal.js";
import ReactBasicWidget from "../react/ReactBasicWidget.js";
import { useState } from "preact/hooks";
import useTriliumEvent from "../react/hooks.jsx";
import { useTriliumEvent } from "../react/hooks.jsx";
function IncorrectCpuArchDialogComponent() {
export default function IncorrectCpuArchDialogComponent() {
const [ shown, setShown ] = useState(false);
const downloadButtonRef = useRef<HTMLButtonElement>(null);
useTriliumEvent("showCpuArchWarning", () => setShown(true));
@@ -44,11 +43,3 @@ function IncorrectCpuArchDialogComponent() {
</Modal>
)
}
export default class IncorrectCpuArchDialog extends ReactBasicWidget {
get component() {
return <IncorrectCpuArchDialogComponent />
}
}

View File

@@ -1,13 +1,12 @@
import { EventData } from "../../components/app_context";
import ReactBasicWidget from "../react/ReactBasicWidget";
import Modal from "../react/Modal";
import { t } from "../../services/i18n";
import Button from "../react/Button";
import { useRef, useState } from "preact/hooks";
import { RawHtmlBlock } from "../react/RawHtml";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function ShowInfoDialogComponent() {
export default function InfoDialog() {
const [ opts, setOpts ] = useState<EventData<"showInfoDialog">>();
const [ shown, setShown ] = useState(false);
const okButtonRef = useRef<HTMLButtonElement>(null);
@@ -37,11 +36,3 @@ function ShowInfoDialogComponent() {
<RawHtmlBlock className="info-dialog-content" html={opts?.message ?? ""} />
</Modal>);
}
export default class InfoDialog extends ReactBasicWidget {
get component() {
return <ShowInfoDialogComponent />;
}
}

View File

@@ -1,4 +1,3 @@
import ReactBasicWidget from "../react/ReactBasicWidget";
import Modal from "../react/Modal";
import Button from "../react/Button";
import NoteAutocomplete from "../react/NoteAutocomplete";
@@ -8,13 +7,14 @@ import note_autocomplete, { Suggestion } from "../../services/note_autocomplete"
import appContext from "../../components/app_context";
import commandRegistry from "../../services/command_registry";
import { refToJQuerySelector } from "../react/react_utils";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
import shortcutService from "../../services/shortcuts";
const KEEP_LAST_SEARCH_FOR_X_SECONDS = 120;
type Mode = "last-search" | "recent-notes" | "commands";
function JumpToNoteDialogComponent() {
export default function JumpToNoteDialogComponent() {
const [ mode, setMode ] = useState<Mode>();
const [ lastOpenedTs, setLastOpenedTs ] = useState<number>(0);
const containerRef = useRef<HTMLDivElement>(null);
@@ -26,12 +26,12 @@ function JumpToNoteDialogComponent() {
async function openDialog(commandMode: boolean) {
let newMode: Mode;
let initialText: string = "";
let initialText = "";
if (commandMode) {
newMode = "commands";
initialText = ">";
} else if (Date.now() - lastOpenedTs <= KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000 && actualText) {
} else if (Date.now() - lastOpenedTs <= KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000 && actualText.current) {
// if you open the Jump To dialog soon after using it previously, it can often mean that you
// actually want to search for the same thing (e.g., you opened the wrong note at first try)
// so we'll keep the content.
@@ -83,6 +83,27 @@ function JumpToNoteDialogComponent() {
$autoComplete
.trigger("focus")
.trigger("select");
// Add keyboard shortcut for full search
shortcutService.bindElShortcut($autoComplete, "ctrl+return", () => {
if (!isCommandMode) {
showInFullSearch();
}
});
}
async function showInFullSearch() {
try {
setShown(false);
const searchString = actualText.current?.trim();
if (searchString && !searchString.startsWith(">")) {
await appContext.triggerCommand("searchNotes", {
searchString
});
}
} catch (error) {
console.error("Failed to trigger full search:", error);
}
}
return (
@@ -108,18 +129,15 @@ function JumpToNoteDialogComponent() {
/>}
onShown={onShown}
onHidden={() => setShown(false)}
footer={!isCommandMode && <Button className="show-in-full-text-button" text={t("jump_to_note.search_button")} keyboardShortcut="Ctrl+Enter" />}
footer={!isCommandMode && <Button
className="show-in-full-text-button"
text={t("jump_to_note.search_button")}
keyboardShortcut="Ctrl+Enter"
onClick={showInFullSearch}
/>}
show={shown}
>
<div className="algolia-autocomplete-container jump-to-note-results" ref={containerRef}></div>
</Modal>
);
}
export default class JumpToNoteDialog extends ReactBasicWidget {
get component() {
return <JumpToNoteDialogComponent />;
}
}

View File

@@ -5,18 +5,17 @@ import server from "../../services/server";
import toast from "../../services/toast";
import utils from "../../services/utils";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import Button from "../react/Button";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
interface RenderMarkdownResponse {
htmlContent: string;
}
function MarkdownImportDialogComponent() {
export default function MarkdownImportDialog() {
const markdownImportTextArea = useRef<HTMLTextAreaElement>(null);
let [ text, setText ] = useState("");
let [ shown, setShown ] = useState(false);
const [ text, setText ] = useState("");
const [ shown, setShown ] = useState(false);
const triggerImport = useCallback(() => {
if (appContext.tabManager.getActiveContextNoteType() !== "text") {
@@ -64,14 +63,6 @@ function MarkdownImportDialogComponent() {
)
}
export default class MarkdownImportDialog extends ReactBasicWidget {
get component() {
return <MarkdownImportDialogComponent />;
}
}
async function convertMarkdownToHtml(markdownContent: string) {
const { htmlContent } = await server.post<RenderMarkdownResponse>("other/render-markdown", { markdownContent });

View File

@@ -1,4 +1,3 @@
import ReactBasicWidget from "../react/ReactBasicWidget";
import Modal from "../react/Modal";
import { t } from "../../services/i18n";
import NoteList from "../react/NoteList";
@@ -11,9 +10,9 @@ import tree from "../../services/tree";
import froca from "../../services/froca";
import branches from "../../services/branches";
import toast from "../../services/toast";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function MoveToDialogComponent() {
export default function MoveToDialog() {
const [ movedBranchIds, setMovedBranchIds ] = useState<string[]>();
const [ suggestion, setSuggestion ] = useState<Suggestion | null>(null);
const [ shown, setShown ] = useState(false);
@@ -67,14 +66,6 @@ function MoveToDialogComponent() {
)
}
export default class MoveToDialog extends ReactBasicWidget {
get component() {
return <MoveToDialogComponent />;
}
}
async function moveNotesTo(movedBranchIds: string[] | undefined, parentBranchId: string) {
if (movedBranchIds) {
await branches.moveToParentNote(movedBranchIds, parentBranchId);

View File

@@ -1,4 +1,3 @@
import ReactBasicWidget from "../react/ReactBasicWidget";
import Modal from "../react/Modal";
import { t } from "../../services/i18n";
import FormGroup from "../react/FormGroup";
@@ -10,7 +9,7 @@ import { MenuCommandItem, MenuItem } from "../../menus/context_menu";
import { TreeCommandNames } from "../../menus/tree_context_menu";
import { Suggestion } from "../../services/note_autocomplete";
import Badge from "../react/Badge";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
export interface ChooseNoteTypeResponse {
success: boolean;
@@ -26,7 +25,7 @@ const SEPARATOR_TITLE_REPLACEMENTS = [
t("note_type_chooser.templates")
];
function NoteTypeChooserDialogComponent() {
export default function NoteTypeChooserDialogComponent() {
const [ callback, setCallback ] = useState<ChooseNoteTypeCallback>();
const [ shown, setShown ] = useState(false);
const [ parentNote, setParentNote ] = useState<Suggestion | null>();
@@ -37,25 +36,23 @@ function NoteTypeChooserDialogComponent() {
setShown(true);
});
if (!noteTypes.length) {
useEffect(() => {
note_types.getNoteTypeItems().then(noteTypes => {
let index = -1;
useEffect(() => {
note_types.getNoteTypeItems().then(noteTypes => {
let index = -1;
setNoteTypes((noteTypes ?? []).map((item, _index) => {
if (item.title === "----") {
index++;
return {
title: SEPARATOR_TITLE_REPLACEMENTS[index],
enabled: false
}
setNoteTypes((noteTypes ?? []).map((item) => {
if (item.title === "----") {
index++;
return {
title: SEPARATOR_TITLE_REPLACEMENTS[index],
enabled: false
}
}
return item;
}));
});
return item;
}));
});
}
}, []);
function onNoteTypeSelected(value: string) {
const [ noteType, templateNoteId ] = value.split(",");
@@ -120,11 +117,3 @@ function NoteTypeChooserDialogComponent() {
</Modal>
);
}
export default class NoteTypeChooserDialog extends ReactBasicWidget {
get component() {
return <NoteTypeChooserDialogComponent />
}
}

View File

@@ -1,12 +1,11 @@
import ReactBasicWidget from "../react/ReactBasicWidget";
import Modal from "../react/Modal";
import { t } from "../../services/i18n";
import Button from "../react/Button";
import appContext from "../../components/app_context";
import { useState } from "preact/hooks";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function PasswordNotSetDialogComponent() {
export default function PasswordNotSetDialog() {
const [ shown, setShown ] = useState(false);
useTriliumEvent("showPasswordNotSet", () => setShown(true));
@@ -27,10 +26,3 @@ function PasswordNotSetDialogComponent() {
);
}
export default class PasswordNotSetDialog extends ReactBasicWidget {
get component() {
return <PasswordNotSetDialogComponent />;
}
}

View File

@@ -2,12 +2,10 @@ import { useRef, useState } from "preact/hooks";
import { t } from "../../services/i18n";
import Button from "../react/Button";
import Modal from "../react/Modal";
import { Modal as BootstrapModal } from "bootstrap";
import ReactBasicWidget from "../react/ReactBasicWidget";
import FormTextBox from "../react/FormTextBox";
import FormGroup from "../react/FormGroup";
import { refToJQuerySelector } from "../react/react_utils";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
// JQuery here is maintained for compatibility with existing code.
interface ShownCallbackData {
@@ -28,7 +26,7 @@ export interface PromptDialogOptions {
readOnly?: boolean;
}
function PromptDialogComponent() {
export default function PromptDialog() {
const modalRef = useRef<HTMLDivElement>(null);
const formRef = useRef<HTMLFormElement>(null);
const labelRef = useRef<HTMLLabelElement>(null);
@@ -84,11 +82,3 @@ function PromptDialogComponent() {
</Modal>
);
}
export default class PromptDialog extends ReactBasicWidget {
get component() {
return <PromptDialogComponent />;
}
}

View File

@@ -3,11 +3,10 @@ import { t } from "../../services/i18n";
import Button from "../react/Button";
import FormTextBox from "../react/FormTextBox";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import protected_session from "../../services/protected_session";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function ProtectedSessionPasswordDialogComponent() {
export default function ProtectedSessionPasswordDialog() {
const [ shown, setShown ] = useState(false);
const [ password, setPassword ] = useState("");
const inputRef = useRef<HTMLInputElement>(null);
@@ -38,11 +37,3 @@ function ProtectedSessionPasswordDialogComponent() {
</Modal>
)
}
export default class ProtectedSessionPasswordDialog extends ReactBasicWidget {
get component() {
return <ProtectedSessionPasswordDialogComponent />;
}
}

View File

@@ -6,7 +6,6 @@ import server from "../../services/server";
import toast from "../../services/toast";
import Button from "../react/Button";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import hoisted_note from "../../services/hoisted_note";
import type { RecentChangeRow } from "@triliumnext/commons";
import froca from "../../services/froca";
@@ -14,39 +13,32 @@ import { formatDateTime } from "../../utils/formatters";
import link from "../../services/link";
import RawHtml from "../react/RawHtml";
import ws from "../../services/ws";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function RecentChangesDialogComponent() {
export default function RecentChangesDialog() {
const [ ancestorNoteId, setAncestorNoteId ] = useState<string>();
const [ groupedByDate, setGroupedByDate ] = useState<Map<String, RecentChangeRow[]>>();
const [ needsRefresh, setNeedsRefresh ] = useState(false);
const [ groupedByDate, setGroupedByDate ] = useState<Map<string, RecentChangeRow[]>>();
const [ refreshCounter, setRefreshCounter ] = useState(0);
const [ shown, setShown ] = useState(false);
useTriliumEvent("showRecentChanges", ({ ancestorNoteId }) => {
setNeedsRefresh(true);
useTriliumEvent("showRecentChanges", ({ ancestorNoteId }) => {
setAncestorNoteId(ancestorNoteId ?? hoisted_note.getHoistedNoteId());
setShown(true);
});
if (!groupedByDate || needsRefresh) {
useEffect(() => {
if (needsRefresh) {
setNeedsRefresh(false);
}
useEffect(() => {
server.get<RecentChangeRow[]>(`recent-changes/${ancestorNoteId}`)
.then(async (recentChanges) => {
// preload all notes into cache
await froca.getNotes(
recentChanges.map((r) => r.noteId),
true
);
server.get<RecentChangeRow[]>(`recent-changes/${ancestorNoteId}`)
.then(async (recentChanges) => {
// preload all notes into cache
await froca.getNotes(
recentChanges.map((r) => r.noteId),
true
);
const groupedByDate = groupByDate(recentChanges);
setGroupedByDate(groupedByDate);
});
})
}
const groupedByDate = groupByDate(recentChanges);
setGroupedByDate(groupedByDate);
});
}, [ shown, refreshCounter ])
return (
<Modal
@@ -61,7 +53,7 @@ function RecentChangesDialogComponent() {
style={{ padding: "0 10px" }}
onClick={() => {
server.post("notes/erase-deleted-notes-now").then(() => {
setNeedsRefresh(true);
setRefreshCounter(refreshCounter + 1);
toast.showMessage(t("recent_changes.deleted_notes_message"));
});
}}
@@ -79,7 +71,7 @@ function RecentChangesDialogComponent() {
)
}
function RecentChangesTimeline({ groupedByDate, setShown }: { groupedByDate: Map<String, RecentChangeRow[]>, setShown: Dispatch<StateUpdater<boolean>> }) {
function RecentChangesTimeline({ groupedByDate, setShown }: { groupedByDate: Map<string, RecentChangeRow[]>, setShown: Dispatch<StateUpdater<boolean>> }) {
return (
<>
{ Array.from(groupedByDate.entries()).map(([dateDay, dayChanges]) => {
@@ -114,10 +106,6 @@ function RecentChangesTimeline({ groupedByDate, setShown }: { groupedByDate: Map
}
function NoteLink({ notePath, title }: { notePath: string, title: string }) {
if (!notePath || !title) {
return null;
}
const [ noteLink, setNoteLink ] = useState<JQuery<HTMLElement> | null>(null);
useEffect(() => {
link.createLink(notePath, {
@@ -156,25 +144,19 @@ function DeletedNoteLink({ change, setShown }: { change: RecentChangeRow, setSho
);
}
export default class RecentChangesDialog extends ReactBasicWidget {
get component() {
return <RecentChangesDialogComponent />
}
}
function groupByDate(rows: RecentChangeRow[]) {
const groupedByDate = new Map<String, RecentChangeRow[]>();
const groupedByDate = new Map<string, RecentChangeRow[]>();
for (const row of rows) {
const dateDay = row.date.substr(0, 10);
if (!groupedByDate.has(dateDay)) {
groupedByDate.set(dateDay, []);
let dateDayArray = groupedByDate.get(dateDay);
if (!dateDayArray) {
dateDayArray = [];
groupedByDate.set(dateDay, dateDayArray);
}
groupedByDate.get(dateDay)!.push(row);
dateDayArray.push(row);
}
return groupedByDate;

View File

@@ -8,7 +8,6 @@ import server from "../../services/server";
import toast from "../../services/toast";
import Button from "../react/Button";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import FormList, { FormListItem } from "../react/FormList";
import utils from "../../services/utils";
import { Dispatch, StateUpdater, useEffect, useRef, useState } from "preact/hooks";
@@ -18,9 +17,9 @@ import type { CSSProperties } from "preact/compat";
import open from "../../services/open";
import ActionButton from "../react/ActionButton";
import options from "../../services/options";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function RevisionsDialogComponent() {
export default function RevisionsDialog() {
const [ note, setNote ] = useState<FNote>();
const [ revisions, setRevisions ] = useState<RevisionItem[]>();
const [ currentRevision, setCurrentRevision ] = useState<RevisionItem>();
@@ -72,6 +71,8 @@ function RevisionsDialogComponent() {
onHidden={() => {
setShown(false);
setNote(undefined);
setCurrentRevision(undefined);
setRevisions(undefined);
}}
show={shown}
>
@@ -202,17 +203,9 @@ function RevisionContent({ revisionItem, fullRevision }: { revisionItem?: Revisi
return <></>;
}
switch (revisionItem.type) {
case "text": {
const contentRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (contentRef.current?.querySelector("span.math-tex")) {
renderMathInElement(contentRef.current, { trust: true });
}
});
return <div ref={contentRef} className="ck-content" dangerouslySetInnerHTML={{ __html: content as string }}></div>
}
case "text":
return <RevisionContentText content={content} />
case "code":
return <pre style={CODE_STYLE}>{content}</pre>;
case "image":
@@ -264,6 +257,16 @@ function RevisionContent({ revisionItem, fullRevision }: { revisionItem?: Revisi
}
}
function RevisionContentText({ content }: { content: string | Buffer<ArrayBufferLike> | undefined }) {
const contentRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (contentRef.current?.querySelector("span.math-tex")) {
renderMathInElement(contentRef.current, { trust: true });
}
}, [content]);
return <div ref={contentRef} className="ck-content" dangerouslySetInnerHTML={{ __html: content as string }}></div>
}
function RevisionFooter({ note }: { note?: FNote }) {
if (!note) {
return <></>;
@@ -291,14 +294,6 @@ function RevisionFooter({ note }: { note?: FNote }) {
</>;
}
export default class RevisionsDialog extends ReactBasicWidget {
get component() {
return <RevisionsDialogComponent />
}
}
async function getNote(noteId?: string | null) {
if (noteId) {
return await froca.getNote(noteId);

View File

@@ -5,12 +5,11 @@ import FormCheckbox from "../react/FormCheckbox";
import FormRadioGroup from "../react/FormRadioGroup";
import FormTextBox from "../react/FormTextBox";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import server from "../../services/server";
import FormGroup from "../react/FormGroup";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function SortChildNotesDialogComponent() {
export default function SortChildNotesDialog() {
const [ parentNoteId, setParentNoteId ] = useState<string>();
const [ sortBy, setSortBy ] = useState("title");
const [ sortDirection, setSortDirection ] = useState("asc");
@@ -89,11 +88,3 @@ function SortChildNotesDialogComponent() {
</Modal>
)
}
export default class SortChildNotesDialog extends ReactBasicWidget {
get component() {
return <SortChildNotesDialogComponent />;
}
}

View File

@@ -5,13 +5,12 @@ import FormCheckbox from "../react/FormCheckbox";
import FormFileUpload from "../react/FormFileUpload";
import FormGroup from "../react/FormGroup";
import Modal from "../react/Modal";
import ReactBasicWidget from "../react/ReactBasicWidget";
import options from "../../services/options";
import importService from "../../services/import.js";
import tree from "../../services/tree";
import useTriliumEvent from "../react/hooks";
import { useTriliumEvent } from "../react/hooks";
function UploadAttachmentsDialogComponent() {
export default function UploadAttachmentsDialog() {
const [ parentNoteId, setParentNoteId ] = useState<string>();
const [ files, setFiles ] = useState<FileList | null>(null);
const [ shrinkImages, setShrinkImages ] = useState(options.is("compressImages"));
@@ -24,12 +23,12 @@ function UploadAttachmentsDialogComponent() {
setShown(true);
});
if (parentNoteId) {
useEffect(() => {
tree.getNoteTitle(parentNoteId).then((noteTitle) =>
setDescription(t("upload_attachments.files_will_be_uploaded", { noteTitle })));
}, [parentNoteId]);
}
useEffect(() => {
if (!parentNoteId) return;
tree.getNoteTitle(parentNoteId).then((noteTitle) =>
setDescription(t("upload_attachments.files_will_be_uploaded", { noteTitle })));
}, [parentNoteId]);
return (
<Modal
@@ -64,11 +63,3 @@ function UploadAttachmentsDialogComponent() {
</Modal>
);
}
export default class UploadAttachmentsDialog extends ReactBasicWidget {
get component() {
return <UploadAttachmentsDialogComponent />;
}
}

View File

@@ -1,120 +0,0 @@
import attributeService from "../services/attributes.js";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import { t } from "../services/i18n.js";
import type FNote from "../entities/fnote.js";
import type { EventData } from "../components/app_context.js";
import { Dropdown } from "bootstrap";
type Editability = "auto" | "readOnly" | "autoReadOnlyDisabled";
const TPL = /*html*/`
<div class="dropdown editability-select-widget">
<style>
.editability-dropdown {
width: 300px;
}
.editability-dropdown .dropdown-item {
display: flex !importamt;
}
.editability-dropdown .dropdown-item > div {
margin-left: 10px;
}
.editability-dropdown .description {
font-size: small;
color: var(--muted-text-color);
white-space: normal;
}
</style>
<button type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-sm select-button dropdown-toggle editability-button">
<span class="editability-active-desc">${t("editability_select.auto")}</span>
<span class="caret"></span>
</button>
<div class="editability-dropdown dropdown-menu dropdown-menu-right tn-dropdown-list">
<a class="dropdown-item" href="#" data-editability="auto">
<span class="check">&check;</span>
<div>
${t("editability_select.auto")}
<div class="description">${t("editability_select.note_is_editable")}</div>
</div>
</a>
<a class="dropdown-item" href="#" data-editability="readOnly">
<span class="check">&check;</span>
<div>
${t("editability_select.read_only")}
<div class="description">${t("editability_select.note_is_read_only")}</div>
</div>
</a>
<a class="dropdown-item" href="#" data-editability="autoReadOnlyDisabled">
<span class="check">&check;</span>
<div>
${t("editability_select.always_editable")}
<div class="description">${t("editability_select.note_is_always_editable")}</div>
</div>
</a>
</div>
</div>
`;
export default class EditabilitySelectWidget extends NoteContextAwareWidget {
private dropdown!: Dropdown;
private $editabilityActiveDesc!: JQuery<HTMLElement>;
doRender() {
this.$widget = $(TPL);
this.dropdown = Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']")[0]);
this.$editabilityActiveDesc = this.$widget.find(".editability-active-desc");
this.$widget.on("click", ".dropdown-item", async (e) => {
this.dropdown.toggle();
const editability = $(e.target).closest("[data-editability]").attr("data-editability");
if (!this.note || !this.noteId) {
return;
}
for (const ownedAttr of this.note.getOwnedLabels()) {
if (["readOnly", "autoReadOnlyDisabled"].includes(ownedAttr.name)) {
await attributeService.removeAttributeById(this.noteId, ownedAttr.attributeId);
}
}
if (editability && editability !== "auto") {
await attributeService.addLabel(this.noteId, editability);
}
});
}
async refreshWithNote(note: FNote) {
let editability: Editability = "auto";
if (this.note?.isLabelTruthy("readOnly")) {
editability = "readOnly";
} else if (this.note?.isLabelTruthy("autoReadOnlyDisabled")) {
editability = "autoReadOnlyDisabled";
}
const labels = {
auto: t("editability_select.auto"),
readOnly: t("editability_select.read_only"),
autoReadOnlyDisabled: t("editability_select.always_editable")
};
this.$widget.find(".dropdown-item").removeClass("selected");
this.$widget.find(`.dropdown-item[data-editability='${editability}']`).addClass("selected");
this.$editabilityActiveDesc.text(labels[editability]);
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.getAttributeRows().find((attr) => attr.noteId === this.noteId)) {
this.refresh();
}
}
}

View File

@@ -1,6 +1,6 @@
// taken from the HTML source of https://boxicons.com/
interface Category {
export interface Category {
name: string;
id: number;
}

View File

@@ -0,0 +1,59 @@
.note-icon-widget {
padding-top: 3px;
padding-left: 7px;
margin-right: 0;
width: 50px;
height: 50px;
}
.note-icon-widget button.note-icon {
font-size: 180%;
background-color: transparent;
border: 1px solid transparent;
cursor: pointer;
padding: 6px;
color: var(--main-text-color);
}
.note-icon-widget button.note-icon:hover {
border: 1px solid var(--main-border-color);
}
.note-icon-widget .dropdown-menu {
border-radius: 10px;
border-width: 2px;
box-shadow: 10px 10px 93px -25px black;
padding: 10px 15px 10px 15px !important;
}
.note-icon-widget .filter-row {
padding-top: 10px;
padding-bottom: 10px;
padding-right: 20px;
display: flex;
align-items: baseline;
}
.note-icon-widget .filter-row span {
display: block;
padding-left: 15px;
padding-right: 15px;
font-weight: bold;
}
.note-icon-widget .icon-list {
height: 500px;
overflow: auto;
}
.note-icon-widget .icon-list span {
display: inline-block;
padding: 10px;
cursor: pointer;
border: 1px solid transparent;
font-size: 180%;
}
.note-icon-widget .icon-list span:hover {
border: 1px solid var(--main-border-color);
}

View File

@@ -1,229 +0,0 @@
import { t } from "../services/i18n.js";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import attributeService from "../services/attributes.js";
import server from "../services/server.js";
import type FNote from "../entities/fnote.js";
import type { EventData } from "../components/app_context.js";
import type { Icon } from "./icon_list.js";
import { Dropdown } from "bootstrap";
const TPL = /*html*/`
<div class="note-icon-widget dropdown">
<style>
.note-icon-widget {
padding-top: 3px;
padding-left: 7px;
margin-right: 0;
width: 50px;
height: 50px;
}
.note-icon-widget button.note-icon {
font-size: 180%;
background-color: transparent;
border: 1px solid transparent;
cursor: pointer;
padding: 6px;
color: var(--main-text-color);
}
.note-icon-widget button.note-icon:hover {
border: 1px solid var(--main-border-color);
}
.note-icon-widget .dropdown-menu {
border-radius: 10px;
border-width: 2px;
box-shadow: 10px 10px 93px -25px black;
padding: 10px 15px 10px 15px !important;
}
.note-icon-widget .filter-row {
padding-top: 10px;
padding-bottom: 10px;
padding-right: 20px;
display: flex;
align-items: baseline;
}
.note-icon-widget .filter-row span {
display: block;
padding-left: 15px;
padding-right: 15px;
font-weight: bold;
}
.note-icon-widget .icon-list {
height: 500px;
overflow: auto;
}
.note-icon-widget .icon-list span {
display: inline-block;
padding: 10px;
cursor: pointer;
border: 1px solid transparent;
font-size: 180%;
}
.note-icon-widget .icon-list span:hover {
border: 1px solid var(--main-border-color);
}
</style>
<button class="btn dropdown-toggle note-icon" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="${t("note_icon.change_note_icon")}"></button>
<div class="dropdown-menu" aria-labelledby="note-path-list-button" style="width: 610px;">
<div class="filter-row">
<span>${t("note_icon.category")}</span> <select name="icon-category" class="form-select"></select>
<span>${t("note_icon.search")}</span> <input type="text" name="icon-search" class="form-control" />
</div>
<div class="icon-list"></div>
</div>
</div>`;
interface IconToCountCache {
iconClassToCountMap: Record<string, number>;
}
export default class NoteIconWidget extends NoteContextAwareWidget {
private dropdown!: bootstrap.Dropdown;
private $icon!: JQuery<HTMLElement>;
private $iconList!: JQuery<HTMLElement>;
private $iconCategory!: JQuery<HTMLElement>;
private $iconSearch!: JQuery<HTMLElement>;
private iconToCountCache!: Promise<IconToCountCache | null> | null;
doRender() {
this.$widget = $(TPL);
this.dropdown = Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']")[0]);
this.$icon = this.$widget.find("button.note-icon");
this.$iconList = this.$widget.find(".icon-list");
this.$iconList.on("click", "span", async (e) => {
const clazz = $(e.target).attr("class");
if (this.noteId && this.note) {
await attributeService.setLabel(this.noteId, this.note.hasOwnedLabel("workspace") ? "workspaceIconClass" : "iconClass", clazz);
}
});
this.$iconCategory = this.$widget.find("select[name='icon-category']");
this.$iconCategory.on("change", () => this.renderDropdown());
this.$iconCategory.on("click", (e) => e.stopPropagation());
this.$iconSearch = this.$widget.find("input[name='icon-search']");
this.$iconSearch.on("input", () => this.renderDropdown());
this.$widget.on("show.bs.dropdown", async () => {
const { categories } = (await import("./icon_list.js")).default;
this.$iconCategory.empty();
for (const category of categories) {
this.$iconCategory.append($("<option>").text(category.name).attr("value", category.id));
}
this.$iconSearch.val("");
this.renderDropdown();
});
}
async refreshWithNote(note: FNote) {
this.$icon.removeClass().addClass(`${note.getIcon()} note-icon`);
this.$icon.prop("disabled", !!(this.noteContext?.viewScope?.viewMode !== "default"));
this.dropdown.hide();
}
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (this.noteId && loadResults.isNoteReloaded(this.noteId)) {
this.refresh();
return;
}
for (const attr of loadResults.getAttributeRows()) {
if (attr.type === "label" && ["iconClass", "workspaceIconClass"].includes(attr.name ?? "") && attributeService.isAffecting(attr, this.note)) {
this.refresh();
break;
}
}
}
async renderDropdown() {
const iconToCount = await this.getIconToCountMap();
const { icons } = (await import("./icon_list.js")).default;
this.$iconList.empty();
if (this.getIconLabels().length > 0) {
this.$iconList.append(
$(`<div style="text-align: center">`).append(
$(`<button class="btn btn-sm">${t("note_icon.reset-default")}</button>`).on("click", () =>
this.getIconLabels().forEach((label) => {
if (this.noteId) {
attributeService.removeAttributeById(this.noteId, label.attributeId);
}
})
)
)
);
}
const categoryId = parseInt(String(this.$iconCategory.find("option:selected")?.val()));
const search = String(this.$iconSearch.val())?.trim()?.toLowerCase();
const filteredIcons = icons.filter((icon) => {
if (categoryId && icon.category_id !== categoryId) {
return false;
}
if (search) {
if (!icon.name.includes(search) && !icon.term?.find((t) => t.includes(search))) {
return false;
}
}
return true;
});
if (iconToCount) {
filteredIcons.sort((a, b) => {
const countA = iconToCount[a.className ?? ""] || 0;
const countB = iconToCount[b.className ?? ""] || 0;
return countB - countA;
});
}
for (const icon of filteredIcons) {
this.$iconList.append(this.renderIcon(icon));
}
this.$iconSearch.focus();
}
async getIconToCountMap() {
if (!this.iconToCountCache) {
this.iconToCountCache = server.get<IconToCountCache>("other/icon-usage");
setTimeout(() => (this.iconToCountCache = null), 20000); // invalidate cache after 20 seconds
}
return (await this.iconToCountCache)?.iconClassToCountMap;
}
renderIcon(icon: Icon) {
return $("<span>")
.addClass("bx " + icon.className)
.attr("title", icon.name);
}
getIconLabels() {
if (!this.note) {
return [];
}
return this.note.getOwnedLabels().filter((label) => ["workspaceIconClass", "iconClass"].includes(label.name));
}
}

View File

@@ -0,0 +1,184 @@
import Dropdown from "./react/Dropdown";
import "./note_icon.css";
import { t } from "i18next";
import { useNoteContext, useNoteLabel } from "./react/hooks";
import { useEffect, useRef, useState } from "preact/hooks";
import server from "../services/server";
import type { Category, Icon } from "./icon_list";
import FormTextBox from "./react/FormTextBox";
import FormSelect from "./react/FormSelect";
import FNote from "../entities/fnote";
import attributes from "../services/attributes";
import Button from "./react/Button";
interface IconToCountCache {
iconClassToCountMap: Record<string, number>;
}
interface IconData {
iconToCount: Record<string, number>;
categories: Category[];
icons: Icon[];
}
let fullIconData: {
categories: Category[];
icons: Icon[];
};
let iconToCountCache!: Promise<IconToCountCache> | null;
export default function NoteIcon() {
const { note, viewScope } = useNoteContext();
const [ icon, setIcon ] = useState<string | null | undefined>();
const [ iconClass ] = useNoteLabel(note, "iconClass");
const [ workspaceIconClass ] = useNoteLabel(note, "workspaceIconClass");
useEffect(() => {
setIcon(note?.getIcon());
}, [ note, iconClass, workspaceIconClass ]);
return (
<Dropdown
className="note-icon-widget"
title={t("note_icon.change_note_icon")}
dropdownContainerStyle={{ width: "610px" }}
buttonClassName={`note-icon ${icon ?? "bx bx-empty"}`}
hideToggleArrow
disabled={viewScope?.viewMode !== "default"}
>
{ note && <NoteIconList note={note} /> }
</Dropdown>
)
}
function NoteIconList({ note }: { note: FNote }) {
const searchBoxRef = useRef<HTMLInputElement>(null);
const [ search, setSearch ] = useState<string>();
const [ categoryId, setCategoryId ] = useState<string>("0");
const [ iconData, setIconData ] = useState<IconData>();
useEffect(() => {
async function loadIcons() {
if (!fullIconData) {
fullIconData = (await import("./icon_list.js")).default;
}
// Filter by text and/or category.
let icons: Icon[] = fullIconData.icons;
const processedSearch = search?.trim()?.toLowerCase();
if (processedSearch || categoryId) {
icons = icons.filter((icon) => {
if (categoryId !== "0" && String(icon.category_id) !== categoryId) {
return false;
}
if (processedSearch) {
if (!icon.name.includes(processedSearch) &&
!icon.term?.find((t) => t.includes(processedSearch))) {
return false;
}
}
return true;
});
}
// Sort by count.
const iconToCount = await getIconToCountMap();
if (iconToCount) {
icons.sort((a, b) => {
const countA = iconToCount[a.className ?? ""] || 0;
const countB = iconToCount[b.className ?? ""] || 0;
return countB - countA;
});
}
setIconData({
iconToCount,
icons,
categories: fullIconData.categories
})
}
loadIcons();
}, [ search, categoryId ]);
return (
<>
<div class="filter-row">
<span>{t("note_icon.category")}</span>
<FormSelect
name="icon-category"
values={fullIconData?.categories ?? []}
currentValue={categoryId} onChange={setCategoryId}
keyProperty="id" titleProperty="name"
/>
<span>{t("note_icon.search")}</span>
<FormTextBox
inputRef={searchBoxRef}
type="text"
name="icon-search"
currentValue={search} onChange={setSearch}
autoFocus
/>
</div>
<div
class="icon-list"
onClick={(e) => {
const clickedTarget = e.target as HTMLElement;
if (!clickedTarget.classList.contains("bx")) {
return;
}
const iconClass = Array.from(clickedTarget.classList.values()).join(" ");
if (note) {
const attributeToSet = note.hasOwnedLabel("workspace") ? "workspaceIconClass" : "iconClass";
attributes.setLabel(note.noteId, attributeToSet, iconClass);
}
}}
>
{getIconLabels(note).length > 0 && (
<div style={{ textAlign: "center" }}>
<Button
text={t("note_icon.reset-default")}
onClick={() => {
if (!note) {
return;
}
for (const label of getIconLabels(note)) {
attributes.removeAttributeById(note.noteId, label.attributeId);
}
}}
/>
</div>
)}
{(iconData?.icons ?? []).map(({className, name}) => (
<span class={`bx ${className}`} title={name} />
))}
</div>
</>
);
}
async function getIconToCountMap() {
if (!iconToCountCache) {
iconToCountCache = server.get<IconToCountCache>("other/icon-usage");
setTimeout(() => (iconToCountCache = null), 20000); // invalidate cache after 20 seconds
}
return (await iconToCountCache).iconClassToCountMap;
}
function getIconLabels(note: FNote) {
if (!note) {
return [];
}
return note.getOwnedLabels()
.filter((label) => ["workspaceIconClass", "iconClass"]
.includes(label.name));
}

View File

@@ -1,166 +0,0 @@
import { Dropdown } from "bootstrap";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import { getAvailableLocales, getLocaleById, t } from "../services/i18n.js";
import type { EventData } from "../components/app_context.js";
import type FNote from "../entities/fnote.js";
import attributes from "../services/attributes.js";
import type { Locale } from "@triliumnext/commons";
import options from "../services/options.js";
import appContext from "../components/app_context.js";
const TPL = /*html*/`\
<div class="dropdown note-language-widget">
<button type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-sm dropdown-toggle select-button note-language-button">
<span class="note-language-desc"></span>
<span class="caret"></span>
</button>
<div class="note-language-dropdown dropdown-menu dropdown-menu-left tn-dropdown-list"></div>
<button class="language-help-button icon-action bx bx-help-circle" type="button" data-in-app-help="B0lcI9xz1r8K" title="${t("open-help-page")}"></button>
<style>
.note-language-widget {
display: flex;
align-items: center;
}
.language-help-button {
margin-left: 4px;
}
.note-language-dropdown [dir=rtl] {
text-align: right;
}
.dropdown-item.rtl > .check {
order: 1;
}
</style>
</div>
`;
const DEFAULT_LOCALE: Locale = {
id: "",
name: t("note_language.not_set")
};
export default class NoteLanguageWidget extends NoteContextAwareWidget {
private dropdown!: Dropdown;
private $noteLanguageDropdown!: JQuery<HTMLElement>;
private $noteLanguageDesc!: JQuery<HTMLElement>;
private locales: (Locale | "---")[];
private currentLanguageId?: string;
constructor() {
super();
this.locales = NoteLanguageWidget.#buildLocales();
}
doRender() {
this.$widget = $(TPL);
this.dropdown = Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']")[0]);
this.$widget.on("show.bs.dropdown", () => this.renderDropdown());
this.$noteLanguageDropdown = this.$widget.find(".note-language-dropdown")
this.$noteLanguageDesc = this.$widget.find(".note-language-desc");
}
renderDropdown() {
this.$noteLanguageDropdown.empty();
if (!this.note) {
return;
}
for (const locale of this.locales) {
if (typeof locale === "object") {
const $title = $("<span>").text(locale.name);
const $link = $('<a class="dropdown-item">')
.attr("data-language", locale.id)
.append('<span class="check">&check;</span> ')
.append($title)
.on("click", () => {
const languageId = $link.attr("data-language") ?? "";
this.save(languageId);
});
if (locale.rtl) {
$link.attr("dir", "rtl");
}
if (locale.id === this.currentLanguageId) {
$link.addClass("selected");
}
this.$noteLanguageDropdown.append($link);
} else {
this.$noteLanguageDropdown.append('<div class="dropdown-divider"></div>');
}
}
const $configureLink = $('<a class="dropdown-item">')
.append(`<span>${t("note_language.configure-languages")}</span>`)
.on("click", () => appContext.tabManager.openContextWithNote("_optionsLocalization", { activate: true }));
this.$noteLanguageDropdown.append($configureLink);
}
async save(languageId: string) {
if (!this.note) {
return;
}
attributes.setAttribute(this.note, "label", "language", languageId);
}
async refreshWithNote(note: FNote) {
const currentLanguageId = note.getLabelValue("language") ?? "";
const language = getLocaleById(currentLanguageId) ?? DEFAULT_LOCALE;
this.currentLanguageId = currentLanguageId;
this.$noteLanguageDesc.text(language.name);
this.dropdown.hide();
}
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.isOptionReloaded("languages")) {
this.locales = NoteLanguageWidget.#buildLocales();
}
if (loadResults.getAttributeRows().find((a) => a.noteId === this.noteId && a.name === "language")) {
this.refresh();
}
}
static #buildLocales() {
const enabledLanguages = JSON.parse(options.get("languages") ?? "[]") as string[];
const filteredLanguages = getAvailableLocales().filter((l) => typeof l !== "object" || enabledLanguages.includes(l.id));
const leftToRightLanguages = filteredLanguages.filter((l) => !l.rtl);
const rightToLeftLanguages = filteredLanguages.filter((l) => l.rtl);
let locales: ("---" | Locale)[] = [
DEFAULT_LOCALE
];
if (leftToRightLanguages.length > 0) {
locales = [
...locales,
"---",
...leftToRightLanguages
];
}
if (rightToLeftLanguages.length > 0) {
locales = [
...locales,
"---",
...rightToLeftLanguages
];
}
// This will separate the list of languages from the "Configure languages" button.
// If there is at least one language.
locales.push("---");
return locales;
}
}

View File

@@ -0,0 +1,25 @@
.note-title-widget {
flex-grow: 1000;
height: 100%;
}
.note-title-widget input.note-title {
font-size: 110%;
border: 0;
margin: 2px 0px;
min-width: 5em;
width: 100%;
padding: 1px 12px;
}
.note-title-widget input.note-title.protected {
text-shadow: 4px 4px 4px var(--muted-text-color);
}
body.mobile .note-title-widget input.note-title {
padding: 0;
}
body.desktop .note-title-widget input.note-title {
font-size: 180%;
}

View File

@@ -1,147 +0,0 @@
import { t } from "../services/i18n.js";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import protectedSessionHolder from "../services/protected_session_holder.js";
import server from "../services/server.js";
import SpacedUpdate from "../services/spaced_update.js";
import appContext, { type EventData } from "../components/app_context.js";
import branchService from "../services/branches.js";
import shortcutService from "../services/shortcuts.js";
import utils from "../services/utils.js";
import type FNote from "../entities/fnote.js";
const TPL = /*html*/`
<div class="note-title-widget">
<style>
.note-title-widget {
flex-grow: 1000;
height: 100%;
}
.note-title-widget input.note-title {
font-size: 110%;
border: 0;
margin: 2px 0px;
min-width: 5em;
width: 100%;
}
body.mobile .note-title-widget input.note-title {
padding: 0;
}
body.desktop .note-title-widget input.note-title {
font-size: 180%;
}
.note-title-widget input.note-title.protected {
text-shadow: 4px 4px 4px var(--muted-text-color);
}
</style>
<input autocomplete="off" value="" placeholder="${t("note_title.placeholder")}" class="note-title" tabindex="100">
</div>`;
export default class NoteTitleWidget extends NoteContextAwareWidget {
private $noteTitle!: JQuery<HTMLElement>;
private deleteNoteOnEscape: boolean;
private spacedUpdate: SpacedUpdate;
constructor() {
super();
this.spacedUpdate = new SpacedUpdate(async () => {
const title = this.$noteTitle.val();
if (this.note) {
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
}
await server.put(`notes/${this.noteId}/title`, { title }, this.componentId);
});
this.deleteNoteOnEscape = false;
appContext.addBeforeUnloadListener(this);
}
doRender() {
this.$widget = $(TPL);
this.$noteTitle = this.$widget.find(".note-title");
this.$noteTitle.on("input", () => this.spacedUpdate.scheduleUpdate());
this.$noteTitle.on("blur", () => {
this.spacedUpdate.updateNowIfNecessary();
this.deleteNoteOnEscape = false;
});
shortcutService.bindElShortcut(this.$noteTitle, "esc", () => {
if (this.deleteNoteOnEscape && this.noteContext?.isActive() && this.noteContext?.note) {
branchService.deleteNotes(Object.values(this.noteContext.note.parentToBranch));
}
});
shortcutService.bindElShortcut(this.$noteTitle, "return", () => {
this.triggerCommand("focusOnDetail", { ntxId: this.noteContext?.ntxId });
});
}
async refreshWithNote(note: FNote) {
const isReadOnly =
(note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable())
|| utils.isLaunchBarConfig(note.noteId)
|| this.noteContext?.viewScope?.viewMode !== "default";
this.$noteTitle.val(isReadOnly ? (await this.noteContext?.getNavigationTitle()) || "" : note.title);
this.$noteTitle.prop("readonly", isReadOnly);
this.setProtectedStatus(note);
}
setProtectedStatus(note: FNote) {
this.$noteTitle.toggleClass("protected", !!note.isProtected);
}
async beforeNoteSwitchEvent({ noteContext }: EventData<"beforeNoteSwitch">) {
if (this.isNoteContext(noteContext.ntxId)) {
await this.spacedUpdate.updateNowIfNecessary();
}
}
async beforeNoteContextRemoveEvent({ ntxIds }: EventData<"beforeNoteContextRemove">) {
if (this.isNoteContext(ntxIds)) {
await this.spacedUpdate.updateNowIfNecessary();
}
}
focusOnTitleEvent() {
if (this.noteContext && this.noteContext.isActive()) {
this.$noteTitle.trigger("focus");
}
}
focusAndSelectTitleEvent({ isNewNote } = { isNewNote: false }) {
if (this.noteContext && this.noteContext.isActive()) {
this.$noteTitle.trigger("focus").trigger("select");
this.deleteNoteOnEscape = isNewNote;
}
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.isNoteReloaded(this.noteId) && this.note) {
// not updating the title specifically since the synced title might be older than what the user is currently typing
this.setProtectedStatus(this.note);
}
if (loadResults.isNoteReloaded(this.noteId, this.componentId)) {
this.refresh();
}
}
beforeUnloadEvent() {
return this.spacedUpdate.isAllSavedAndTriggerUpdate();
}
}

View File

@@ -0,0 +1,99 @@
import { useEffect, useRef, useState } from "preact/hooks";
import { t } from "../services/i18n";
import FormTextBox from "./react/FormTextBox";
import { useNoteContext, useNoteProperty, useSpacedUpdate, useTriliumEvent, useTriliumEvents } from "./react/hooks";
import protected_session_holder from "../services/protected_session_holder";
import server from "../services/server";
import "./note_title.css";
import { isLaunchBarConfig } from "../services/utils";
import appContext from "../components/app_context";
import branches from "../services/branches";
export default function NoteTitleWidget() {
const { note, noteId, componentId, viewScope, noteContext, parentComponent } = useNoteContext();
const title = useNoteProperty(note, "title", componentId);
const isProtected = useNoteProperty(note, "isProtected");
const newTitle = useRef("");
const [ isReadOnly, setReadOnly ] = useState<boolean>(false);
const [ navigationTitle, setNavigationTitle ] = useState<string | null>(null);
// Manage read-only
useEffect(() => {
const isReadOnly = note === null
|| note === undefined
|| (note.isProtected && !protected_session_holder.isProtectedSessionAvailable())
|| isLaunchBarConfig(note.noteId)
|| viewScope?.viewMode !== "default";
setReadOnly(isReadOnly);
}, [ note, note?.noteId, note?.isProtected, viewScope?.viewMode ]);
// Manage the title for read-only notes
useEffect(() => {
if (isReadOnly) {
noteContext?.getNavigationTitle().then(setNavigationTitle);
}
}, [isReadOnly]);
// Save changes to title.
const spacedUpdate = useSpacedUpdate(async () => {
if (!note) {
return;
}
protected_session_holder.touchProtectedSessionIfNecessary(note);
await server.put<void>(`notes/${noteId}/title`, { title: newTitle.current }, componentId);
});
// Prevent user from navigating away if the spaced update is not done.
useEffect(() => {
appContext.addBeforeUnloadListener(() => spacedUpdate.isAllSavedAndTriggerUpdate());
}, []);
useTriliumEvents([ "beforeNoteSwitch", "beforeNoteContextRemove" ], () => spacedUpdate.updateNowIfNecessary());
// Manage focus.
const textBoxRef = useRef<HTMLInputElement>(null);
const isNewNote = useRef<boolean>();
useTriliumEvents([ "focusOnTitle", "focusAndSelectTitle" ], (e, eventName) => {
if (noteContext?.isActive() && textBoxRef.current) {
textBoxRef.current.focus();
if (eventName === "focusAndSelectTitle") {
textBoxRef.current.select();
}
isNewNote.current = ("isNewNote" in e ? e.isNewNote : false);
}
});
return (
<div className="note-title-widget">
{note && <FormTextBox
inputRef={textBoxRef}
autocomplete="off"
currentValue={(!isReadOnly ? title : navigationTitle) ?? ""}
placeholder={t("note_title.placeholder")}
className={`note-title ${isProtected ? "protected" : ""}`}
tabIndex={100}
readOnly={isReadOnly}
onChange={(newValue) => {
newTitle.current = newValue;
spacedUpdate.scheduleUpdate();
}}
onKeyDown={(e) => {
// Focus on the note content when pressing enter.
if (e.key === "Enter") {
e.preventDefault();
parentComponent.triggerCommand("focusOnDetail", { ntxId: noteContext?.ntxId });
return;
}
if (e.key === "Escape" && isNewNote.current && noteContext?.isActive() && note) {
branches.deleteNotes(Object.values(note.parentToBranch));
}
}}
onBlur={() => {
spacedUpdate.updateNowIfNecessary();
isNewNote.current = false;
}}
/>}
</div>
);
}

View File

@@ -152,7 +152,7 @@ const TPL = /*html*/`
const MAX_SEARCH_RESULTS_IN_TREE = 100;
// this has to be hanged on the actual elements to effectively intercept and stop click event
const cancelClickPropagation: JQuery.TypeEventHandler<unknown, unknown, unknown, unknown, any> = (e) => e.stopPropagation();
const cancelClickPropagation: (e: JQuery.ClickEvent) => void = (e) => e.stopPropagation();
// TODO: Fix once we remove Node.js API from public
type Timeout = NodeJS.Timeout | string | number | undefined;

View File

@@ -1,175 +0,0 @@
import { Dropdown } from "bootstrap";
import { NOTE_TYPES } from "../services/note_types.js";
import { t } from "../services/i18n.js";
import dialogService from "../services/dialog.js";
import mimeTypesService from "../services/mime_types.js";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import server from "../services/server.js";
import type { EventData } from "../components/app_context.js";
import type { NoteType } from "../entities/fnote.js";
import type FNote from "../entities/fnote.js";
const NOT_SELECTABLE_NOTE_TYPES = NOTE_TYPES.filter((nt) => nt.reserved || nt.static).map((nt) => nt.type);
const TPL = /*html*/`
<div class="dropdown note-type-widget">
<style>
.note-type-dropdown {
max-height: 500px;
overflow-y: auto;
overflow-x: hidden;
}
</style>
<button type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-sm dropdown-toggle select-button note-type-button">
<span class="note-type-desc"></span>
<span class="caret"></span>
</button>
<div class="note-type-dropdown dropdown-menu dropdown-menu-left tn-dropdown-list"></div>
</div>
`;
export default class NoteTypeWidget extends NoteContextAwareWidget {
private dropdown!: Dropdown;
private $noteTypeDropdown!: JQuery<HTMLElement>;
private $noteTypeButton!: JQuery<HTMLElement>;
private $noteTypeDesc!: JQuery<HTMLElement>;
doRender() {
this.$widget = $(TPL);
this.dropdown = Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']")[0]);
this.$widget.on("show.bs.dropdown", () => this.renderDropdown());
this.$noteTypeDropdown = this.$widget.find(".note-type-dropdown");
this.$noteTypeButton = this.$widget.find(".note-type-button");
this.$noteTypeDesc = this.$widget.find(".note-type-desc");
this.$widget.on("click", ".dropdown-item", () => this.dropdown.toggle());
}
async refreshWithNote(note: FNote) {
this.$noteTypeButton.prop("disabled", () => NOT_SELECTABLE_NOTE_TYPES.includes(note.type));
this.$noteTypeDesc.text(await this.findTypeTitle(note.type, note.mime));
this.dropdown.hide();
}
/** the actual body is rendered lazily on note-type button click */
async renderDropdown() {
this.$noteTypeDropdown.empty();
if (!this.note) {
return;
}
for (const noteType of NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static)) {
let $typeLink: JQuery<HTMLElement>;
const $title = $("<span>").text(noteType.title);
if (noteType.isNew) {
$title.append($(`<span class="badge new-note-type-badge">`).text(t("note_types.new-feature")));
}
if (noteType.isBeta) {
$title.append($(`<span class="badge">`).text(t("note_types.beta-feature")));
}
if (noteType.type !== "code") {
$typeLink = $('<a class="dropdown-item">')
.attr("data-note-type", noteType.type)
.append('<span class="check">&check;</span> ')
.append($title)
.on("click", (e) => {
const type = $typeLink.attr("data-note-type");
const noteType = NOTE_TYPES.find((nt) => nt.type === type);
if (noteType) {
this.save(noteType.type, noteType.mime);
}
});
} else {
this.$noteTypeDropdown.append('<div class="dropdown-divider"></div>');
$typeLink = $('<a class="dropdown-item disabled">').attr("data-note-type", noteType.type).append('<span class="check">&check;</span> ').append($("<strong>").text(noteType.title));
}
if (this.note.type === noteType.type) {
$typeLink.addClass("selected");
}
this.$noteTypeDropdown.append($typeLink);
}
for (const mimeType of mimeTypesService.getMimeTypes()) {
if (!mimeType.enabled) {
continue;
}
const $mimeLink = $('<a class="dropdown-item">')
.attr("data-mime-type", mimeType.mime)
.append('<span class="check">&check;</span> ')
.append($("<span>").text(mimeType.title))
.on("click", (e) => {
const $link = $(e.target).closest(".dropdown-item");
this.save("code", $link.attr("data-mime-type") ?? "");
});
if (this.note.type === "code" && this.note.mime === mimeType.mime) {
$mimeLink.addClass("selected");
this.$noteTypeDesc.text(mimeType.title);
}
this.$noteTypeDropdown.append($mimeLink);
}
}
async findTypeTitle(type: NoteType, mime: string) {
if (type === "code") {
const mimeTypes = mimeTypesService.getMimeTypes();
const found = mimeTypes.find((mt) => mt.mime === mime);
return found ? found.title : mime;
} else {
const noteType = NOTE_TYPES.find((nt) => nt.type === type);
return noteType ? noteType.title : type;
}
}
async save(type: NoteType, mime?: string) {
if (type === this.note?.type && mime === this.note?.mime) {
return;
}
if (type !== this.note?.type && !(await this.confirmChangeIfContent())) {
return;
}
await server.put(`notes/${this.noteId}/type`, { type, mime });
}
async confirmChangeIfContent() {
if (!this.note) {
return;
}
const blob = await this.note.getBlob();
if (!blob?.content || !blob.content.trim().length) {
return true;
}
return await dialogService.confirm(t("note_types.confirm-change"));
}
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.isNoteReloaded(this.noteId)) {
this.refresh();
}
}
}

View File

@@ -1,16 +1,16 @@
import { t } from "../../services/i18n.js";
import server from "../../services/server.js";
import ws from "../../services/ws.js";
import treeService from "../../services/tree.js";
import noteAutocompleteService from "../../services/note_autocomplete.js";
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import attributeService from "../../services/attributes.js";
import options from "../../services/options.js";
import utils from "../../services/utils.js";
import type FNote from "../../entities/fnote.js";
import type { Attribute } from "../../services/attribute_parser.js";
import type FAttribute from "../../entities/fattribute.js";
import type { EventData } from "../../components/app_context.js";
import { t } from "../services/i18n.js";
import server from "../services/server.js";
import ws from "../services/ws.js";
import treeService from "../services/tree.js";
import noteAutocompleteService from "../services/note_autocomplete.js";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import attributeService from "../services/attributes.js";
import options from "../services/options.js";
import utils from "../services/utils.js";
import type FNote from "../entities/fnote.js";
import type { Attribute } from "../services/attribute_parser.js";
import type FAttribute from "../entities/fattribute.js";
import type { EventData } from "../components/app_context.js";
const TPL = /*html*/`
<div class="promoted-attributes-widget">

View File

@@ -1,39 +0,0 @@
import type { EventData } from "../components/app_context.js";
import type FNote from "../entities/fnote.js";
import { t } from "../services/i18n.js";
import protectedSessionService from "../services/protected_session.js";
import SwitchWidget from "./switch.js";
export default class ProtectedNoteSwitchWidget extends SwitchWidget {
doRender() {
super.doRender();
this.switchOnName = t("protect_note.toggle-on");
this.switchOnTooltip = t("protect_note.toggle-on-hint");
this.switchOffName = t("protect_note.toggle-off");
this.switchOffTooltip = t("protect_note.toggle-off-hint");
}
switchOn() {
if (this.noteId) {
protectedSessionService.protectNote(this.noteId, true, false);
}
}
switchOff() {
if (this.noteId) {
protectedSessionService.protectNote(this.noteId, false, false);
}
}
async refreshWithNote(note: FNote) {
this.isToggled = note.isProtected;
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.isNoteReloaded(this.noteId)) {
this.refresh();
}
}
}

View File

@@ -1,13 +1,19 @@
import { CommandNames } from "../../components/app_context";
interface ActionButtonProps {
text: string;
titlePosition?: "bottom"; // TODO: Use it
icon: string;
onClick?: () => void;
className?: string;
onClick?: (e: MouseEvent) => void;
triggerCommand?: CommandNames;
}
export default function ActionButton({ text, icon, onClick }: ActionButtonProps) {
export default function ActionButton({ text, icon, className, onClick, triggerCommand }: ActionButtonProps) {
return <button
class={`icon-action ${icon}`}
class={`icon-action ${icon} ${className ?? ""}`}
title={text}
onClick={onClick}
onClick={onClick}
data-trigger-command={triggerCommand}
/>;
}

View File

@@ -1,9 +1,10 @@
import type { RefObject } from "preact";
import type { CSSProperties } from "preact/compat";
import { useRef, useMemo } from "preact/hooks";
import { useMemo } from "preact/hooks";
import { memo } from "preact/compat";
import { CommandNames } from "../../components/app_context";
interface ButtonProps {
export interface ButtonProps {
name?: string;
/** Reference to the button element. Mostly useful for requesting focus. */
buttonRef?: RefObject<HTMLButtonElement>;
@@ -17,9 +18,11 @@ interface ButtonProps {
disabled?: boolean;
size?: "normal" | "small" | "micro";
style?: CSSProperties;
triggerCommand?: CommandNames;
title?: string;
}
const Button = memo(({ name, buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, size, style }: ButtonProps) => {
const Button = memo(({ name, buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, size, style, triggerCommand, ...restProps }: ButtonProps) => {
// Memoize classes array to prevent recreation
const classes = useMemo(() => {
const classList: string[] = ["btn"];
@@ -39,8 +42,6 @@ const Button = memo(({ name, buttonRef: _buttonRef, className, text, onClick, ke
return classList.join(" ");
}, [primary, className, size]);
const buttonRef = _buttonRef ?? useRef<HTMLButtonElement>(null);
// Memoize keyboard shortcut rendering
const shortcutElements = useMemo(() => {
if (!keyboardShortcut) return null;
@@ -57,11 +58,13 @@ const Button = memo(({ name, buttonRef: _buttonRef, className, text, onClick, ke
<button
name={name}
className={classes}
type={onClick ? "button" : "submit"}
type={onClick || triggerCommand ? "button" : "submit"}
onClick={onClick}
ref={buttonRef}
disabled={disabled}
style={style}
data-trigger-command={triggerCommand}
{...restProps}
>
{icon && <span className={`bx ${icon}`}></span>}
{text} {shortcutElements}

View File

@@ -0,0 +1,106 @@
import type { CKTextEditor, AttributeEditor, EditorConfig, ModelPosition } from "@triliumnext/ckeditor5";
import { useEffect, useImperativeHandle, useRef } from "preact/compat";
import { MutableRef } from "preact/hooks";
export interface CKEditorApi {
focus(): void;
/**
* Imperatively sets the text in the editor.
*
* Prefer setting `currentValue` prop where possible.
*
* @param text text to set in the editor
*/
setText(text: string): void;
}
interface CKEditorOpts {
apiRef: MutableRef<CKEditorApi | undefined>;
currentValue?: string;
className: string;
tabIndex?: number;
config: EditorConfig;
editor: typeof AttributeEditor;
disableNewlines?: boolean;
disableSpellcheck?: boolean;
onChange?: (newValue?: string) => void;
onClick?: (e: MouseEvent, pos?: ModelPosition | null) => void;
onKeyDown?: (e: KeyboardEvent) => void;
onBlur?: () => void;
}
export default function CKEditor({ apiRef, currentValue, editor, config, disableNewlines, disableSpellcheck, onChange, onClick, ...restProps }: CKEditorOpts) {
const editorContainerRef = useRef<HTMLDivElement>(null);
const textEditorRef = useRef<CKTextEditor>(null);
useImperativeHandle(apiRef, () => {
return {
focus() {
editorContainerRef.current?.focus();
textEditorRef.current?.model.change((writer) => {
const documentRoot = textEditorRef.current?.editing.model.document.getRoot();
if (documentRoot) {
writer.setSelection(writer.createPositionAt(documentRoot, "end"));
}
});
},
setText(text: string) {
textEditorRef.current?.setData(text);
}
};
}, [ editorContainerRef ]);
useEffect(() => {
if (!editorContainerRef.current) return;
editor.create(editorContainerRef.current, config).then((textEditor) => {
textEditorRef.current = textEditor;
if (disableNewlines) {
textEditor.editing.view.document.on(
"enter",
(event, data) => {
// disable entering new line - see https://github.com/ckeditor/ckeditor5/issues/9422
data.preventDefault();
event.stop();
},
{ priority: "high" }
);
}
if (disableSpellcheck) {
const documentRoot = textEditor.editing.view.document.getRoot();
if (documentRoot) {
textEditor.editing.view.change((writer) => writer.setAttribute("spellcheck", "false", documentRoot));
}
}
if (onChange) {
textEditor.model.document.on("change:data", () => {
onChange(textEditor.getData())
});
}
if (currentValue) {
textEditor.setData(currentValue);
}
});
}, []);
useEffect(() => {
if (!textEditorRef.current) return;
textEditorRef.current.setData(currentValue ?? "");
}, [ currentValue ]);
return (
<div
ref={editorContainerRef}
onClick={(e) => {
if (onClick) {
const pos = textEditorRef.current?.model.document.selection.getFirstPosition();
onClick(e, pos);
}
}}
{...restProps}
/>
)
}

View File

@@ -1,17 +1,31 @@
import { Dropdown as BootstrapDropdown } from "bootstrap";
import { ComponentChildren } from "preact";
import { useEffect, useRef } from "preact/hooks";
import { CSSProperties } from "preact/compat";
import { useCallback, useEffect, useRef, useState } from "preact/hooks";
import { useUniqueName } from "./hooks";
interface DropdownProps {
export interface DropdownProps {
className?: string;
buttonClassName?: string;
isStatic?: boolean;
children: ComponentChildren;
title?: string;
dropdownContainerStyle?: CSSProperties;
dropdownContainerClassName?: string;
hideToggleArrow?: boolean;
/** If set to true, then the dropdown button will be considered an icon action (without normal border and sized for icons only). */
iconAction?: boolean;
noSelectButtonStyle?: boolean;
disabled?: boolean;
text?: ComponentChildren;
}
export default function Dropdown({ className, isStatic, children }: DropdownProps) {
export default function Dropdown({ className, buttonClassName, isStatic, children, title, text, dropdownContainerStyle, dropdownContainerClassName, hideToggleArrow, iconAction, disabled, noSelectButtonStyle }: DropdownProps) {
const dropdownRef = useRef<HTMLDivElement | null>(null);
const triggerRef = useRef<HTMLButtonElement | null>(null);
const [ shown, setShown ] = useState(false);
useEffect(() => {
if (!triggerRef.current) return;
@@ -19,33 +33,54 @@ export default function Dropdown({ className, isStatic, children }: DropdownProp
return () => dropdown.dispose();
}, []); // Add dependency array
const onShown = useCallback(() => {
setShown(true);
}, [])
const onHidden = useCallback(() => {
setShown(false);
}, []);
useEffect(() => {
if (!dropdownRef.current) return;
const handleHide = () => {
// Remove console.log from production code
};
const $dropdown = $(dropdownRef.current);
$dropdown.on("hide.bs.dropdown", handleHide);
$dropdown.on("show.bs.dropdown", onShown);
$dropdown.on("hide.bs.dropdown", onHidden);
// Add proper cleanup
return () => {
$dropdown.off("hide.bs.dropdown", handleHide);
$dropdown.off("show.bs.dropdown", onShown);
$dropdown.off("hide.bs.dropdown", onHidden);
};
}, []); // Add dependency array
const ariaId = useUniqueName("button");
return (
<div ref={dropdownRef} class="dropdown" style={{ display: "flex" }}>
<div ref={dropdownRef} class={`dropdown ${className ?? ""}`} style={{ display: "flex" }}>
<button
className={`${iconAction ? "icon-action" : "btn"} ${!noSelectButtonStyle ? "select-button" : ""} ${buttonClassName ?? ""} ${!hideToggleArrow ? "dropdown-toggle" : ""}`}
ref={triggerRef}
type="button"
style={{ display: "none" }}
data-bs-toggle="dropdown"
data-bs-display={ isStatic ? "static" : undefined } />
data-bs-display={ isStatic ? "static" : undefined }
aria-haspopup="true"
aria-expanded="false"
title={title}
id={ariaId}
disabled={disabled}
>
{text}
<span className="caret"></span>
</button>
<div class={`dropdown-menu ${className ?? ""} ${isStatic ? "static" : undefined}`}>
{children}
<div
class={`dropdown-menu ${isStatic ? "static" : ""} ${dropdownContainerClassName ?? ""} tn-dropdown-list`}
style={dropdownContainerStyle}
aria-labelledby={ariaId}
>
{shown && children}
</div>
</div>
)

View File

@@ -6,7 +6,6 @@ import { CSSProperties, memo } from "preact/compat";
import { useUniqueName } from "./hooks";
interface FormCheckboxProps {
id?: string;
name?: string;
label: string | ComponentChildren;
/**
@@ -19,9 +18,9 @@ interface FormCheckboxProps {
containerStyle?: CSSProperties;
}
const FormCheckbox = memo(({ name, id: _id, disabled, label, currentValue, onChange, hint, containerStyle }: FormCheckboxProps) => {
const id = _id ?? useUniqueName(name);
const FormCheckbox = memo(({ name, disabled, label, currentValue, onChange, hint, containerStyle }: FormCheckboxProps) => {
const labelRef = useRef<HTMLLabelElement>(null);
const id = useUniqueName(name);
// Fix: Move useEffect outside conditional
useEffect(() => {

View File

@@ -0,0 +1,30 @@
import Dropdown, { DropdownProps } from "./Dropdown";
import { FormListItem } from "./FormList";
interface FormDropdownList<T> extends Omit<DropdownProps, "children"> {
values: T[];
keyProperty: keyof T;
titleProperty: keyof T;
descriptionProperty?: keyof T;
currentValue: string;
onChange(newValue: string): void;
}
export default function FormDropdownList<T>({ values, keyProperty, titleProperty, descriptionProperty, currentValue, onChange, ...restProps }: FormDropdownList<T>) {
const currentValueData = values.find(value => value[keyProperty] === currentValue);
return (
<Dropdown text={currentValueData?.[titleProperty] ?? ""} {...restProps}>
{values.map(item => (
<FormListItem
onClick={() => onChange(item[keyProperty] as string)}
checked={currentValue === item[keyProperty]}
description={descriptionProperty && item[descriptionProperty] as string}
selected={currentValue === item[keyProperty]}
>
{item[titleProperty] as string}
</FormListItem>
))}
</Dropdown>
)
}

View File

@@ -1,13 +1,48 @@
import { Ref } from "preact";
import Button, { ButtonProps } from "./Button";
import { useRef } from "preact/hooks";
interface FormFileUploadProps {
name?: string;
onChange: (files: FileList | null) => void;
multiple?: boolean;
hidden?: boolean;
inputRef?: Ref<HTMLInputElement>;
}
export default function FormFileUpload({ onChange, multiple }: FormFileUploadProps) {
export default function FormFileUpload({ inputRef, name, onChange, multiple, hidden }: FormFileUploadProps) {
return (
<label class="tn-file-input tn-input-field">
<input type="file" class="form-control-file" multiple={multiple}
<label class="tn-file-input tn-input-field" style={hidden ? { display: "none" } : undefined}>
<input
ref={inputRef}
name={name}
type="file"
class="form-control-file"
multiple={multiple}
onChange={e => onChange((e.target as HTMLInputElement).files)} />
</label>
)
}
/**
* Combination of a button with a hidden file upload field.
*
* @param param the change listener for the file upload and the properties for the button.
*/
export function FormFileUploadButton({ onChange, ...buttonProps }: Omit<ButtonProps, "onClick"> & Pick<FormFileUploadProps, "onChange">) {
const inputRef = useRef<HTMLInputElement>(null);
return (
<>
<Button
{...buttonProps}
onClick={() => inputRef.current?.click()}
/>
<FormFileUpload
inputRef={inputRef}
hidden
onChange={onChange}
/>
</>
)
}

View File

@@ -8,6 +8,7 @@ interface FormGroupProps {
label?: string;
title?: string;
className?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: VNode<any>;
description?: string | ComponentChildren;
disabled?: boolean;
@@ -25,7 +26,7 @@ export default function FormGroup({ name, label, title, className, children, des
{childWithId}
{description && <small className="form-text">{description}</small>}
{description && <div><small className="form-text">{description}</small></div>}
</div>
);
}

View File

@@ -0,0 +1,9 @@
.dropdown-item .description {
font-size: small;
color: var(--muted-text-color);
white-space: normal;
}
.dropdown-item span.bx {
flex-shrink: 0;
}

View File

@@ -2,6 +2,8 @@ import { Dropdown as BootstrapDropdown } from "bootstrap";
import { ComponentChildren } from "preact";
import Icon from "./Icon";
import { useEffect, useMemo, useRef, type CSSProperties } from "preact/compat";
import "./FormList.css";
import { CommandNames } from "../../components/app_context";
interface FormListOpts {
children: ComponentChildren;
@@ -33,6 +35,7 @@ export default function FormList({ children, onSelect, style, fullHeight }: Form
const style: CSSProperties = {};
if (fullHeight) {
style.height = "100%";
style.overflow = "auto";
}
return style;
}, [ fullHeight ]);
@@ -51,7 +54,8 @@ export default function FormList({ children, onSelect, style, fullHeight }: Form
...builtinStyles,
position: "relative",
}} onClick={(e) => {
const value = (e.target as HTMLElement)?.dataset?.value;
const dropdownItem = (e.target as HTMLElement).closest(".dropdown-item") as HTMLElement | null;
const value = dropdownItem?.dataset?.value;
if (value && onSelect) {
onSelect(value);
}
@@ -63,23 +67,50 @@ export default function FormList({ children, onSelect, style, fullHeight }: Form
);
}
export interface FormListBadge {
className?: string;
text: string;
}
interface FormListItemOpts {
children: ComponentChildren;
icon?: string;
value?: string;
title?: string;
active?: boolean;
badges?: FormListBadge[];
disabled?: boolean;
checked?: boolean | null;
selected?: boolean;
onClick?: (e: MouseEvent) => void;
triggerCommand?: CommandNames;
description?: string;
className?: string;
rtl?: boolean;
}
export function FormListItem({ children, icon, value, title, active }: FormListItemOpts) {
export function FormListItem({ children, icon, value, title, active, badges, disabled, checked, onClick, description, selected, rtl, triggerCommand }: FormListItemOpts) {
if (checked) {
icon = "bx bx-check";
}
return (
<a
class={`dropdown-item ${active ? "active" : ""}`}
class={`dropdown-item ${active ? "active" : ""} ${disabled ? "disabled" : ""} ${selected ? "selected" : ""}`}
data-value={value} title={title}
tabIndex={0}
onClick={onClick}
data-trigger-command={triggerCommand}
dir={rtl ? "rtl" : undefined}
>
<Icon icon={icon} />&nbsp;
{children}
<div>
{children}
{badges && badges.map(({ className, text }) => (
<span className={`badge ${className ?? ""}`}>{text}</span>
))}
{description && <div className="description">{description}</div>}
</div>
</a>
);
}
@@ -95,3 +126,7 @@ export function FormListHeader({ text }: FormListHeaderOpts) {
</li>
)
}
export function FormDropdownDivider() {
return <div className="dropdown-divider" />;
}

View File

@@ -20,16 +20,18 @@ interface ValueConfig<T, Q> {
interface FormSelectProps<T, Q> extends ValueConfig<T, Q> {
id?: string;
name?: string;
onChange: OnChangeListener;
style?: CSSProperties;
className?: string;
}
/**
* Combobox component that takes in any object array as data. Each item of the array is rendered as an item, and the key and values are obtained by looking into the object by a specified key.
*/
export default function FormSelect<T>({ id, onChange, style, ...restProps }: FormSelectProps<T, T>) {
export default function FormSelect<T>({ name, id, onChange, style, className, ...restProps }: FormSelectProps<T, T>) {
return (
<FormSelectBody id={id} onChange={onChange} style={style}>
<FormSelectBody name={name} id={id} onChange={onChange} style={style} className={className}>
<FormSelectGroup {...restProps} />
</FormSelectBody>
);
@@ -38,27 +40,35 @@ export default function FormSelect<T>({ id, onChange, style, ...restProps }: For
/**
* Similar to {@link FormSelect}, but the top-level elements are actually groups.
*/
export function FormSelectWithGroups<T>({ id, values, keyProperty, titleProperty, currentValue, onChange }: FormSelectProps<T, FormSelectGroup<T>>) {
export function FormSelectWithGroups<T>({ name, id, values, keyProperty, titleProperty, currentValue, onChange, ...restProps }: FormSelectProps<T, FormSelectGroup<T> | T>) {
return (
<FormSelectBody id={id} onChange={onChange}>
{values.map(({ title, items }) => {
return (
<optgroup label={title}>
<FormSelectGroup values={items} keyProperty={keyProperty} titleProperty={titleProperty} currentValue={currentValue} />
</optgroup>
);
<FormSelectBody name={name} id={id} onChange={onChange} {...restProps}>
{values.map((item) => {
if (!item) return <></>;
if (typeof item === "object" && "items" in item) {
return (
<optgroup label={item.title}>
<FormSelectGroup values={item.items} keyProperty={keyProperty} titleProperty={titleProperty} currentValue={currentValue} />
</optgroup>
);
} else {
return (
<FormSelectGroup values={[ item ]} keyProperty={keyProperty} titleProperty={titleProperty} currentValue={currentValue} />
)
}
})}
</FormSelectBody>
)
}
function FormSelectBody({ id, children, onChange, style }: { id?: string, children: ComponentChildren, onChange: OnChangeListener, style?: CSSProperties }) {
function FormSelectBody({ id, name, children, onChange, style, className }: { id?: string, name?: string, children: ComponentChildren, onChange: OnChangeListener, style?: CSSProperties, className?: string }) {
return (
<select
id={id}
class="form-select"
name={name}
onChange={e => onChange((e.target as HTMLInputElement).value)}
style={style}
className={`form-select ${className ?? ""}`}
>
{children}
</select>
@@ -69,10 +79,10 @@ function FormSelectGroup<T>({ values, keyProperty, titleProperty, currentValue }
return values.map(item => {
return (
<option
value={item[keyProperty] as any}
value={item[keyProperty] as string | number}
selected={item[keyProperty] === currentValue}
>
{item[titleProperty ?? keyProperty] ?? item[keyProperty] as any}
{item[titleProperty ?? keyProperty] ?? item[keyProperty] as string | number}
</option>
);
});

View File

@@ -1,18 +1,26 @@
interface FormTextAreaProps {
import { RefObject, TextareaHTMLAttributes } from "preact/compat";
interface FormTextAreaProps extends Omit<TextareaHTMLAttributes, "onBlur" | "onChange"> {
id?: string;
currentValue: string;
onChange?(newValue: string): void;
onBlur?(newValue: string): void;
rows: number;
inputRef?: RefObject<HTMLTextAreaElement>
}
export default function FormTextArea({ id, onBlur, rows, currentValue }: FormTextAreaProps) {
export default function FormTextArea({ inputRef, id, onBlur, onChange, currentValue, className, ...restProps }: FormTextAreaProps) {
return (
<textarea
ref={inputRef}
id={id}
rows={rows}
className={`form-control ${className ?? ""}`}
onChange={(e) => {
onChange?.(e.currentTarget.value);
}}
onBlur={(e) => {
onBlur?.(e.currentTarget.value);
}}
style={{ width: "100%" }}
{...restProps}
>{currentValue}</textarea>
)
}

View File

@@ -1,4 +1,4 @@
import type { InputHTMLAttributes, RefObject } from "preact/compat";
import { useEffect, type InputHTMLAttributes, type RefObject } from "preact/compat";
interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur" | "value"> {
id?: string;
@@ -8,7 +8,7 @@ interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "
inputRef?: RefObject<HTMLInputElement>;
}
export default function FormTextBox({ inputRef, className, type, currentValue, onChange, onBlur,...rest}: FormTextBoxProps) {
export default function FormTextBox({ inputRef, className, type, currentValue, onChange, onBlur, autoFocus, ...rest}: FormTextBoxProps) {
if (type === "number" && currentValue) {
const { min, max } = rest;
const currentValueNum = parseInt(currentValue, 10);
@@ -19,6 +19,12 @@ export default function FormTextBox({ inputRef, className, type, currentValue, o
}
}
useEffect(() => {
if (autoFocus) {
inputRef?.current?.focus();
}
}, []);
return (
<input
ref={inputRef}

View File

@@ -0,0 +1,98 @@
.switch-widget {
--switch-track-width: 50px;
--switch-track-height: 24px;
--switch-off-track-background: var(--more-accented-background-color);
--switch-on-track-background: var(--main-text-color);
--switch-thumb-width: 16px;
--switch-thumb-height: 16px;
--switch-off-thumb-background: var(--main-background-color);
--switch-on-thumb-background: var(--main-background-color);
display: flex;
align-items: center;
}
/* The track of the toggle switch */
.switch-widget .switch-button {
display: block;
position: relative;
margin-left: 8px;
width: var(--switch-track-width);
height: var(--switch-track-height);
border-radius: 24px;
background-color: var(--switch-off-track-background);
transition: background 200ms ease-in;
}
.switch-widget .switch-button.on {
background: var(--switch-on-track-background);
transition: background 100ms ease-out;
}
/* The thumb of the toggle switch */
.switch-widget .switch-button:after {
--y: calc((var(--switch-track-height) - var(--switch-thumb-height)) / 2);
--x: var(--y);
content: "";
position: absolute;
top: 0;
left: 0;
width: var(--switch-thumb-width);
height: var(--switch-thumb-height);
background-color: var(--switch-off-thumb-background);
border-radius: 50%;
transform: translate(var(--x), var(--y));
transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1),
background 200ms ease-out;
}
.switch-widget .switch-button.on:after {
--x: calc(var(--switch-track-width) - var(--switch-thumb-width) - var(--y));
background: var(--switch-on-thumb-background);
transition: transform 200ms cubic-bezier(0.64, 0, 0.78, 0),
background 100ms ease-in;
}
.switch-widget .switch-button input[type="checkbox"] {
/* A hidden check box for accesibility purposes */
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
/* Disabled state */
.switch-widget .switch-button:not(.disabled) input[type="checkbox"],
.switch-widget .switch-button:not(.disabled) {
cursor: pointer;
}
.switch-widget .switch-button:has(input[type="checkbox"]:focus-visible) {
outline: 2px solid var(--button-border-color);
outline-offset: 2px;
}
.switch-widget .switch-button.disabled {
opacity: 70%;
}
.switch-widget .switch-help-button {
border: 0;
margin-left: 4px;
background: none;
cursor: pointer;
font-size: 1.1em;
color: var(--muted-text-color);
}
.switch-widget .switch-help-button:hover {
color: var(--main-text-color);
}

View File

@@ -0,0 +1,41 @@
import "./FormToggle.css";
import HelpButton from "./HelpButton";
interface FormToggleProps {
currentValue: boolean | null;
onChange(newValue: boolean): void;
switchOnName: string;
switchOnTooltip: string;
switchOffName: string;
switchOffTooltip: string;
helpPage?: string;
disabled?: boolean;
}
export default function FormToggle({ currentValue, helpPage, switchOnName, switchOnTooltip, switchOffName, switchOffTooltip, onChange, disabled }: FormToggleProps) {
return (
<div className="switch-widget">
<span className="switch-name">{ currentValue ? switchOffName : switchOnName }</span>
<label>
<div
className={`switch-button ${currentValue ? "on" : ""} ${disabled ? "disabled" : ""}`}
title={currentValue ? switchOffTooltip : switchOnTooltip }
>
<input
className="switch-toggle"
type="checkbox"
checked={currentValue === true}
onInput={(e) => {
onChange(!currentValue);
e.preventDefault();
}}
disabled={disabled}
/>
</div>
</label>
{ helpPage && <HelpButton className="switch-help-button" helpPage={helpPage} />}
</div>
)
}

View File

@@ -0,0 +1,21 @@
import { CSSProperties } from "preact/compat";
import { t } from "../../services/i18n";
import { openInAppHelpFromUrl } from "../../services/utils";
interface HelpButtonProps {
className?: string;
helpPage: string;
style?: CSSProperties;
}
export default function HelpButton({ className, helpPage, style }: HelpButtonProps) {
return (
<button
class={`${className ?? ""} icon-action bx bx-help-circle`}
type="button"
onClick={() => openInAppHelpFromUrl(helpPage)}
title={t("open-help-page")}
style={style}
/>
);
}

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