Compare commits

..

129 Commits

Author SHA1 Message Date
SiriusXT
0227449c55 fix(tab_manager): correct order when reopening split pane 2025-11-17 22:00:30 +08:00
SiriusXT
f57e90b35c Merge branch 'main' into siriusbcd_close_split 2025-11-17 21:03:54 +08:00
SiriusXT
5a5d242ea0 fix(tab_manager): correct order when reopening split pane 2025-11-17 21:01:21 +08:00
SiriusXT
4afea27fa5 fix(tab_manager): correct order when reopening tabs 2025-11-17 21:00:27 +08:00
Elian Doran
fc8042aa25 Add Traefik configuration documentation (#7769) 2025-11-17 08:30:08 +02:00
Elian Doran
2b6220beb8 docs(user): sync 2025-11-17 08:26:06 +02:00
Elian Doran
78426a6c7b Merge remote-tracking branch 'origin/main' into patch-2 2025-11-17 08:20:18 +02:00
Elian Doran
620e53c255 docs(user): fix broken reference link (see #7766) 2025-11-17 08:19:23 +02:00
Elian Doran
753fc6c769 Calendar: Lock calendar initialDate using label (#7694) 2025-11-17 08:10:36 +02:00
Elian Doran
3d6e1dfc0a fix(deps): update dependency mind-elixir to v5.3.6 (#7771) 2025-11-17 07:30:41 +02:00
renovate[bot]
d92431ad65 fix(deps): update dependency mind-elixir to v5.3.6 2025-11-17 02:06:54 +00:00
SiriusXT
be19d1f5b5 fix(split pane): hide the close button when no split panes exist 2025-11-17 09:24:18 +08:00
Andrea Santoro
ca08a52998 Fix volume path syntax in Traefik documentation 2025-11-16 22:39:50 +01:00
Andrea Santoro
e54822f3b0 Clarify TRILIUM_NETWORK_TRUSTEDREVERSEPROXY config
Added example IP address for TRILIUM_NETWORK_TRUSTEDREVERSEPROXY.
2025-11-16 22:27:14 +01:00
Andrea Santoro
3863e657ef Update docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.md
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-16 22:25:06 +01:00
Andrea Santoro
341ef79b49 Update docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.md
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-16 22:23:39 +01:00
Andrea Santoro
335f34b824 Update docs/User Guide/User Guide/Installation & Setup/Server Installation/2. Reverse proxy/Traefik.md
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-11-16 22:23:15 +01:00
Andrea Santoro
c864863be4 Add Traefik configuration documentation
Added documentation for configuring Traefik as a reverse proxy with HTTPS support, including example docker-compose configuration.
2025-11-16 22:19:46 +01:00
Elian Doran
c3ebef0dde Translations update from Hosted Weblate (#7762) 2025-11-16 22:10:05 +02:00
Elian Doran
7b7058c77b Translated using Weblate (Romanian)
Currently translated at 100.0% (152 of 152 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/ro/
2025-11-16 21:08:43 +01:00
Elian Doran
192cf9bc26 Translated using Weblate (Romanian)
Currently translated at 100.0% (1625 of 1625 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ro/
2025-11-16 21:08:43 +01:00
Elian Doran
1cccbcfabe Translated using Weblate (Romanian)
Currently translated at 100.0% (152 of 152 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/ro/
2025-11-16 21:02:49 +01:00
Elian Doran
a85b37985a Translated using Weblate (Romanian)
Currently translated at 100.0% (118 of 118 strings)

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/ro/
2025-11-16 21:02:48 +01:00
Elian Doran
8b6b1ee315 Translated using Weblate (Romanian)
Currently translated at 100.0% (389 of 389 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/ro/
2025-11-16 21:02:47 +01:00
Elian Doran
021c655a1a Translated using Weblate (Romanian)
Currently translated at 100.0% (1625 of 1625 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ro/
2025-11-16 21:02:45 +01:00
Elian Doran
8af8968b49 Internationalization v2 (#7767) 2025-11-16 22:02:37 +02:00
Elian Doran
17298edfcc chore: handle requested changes 2025-11-16 21:32:08 +02:00
Elian Doran
5281e8e5b4 docs(dev): document adding a new locale 2025-11-16 21:24:34 +02:00
Elian Doran
cc0e30e3f5 test(ckeditor): test all languages are mapped correctly 2025-11-16 21:18:34 +02:00
Elian Doran
497bb35209 test(canvas): test all languages are mapped correctly 2025-11-16 21:03:53 +02:00
Elian Doran
7d1453ffbd feat(canvas): add support for locales 2025-11-16 17:49:55 +02:00
Elian Doran
89228f264f feat(mindmap): add support for locales 2025-11-16 17:34:56 +02:00
Elian Doran
a10d99f938 feat(ckeditor5): set up multi-language support 2025-11-16 14:24:07 +02:00
Elian Doran
d014ae4fcf chore(ckeditor5): set up dependency to commons 2025-11-16 14:23:48 +02:00
SiriusXT
a22687e2d8 Merge branch 'main' into siriusbcd_close_split 2025-11-16 20:15:43 +08:00
SiriusXT
44475853df feat(split): allow closing any split pane 2025-11-16 20:12:56 +08:00
Elian Doran
bbcc670655 feat(client/link): render reference links same as in editor 2025-11-16 11:01:37 +02:00
Elian Doran
ae58b4af35 feat(help): render reference links with icon 2025-11-16 11:01:37 +02:00
Elian Doran
fbc2ffac59 chore(deps): update dependency i18next-fs-backend to v2.6.1 (#7760) 2025-11-16 09:23:30 +02:00
renovate[bot]
f279839e6f chore(deps): update dependency i18next-fs-backend to v2.6.1 2025-11-16 02:27:29 +00:00
Elian Doran
1844a7d666 fix(calendar): unable to delete in journal (closes #7702) 2025-11-15 22:43:35 +02:00
Elian Doran
c9f648fcb8 fix(tree): #top/#bottom reversed in desc order (closes #7716) 2025-11-15 22:27:02 +02:00
Elian Doran
948688a4ea fix(note_list): no longer displayed in help or search 2025-11-15 22:05:32 +02:00
Elian Doran
35ca295d48 fix(settings/appearance): font size can't be typed out properly (closes #7740) 2025-11-15 21:38:17 +02:00
Elian Doran
cacc4ad01d Translations update from Hosted Weblate (#7756) 2025-11-15 21:32:13 +02:00
Hosted Weblate
b12085f61f Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/
2025-11-15 19:29:45 +00:00
Elian Doran
39dacafa82 Fix #6696 by using shell.openExternal (#7737) 2025-11-15 21:29:30 +02:00
Elian Doran
57deb36027 Merge branch 'main' into patch-1 2025-11-15 21:24:24 +02:00
Elian Doran
2840df82f4 chore(client): fix typecheck issue 2025-11-15 17:52:08 +02:00
Elian Doran
3d971108b8 chore(ci/docker): update nightly version on main branch 2025-11-15 17:47:20 +02:00
Elian Doran
5bcdce72ef chore(client): remove redundant log 2025-11-15 17:33:06 +02:00
Elian Doran
398329a219 fix(text): insert link sometimes occurs in the wrong tab 2025-11-15 17:32:06 +02:00
Elian Doran
754a06343f Translations update from Hosted Weblate (#7751) 2025-11-15 16:44:12 +02:00
minkipark
55a79e5fbf Translated using Weblate (Korean)
Currently translated at 7.8% (12 of 152 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/ko/
2025-11-15 15:36:43 +01:00
Yunho Park
c78a97fed1 Translated using Weblate (Korean)
Currently translated at 7.8% (12 of 152 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/ko/
2025-11-15 15:36:43 +01:00
Elian Doran
13c8ff5cb3 Kanban board v3 (#7753) 2025-11-15 16:36:39 +02:00
Elian Doran
9e34d3a668 chore(client): fix typecheck issue 2025-11-15 16:01:30 +02:00
Elian Doran
57f220e64c Apply suggestions from code review
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-15 15:37:00 +02:00
Elian Doran
a89756a76c docs(user): improve documentation on promoted attributes 2025-11-15 15:25:36 +02:00
Elian Doran
88c1aa163e docs(user): working with the note tree in board 2025-11-15 13:41:48 +02:00
Elian Doran
d2184682e5 docs(user): grouping by relation in board 2025-11-15 13:37:24 +02:00
Elian Doran
63cc5b21b4 feat(board): scroll snapping on mobile 2025-11-15 13:06:51 +02:00
Elian Doran
b7703fc4df style(next): use main background color on mobile 2025-11-15 12:52:20 +02:00
Elian Doran
254d3a1c8e fix(board): not reacting to external title changes 2025-11-15 12:42:49 +02:00
Elian Doran
8d3892757a fix(board): not refreshing on status attribute change 2025-11-15 12:37:25 +02:00
Elian Doran
a8992d08b3 fix(board): escape not working in "Add column" 2025-11-15 12:35:10 +02:00
Elian Doran
5e35aa8079 fix(board): columns leaking between notes 2025-11-15 12:24:18 +02:00
Elian Doran
df8da0fd4f feat(board): warn when column already exists 2025-11-15 11:34:01 +02:00
Elian Doran
f820c6f23b feat(board/relation): react to column title changes 2025-11-15 11:28:35 +02:00
Elian Doran
0c616fecdf feat(board/relation): improve relation editing experience 2025-11-15 11:21:23 +02:00
Elian Doran
092a84693f feat(board/relation): basic support for editing relations in columns 2025-11-15 11:13:55 +02:00
Elian Doran
d1e80815d5 feat(board/relation): add support for more APIs 2025-11-15 10:50:55 +02:00
Elian Doran
0f000ccd93 fix(board/relation): not reacting to status change 2025-11-15 10:42:32 +02:00
Elian Doran
f90e0767cb feat(board/relation): allow dragging between columns 2025-11-15 10:26:19 +02:00
Elian Doran
ad6d61f1f7 feat(board/relation): display note titles 2025-11-15 10:17:40 +02:00
Elian Doran
47f7968dc4 feat(board/relation): group by relation 2025-11-15 10:15:11 +02:00
Elian Doran
455b190a5b refactor(client): rename to user attributes 2025-11-15 09:36:18 +02:00
Elian Doran
0bc8584c35 chore(deps): update dependency electron to v38.7.0 (#7748) 2025-11-15 09:01:14 +02:00
Elian Doran
da39cdb27f chore(deps): update dependency @ckeditor/ckeditor5-package-tools to v5.0.1 (#7741) 2025-11-15 09:00:57 +02:00
Elian Doran
769c2e9b4e chore(deps): update dependency @smithy/middleware-retry to v4.4.11 (#7742) 2025-11-15 09:00:48 +02:00
Elian Doran
783d2b8843 chore(deps): update dependency @types/yargs to v17.0.35 (#7743) 2025-11-15 09:00:13 +02:00
Elian Doran
baca0a17c3 chore(deps): update dependency rcedit to v5.0.1 (#7744) 2025-11-15 08:59:50 +02:00
Elian Doran
f48d47bac5 fix(deps): update dependency @codemirror/view to v6.38.7 (#7745) 2025-11-15 08:59:29 +02:00
Elian Doran
14fa5d2723 fix(deps): update dependency color to v5.0.3 (#7746) 2025-11-15 08:58:40 +02:00
Elian Doran
70845611a4 chore(deps): update dependency @anthropic-ai/sdk to v0.69.0 (#7747) 2025-11-15 08:58:20 +02:00
Elian Doran
7be11da85f chore(deps): update dependency node-abi to v4.24.0 (#7749) 2025-11-15 08:56:25 +02:00
renovate[bot]
f2f4b0e75b chore(deps): update dependency node-abi to v4.24.0 2025-11-15 01:04:53 +00:00
renovate[bot]
491cd27f2d chore(deps): update dependency electron to v38.7.0 2025-11-15 01:04:10 +00:00
renovate[bot]
7b62881113 chore(deps): update dependency @anthropic-ai/sdk to v0.69.0 2025-11-15 01:03:30 +00:00
renovate[bot]
22f46919f9 fix(deps): update dependency color to v5.0.3 2025-11-15 01:02:49 +00:00
renovate[bot]
1ef7fd401f fix(deps): update dependency @codemirror/view to v6.38.7 2025-11-15 01:02:07 +00:00
renovate[bot]
5f1dbc23b4 chore(deps): update dependency rcedit to v5.0.1 2025-11-15 01:01:27 +00:00
renovate[bot]
8d750417ec chore(deps): update dependency @types/yargs to v17.0.35 2025-11-15 01:01:22 +00:00
renovate[bot]
52f30052d5 chore(deps): update dependency @smithy/middleware-retry to v4.4.11 2025-11-15 01:00:40 +00:00
renovate[bot]
655e6bafd1 chore(deps): update dependency @ckeditor/ckeditor5-package-tools to v5.0.1 2025-11-15 00:59:58 +00:00
Elian Doran
d4dfb0cb53 Translations update from Hosted Weblate (#7738) 2025-11-14 18:19:39 +02:00
Hosted Weblate
8d08973d48 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/
2025-11-14 15:38:37 +00:00
Elian Doran
9b1b56a381 fix NoteLink component is unable to display path for root note (#7736) 2025-11-14 17:38:19 +02:00
laund
f709c27329 use shell.openExternal for URI protocol handling, clean up and unify logic 2025-11-14 15:31:51 +01:00
contributor
02859039ec fix NoteLink component is unable to display path for root note 2025-11-14 16:02:43 +02:00
Elian Doran
e6810ef753 Fix toggle tray wont restore from tray (#7735) 2025-11-14 11:57:31 +02:00
contributor
ef86e195c6 remove constant and import, it is type safe as is #7730 2025-11-14 11:45:44 +02:00
contributor
d69dd2a83f handle toggleTray global shortcut differently from other global shortcuts #7730 2025-11-14 11:45:39 +02:00
Elian Doran
5dd21ac539 fix(flake): upgrade to Nodejs 24 (#7732) 2025-11-14 10:53:47 +02:00
FliegendeWurst
bd6575982b fix(flake): revert pname to just trilium-* 2025-11-14 08:54:25 +01:00
FliegendeWurst
80313527c5 fix(flake): upgrade to Nodejs 24
This ensures consistency with the main server build.
2025-11-14 08:53:40 +01:00
Elian Doran
78901e03d7 fix markdown headings are rendered with extra character (#7720) 2025-11-14 08:28:56 +02:00
Elian Doran
01c1b19601 chore(deps): update dependency openai to v6.9.0 (#7727) 2025-11-14 08:27:10 +02:00
Elian Doran
1d837092a2 Translations update from Hosted Weblate (#7731) 2025-11-14 08:26:47 +02:00
Elian Doran
bde04919fe chore(deps): update dependency @ckeditor/ckeditor5-package-tools to v5 (#7729) 2025-11-14 08:26:14 +02:00
Hosted Weblate
0dd0416346 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/
2025-11-14 06:25:56 +00:00
Yunho Park
711dd64093 Translated using Weblate (Korean)
Currently translated at 3.9% (6 of 152 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/ko/
2025-11-14 06:25:47 +00:00
Hosted Weblate
db7b4829b5 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/
2025-11-14 06:25:46 +00:00
Elian Doran
f97c63fe93 chore(deps): update ckeditor5 config packages to v13 (major) (#7728) 2025-11-14 08:25:38 +02:00
renovate[bot]
cb5fe95768 chore(deps): update dependency openai to v6.9.0 2025-11-14 06:25:29 +00:00
Elian Doran
34359dd7b6 fix(deps): update dependency react-i18next to v16.3.3 (#7725) 2025-11-14 08:24:40 +02:00
Elian Doran
476d1d274e chore(deps): update dependency node-abi to v4.23.0 (#7726) 2025-11-14 08:24:07 +02:00
Elian Doran
c52265c046 fix(deps): update dependency @mind-elixir/node-menu to v5.0.1 (#7724) 2025-11-14 08:23:26 +02:00
Elian Doran
4fbf3d79c7 chore(deps): update dependency ollama to v0.6.3 (#7723) 2025-11-14 08:22:51 +02:00
renovate[bot]
e8cc92db95 chore(deps): update dependency @ckeditor/ckeditor5-package-tools to v5 2025-11-14 02:38:29 +00:00
renovate[bot]
40e969bab9 chore(deps): update ckeditor5 config packages to v13 2025-11-14 02:37:48 +00:00
renovate[bot]
3df2105016 chore(deps): update dependency node-abi to v4.23.0 2025-11-14 02:36:26 +00:00
renovate[bot]
0aa3cc3d6f fix(deps): update dependency react-i18next to v16.3.3 2025-11-14 02:35:52 +00:00
renovate[bot]
666f26f516 fix(deps): update dependency @mind-elixir/node-menu to v5.0.1 2025-11-14 02:35:12 +00:00
renovate[bot]
7662dde294 chore(deps): update dependency ollama to v0.6.3 2025-11-14 02:34:31 +00:00
contributor
d28dda876c fix markdown headings are rendered with extra character 2025-11-13 23:18:38 +02:00
Diego Herrera
309d7e704c Add feature to docs 2025-11-12 12:58:56 -03:00
Diego Herrera
ecf9ce586c Use NoteLabel instead of CustomisableLabel 2025-11-12 12:43:37 -03:00
Diego Herrera
d0de9e5e21 calendar: Lock calendar initialDate using label 2025-11-11 18:06:11 -03:00
125 changed files with 1990 additions and 937 deletions

View File

@@ -155,6 +155,10 @@ jobs:
- name: Update build info
run: pnpm run chore:update-build-info
- name: Update nightly version
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: pnpm run chore:ci-update-nightly-version
- name: Run the TypeScript build
run: pnpm run server:build

View File

@@ -57,7 +57,7 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Update nightly version
run: npm run chore:ci-update-nightly-version
run: pnpm run chore:ci-update-nightly-version
- name: Run the build
uses: ./.github/actions/build-electron
with:

View File

@@ -39,14 +39,14 @@
"@stylistic/eslint-plugin": "5.5.0",
"@types/express": "5.0.5",
"@types/node": "24.10.1",
"@types/yargs": "17.0.34",
"@types/yargs": "17.0.35",
"@vitest/coverage-v8": "3.2.4",
"eslint": "9.39.1",
"eslint-plugin-simple-import-sort": "12.1.1",
"esm": "3.2.25",
"jsdoc": "4.0.5",
"lorem-ipsum": "2.0.8",
"rcedit": "5.0.0",
"rcedit": "5.0.1",
"rimraf": "6.1.0",
"tslib": "2.8.1"
},

View File

@@ -25,7 +25,7 @@
"@fullcalendar/timegrid": "6.1.19",
"@maplibre/maplibre-gl-leaflet": "0.1.3",
"@mermaid-js/layout-elk": "0.2.0",
"@mind-elixir/node-menu": "5.0.0",
"@mind-elixir/node-menu": "5.0.1",
"@popperjs/core": "2.11.8",
"@triliumnext/ckeditor5": "workspace:*",
"@triliumnext/codemirror": "workspace:*",
@@ -36,7 +36,7 @@
"autocomplete.js": "0.38.1",
"bootstrap": "5.3.8",
"boxicons": "2.1.4",
"color": "5.0.2",
"color": "5.0.3",
"dayjs": "1.11.19",
"dayjs-plugin-utc": "0.1.2",
"debounce": "3.0.0",
@@ -55,11 +55,11 @@
"mark.js": "8.11.1",
"marked": "16.4.2",
"mermaid": "11.12.1",
"mind-elixir": "5.3.5",
"mind-elixir": "5.3.6",
"normalize.css": "8.0.1",
"panzoom": "9.4.3",
"preact": "10.27.2",
"react-i18next": "16.3.1",
"react-i18next": "16.3.3",
"reveal.js": "5.2.1",
"svg-pan-zoom": "3.6.2",
"tabulator-tables": "6.3.1",

View File

@@ -647,7 +647,32 @@ export default class TabManager extends Component {
...this.noteContexts.slice(-noteContexts.length),
...this.noteContexts.slice(lastClosedTab.position, -noteContexts.length)
];
this.noteContextReorderEvent({ ntxIdsInOrder: ntxsInOrder.map((nc) => nc.ntxId).filter((id) => id !== null) });
// Update mainNtxId if the restored pane is the main pane in the split pane
const { oldMainNtxId, newMainNtxId } = (() => {
if (noteContexts.length !== 1) {
return { oldMainNtxId: undefined, newMainNtxId: undefined };
}
const mainNtxId = noteContexts[0]?.mainNtxId;
const index = this.noteContexts.findIndex(c => c.ntxId === mainNtxId);
// No need to update if the restored position is after mainNtxId
if (index === -1 || lastClosedTab.position > index) {
return { oldMainNtxId: undefined, newMainNtxId: undefined };
}
return {
oldMainNtxId: this.noteContexts[index].ntxId ?? undefined,
newMainNtxId: noteContexts[0]?.ntxId ?? undefined
};
})();
this.triggerCommand("noteContextReorder", {
ntxIdsInOrder: ntxsInOrder.map((nc) => nc.ntxId).filter((id) => id !== null),
oldMainNtxId,
newMainNtxId
});
let mainNtx = noteContexts.find((nc) => nc.isMainContext());
if (mainNtx) {

View File

@@ -257,7 +257,9 @@ export default class FNote {
}
async getChildNoteIdsWithArchiveFiltering(includeArchived = false) {
if (!includeArchived) {
const isHiddenNote = this.noteId.startsWith("_");
const isSearchNote = this.type === "search";
if (!includeArchived && !isHiddenNote && !isSearchNote) {
const unorderedIds = new Set(await search.searchForNoteIds(`note.parents.noteId="${this.noteId}" #!archived`));
const results: string[] = [];
for (const id of this.children) {
@@ -804,6 +806,16 @@ export default class FNote {
return this.getAttributeValue(LABEL, name);
}
getLabelOrRelation(nameWithPrefix: string) {
if (nameWithPrefix.startsWith("#")) {
return this.getLabelValue(nameWithPrefix.substring(1));
} else if (nameWithPrefix.startsWith("~")) {
return this.getRelationValue(nameWithPrefix.substring(1));
} else {
return this.getLabelValue(nameWithPrefix);
}
}
/**
* @param name - relation name
* @returns relation value if relation exists, null otherwise

View File

@@ -31,7 +31,6 @@ import ScrollingContainer from "../widgets/containers/scrolling_container.js";
import ScrollPadding from "../widgets/scroll_padding.js";
import SearchResult from "../widgets/search_result.jsx";
import SharedInfo from "../widgets/shared_info.jsx";
import OriginInfo from "../widgets/note_origin.jsx";
import SpacerWidget from "../widgets/spacer.js";
import SplitNoteContainer from "../widgets/containers/split_note_container.js";
import SqlResults from "../widgets/sql_result.js";
@@ -139,7 +138,6 @@ export default class DesktopLayout {
.filling()
.child(new ContentHeader()
.child(<ReadOnlyNoteInfoBar />)
.child(<OriginInfo />)
.child(<SharedInfo />)
)
.child(new PromotedAttributesWidget())

View File

@@ -22,6 +22,15 @@ export async function setLabel(noteId: string, name: string, value: string = "",
});
}
export async function setRelation(noteId: string, name: string, value: string = "", isInheritable = false) {
await server.put(`notes/${noteId}/set-attribute`, {
type: "relation",
name: name,
value: value,
isInheritable
});
}
async function removeAttributeById(noteId: string, attributeId: string) {
await server.remove(`notes/${noteId}/attributes/${attributeId}`);
}
@@ -51,6 +60,23 @@ function removeOwnedLabelByName(note: FNote, labelName: string) {
return false;
}
/**
* Removes a relation identified by its name from the given note, if it exists. Note that the relation must be owned, i.e.
* it will not remove inherited attributes.
*
* @param note the note from which to remove the relation.
* @param relationName the name of the relation to remove.
* @returns `true` if an attribute was identified and removed, `false` otherwise.
*/
function removeOwnedRelationByName(note: FNote, relationName: string) {
const relation = note.getOwnedRelation(relationName);
if (relation) {
removeAttributeById(note.noteId, relation.attributeId);
return true;
}
return false;
}
/**
* Sets the attribute of the given note to the provided value if its truthy, or removes the attribute if the value is falsy.
* For an attribute with an empty value, pass an empty string instead.
@@ -116,8 +142,10 @@ function isAffecting(attrRow: AttributeRow, affectedNote: FNote | null | undefin
export default {
addLabel,
setLabel,
setRelation,
setAttribute,
removeAttributeById,
removeOwnedLabelByName,
removeOwnedRelationByName,
isAffecting
};

View File

@@ -1,4 +1,5 @@
import type FNote from "../entities/fnote.js";
import { applyReferenceLinks } from "../widgets/type_widgets/text/read_only_helper.js";
import { getCurrentLanguage } from "./i18n.js";
import { formatCodeBlocks } from "./syntax_highlight.js";
@@ -10,18 +11,18 @@ export default function renderDoc(note: FNote) {
if (docName) {
// find doc based on language
const url = getUrl(docName, getCurrentLanguage());
$content.load(url, (response, status) => {
$content.load(url, async (response, status) => {
// fallback to english doc if no translation available
if (status === "error") {
const fallbackUrl = getUrl(docName, "en");
$content.load(fallbackUrl, () => {
processContent(fallbackUrl, $content)
$content.load(fallbackUrl, async () => {
await processContent(fallbackUrl, $content)
resolve($content);
});
return;
}
processContent(url, $content);
await processContent(url, $content);
resolve($content);
});
} else {
@@ -32,7 +33,7 @@ export default function renderDoc(note: FNote) {
});
}
function processContent(url: string, $content: JQuery<HTMLElement>) {
async function processContent(url: string, $content: JQuery<HTMLElement>) {
const dir = url.substring(0, url.lastIndexOf("/"));
// Images are relative to the docnote but that will not work when rendered in the application since the path breaks.
@@ -42,6 +43,9 @@ function processContent(url: string, $content: JQuery<HTMLElement>) {
});
formatCodeBlocks($content);
// Apply reference links.
await applyReferenceLinks($content[0]);
}
function getUrl(docNameValue: string, language: string) {

View File

@@ -29,6 +29,8 @@ async function getActionsForScope(scope: string) {
}
async function setupActionsForElement(scope: string, $el: JQuery<HTMLElement>, component: Component) {
if (!$el[0]) return [];
const actions = await getActionsForScope(scope);
const bindings: ShortcutBinding[] = [];

View File

@@ -150,11 +150,16 @@ async function createLink(notePath: string | undefined, options: CreateLinkOptio
$container.append($noteLink);
if (showNotePath) {
let pathSegments: string[];
if (notePath == "root") {
pathSegments = ["⌂"];
} else {
const resolvedPathSegments = (await treeService.resolveNotePathToSegments(notePath)) || [];
resolvedPathSegments.pop(); // Remove last element
const resolvedPath = resolvedPathSegments.join("/");
const pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
}
if (pathSegments) {
if (pathSegments.length) {
@@ -302,7 +307,8 @@ export function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDo
// Right click is handled separately.
const isMiddleClick = evt && "which" in evt && evt.which === 2;
const targetIsBlank = ($link?.attr("target") === "_blank");
const openInNewTab = (isLeftClick && ctrlKey) || isMiddleClick || targetIsBlank;
const isDoubleClick = isLeftClick && evt?.type === "dblclick";
const openInNewTab = (isLeftClick && ctrlKey) || isDoubleClick || isMiddleClick || targetIsBlank;
const activate = (isLeftClick && ctrlKey && shiftKey) || (isMiddleClick && shiftKey);
const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey;
@@ -323,20 +329,22 @@ export function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDo
const withinEditLink = $link?.hasClass("ck-link-actions__preview");
const outsideOfCKEditor = !$link || $link.closest("[contenteditable]").length === 0;
if (openInNewTab || (withinEditLink && (isLeftClick || isMiddleClick)) || (outsideOfCKEditor && (isLeftClick || isMiddleClick))) {
if (openInNewTab || openInNewWindow || (isLeftClick && (withinEditLink || outsideOfCKEditor))) {
if (hrefLink.toLowerCase().startsWith("http") || hrefLink.startsWith("api/")) {
window.open(hrefLink, "_blank");
} else if ((hrefLink.toLowerCase().startsWith("file:") || hrefLink.toLowerCase().startsWith("geo:")) && utils.isElectron()) {
const electron = utils.dynamicRequire("electron");
electron.shell.openPath(hrefLink);
} else {
// Enable protocols supported by CKEditor 5 to be clickable.
if (ALLOWED_PROTOCOLS.some((protocol) => hrefLink.toLowerCase().startsWith(protocol + ":"))) {
if ( utils.isElectron()) {
const electron = utils.dynamicRequire("electron");
electron.shell.openExternal(hrefLink);
} else {
window.open(hrefLink, "_blank");
}
}
}
}
}
return true;
}
@@ -468,18 +476,9 @@ $(document).on("auxclick", "a", goToLink); // to handle the middle button
// TODO: Check why the event is not supported.
//@ts-ignore
$(document).on("contextmenu", "a", linkContextMenu);
$(document).on("dblclick", "a", (e) => {
e.preventDefault();
e.stopPropagation();
const $link = $(e.target).closest("a");
const address = $link.attr("href");
if (address && address.startsWith("http")) {
window.open(address, "_blank");
}
});
// TODO: Check why the event is not supported.
//@ts-ignore
$(document).on("dblclick", "a", goToLink);
$(document).on("mousedown", "a", (e) => {
if (e.which === 2) {

View File

@@ -1,11 +1,21 @@
import type { AttachmentRow, EtapiTokenRow, OptionNames } from "@triliumnext/commons";
import type { AttachmentRow, EtapiTokenRow, NoteType, OptionNames } from "@triliumnext/commons";
import type { AttributeType } from "../entities/fattribute.js";
import type { EntityChange } from "../server_types.js";
// TODO: Deduplicate with server.
interface NoteRow {
blobId: string;
dateCreated: string;
dateModified: string;
isDeleted?: boolean;
isProtected?: boolean;
mime: string;
noteId: string;
title: string;
type: NoteType;
utcDateCreated: string;
utcDateModified: string;
}
// TODO: Deduplicate with BranchRow from `rows.ts`/

View File

@@ -77,11 +77,11 @@ function closePersistent(id: string) {
$(`#toast-${id}`).remove();
}
function showMessage(message: string, delay = 2000) {
function showMessage(message: string, delay = 2000, icon = "check") {
console.debug(utils.now(), "message:", message);
toast({
icon: "check",
icon,
message: message,
autohide: true,
delay

View File

@@ -16,6 +16,10 @@
background-color: var(--root-background);
}
body.mobile #root-widget {
background-color: var(--main-background-color);
}
body {
--native-titlebar-darwin-x-offset: 10;
--native-titlebar-darwin-y-offset: 12 !important;

View File

@@ -512,7 +512,7 @@
"title": "الملاحظات المعدلة"
},
"note_properties": {
"this_note_was_originally_taken_from": ""
"info": "معلومات"
},
"backend_log": {
"refresh": "تحديث"

View File

@@ -837,7 +837,8 @@
"search": "搜索"
},
"note_properties": {
"this_note_was_originally_taken_from": "笔记来源:"
"this_note_was_originally_taken_from": "笔记来源:",
"info": "信息"
},
"owned_attribute_list": {
"owned_attributes": "拥有的属性"

View File

@@ -830,7 +830,8 @@
"search": "Suchen"
},
"note_properties": {
"this_note_was_originally_taken_from": "Diese Notiz stammt ursprünglich aus:"
"this_note_was_originally_taken_from": "Diese Notiz stammt ursprünglich aus:",
"info": "Info"
},
"owned_attribute_list": {
"owned_attributes": "Eigene Attribute"

View File

@@ -837,7 +837,8 @@
"search": "Search"
},
"note_properties": {
"this_note_was_originally_taken_from": "This note was originally taken from:"
"this_note_was_originally_taken_from": "This note was originally taken from:",
"info": "Info"
},
"owned_attribute_list": {
"owned_attributes": "Owned Attributes"
@@ -2034,7 +2035,8 @@
"add-column": "Add Column",
"add-column-placeholder": "Enter column name...",
"edit-note-title": "Click to edit note title",
"edit-column-title": "Click to edit column title"
"edit-column-title": "Click to edit column title",
"column-already-exists": "This column already exists on the board."
},
"presentation_view": {
"edit-slide": "Edit this slide",

View File

@@ -836,7 +836,8 @@
"search": "Buscar"
},
"note_properties": {
"this_note_was_originally_taken_from": "Esta nota fue tomada originalmente de:"
"this_note_was_originally_taken_from": "Esta nota fue tomada originalmente de:",
"info": "Información"
},
"owned_attribute_list": {
"owned_attributes": "Atributos propios"

View File

@@ -832,7 +832,8 @@
"search": "Recherche"
},
"note_properties": {
"this_note_was_originally_taken_from": "Cette note est initialement extraite de :"
"this_note_was_originally_taken_from": "Cette note est initialement extraite de :",
"info": "Infos"
},
"owned_attribute_list": {
"owned_attributes": "Attributs propres"

View File

@@ -1408,7 +1408,8 @@
"search": "Ricerca"
},
"note_properties": {
"this_note_was_originally_taken_from": "Questa nota è stata originariamente tratta da:"
"this_note_was_originally_taken_from": "Questa nota è stata originariamente tratta da:",
"info": "Informazioni"
},
"owned_attribute_list": {
"owned_attributes": "Attributi posseduti"

View File

@@ -688,6 +688,7 @@
"outside_hoisted": "このパスはホイストされたノートの外側にあるため、ホイストを解除する必要があります。"
},
"note_properties": {
"info": "情報",
"this_note_was_originally_taken_from": "このノートは元々以下から引用したものです:"
},
"similar_notes": {

View File

@@ -448,7 +448,8 @@
"search": "Szukaj"
},
"note_properties": {
"this_note_was_originally_taken_from": "Ta notatka oryginalnie została wzięta z:"
"this_note_was_originally_taken_from": "Ta notatka oryginalnie została wzięta z:",
"info": "Info"
},
"owned_attribute_list": {
"owned_attributes": "Posiadane atrybuty"

View File

@@ -810,7 +810,8 @@
"search": "Pesquisar"
},
"note_properties": {
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:"
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:",
"info": "Informações"
},
"owned_attribute_list": {
"owned_attributes": "Atributos próprios"

View File

@@ -1076,7 +1076,8 @@
"outside_hoisted": "Este caminho está fora de uma nota fixada e você teria que desafixar."
},
"note_properties": {
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:"
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:",
"info": "Informações"
},
"promoted_attributes": {
"promoted_attributes": "Atributos Promovidos",

View File

@@ -302,7 +302,10 @@
"edit_branch_prefix": "Editează prefixul ramurii",
"help_on_tree_prefix": "Informații despre prefixe de ierarhie",
"prefix": "Prefix: ",
"save": "Salvează"
"save": "Salvează",
"edit_branch_prefix_multiple": "Editează prefixul pentru {{count}} ramuri",
"branch_prefix_saved_multiple": "Prefixul a fost modificat pentru {{count}} ramuri.",
"affected_branches": "Ramuri afectate ({{count}}):"
},
"bulk_actions": {
"affected_notes": "Notițe afectate",
@@ -537,7 +540,8 @@
"opml_version_1": "OPML v1.0 - text simplu",
"opml_version_2": "OPML v2.0 - permite și HTML",
"format_html": "HTML - recomandat deoarece păstrează toata formatarea",
"format_pdf": "PDF - cu scopul de printare sau partajare."
"format_pdf": "PDF - cu scopul de printare sau partajare.",
"share-format": "HTML pentru publicare web - folosește aceeași temă pentru notițele partajate, dar se pot publica într-un website static."
},
"fast_search": {
"description": "Căutarea rapidă dezactivează căutarea la nivel de conținut al notițelor cu scopul de a îmbunătăți performanța de căutare pentru baze de date mari.",
@@ -753,7 +757,8 @@
"placeholder": "Introduceți etichetele HTML, câte unul pe linie",
"reset_button": "Resetează la lista implicită",
"title": "Etichete HTML la importare"
}
},
"importZipRecommendation": "Când importați un fișier ZIP, ierarhia notițelor va reflecta structura subdirectoarelor din arhivă."
},
"include_archived_notes": {
"include_archived_notes": "Include notițele arhivate"
@@ -799,7 +804,8 @@
"default_description": "În mod implicit Trilium limitează lățimea conținutului pentru a îmbunătăți lizibilitatea pentru ferestrele maximizate pe ecrane late.",
"max_width_label": "Lungimea maximă a conținutului",
"max_width_unit": "pixeli",
"title": "Lățime conținut"
"title": "Lățime conținut",
"centerContent": "Centrează conținutul"
},
"mobile_detail_menu": {
"delete_this_note": "Șterge această notiță",
@@ -856,7 +862,8 @@
"convert_into_attachment_failed": "Nu s-a putut converti notița „{{title}}”.",
"convert_into_attachment_successful": "Notița „{{title}}” a fost convertită în atașament.",
"convert_into_attachment_prompt": "Doriți convertirea notiței „{{title}}” într-un atașament al notiței părinte?",
"print_pdf": "Exportare ca PDF..."
"print_pdf": "Exportare ca PDF...",
"open_note_on_server": "Deschide notița pe server"
},
"note_erasure_timeout": {
"deleted_notes_erased": "Notițele șterse au fost eliminate permanent.",
@@ -897,6 +904,7 @@
"title": "Căile notiței"
},
"note_properties": {
"info": "Informații",
"this_note_was_originally_taken_from": "Această notiță a fost preluată original de la:"
},
"note_type_chooser": {
@@ -1245,11 +1253,11 @@
"timeout_unit": "milisecunde"
},
"table_of_contents": {
"description": "Tabela de conținut va apărea în notițele de tip text atunci când notița are un număr de titluri mai mare decât cel definit. Acest număr se poate personaliza:",
"description": "Cuprinsul va apărea în notițele de tip text atunci când notița are un număr de titluri mai mare decât cel definit. Acest număr se poate personaliza:",
"unit": "titluri",
"disable_info": "De asemenea se poate dezactiva tabela de conținut setând o valoare foarte mare.",
"shortcut_info": "Se poate configura și o scurtatură pentru a comuta rapid vizibilitatea panoului din dreapta (inclusiv tabela de conținut) în Opțiuni -> Scurtături (denumirea „toggleRightPane”).",
"title": "Tabelă de conținut"
"disable_info": "De asemenea se poate dezactiva cuprinsul setând o valoare foarte mare.",
"shortcut_info": "Se poate configura și o scurtatură pentru a comuta rapid vizibilitatea panoului din dreapta (inclusiv cuprinsul) în Opțiuni -> Scurtături (denumirea „toggleRightPane”).",
"title": "Cuprins"
},
"text_auto_read_only_size": {
"description": "Marchează pragul în care o notiță de o anumită dimensiune va fi afișată în mod de citire (pentru motive de performanță).",
@@ -1502,7 +1510,9 @@
"window-on-top": "Menține fereastra mereu vizibilă"
},
"note_detail": {
"could_not_find_typewidget": "Nu s-a putut găsi widget-ul corespunzător tipului „{{type}}”"
"could_not_find_typewidget": "Nu s-a putut găsi widget-ul corespunzător tipului „{{type}}”",
"printing": "Imprimare în curs...",
"printing_pdf": "Exportare ca PDF în curs..."
},
"note_title": {
"placeholder": "introduceți titlul notiței aici..."
@@ -2013,7 +2023,8 @@
"new-item-placeholder": "Introduceți titlul notiței...",
"add-column-placeholder": "Introduceți denumirea coloanei...",
"edit-note-title": "Clic pentru a edita titlul notiței",
"edit-column-title": "Clic pentru a edita titlul coloanei"
"edit-column-title": "Clic pentru a edita titlul coloanei",
"column-already-exists": "Această coloană deja există."
},
"command_palette": {
"tree-action-name": "Listă de notițe: {{name}}",
@@ -2075,5 +2086,14 @@
"edit-slide": "Editați acest slide",
"start-presentation": "Începeți prezentarea",
"slide-overview": "Afișați o imagine de ansamblu a slide-urilor"
},
"read-only-info": {
"read-only-note": "Vizualizați o notiță în modul doar în citire.",
"auto-read-only-note": "Această notiță este afișată în modul doar în citire din motive de performanță.",
"auto-read-only-learn-more": "Mai multe detalii",
"edit-note": "Editează notița"
},
"calendar_view": {
"delete_note": "Șterge notița..."
}
}

View File

@@ -1067,6 +1067,7 @@
"archived": "Архивировано"
},
"note_properties": {
"info": "Информация",
"this_note_was_originally_taken_from": "Эта заметка была первоначально взята из:"
},
"promoted_attributes": {

View File

@@ -834,7 +834,8 @@
"search": "搜尋"
},
"note_properties": {
"this_note_was_originally_taken_from": "筆記來源:"
"this_note_was_originally_taken_from": "筆記來源:",
"info": "資訊"
},
"owned_attribute_list": {
"owned_attributes": "自有屬性"

View File

@@ -939,7 +939,8 @@
"outside_hoisted": "Цей шлях знаходиться поза межами закріпленої нотатки і вам доведеться відкріпити."
},
"note_properties": {
"this_note_was_originally_taken_from": "Цю нотатку було спочатку взято з:"
"this_note_was_originally_taken_from": "Цю нотатку було спочатку взято з:",
"info": "Інформація"
},
"owned_attribute_list": {
"owned_attributes": "Власні Атрибути"

View File

@@ -1,4 +1,4 @@
.promoted-attributes {
.user-attributes {
display: flex;
flex-wrap: wrap;
gap: 8px;
@@ -6,7 +6,7 @@
margin-top: 8px;
}
.promoted-attributes .promoted-attribute {
.user-attributes .user-attribute {
padding: 2px 10px;
border-radius: 9999px;
white-space: nowrap;
@@ -17,15 +17,15 @@
line-height: 1.2;
}
.promoted-attributes .promoted-attribute:hover {
.user-attributes .user-attribute:hover {
background-color: var(--chip-bg-hover, rgba(0, 0, 0, 0.12));
border-color: var(--chip-border-hover, rgba(0, 0, 0, 0.22));
}
.promoted-attributes .promoted-attribute .name {
.user-attributes .user-attribute .name {
font-weight: 600;
}
.promoted-attributes .promoted-attribute .value {
.user-attributes .user-attribute .value {
opacity: 0.9;
}

View File

@@ -1,16 +1,16 @@
import { useState } from "preact/hooks";
import FNote from "../../entities/fnote";
import "./PromotedAttributesDisplay.css";
import "./UserAttributesList.css";
import { useTriliumEvent } from "../react/hooks";
import attributes from "../../services/attributes";
import { DefinitionObject } from "../../services/promoted_attribute_definition_parser";
import { formatDateTime } from "../../utils/formatters";
import { ComponentChild, ComponentChildren, CSSProperties } from "preact";
import { ComponentChildren, CSSProperties } from "preact";
import Icon from "../react/Icon";
import NoteLink from "../react/NoteLink";
import { getReadableTextColor } from "../../services/css_class_manager";
interface PromotedAttributesDisplayProps {
interface UserAttributesListProps {
note: FNote;
ignoredAttributes?: string[];
}
@@ -23,39 +23,39 @@ interface AttributeWithDefinitions {
def: DefinitionObject;
}
export default function PromotedAttributesDisplay({ note, ignoredAttributes }: PromotedAttributesDisplayProps) {
const promotedDefinitionAttributes = useNoteAttributesWithDefinitions(note, ignoredAttributes);
return promotedDefinitionAttributes?.length > 0 && (
<div className="promoted-attributes">
{promotedDefinitionAttributes?.map(attr => buildPromotedAttribute(attr))}
export default function UserAttributesDisplay({ note, ignoredAttributes }: UserAttributesListProps) {
const userAttributes = useNoteAttributesWithDefinitions(note, ignoredAttributes);
return userAttributes?.length > 0 && (
<div className="user-attributes">
{userAttributes?.map(attr => buildUserAttribute(attr))}
</div>
)
}
function useNoteAttributesWithDefinitions(note: FNote, attributesToIgnore: string[] = []): AttributeWithDefinitions[] {
const [ promotedDefinitionAttributes, setPromotedDefinitionAttributes ] = useState<AttributeWithDefinitions[]>(getAttributesWithDefinitions(note, attributesToIgnore));
const [ userAttributes, setUserAttributes ] = useState<AttributeWithDefinitions[]>(getAttributesWithDefinitions(note, attributesToIgnore));
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
if (loadResults.getAttributeRows().some(attr => attributes.isAffecting(attr, note))) {
setPromotedDefinitionAttributes(getAttributesWithDefinitions(note, attributesToIgnore));
setUserAttributes(getAttributesWithDefinitions(note, attributesToIgnore));
}
});
return promotedDefinitionAttributes;
return userAttributes;
}
function PromotedAttribute({ attr, children, style }: { attr: AttributeWithDefinitions, children: ComponentChildren, style?: CSSProperties }) {
function UserAttribute({ attr, children, style }: { attr: AttributeWithDefinitions, children: ComponentChildren, style?: CSSProperties }) {
const className = `${attr.type === "label" ? "label" + " " + attr.def.labelType : "relation"}`;
return (
<span key={attr.friendlyName} className={`promoted-attribute type-${className}`} style={style}>
<span key={attr.friendlyName} className={`user-attribute type-${className}`} style={style}>
{children}
</span>
)
}
function buildPromotedAttribute(attr: AttributeWithDefinitions): ComponentChildren {
function buildUserAttribute(attr: AttributeWithDefinitions): ComponentChildren {
const defaultLabel = <><strong>{attr.friendlyName}:</strong>{" "}</>;
let content: ComponentChildren;
let style: CSSProperties | undefined;
@@ -102,13 +102,13 @@ function buildPromotedAttribute(attr: AttributeWithDefinitions): ComponentChildr
content = <>{defaultLabel}<NoteLink notePath={attr.value} showNoteIcon /></>;
}
return <PromotedAttribute attr={attr} style={style}>{content}</PromotedAttribute>
return <UserAttribute attr={attr} style={style}>{content}</UserAttribute>
}
function getAttributesWithDefinitions(note: FNote, attributesToIgnore: string[] = []): AttributeWithDefinitions[] {
const promotedDefinitionAttributes = note.getAttributeDefinitions();
const attributeDefintions = note.getAttributeDefinitions();
const result: AttributeWithDefinitions[] = [];
for (const attr of promotedDefinitionAttributes) {
for (const attr of attributeDefintions) {
const def = attr.getDefinition();
const [ type, name ] = attr.name.split(":", 2);
const friendlyName = def?.promotedAlias || name;

View File

@@ -1,18 +1,20 @@
import { useEffect, useState } from "preact/hooks";
import { t } from "../../services/i18n";
import ActionButton from "../react/ActionButton";
import { useNoteContext, useTriliumEvent } from "../react/hooks";
import { useNoteContext, useTriliumEvents } from "../react/hooks";
import appContext from "../../components/app_context";
export default function ClosePaneButton() {
const { noteContext, ntxId, parentComponent } = useNoteContext();
const [ isEnabled, setIsEnabled ] = useState(false);
const [isEnabled, setIsEnabled] = useState(false);
function refresh() {
setIsEnabled(!!(noteContext && !!noteContext.mainNtxId));
const isMainOfSomeContext = appContext.tabManager.noteContexts.some(c => c.mainNtxId === ntxId);
setIsEnabled(!!(noteContext && (!!noteContext.mainNtxId || isMainOfSomeContext)));
}
useTriliumEvent("noteContextReorder", refresh);
useEffect(refresh, [ ntxId ]);
useTriliumEvents(["noteContextRemoved", "noteContextReorder", "newNoteContextCreated"], refresh);
useEffect(refresh, [ntxId]);
return (
<ActionButton

View File

@@ -77,8 +77,8 @@ export function CustomNoteList<T extends object>({ note, isEnabled: shouldEnable
props = {
note, noteIds, notePath,
highlightedTokens,
viewConfig: viewModeConfig[0],
saveConfig: viewModeConfig[1],
viewConfig: viewModeConfig.config,
saveConfig: viewModeConfig.storeFn,
onReady: onReady ?? (() => {}),
...restProps
}
@@ -192,7 +192,11 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOpt
}
export function useViewModeConfig<T extends object>(note: FNote | null | undefined, viewType: ViewTypeOptions | undefined) {
const [ viewConfig, setViewConfig ] = useState<[T | undefined, (data: T) => void]>();
const [ viewConfig, setViewConfig ] = useState<{
config: T | undefined;
storeFn: (data: T) => void;
note: FNote;
}>();
useEffect(() => {
if (!note || !viewType) return;
@@ -200,12 +204,14 @@ export function useViewModeConfig<T extends object>(note: FNote | null | undefin
const viewStorage = new ViewModeStorage<T>(note, viewType);
viewStorage.restore().then(config => {
const storeFn = (config: T) => {
setViewConfig([ config, storeFn ]);
setViewConfig({ note, config, storeFn });
viewStorage.store(config);
};
setViewConfig([ config, storeFn ]);
setViewConfig({ note, config, storeFn });
});
}, [ note, viewType ]);
// Only expose config for the current note, avoid leaking notes when switching between them.
if (viewConfig?.note !== note) return undefined;
return viewConfig;
}

View File

@@ -1,3 +1,4 @@
import { BulkAction } from "@triliumnext/commons";
import { BoardViewData } from ".";
import appContext from "../../../components/app_context";
import FNote from "../../../entities/fnote";
@@ -12,15 +13,25 @@ import { ColumnMap } from "./data";
export default class BoardApi {
private isRelationMode: boolean;
statusAttribute: string;
constructor(
private byColumn: ColumnMap | undefined,
public columns: string[],
private parentNote: FNote,
readonly statusAttribute: string,
statusAttribute: string,
private viewConfig: BoardViewData,
private saveConfig: (newConfig: BoardViewData) => void,
private setBranchIdToEdit: (branchId: string | undefined) => void
) {};
) {
this.isRelationMode = statusAttribute.startsWith("~");
if (statusAttribute.startsWith("~") || statusAttribute.startsWith("#")) {
statusAttribute = statusAttribute.substring(1);
}
this.statusAttribute = statusAttribute;
};
async createNewItem(column: string, title: string) {
try {
@@ -42,8 +53,12 @@ export default class BoardApi {
}
async changeColumn(noteId: string, newColumn: string) {
if (this.isRelationMode) {
await attributes.setRelation(noteId, this.statusAttribute, newColumn);
} else {
await attributes.setLabel(noteId, this.statusAttribute, newColumn);
}
}
async addNewColumn(columnName: string) {
if (!columnName.trim()) {
@@ -60,22 +75,20 @@ export default class BoardApi {
// Add the new column to persisted data if it doesn't exist
const existingColumn = this.viewConfig.columns.find(col => col.value === columnName);
if (!existingColumn) {
if (existingColumn) return false;
this.viewConfig.columns.push({ value: columnName });
this.saveConfig(this.viewConfig);
}
return true;
}
async removeColumn(column: string) {
// Remove the value from the notes.
const noteIds = this.byColumn?.get(column)?.map(item => item.note.noteId) || [];
await executeBulkActions(noteIds, [
{
name: "deleteLabel",
labelName: this.statusAttribute
}
]);
const action: BulkAction = this.isRelationMode
? { name: "deleteRelation", relationName: this.statusAttribute }
: { name: "deleteLabel", labelName: this.statusAttribute }
await executeBulkActions(noteIds, [ action ]);
this.viewConfig.columns = (this.viewConfig.columns ?? []).filter(col => col.value !== column);
this.saveConfig(this.viewConfig);
}
@@ -84,13 +97,10 @@ export default class BoardApi {
const noteIds = this.byColumn?.get(oldValue)?.map(item => item.note.noteId) || [];
// Change the value in the notes.
await executeBulkActions(noteIds, [
{
name: "updateLabelValue",
labelName: this.statusAttribute,
labelValue: newValue
}
]);
const action: BulkAction = this.isRelationMode
? { name: "updateRelationTarget", relationName: this.statusAttribute, targetNoteId: newValue }
: { name: "updateLabelValue", labelName: this.statusAttribute, labelValue: newValue }
await executeBulkActions(noteIds, [ action ]);
// Rename the column in the persisted data.
for (const column of this.viewConfig.columns || []) {
@@ -167,8 +177,12 @@ export default class BoardApi {
removeFromBoard(noteId: string) {
const note = froca.getNoteFromCache(noteId);
if (!note) return;
if (this.isRelationMode) {
return attributes.removeOwnedRelationByName(note, this.statusAttribute);
} else {
return attributes.removeOwnedLabelByName(note, this.statusAttribute);
}
}
async moveWithinBoard(noteId: string, sourceBranchId: string, sourceIndex: number, targetIndex: number, sourceColumn: string, targetColumn: string) {
const targetItems = this.byColumn?.get(targetColumn) ?? [];

View File

@@ -6,7 +6,8 @@ import { BoardViewContext, TitleEditor } from ".";
import { ContextMenuEvent } from "../../../menus/context_menu";
import { openNoteContextMenu } from "./context_menu";
import { t } from "../../../services/i18n";
import PromotedAttributesDisplay from "../../attribute_widgets/PromotedAttributesDisplay";
import UserAttributesDisplay from "../../attribute_widgets/UserAttributesList";
import { useTriliumEvent } from "../../react/hooks";
export const CARD_CLIPBOARD_TYPE = "trilium/board-card";
@@ -40,6 +41,13 @@ export default function Card({
const [ isVisible, setVisible ] = useState(true);
const [ title, setTitle ] = useState(note.title);
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
const row = loadResults.getEntityRow("notes", note.noteId);
if (row) {
setTitle(row.title);
}
});
const handleDragStart = useCallback((e: DragEvent) => {
e.dataTransfer!.effectAllowed = 'move';
const data: CardDragData = { noteId: note.noteId, branchId: branch.branchId, fromColumn: column, index };
@@ -109,7 +117,7 @@ export default function Card({
title={t("board_view.edit-note-title")}
onClick={handleEdit}
/>
<PromotedAttributesDisplay note={note} ignoredAttributes={[api.statusAttribute]} />
<UserAttributesDisplay note={note} ignoredAttributes={[api.statusAttribute]} />
</>
) : (
<TitleEditor
@@ -119,7 +127,7 @@ export default function Card({
setTitle(newTitle);
}}
dismiss={() => api.dismissEditingTitle()}
multiline
mode="multiline"
/>
)}
</div>

View File

@@ -12,6 +12,7 @@ import Card, { CARD_CLIPBOARD_TYPE, CardDragData } from "./card";
import { JSX } from "preact/jsx-runtime";
import froca from "../../../services/froca";
import { DragData, TREE_CLIPBOARD_TYPE } from "../../note_tree";
import NoteLink from "../../react/NoteLink";
interface DragContext {
column: string;
@@ -27,12 +28,14 @@ export default function Column({
api,
onColumnHover,
isAnyColumnDragging,
isInRelationMode
}: {
columnItems?: { note: FNote, branch: FBranch }[];
isDraggingColumn: boolean,
api: BoardApi,
onColumnHover?: (index: number, mouseX: number, rect: DOMRect) => void,
isAnyColumnDragging?: boolean
isAnyColumnDragging?: boolean,
isInRelationMode: boolean
} & DragContext) {
const [ isVisible, setVisible ] = useState(true);
const { columnNameToEdit, setColumnNameToEdit, dropTarget, draggedCard, dropPosition } = useContext(BoardViewContext)!;
@@ -103,7 +106,11 @@ export default function Column({
>
{!isEditing ? (
<>
<span className="title">{column}</span>
<span className="title">
{isInRelationMode
? <NoteLink notePath={column} showNoteIcon />
: column}
</span>
<span className="counter-badge">{columnItems?.length ?? 0}</span>
<div className="spacer" />
<span
@@ -117,6 +124,7 @@ export default function Column({
currentValue={column}
save={newTitle => api.renameColumn(column, newTitle)}
dismiss={() => setColumnNameToEdit?.(undefined)}
mode={isInRelationMode ? "relation" : "normal"}
/>
)}
</h3>
@@ -180,7 +188,7 @@ function AddNewItem({ column, api }: { column: string, api: BoardApi }) {
placeholder={t("board_view.new-item-placeholder")}
save={(title) => api.createNewItem(column, title)}
dismiss={() => setIsCreatingNewItem(false)}
multiline isNewItem
mode="multiline" isNewItem
/>
)}
</div>

View File

@@ -57,7 +57,8 @@ export async function getBoardData(parentNote: FNote, groupByColumn: string, per
return {
byColumn,
newPersistedData
newPersistedData,
isInRelationMode: groupByColumn.startsWith("~")
};
}
@@ -70,7 +71,7 @@ async function recursiveGroupBy(branches: FBranch[], byColumn: ColumnMap, groupB
await recursiveGroupBy(note.getChildBranches(), byColumn, groupByColumn, includeArchived, seenNoteIds);
}
const group = note.getLabelValue(groupByColumn);
const group = note.getLabelOrRelation(groupByColumn);
if (!group || seenNoteIds.has(note.noteId)) {
continue;
}

View File

@@ -9,6 +9,12 @@
--card-padding: 0.6em;
}
body.mobile .board-view {
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
}
.board-view-container {
height: 100%;
display: flex;
@@ -31,6 +37,12 @@
flex-direction: column;
}
body.mobile .board-view-container .board-column {
width: 75vw;
max-width: 300px;
scroll-snap-align: center;
}
.board-view-container .board-column.drag-over {
border-color: var(--main-text-color);
background-color: var(--hover-item-background-color);
@@ -53,6 +65,11 @@
align-items: center;
}
.board-view-container .board-column h3 a {
text-decoration: none;
color: inherit;
}
.board-view-container .board-column h3 .counter-badge {
background-color: var(--muted-text-color);
color: var(--main-background-color);

View File

@@ -13,6 +13,8 @@ import Column from "./column";
import BoardApi from "./api";
import FormTextArea from "../../react/FormTextArea";
import FNote from "../../../entities/fnote";
import NoteAutocomplete from "../../react/NoteAutocomplete";
import toast from "../../../services/toast";
export interface BoardViewData {
columns?: BoardColumnData[];
@@ -42,10 +44,11 @@ interface BoardViewContextData {
export const BoardViewContext = createContext<BoardViewContextData | undefined>(undefined);
export default function BoardView({ note: parentNote, noteIds, viewConfig, saveConfig }: ViewModeProps<BoardViewData>) {
const [ statusAttribute ] = useNoteLabelWithDefault(parentNote, "board:groupBy", "status");
const [ statusAttributeWithPrefix ] = useNoteLabelWithDefault(parentNote, "board:groupBy", "status");
const [ includeArchived ] = useNoteLabelBoolean(parentNote, "includeArchived");
const [ byColumn, setByColumn ] = useState<ColumnMap>();
const [ columns, setColumns ] = useState<string[]>();
const [ isInRelationMode, setIsRelationMode ] = useState(false);
const [ draggedCard, setDraggedCard ] = useState<{ noteId: string, branchId: string, fromColumn: string, index: number } | null>(null);
const [ dropTarget, setDropTarget ] = useState<string | null>(null);
const [ dropPosition, setDropPosition ] = useState<{ column: string, index: number } | null>(null);
@@ -55,8 +58,8 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
const [ branchIdToEdit, setBranchIdToEdit ] = useState<string>();
const [ columnNameToEdit, setColumnNameToEdit ] = useState<string>();
const api = useMemo(() => {
return new Api(byColumn, columns ?? [], parentNote, statusAttribute, viewConfig ?? {}, saveConfig, setBranchIdToEdit );
}, [ byColumn, columns, parentNote, statusAttribute, viewConfig, saveConfig, setBranchIdToEdit ]);
return new Api(byColumn, columns ?? [], parentNote, statusAttributeWithPrefix, viewConfig ?? {}, saveConfig, setBranchIdToEdit );
}, [ byColumn, columns, parentNote, statusAttributeWithPrefix, viewConfig, saveConfig, setBranchIdToEdit ]);
const boardViewContext = useMemo<BoardViewContextData>(() => ({
api,
parentNote,
@@ -78,8 +81,9 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
]);
function refresh() {
getBoardData(parentNote, statusAttribute, viewConfig ?? {}, includeArchived).then(({ byColumn, newPersistedData }) => {
getBoardData(parentNote, statusAttributeWithPrefix, viewConfig ?? {}, includeArchived).then(({ byColumn, newPersistedData, isInRelationMode }) => {
setByColumn(byColumn);
setIsRelationMode(isInRelationMode);
if (newPersistedData) {
viewConfig = { ...newPersistedData };
@@ -94,7 +98,7 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
});
}
useEffect(refresh, [ parentNote, noteIds, viewConfig ]);
useEffect(refresh, [ parentNote, noteIds, viewConfig, statusAttributeWithPrefix ]);
const handleColumnDrop = useCallback((fromIndex: number, toIndex: number) => {
const newColumns = api.reorderColumn(fromIndex, toIndex);
@@ -110,7 +114,7 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
// Check if any changes affect our board
const hasRelevantChanges =
// React to changes in status attribute for notes in this board
loadResults.getAttributeRows().some(attr => attr.name === statusAttribute && noteIds.includes(attr.noteId!)) ||
loadResults.getAttributeRows().some(attr => attr.name === api.statusAttribute && noteIds.includes(attr.noteId!)) ||
// React to changes in note title
loadResults.getNoteIds().some(noteId => noteIds.includes(noteId)) ||
// React to changes in branches for subchildren (e.g., moved, added, or removed notes)
@@ -171,6 +175,7 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
<div className="column-drop-placeholder show" />
)}
<Column
isInRelationMode={isInRelationMode}
api={api}
column={column}
columnIndex={index}
@@ -185,14 +190,14 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
<div className="column-drop-placeholder show" />
)}
<AddNewColumn api={api} />
<AddNewColumn api={api} isInRelationMode={isInRelationMode} />
</div>
</BoardViewContext.Provider>
</div>
)
}
function AddNewColumn({ api }: { api: BoardApi }) {
function AddNewColumn({ api, isInRelationMode }: { api: BoardApi, isInRelationMode: boolean }) {
const [ isCreatingNewColumn, setIsCreatingNewColumn ] = useState(false);
const addColumnCallback = useCallback(() => {
@@ -209,22 +214,28 @@ function AddNewColumn({ api }: { api: BoardApi }) {
: (
<TitleEditor
placeholder={t("board_view.add-column-placeholder")}
save={(columnName) => api.addNewColumn(columnName)}
save={async (columnName) => {
const created = await api.addNewColumn(columnName);
if (!created) {
toast.showMessage(t("board_view.column-already-exists"), undefined, "bx bx-duplicate");
}
}}
dismiss={() => setIsCreatingNewColumn(false)}
isNewItem
mode={isInRelationMode ? "relation" : "normal"}
/>
)}
</div>
)
}
export function TitleEditor({ currentValue, placeholder, save, dismiss, multiline, isNewItem }: {
export function TitleEditor({ currentValue, placeholder, save, dismiss, mode, isNewItem }: {
currentValue?: string;
placeholder?: string;
save: (newValue: string) => void;
dismiss: () => void;
multiline?: boolean;
isNewItem?: boolean;
mode?: "normal" | "multiline" | "relation";
}) {
const inputRef = useRef<any>(null);
const focusElRef = useRef<Element>(null);
@@ -232,13 +243,11 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilin
const shouldDismiss = useRef(false);
useEffect(() => {
focusElRef.current = document.activeElement;
focusElRef.current = document.activeElement !== document.body ? document.activeElement : null;
inputRef.current?.focus();
inputRef.current?.select();
}, [ inputRef ]);
const Element = multiline ? FormTextArea : FormTextBox;
useEffect(() => {
if (dismissOnNextRefreshRef.current) {
dismiss();
@@ -246,31 +255,62 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilin
}
});
return (
<Element
inputRef={inputRef}
currentValue={currentValue ?? ""}
placeholder={placeholder}
autoComplete="trilium-title-entry" // forces the auto-fill off better than the "off" value.
rows={multiline ? 4 : undefined}
onKeyDown={(e: TargetedKeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {
const onKeyDown = (e: TargetedKeyboardEvent<HTMLInputElement | HTMLTextAreaElement> | KeyboardEvent) => {
if (e.key === "Enter" || e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
shouldDismiss.current = (e.key === "Escape");
if (focusElRef.current instanceof HTMLElement) {
shouldDismiss.current = (e.key === "Escape");
focusElRef.current.focus();
} else {
dismiss();
}
}
}}
onBlur={(newValue) => {
};
const onBlur = (newValue: string) => {
if (!shouldDismiss.current && newValue.trim() && (newValue !== currentValue || isNewItem)) {
save(newValue);
dismissOnNextRefreshRef.current = true;
} else {
dismiss();
}
};
if (mode !== "relation") {
const Element = mode === "multiline" ? FormTextArea : FormTextBox;
return (
<Element
inputRef={inputRef}
currentValue={currentValue ?? ""}
placeholder={placeholder}
autoComplete="trilium-title-entry" // forces the auto-fill off better than the "off" value.
rows={mode === "multiline" ? 4 : undefined}
onKeyDown={onKeyDown}
onBlur={onBlur}
/>
);
} else {
return (
<NoteAutocomplete
inputRef={inputRef}
noteId={currentValue ?? ""}
opts={{
hideAllButtons: true,
allowCreatingNotes: true
}}
onKeyDown={(e) => {
if (e.key === "Escape") {
dismiss();
}
}}
onBlur={() => dismiss()}
noteIdChanged={(newValue) => {
save(newValue);
dismiss();
}}
/>
);
}
}

View File

@@ -2,6 +2,7 @@ import FNote from "../../../entities/fnote";
import contextMenu, { ContextMenuEvent } from "../../../menus/context_menu";
import link_context_menu from "../../../menus/link_context_menu";
import branches from "../../../services/branches";
import froca from "../../../services/froca";
import { t } from "../../../services/i18n";
export function openCalendarContextMenu(e: ContextMenuEvent, noteId: string, parentNote: FNote) {
@@ -18,8 +19,20 @@ export function openCalendarContextMenu(e: ContextMenuEvent, noteId: string, par
title: t("calendar_view.delete_note"),
uiIcon: "bx bx-trash",
handler: async () => {
const branchId = parentNote.childToBranch[noteId];
await branches.deleteNotes([ branchId ], false, false);
const noteToDelete = await froca.getNote(noteId);
if (!noteToDelete) return;
let branchIdToDelete: string | null = null;
for (const parentBranch of noteToDelete.getParentBranches()) {
const parentNote = await parentBranch.getNote();
if (parentNote?.hasAncestor(parentNote.noteId)) {
branchIdToDelete = parentBranch.branchId;
}
}
if (branchIdToDelete) {
await branches.deleteNotes([ branchIdToDelete ], false, false);
}
}
}
],

View File

@@ -91,6 +91,7 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
const [ hideWeekends ] = useNoteLabelBoolean(note, "calendar:hideWeekends");
const [ weekNumbers ] = useNoteLabelBoolean(note, "calendar:weekNumbers");
const [ calendarView, setCalendarView ] = useNoteLabel(note, "calendar:view");
const [ initialDate ] = useNoteLabel(note, "calendar:initialDate");
const initialView = useRef(calendarView);
const viewSpacedUpdate = useSpacedUpdate(() => setCalendarView(initialView.current));
useResizeObserver(containerRef, () => calendarRef.current?.updateSize());
@@ -134,6 +135,7 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
height="90%"
nowIndicator
handleWindowResize={false}
initialDate={initialDate || undefined}
locale={locale}
{...editingProps}
eventDidMount={eventDidMount}

View File

@@ -100,9 +100,23 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
}
async closeThisNoteSplitCommand({ ntxId }: CommandListenerData<"closeThisNoteSplit">) {
if (ntxId) {
await appContext.tabManager.removeNoteContext(ntxId);
if (!ntxId) return;
const contexts = appContext.tabManager.noteContexts;
const currentIndex = contexts.findIndex((c) => c.ntxId === ntxId);
if (currentIndex === -1) return;
const isRemoveMainContext = !contexts[currentIndex].mainNtxId;
if (isRemoveMainContext && currentIndex + 1 <= contexts.length) {
const ntxIds = contexts.map((c) => c.ntxId).filter((c) => !!c) as string[];
this.triggerCommand("noteContextReorder", {
ntxIdsInOrder: ntxIds,
oldMainNtxId: ntxId,
newMainNtxId: ntxIds[currentIndex + 1]
});
}
await appContext.tabManager.removeNoteContext(ntxId);
}
async moveThisNoteSplitCommand({ ntxId, isMovingLeft }: CommandListenerData<"moveThisNoteSplit">) {
@@ -167,12 +181,16 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
splitService.delNoteSplitResizer(ntxIds);
}
contextsReopenedEvent({ ntxId, afterNtxId }: EventData<"contextsReopened">) {
if (ntxId === undefined || afterNtxId === undefined) {
// no single split reopened
return;
}
contextsReopenedEvent({ ntxId, mainNtxId, tabPosition, afterNtxId }: EventData<"contextsReopened">) {
if (ntxId !== undefined && afterNtxId !== undefined) {
this.$widget.find(`[data-ntx-id="${ntxId}"]`).insertAfter(this.$widget.find(`[data-ntx-id="${afterNtxId}"]`));
} else if (mainNtxId && tabPosition >= 0) {
const contexts = appContext.tabManager.noteContexts;
const nextIndex = contexts.findIndex(c => c.ntxId === mainNtxId);
const beforeNtxId = (nextIndex !== -1 && nextIndex + 1 < contexts.length) ? contexts[nextIndex + 1].ntxId : null;
this.$widget.find(`[data-ntx-id="${mainNtxId}"]`).insertBefore(this.$widget.find(`[data-ntx-id="${beforeNtxId}"]`));
}
}
async refresh() {

View File

@@ -1,43 +0,0 @@
import { t } from "../services/i18n";
import { useNoteContext, useTriliumEvent, useTriliumOption } from "./react/hooks";
import { useEffect, useState } from "preact/hooks";
import attributes from "../services/attributes";
import InfoBar from "./react/InfoBar";
import RawHtml from "./react/RawHtml";
import FNote from "../entities/fnote";
export default function OriginInfo() {
const { note } = useNoteContext();
const [link, setLink] = useState<string>();
function refresh() {
if (!note) return;
const pageUrl = getPageUrl(note);
if (!pageUrl) {
setLink(undefined);
return;
}
setLink(`<a href="${pageUrl}" class="external tn-link">${pageUrl}</a>`);
}
useEffect(refresh, [note]);
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
if (loadResults.getAttributeRows().find((attr) => attr.type === "label" && attr.name?.toString() === "pageUrl" && attributes.isAffecting(attr, note))) {
refresh();
}
});
return (
<InfoBar className="origin-info-widget" type="subtle" style={{ display: (!link) ? "none" : undefined }}>
{link && (
<RawHtml
html={`${t("note_properties.this_note_was_originally_taken_from")} ${link}`}
/>
)}
</InfoBar>
)
}
function getPageUrl(note: FNote) {
return note.getOwnedLabelValue("pageUrl");
}

View File

@@ -15,11 +15,13 @@ interface NoteAutocompleteProps {
opts?: Omit<Options, "container">;
onChange?: (suggestion: Suggestion | null) => void;
onTextChange?: (text: string) => void;
onKeyDown?: (e: KeyboardEvent) => void;
onBlur?: (newValue: string) => void;
noteIdChanged?: (noteId: string) => void;
noteId?: string;
}
export default function NoteAutocomplete({ id, inputRef: externalInputRef, text, placeholder, onChange, onTextChange, container, containerStyle, opts, noteId, noteIdChanged }: NoteAutocompleteProps) {
export default function NoteAutocomplete({ id, inputRef: externalInputRef, text, placeholder, onChange, onTextChange, container, containerStyle, opts, noteId, noteIdChanged, onKeyDown, onBlur }: NoteAutocompleteProps) {
const ref = useSyncedRef<HTMLInputElement>(externalInputRef);
useEffect(() => {
@@ -57,6 +59,12 @@ export default function NoteAutocomplete({ id, inputRef: externalInputRef, text,
if (onTextChange) {
$autoComplete.on("input", () => onTextChange($autoComplete[0].value));
}
if (onKeyDown) {
$autoComplete.on("keydown", (e) => e.originalEvent && onKeyDown(e.originalEvent));
}
if (onBlur) {
$autoComplete.on("blur", () => onBlur($autoComplete.getSelectedNoteId() ?? ""));
}
}, [opts, container?.current]);
useEffect(() => {

View File

@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from "preact/hooks";
import link, { ViewScope } from "../../services/link";
import { useImperativeSearchHighlighlighting } from "./hooks";
import { useImperativeSearchHighlighlighting, useTriliumEvent } from "./hooks";
interface NoteLinkOpts {
className?: string;
@@ -19,9 +19,11 @@ interface NoteLinkOpts {
export default function NoteLink({ className, notePath, showNotePath, showNoteIcon, style, noPreview, noTnLink, highlightedTokens, title, viewScope, noContextMenu }: NoteLinkOpts) {
const stringifiedNotePath = Array.isArray(notePath) ? notePath.join("/") : notePath;
const noteId = stringifiedNotePath.split("/").at(-1);
const ref = useRef<HTMLSpanElement>(null);
const [ jqueryEl, setJqueryEl ] = useState<JQuery<HTMLElement>>();
const highlightSearch = useImperativeSearchHighlighlighting(highlightedTokens);
const [ noteTitle, setNoteTitle ] = useState<string>();
useEffect(() => {
link.createLink(stringifiedNotePath, {
@@ -30,7 +32,7 @@ export default function NoteLink({ className, notePath, showNotePath, showNoteIc
showNoteIcon,
viewScope
}).then(setJqueryEl);
}, [ stringifiedNotePath, showNotePath, title, viewScope ]);
}, [ stringifiedNotePath, showNotePath, title, viewScope, noteTitle ]);
useEffect(() => {
if (!ref.current || !jqueryEl) return;
@@ -38,6 +40,16 @@ export default function NoteLink({ className, notePath, showNotePath, showNoteIc
highlightSearch(ref.current);
}, [ jqueryEl, highlightedTokens ]);
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
// React to note title changes, but only if the title is not overwritten.
if (!title && noteId) {
const entityRow = loadResults.getEntityRow("notes", noteId);
if (entityRow) {
setNoteTitle(entityRow.title);
}
}
});
if (style) {
jqueryEl?.css(style);
}

View File

@@ -0,0 +1,20 @@
import { t } from "../../services/i18n";
import { useNoteLabel } from "../react/hooks";
import { TabContext } from "./ribbon-interface";
/**
* TODO: figure out better name or conceptualize better.
*/
export default function NotePropertiesTab({ note }: TabContext) {
const [ pageUrl ] = useNoteLabel(note, "pageUrl");
return (
<div className="note-properties-widget" style={{ padding: "12px", color: "var(--muted-text-color)" }}>
{ pageUrl && (
<div style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{t("note_properties.this_note_was_originally_taken_from")} <a href={pageUrl} class="page-url external">{pageUrl}</a>
</div>
)}
</div>
)
}

View File

@@ -1,5 +1,6 @@
import ScriptTab from "./ScriptTab";
import EditedNotesTab from "./EditedNotesTab";
import NotePropertiesTab from "./NotePropertiesTab";
import NoteInfoTab from "./NoteInfoTab";
import SimilarNotesTab from "./SimilarNotesTab";
import FilePropertiesTab from "./FilePropertiesTab";
@@ -58,6 +59,13 @@ export const RIBBON_TAB_DEFINITIONS: TabConfiguration[] = [
show: ({ note }) => note?.type === "book" || note?.type === "search",
toggleCommand: "toggleRibbonTabBookProperties"
},
{
title: t("note_properties.info"),
icon: "bx bx-info-square",
content: NotePropertiesTab,
show: ({ note }) => !!note?.getLabelValue("pageUrl"),
activate: true
},
{
title: t("file_properties.title"),
icon: "bx bx-file",

View File

@@ -820,12 +820,15 @@ export default class TabRowWidget extends BasicWidget {
}
contextsReopenedEvent({ mainNtxId, tabPosition }: EventData<"contextsReopened">) {
if (!mainNtxId || !tabPosition) {
if (!mainNtxId || tabPosition < 0) {
// no tab reopened
return;
}
const tabEl = this.getTabById(mainNtxId)[0];
tabEl.parentNode?.insertBefore(tabEl, this.tabEls[tabPosition]);
if ( tabEl && tabEl.parentNode ){
tabEl.parentNode.insertBefore(tabEl, this.tabEls[tabPosition]);
}
}
updateTabById(ntxId: string | null) {

View File

@@ -7,7 +7,6 @@ import { useTriliumEvent } from "../react/hooks";
import { refToJQuerySelector } from "../react/react_utils";
export default function Doc({ note, viewScope, ntxId }: TypeWidgetProps) {
const [ html, setHtml ] = useState<string>();
const initialized = useRef<Promise<void> | null>(null);
const containerRef = useRef<HTMLDivElement>(null);
@@ -15,7 +14,7 @@ export default function Doc({ note, viewScope, ntxId }: TypeWidgetProps) {
if (!note) return;
initialized.current = renderDoc(note).then($content => {
setHtml($content.html());
containerRef.current?.replaceChildren(...$content);
});
}, [ note ]);
@@ -26,10 +25,9 @@ export default function Doc({ note, viewScope, ntxId }: TypeWidgetProps) {
});
return (
<RawHtmlBlock
containerRef={containerRef}
<div
ref={containerRef}
className={`note-detail-doc-content ck-content ${viewScope?.viewMode === "contextual-help" ? "contextual-help" : ""}`}
html={html}
/>
);
}

View File

@@ -1,15 +1,16 @@
import { useCallback, useEffect, useRef } from "preact/hooks";
import { TypeWidgetProps } from "./type_widget";
import { MindElixirData, MindElixirInstance, Operation, default as VanillaMindElixir } from "mind-elixir";
import { MindElixirData, MindElixirInstance, Operation, Options, default as VanillaMindElixir } from "mind-elixir";
import { HTMLAttributes, RefObject } from "preact";
// allow node-menu plugin css to be bundled by webpack
import nodeMenu from "@mind-elixir/node-menu";
import "mind-elixir/style";
import "@mind-elixir/node-menu/dist/style.css";
import "./MindMap.css";
import { useEditorSpacedUpdate, useNoteLabelBoolean, useSyncedRef, useTriliumEvent, useTriliumEvents } from "../react/hooks";
import { useEditorSpacedUpdate, useNoteLabelBoolean, useSyncedRef, useTriliumEvent, useTriliumEvents, useTriliumOption } from "../react/hooks";
import { refToJQuerySelector } from "../react/react_utils";
import utils from "../../services/utils";
import { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons";
const NEW_TOPIC_NAME = "";
@@ -21,6 +22,24 @@ interface MindElixirProps {
onChange?: () => void;
}
const LOCALE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, Options["locale"] | null> = {
ar: null,
cn: "zh_CN",
de: null,
en: "en",
en_rtl: "en",
es: "es",
fr: "fr",
it: "it",
ja: "ja",
pt: "pt",
pt_br: "pt",
ro: null,
ru: "ru",
tw: "zh_TW",
uk: null
};
export default function MindMap({ note, ntxId, noteContext }: TypeWidgetProps) {
const apiRef = useRef<MindElixirInstance>(null);
const containerRef = useRef<HTMLDivElement>(null);
@@ -110,12 +129,14 @@ export default function MindMap({ note, ntxId, noteContext }: TypeWidgetProps) {
function MindElixir({ containerRef: externalContainerRef, containerProps, apiRef: externalApiRef, onChange, editable }: MindElixirProps) {
const containerRef = useSyncedRef<HTMLDivElement>(externalContainerRef, null);
const apiRef = useRef<MindElixirInstance>(null);
const [ locale ] = useTriliumOption("locale");
function reinitialize() {
if (!containerRef.current) return;
const mind = new VanillaMindElixir({
el: containerRef.current,
locale: LOCALE_MAPPINGS[locale as DISPLAYABLE_LOCALE_IDS] ?? undefined,
editable
});
@@ -143,7 +164,7 @@ function MindElixir({ containerRef: externalContainerRef, containerProps, apiRef
if (data) {
apiRef.current?.init(data);
}
}, [ editable ]);
}, [ editable, locale ]);
// On change listener.
useEffect(() => {

View File

@@ -1,7 +1,7 @@
import { Excalidraw } from "@excalidraw/excalidraw";
import { TypeWidgetProps } from "../type_widget";
import "@excalidraw/excalidraw/index.css";
import { useNoteLabelBoolean } from "../../react/hooks";
import { useNoteLabelBoolean, useTriliumOption } from "../../react/hooks";
import { useCallback, useMemo, useRef } from "preact/hooks";
import { type ExcalidrawImperativeAPI, type AppState } from "@excalidraw/excalidraw/types";
import options from "../../../services/options";
@@ -9,6 +9,8 @@ import "./Canvas.css";
import { NonDeletedExcalidrawElement } from "@excalidraw/excalidraw/element/types";
import { goToLinkExt } from "../../../services/link";
import useCanvasPersistence from "./persistence";
import { LANGUAGE_MAPPINGS } from "./i18n";
import { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons";
// currently required by excalidraw, in order to allows self-hosting fonts locally.
// this avoids making excalidraw load the fonts from an external CDN.
@@ -21,6 +23,7 @@ export default function Canvas({ note, noteContext }: TypeWidgetProps) {
const documentStyle = window.getComputedStyle(document.documentElement);
return documentStyle.getPropertyValue("--theme-style")?.trim() as AppState["theme"];
}, []);
const [ locale ] = useTriliumOption("locale");
const persistence = useCanvasPersistence(note, noteContext, apiRef, themeStyle, isReadOnly);
/** Use excalidraw's native zoom instead of the global zoom. */
@@ -58,6 +61,7 @@ export default function Canvas({ note, noteContext }: TypeWidgetProps) {
detectScroll={false}
handleKeyboardGlobally={false}
autoFocus={false}
langCode={LANGUAGE_MAPPINGS[locale as DISPLAYABLE_LOCALE_IDS] ?? undefined}
UIOptions={{
canvasActions: {
saveToActiveFile: false,

View File

@@ -0,0 +1,29 @@
import { LOCALES } from "@triliumnext/commons";
import { readdirSync } from "fs";
import { join } from "path";
import { describe, expect, it } from "vitest";
import { LANGUAGE_MAPPINGS } from "./i18n.js";
const localeDir = join(__dirname, "../../../../../../node_modules/@excalidraw/excalidraw/dist/prod/locales");
describe("Canvas i18n", () => {
it("all languages are mapped correctly", () => {
// Read the node_modules dir to obtain all the supported locales.
const supportedLanguageCodes = new Set<string>();
for (const file of readdirSync(localeDir)) {
if (file.startsWith("percentages")) continue;
const match = file.match("^[a-z]{2,3}(?:-[A-Z]{2,3})?");
if (!match) continue;
supportedLanguageCodes.add(match[0]);
}
// Cross-check the locales.
for (const locale of LOCALES) {
if (locale.contentOnly || locale.devOnly) continue;
const languageCode = LANGUAGE_MAPPINGS[locale.id];
if (!supportedLanguageCodes.has(languageCode)) {
expect.fail(`Unable to find locale for ${locale.id} -> ${languageCode}.`)
}
}
});
});

View File

@@ -0,0 +1,19 @@
import type { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons";
export const LANGUAGE_MAPPINGS: Record<DISPLAYABLE_LOCALE_IDS, string | null> = {
ar: "ar-SA",
cn: "zh-CN",
de: "de-DE",
en: "en",
en_rtl: "en",
es: "es-ES",
fr: "fr-FR",
it: "it-IT",
ja: "ja-JP",
pt: "pt-PT",
pt_br: "pt-BR",
ro: "ro-RO",
ru: "ru-RU",
tw: "zh-TW",
uk: "uk-UA"
};

View File

@@ -203,7 +203,7 @@ function Font({ title, fontFamilyOption, fontSizeOption }: { title: string, font
<FormTextBoxWithUnit
name="tree-font-size"
type="number" min={50} max={200} step={10}
currentValue={fontSize} onChange={setFontSize}
currentValue={fontSize} onBlur={setFontSize}
unit={t("units.percentage")}
/>
</FormGroup>

View File

@@ -1,9 +1,10 @@
import { HTMLProps, RefObject, useEffect, useImperativeHandle, useRef, useState } from "preact/compat";
import { PopupEditor, ClassicEditor, EditorWatchdog, type WatchdogConfig, CKTextEditor, TemplateDefinition } from "@triliumnext/ckeditor5";
import { buildConfig, BuildEditorOptions } from "./config";
import { useLegacyImperativeHandlers, useSyncedRef } from "../../react/hooks";
import { useKeyboardShortcuts, useLegacyImperativeHandlers, useNoteContext, useSyncedRef, useTriliumOption } from "../../react/hooks";
import link from "../../../services/link";
import froca from "../../../services/froca";
import { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons";
export type BoxSize = "small" | "medium" | "full";
@@ -37,7 +38,11 @@ interface CKEditorWithWatchdogProps extends Pick<HTMLProps<HTMLDivElement>, "cla
export default function CKEditorWithWatchdog({ containerRef: externalContainerRef, content, contentLanguage, className, tabIndex, isClassicEditor, watchdogRef: externalWatchdogRef, watchdogConfig, onNotificationWarning, onWatchdogStateChange, onChange, onEditorInitialized, editorApi, templates }: CKEditorWithWatchdogProps) {
const containerRef = useSyncedRef<HTMLDivElement>(externalContainerRef, null);
const watchdogRef = useRef<EditorWatchdog>(null);
const [ uiLanguage ] = useTriliumOption("locale");
const [ editor, setEditor ] = useState<CKTextEditor>();
const { parentComponent } = useNoteContext();
useKeyboardShortcuts("text-detail", containerRef, parentComponent);
useImperativeHandle(editorApi, () => ({
hasSelection() {
@@ -153,6 +158,7 @@ export default function CKEditorWithWatchdog({ containerRef: externalContainerRe
const editor = await buildEditor(container, !!isClassicEditor, {
forceGplLicense: false,
isClassicEditor: !!isClassicEditor,
uiLanguage: uiLanguage as DISPLAYABLE_LOCALE_IDS,
contentLanguage: contentLanguage ?? null,
templates
});
@@ -177,7 +183,7 @@ export default function CKEditorWithWatchdog({ containerRef: externalContainerRe
watchdog.create(container);
return () => watchdog.destroy();
}, [ contentLanguage, templates ]);
}, [ contentLanguage, templates, uiLanguage ]);
// React to content changes.
useEffect(() => editor?.setData(content ?? ""), [ editor, content ]);

View File

@@ -32,11 +32,11 @@ body.mobile .note-detail-editable-text {
.note-detail-editable-text h5 { font-size: 1.1em; }
.note-detail-editable-text h6 { font-size: 1.0em; }
body.heading-style-markdown .note-detail-editable-text h2::before { content: "##\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h3::before { content: "###\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h4:not(.include-note-title)::before { content: "####\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h5::before { content: "#####\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h6::before { content: "######\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h2::before { content: "##\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h3::before { content: "###\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h4:not(.include-note-title)::before { content: "####\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h5::before { content: "#####\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-editable-text h6::before { content: "######\2004"; color: var(--muted-text-color); }
body.heading-style-underline .note-detail-editable-text h2 { border-bottom: 1px solid var(--main-border-color); }
body.heading-style-underline .note-detail-editable-text h3 { border-bottom: 1px solid var(--main-border-color); }

View File

@@ -196,14 +196,12 @@ export default function EditableText({ note, parentComponent, ntxId, noteContext
});
}
useKeyboardShortcuts("text-detail", containerRef, parentComponent);
useTriliumEvent("insertDateTimeToText", ({ ntxId: eventNtxId }) => {
if (eventNtxId !== ntxId) return;
const date = new Date();
const customDateTimeFormat = options.get("customDateTimeFormat");
const dateString = utils.formatDateTime(date, customDateTimeFormat);
console.log("Insert text ", ntxId, eventNtxId, dateString);
addTextToEditor(dateString);
});
useTriliumEvent("addTextToActiveEditor", ({ text }) => {

View File

@@ -6,12 +6,12 @@
.note-detail-readonly-text h5 { font-size: 1.1em; }
.note-detail-readonly-text h6 { font-size: 1.0em; }
body.heading-style-markdown .note-detail-readonly-text h1::before { content: "#\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h2::before { content: "##\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h3::before { content: "###\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h4:not(.include-note-title)::before { content: "####\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h5::before { content: "#####\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h6::before { content: "######\\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h1::before { content: "#\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h2::before { content: "##\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h3::before { content: "###\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h4:not(.include-note-title)::before { content: "####\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h5::before { content: "#####\2004"; color: var(--muted-text-color); }
body.heading-style-markdown .note-detail-readonly-text h6::before { content: "######\2004"; color: var(--muted-text-color); }
body.heading-style-underline .note-detail-readonly-text h1 { border-bottom: 1px solid var(--main-border-color); }
body.heading-style-underline .note-detail-readonly-text h2 { border-bottom: 1px solid var(--main-border-color); }

View File

@@ -17,6 +17,7 @@ import link from "../../../services/link";
import { formatCodeBlocks } from "../../../services/syntax_highlight";
import TouchBar, { TouchBarButton, TouchBarSpacer } from "../../react/TouchBar";
import appContext from "../../../components/app_context";
import { applyReferenceLinks } from "./read_only_helper";
export default function ReadOnlyText({ note, noteContext, ntxId }: TypeWidgetProps) {
const blob = useNoteBlob(note);
@@ -122,10 +123,3 @@ function applyMath(container: HTMLDivElement) {
renderMathInElement(equation, { trust: true });
}
}
function applyReferenceLinks(container: HTMLDivElement) {
const referenceLinks = container.querySelectorAll<HTMLDivElement>("a.reference-link");
for (const referenceLink of referenceLinks) {
link.loadReferenceLinkTitle($(referenceLink));
}
}

View File

@@ -0,0 +1,39 @@
import { DISPLAYABLE_LOCALE_IDS, LOCALES } from "@triliumnext/commons";
import { describe, expect, it, vi } from "vitest";
vi.mock('../../../services/options.js', () => ({
default: {
get(name: string) {
if (name === "allowedHtmlTags") return "[]";
return undefined;
},
getJson: () => []
}
}));
describe("CK config", () => {
it("maps all languages correctly", async () => {
const { buildConfig } = await import("./config.js");
for (const locale of LOCALES) {
if (locale.contentOnly || locale.devOnly) continue;
const config = await buildConfig({
uiLanguage: locale.id as DISPLAYABLE_LOCALE_IDS,
contentLanguage: locale.id,
forceGplLicense: false,
isClassicEditor: false,
templates: []
});
let expectedLocale = locale.id.substring(0, 2);
if (expectedLocale === "cn") expectedLocale = "zh";
if (expectedLocale === "tw") expectedLocale = "zh-tw";
if (locale.id !== "en") {
expect((config.language as any).ui).toMatch(new RegExp(`^${expectedLocale}`));
expect(config.translations, locale.id).toBeDefined();
expect(config.translations, locale.id).toHaveLength(2);
}
}
});
});

View File

@@ -1,5 +1,5 @@
import { ALLOWED_PROTOCOLS, MIME_TYPE_AUTO } from "@triliumnext/commons";
import { buildExtraCommands, type EditorConfig, PREMIUM_PLUGINS, TemplateDefinition } from "@triliumnext/ckeditor5";
import { ALLOWED_PROTOCOLS, DISPLAYABLE_LOCALE_IDS, MIME_TYPE_AUTO } from "@triliumnext/commons";
import { buildExtraCommands, type EditorConfig, getCkLocale, PREMIUM_PLUGINS, TemplateDefinition } from "@triliumnext/ckeditor5";
import { getHighlightJsNameForMime } from "../../../services/mime_types.js";
import options from "../../../services/options.js";
import { ensureMimeTypesForHighlighting, isSyntaxHighlightEnabled } from "../../../services/syntax_highlight.js";
@@ -17,6 +17,7 @@ export const OPEN_SOURCE_LICENSE_KEY = "GPL";
export interface BuildEditorOptions {
forceGplLicense: boolean;
isClassicEditor: boolean;
uiLanguage: DISPLAYABLE_LOCALE_IDS;
contentLanguage: string | null;
templates: TemplateDefinition[];
}
@@ -161,9 +162,8 @@ export async function buildConfig(opts: BuildEditorOptions): Promise<EditorConfi
htmlSupport: {
allow: JSON.parse(options.get("allowedHtmlTags"))
},
// This value must be kept in sync with the language defined in webpack.config.js.
language: "en",
removePlugins: getDisabledPlugins()
removePlugins: getDisabledPlugins(),
...await getCkLocale(opts.uiLanguage)
};
// Set up content language.

View File

@@ -0,0 +1,13 @@
import link from "../../../services/link";
export async function applyReferenceLinks(container: HTMLDivElement | HTMLElement) {
const referenceLinks = container.querySelectorAll<HTMLDivElement>("a.reference-link");
for (const referenceLink of referenceLinks) {
await link.loadReferenceLinkTitle($(referenceLink));
// Wrap in a <span> to match the design while in CKEditor.
const spanEl = document.createElement("span");
spanEl.replaceChildren(...referenceLink.childNodes);
referenceLink.replaceChildren(spanEl);
}
}

View File

@@ -35,7 +35,7 @@
"@triliumnext/commons": "workspace:*",
"@triliumnext/server": "workspace:*",
"copy-webpack-plugin": "13.0.1",
"electron": "38.6.0",
"electron": "38.7.0",
"@electron-forge/cli": "7.10.2",
"@electron-forge/maker-deb": "7.10.2",
"@electron-forge/maker-dmg": "7.10.2",

View File

@@ -13,7 +13,7 @@
"devDependencies": {
"@types/better-sqlite3": "7.6.13",
"@types/mime-types": "3.0.1",
"@types/yargs": "17.0.34"
"@types/yargs": "17.0.35"
},
"scripts": {
"dev": "tsx src/main.ts",

View File

@@ -12,7 +12,7 @@
"@triliumnext/desktop": "workspace:*",
"@types/fs-extra": "11.0.4",
"copy-webpack-plugin": "13.0.1",
"electron": "38.6.0",
"electron": "38.7.0",
"fs-extra": "11.3.2"
},
"scripts": {

View File

@@ -30,7 +30,7 @@
"node-html-parser": "7.0.1"
},
"devDependencies": {
"@anthropic-ai/sdk": "0.68.0",
"@anthropic-ai/sdk": "0.69.0",
"@braintree/sanitize-url": "7.1.1",
"@electron/remote": "2.1.3",
"@preact/preset-vite": "2.10.2",
@@ -81,7 +81,7 @@
"debounce": "3.0.0",
"debug": "4.4.3",
"ejs": "3.1.10",
"electron": "38.6.0",
"electron": "38.7.0",
"electron-debug": "4.1.0",
"electron-window-state": "5.0.3",
"escape-html": "1.0.3",
@@ -98,7 +98,7 @@
"http-proxy-agent": "7.0.2",
"https-proxy-agent": "7.0.6",
"i18next": "25.6.2",
"i18next-fs-backend": "2.6.0",
"i18next-fs-backend": "2.6.1",
"image-type": "6.0.0",
"ini": "6.0.0",
"is-animated": "2.0.2",
@@ -109,8 +109,8 @@
"mime-types": "3.0.1",
"multer": "2.0.2",
"normalize-strings": "1.1.1",
"ollama": "0.6.2",
"openai": "6.8.1",
"ollama": "0.6.3",
"openai": "6.9.0",
"rand-token": "1.0.1",
"safe-compare": "1.1.4",
"sanitize-filename": "1.6.3",

File diff suppressed because one or more lines are too long

View File

@@ -23,6 +23,29 @@
</ol>
<p>These attributes play a crucial role in organizing, categorizing, and
enhancing the functionality of notes.</p>
<h2>Types of attributes</h2>
<p>Conceptually there are two types of attributes (applying to both labels
and relations):</p>
<ol>
<li><strong>System attributes</strong>
<br>As the name suggest, these attributes have a special meaning since they
are interpreted by Trilium. For example the <code>color</code> attribute
will change the color of the note as displayed in the&nbsp;<a class="reference-link"
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>&nbsp;and links, and <code>iconClass</code> will
change the icon of a note.</li>
<li><strong>User-defined attributes</strong>
<br>These are free-form labels or relations that can be used by the user.
They can be used purely for categorization purposes (especially if combined
with&nbsp;<a class="reference-link" href="#root/_help_eIg8jdvaoNNd">Search</a>),
or they can be given meaning through the use of&nbsp;<a class="reference-link"
href="#root/_help_CdNpE2pqjmI6">Scripting</a>.</li>
</ol>
<p>In practice, Trilium makes no direct distinction of whether an attribute
is a system one or a user-defined one. A label or relation is considered
a system attribute if it matches one of the built-in names (e.g. like the
aforementioned <code>iconClass</code>). Keep this in mind when creating
&nbsp;<a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;in
order not to accidentally alter a system attribute (unless intended).</p>
<h2>Viewing the list of attributes</h2>
<p>Both the labels and relations for the current note are displayed in the <em>Owned Attributes</em> section
of the&nbsp;<a class="reference-link" href="#root/_help_BlN9DFI679QC">Ribbon</a>,
@@ -31,13 +54,14 @@
only be viewed.</p>
<p>In the list of attributes, labels are prefixed with the <code>#</code> character
whereas relations are prefixed with the <code>~</code> character.</p>
<h2>Attribute Definitions and Promoted Attributes</h2>
<p><a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;create
a form-like editing experience for attributes, which makes it easy to enhancing
the organization and management of attributes</p>
<h2>Multiplicity</h2>
<p>Attributes in Trilium can be "multi-valued", meaning multiple attributes
with the same name can co-exist.</p>
<h2>Attribute Definitions and Promoted Attributes</h2>
<p>Special labels create "label/attribute" definitions, enhancing the organization
and management of attributes. For more details, see&nbsp;<a class="reference-link"
href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>.</p>
with the same name can co-exist. This can be combined with&nbsp;<a class="reference-link"
href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;to easily add them.</p>
<h2>Attribute Inheritance</h2>
<p>Trilium supports attribute inheritance, allowing child notes to inherit
attributes from their parents. For more information, see&nbsp;<a class="reference-link"

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,31 +1,116 @@
<figure class="image image_resized" style="width:61.4%;">
<img style="aspect-ratio:938/368;" src="Promoted Attributes_image.png"
width="938" height="368">
</figure>
<p>Promoted attributes are <a href="#root/_help_zEY4DaJG4YT5">attributes</a> which
are considered important and thus are "promoted" onto the main note UI.
See example below:</p>
<p>
<img src="Promoted Attributes_promot.png">
</p>
<p>You can see the note having kind of form with several fields. Each of
these is just regular attribute, the only difference is that they appear
on the note itself.</p>
are displayed prominently in the UI which allow them to be easily viewed
and edited.</p>
<p>One way of seeing promoted attributes is as a kind of form with several
fields. Each field is just regular attribute, the only difference is that
they appear on the note itself.</p>
<p>Attributes can be pretty useful since they allow for querying and script
automation etc. but they are also inconveniently hidden. This allows you
to select few of the important ones and push them to the front of the user.</p>
<p>Now, how do we make attribute to appear on the UI?</p>
<h2>Attribute definition</h2>
<p>Attribute is always name-value pair where both name and value are strings.</p>
<p><em>Attribute definition</em> specifies how should this value be interpreted
- is it just string, or is it a date? Should we allow multiple values or
note? And importantly, should we <em>promote</em> the attribute or not?</p>
<p>
<img src="Promoted Attributes_image.png">
</p>
<p>You can notice tag attribute definition. These "definition" attributes
define how the "value" attributes should behave.</p>
<p>In order to have promoted attributes, there needs to be a way to define
them.</p>
<figure class="image image-style-align-right image_resized" style="width:38.82%;">
<img style="aspect-ratio:492/346;" src="1_Promoted Attributes_image.png"
width="492" height="346">
</figure>
<p>Technically, attributes are only name-value pairs where both name and
value are strings.</p>
<p>The <em>Attribute definition</em> specifies how should this value be interpreted:</p>
<ul>
<li>Is it just string, or is it a date?</li>
<li>Should we allow multiple values or note?</li>
<li>Should we <em>promote</em> the attribute or not?</li>
</ul>
<h2>Creating a new promoted attribute definition</h2>
<p>To create a new promoted attribute:</p>
<ol>
<li>Go to a note.</li>
<li>Go to <em>Owned Attributes</em> in the&nbsp;<a class="reference-link" href="#root/_help_BlN9DFI679QC">Ribbon</a>.</li>
<li>Press the + button.</li>
<li>Select either <em>Add new label definition</em> or <em>Add new relation definition</em>.</li>
<li>Select the name which will be name of the label or relation that will
be created when the promoted attribute is edited.</li>
<li>Ensure <em>Promoted</em> is checked in order to display it at the top of
notes.</li>
<li>Optionally, choose an <em>Alias</em> which will be displayed next to the
promoted attribute instead of the attribute name. Generally it's best to
choose a “user-friendly” name since it can contain spaces and other characters
which are not supported as attribute names.</li>
<li>Check <em>Inheritable</em> to apply it to this note and all its descendants.
To keep it only for the current note, un-check it.</li>
<li>Press “Save &amp; Close” to apply the changes.</li>
</ol>
<h2>How attribute definitions actually work</h2>
<p>When a new promoted attribute definition is created, it creates a corresponding
label prefixed with either <code>label</code> or <code>relation</code>, depending
on the definition type:</p><pre><code class="language-text-x-trilium-auto">#label:myColor(inheritable)="promoted,alias=Color,multi,color"</code></pre>
<p>The only purpose of the attribute definition is to set up a template.
If the attribute was marked as promoted, then it's also displayed to the
user for easy editing.</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<figure class="image">
<img style="aspect-ratio:495/157;" src="2_Promoted Attributes_image.png"
width="495" height="157">
</figure>
</td>
<td>Notice how the promoted attribute definition only creates a “Due date”
box above the text content.</td>
</tr>
<tr>
<td>
<figure class="image">
<img style="aspect-ratio:663/160;" src="3_Promoted Attributes_image.png"
width="663" height="160">
</figure>
</td>
<td>Once a value is set by the user, a new label (or relation, depending on
the type) is created. The name of the attribute matches one set when creating
the promoted attribute.</td>
</tr>
</tbody>
</table>
<p>So there's one attribute for value and one for definition. But notice
how definition attribute is <a href="#root/_help_bwZpz2ajCEwO">Inheritable</a>,
meaning that it's also applied to all descendant note. So in a way, this
definition is used for the whole subtree while "value" attributes are applied
only for this note.</p>
how an definition attribute can be made <a href="#root/_help_bwZpz2ajCEwO">Inheritable</a>,
meaning that it's also applied to all descendant notes. In this case, the
definition used for the whole sub-tree while "value" attributes are for
each not individually.</p>
<h2>Using system attributes</h2>
<p>It's possible to create promoted attributes out of system attributes,
to be able to easily alter them.</p>
<p>Here are a few practical examples:</p>
<ul>
<li><a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>&nbsp;already
make use of this practice, for example:
<ul>
<li>Calendars add “Start Date”, “End Date”, “Start Time” and “End Time” as
promoted attributes. These map to system attributes such as <code>startDate</code> which
are then interpreted by the calendar view.</li>
<li><a class="reference-link" href="#root/_help_zP3PMqaG71Ct">Presentation</a>&nbsp;adds
a “Background” promoted attribute for each of the slide to easily be able
to customize.</li>
</ul>
</li>
<li>The Trilium documentation (which is edited in Trilium) uses a promoted
attribute to be able to easily edit the <code>#shareAlias</code> (see&nbsp;
<a
class="reference-link" href="#root/_help_R9pX4DGra2Vt">Sharing</a>) in order to form clean URLs.</li>
<li>If you always edit a particular system attribute such as <code>#color</code>,
simply create a promoted attribute for it to make it easier.</li>
</ul>
<h3>Inverse relation</h3>
<p>Some relations always occur in pairs - my favorite example is on the family.
If you have a note representing husband and note representing wife, then
@@ -33,7 +118,7 @@
This is bidirectional relationship - meaning that if a relation is pointing
from husband to wife then there should be always another relation pointing
from wife to husband.</p>
<p>Another example is with parent - child relationship. Again these always
<p>Another example is with parent-child relationship. Again these always
occur in pairs, but in this case it's not exact same relation - the one
going from parent to child might be called <code>isParentOf</code> and the
other one going from child to parent might be called <code>isChildOf</code>.</p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -112,6 +112,12 @@
<td>When present (regardless of value), it will show the number of the week
on the calendar.</td>
</tr>
<tr>
<td><code>#calendar:initialDate</code>
</td>
<td>Change the date the calendar opens on. When not present, the calendar
opens on the current date.</td>
</tr>
<tr>
<td><code>#calendar:view</code>
</td>

View File

@@ -1,8 +1,9 @@
<aside class="admonition important">
<p>Starting with Trilium v0.97.0, the geo map has been converted from a standalone
<a
href="#root/_help_KSZ04uQ2D1St">note type</a>to a type of view for the&nbsp;<a class="reference-link"
href="#root/_help_0ESUbbAxVnoK">Note List</a>.&nbsp;</p>
<p><a class="reference-link" href="#root/_help_zEY4DaJG4YT5">Attributes</a><a class="reference-link"
href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a><a class="reference-link"
href="#root/_help_zEY4DaJG4YT5">Attributes</a>Starting with Trilium v0.97.0,
the geo map has been converted from a standalone <a href="#root/_help_KSZ04uQ2D1St">note type</a> to
a type of view for the&nbsp;<a class="reference-link" href="#root/_help_0ESUbbAxVnoK">Note List</a>.&nbsp;</p>
</aside>
<figure class="image image-style-align-center">
<img style="aspect-ratio:892/675;" src="9_Geo Map_image.png"
@@ -68,7 +69,7 @@
<td>To create a marker, first navigate to the desired point on the map. Then
press the
<img src="10_Geo Map_image.png">button in the&nbsp;<a href="#root/_help_XpOYSgsLkTJy">Floating buttons</a>&nbsp;(top-right)
area.&nbsp;&nbsp;&nbsp;
area.&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>If the button is not visible, make sure the button section is visible
by pressing the chevron button (
@@ -82,7 +83,7 @@
width="1730" height="416">
</td>
<td>Once pressed, the map will enter in the insert mode, as illustrated by
the notification.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
the notification.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>Simply click the point on the map where to place the marker, or the Escape
key to cancel.</td>
@@ -112,7 +113,8 @@
<li>Right click anywhere on the map, where to place the newly created marker
(and corresponding note).</li>
<li>Select <em>Add a marker at this location</em>.</li>
<li>Enter the name of the newly created note.</li>
<li>Enter the name of the ne<a class="reference-link" href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>wly
created note.</li>
<li>The map should be updated with the new marker.</li>
</ol>
<h3>Adding an existing note on note from the note tree</h3>
@@ -221,10 +223,10 @@ width="1288" height="278">
</figure>
</td>
<td>Go to Google Maps on the web and look for a desired location, right click
on it and a context menu will show up.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
on it and a context menu will show up.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>Simply click on the first item displaying the coordinates and they will
be copied to clipboard.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
be copied to clipboard.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>Then paste the value inside the text box into the <code>#geolocation</code> attribute
of a child note of the map (don't forget to surround the value with a <code>"</code> character).</td>
@@ -282,7 +284,7 @@ width="1288" height="278">
width="696" height="480">
</td>
<td>The address will be visible in the top-left of the screen, in the place
of the search bar.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
of the search bar.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>Select the coordinates and copy them into the clipboard.</td>
</tr>
@@ -339,7 +341,7 @@ width="1288" height="278">
width="620" height="530">
</figure>
</td>
<td>When going back to the map, the track should now be visible.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<td>When going back to the map, the track should now be visible.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<br>The start and end points of the track are indicated by the two blue markers.</td>
</tr>

View File

@@ -1,5 +1,5 @@
<figure class="image">
<img style="aspect-ratio:918/248;" src="Kanban Board_image.png"
<img style="aspect-ratio:918/248;" src="2_Kanban Board_image.png"
width="918" height="248">
</figure>
<p>The Board view presents sub-notes in columns for a Kanban-like experience.
@@ -70,7 +70,22 @@
<li>If there are many notes within the column, move the mouse over the column
and use the mouse wheel to scroll.</li>
</ul>
<h2>Keyboard interaction</h2>
<h3>Working with the note tree</h3>
<p>It's also possible to add items on the board using the&nbsp;<a class="reference-link"
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>.</p>
<ol>
<li>Select the desired note in the&nbsp;<a class="reference-link" href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>.</li>
<li>Hold the mouse on the note and drag it to the to the desired column.</li>
</ol>
<p>This works for:</p>
<ul>
<li>Notes that are not children of the board, case in which a <a href="#root/_help_IakOLONlIfGI">clone</a> will
be created.</li>
<li>Notes that are children of the board, but not yet assigned on the board.</li>
<li>Notes that are children of the board, case in which they will be moved
to the new column.</li>
</ul>
<h3>Keyboard interaction</h3>
<p>The board view has mild support for keyboard-based navigation:</p>
<ul>
<li>Use <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> to navigate between
@@ -82,16 +97,81 @@
<li>To dismiss a rename of a note or a column, press <kbd>Escape</kbd>.</li>
</ul>
<h2>Configuration</h2>
<h3>Grouping by another attribute</h3>
<h3>Displaying custom attributes</h3>
<figure class="image image-style-align-center">
<img style="aspect-ratio:531/485;" src="Kanban Board_image.png"
width="531" height="485">
</figure>
<p>Note attributes can be displayed on the board to enhance it with custom
information such as adding a Due date for your tasks.</p>
<p>This feature works exclusively via attribute definitions (<a class="reference-link"
href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>). The easiest way to
add these is:</p>
<ol>
<li>Go to board note.</li>
<li>In the ribbon select <em>Owned Attributes</em> → plus button → <em>Add new label/relation definition</em>.</li>
<li>Configure the attribute as desired.</li>
<li>Check <em>Inheritable</em> to make it applicable to child notes automatically.</li>
</ol>
<p>After creating the attribute, click on a note and fill in the promoted
attributes which should then reflect inside the board.</p>
<p>Of note:</p>
<ul>
<li>Both promoted and non-promoted attribute definitions are supported. The
only difference is that non-promoted attributes don't have an “Alias” for
assigning a custom name.</li>
<li>Both “Single value” and “Multi value” attributes are supported. In case
of multi-value, a badge is displayed for every instance of the attribute.</li>
<li>All label types are supported, including dates, booleans and URLs.</li>
<li>Relation attributes are also supported as well, showing a link with the
target note title and icon.</li>
<li>Currently, it's not possible to adjust which promoted attributes are displayed,
since all promoted attributes will be displayed (except the <code>board:groupBy</code> one).
There are plans to improve upon this being able to hide promoted attributes
individually.</li>
</ul>
<h3>Grouping by another label</h3>
<p>By default, the label used to group the notes is <code>#status</code>.
It is possible to use a different label if needed by defining a label named <code>#board:groupBy</code> with
the value being the attribute to use (without <code>#</code> attribute prefix).</p>
<aside
class="admonition note">
<p>It's currently not possible to set a relation as the grouping criteria.
There are plans to add support for it.</p>
</aside>
<h2>Limitations</h2>
<ul>
<li>It is not possible yet to use group by a relation, only by label.</li>
</ul>
the value being the attribute to use (with or without <code>#</code> attribute
prefix).</p>
<h3>Grouping by relations</h3>
<figure class="image image-style-align-right">
<img style="aspect-ratio:535/245;" src="1_Kanban Board_image.png"
width="535" height="245">
</figure>
<p>A more advanced use-case is grouping by <a href="#root/_help_Cq5X6iKQop6R">Relations</a>.</p>
<p>During this mode:</p>
<ul>
<li>The columns represent the <em>target notes</em> of a relation.</li>
<li>When creating a new column, a note is selected instead of a column name.</li>
<li>The column icon will match the target note.</li>
<li>Moving notes between columns will change its relation.</li>
<li>Renaming an existing column will change the target note of all the notes
in that column.</li>
</ul>
<p>Using relations instead of labels has some benefits:</p>
<ul>
<li>The status/grouping of the notes is visible outside the Kanban board,
for example on the&nbsp;<a class="reference-link" href="#root/_help_bdUJEHsAPYQR">Note Map</a>.</li>
<li>Columns can have icons.</li>
<li>Renaming columns is less intensive since it simply involves changing the
note title of the target note instead of having to do a bulk rename.</li>
</ul>
<p>To do so:</p>
<ol>
<li>
<p>First, create a Kanban board from scratch and not a template:</p>
</li>
<li>
<p>Assign <code>#viewType=board #hidePromotedAttributes</code> to emulate the
default template.</p>
</li>
<li>
<p>Set <code>#board:groupBy</code> to the name of a relation to group by, <strong>including the</strong> <code>**~**</code> <strong>prefix</strong> (e.g. <code>~status</code>).</p>
</li>
<li>
<p>Optionally, use&nbsp;<a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;for
easy status change within the note:</p><pre><code class="language-text-x-trilium-auto">#relation:status(inheritable)="promoted,alias=Status,single"</code></pre>
</li>
</ol>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -135,7 +135,7 @@ docker run -d --name trilium -p 8080:8080 --user $(id -u):$(id -g) -v ~/trilium-
(default: <code>/home/node/trilium-data</code>)</li>
</ul>
<p>For a complete list of configuration environment variables (network settings,
authentication, sync, etc.), see <a class="reference-link" href="#root/_help_dmi3wz9muS2O">Configuration (config.ini or environment variables)</a>.</p>
authentication, sync, etc.), see&nbsp;<a class="reference-link" href="#root/_help_Gzjqa934BdH4">Configuration (config.ini or environment variables)</a>.</p>
<h3>Volume Permissions</h3>
<p>If you encounter permission issues with the data volume, ensure that:</p>
<ol>

View File

@@ -0,0 +1,48 @@
<p>Configure Traefik proxy and HTTPS. See <a href="https://github.com/TriliumNext/Trilium/issues/7768#issuecomment-3539165814">#7768</a> for
reference</p>
<h3>Build the docker-compose file</h3>
<p>Setting up Traefik as reverse proxy requires setting the following labels:</p><pre><code class="language-text-x-yaml"> labels:
- traefik.enable=true
- traefik.http.routers.trilium.entrypoints=https
- traefik.http.routers.trilium.rule=Host(`trilium.mydomain.tld`)
- traefik.http.routers.trilium.tls=true
- traefik.http.routers.trilium.service=trilium
- traefik.http.services.trilium.loadbalancer.server.port=8080
# scheme must be HTTP instead of the usual HTTPS because Trilium listens on HTTP internally
- traefik.http.services.trilium.loadbalancer.server.scheme=http
- traefik.docker.network=proxy
# forward HTTP to HTTPS
- traefik.http.routers.trilium.middlewares=trilium-headers@docker
- traefik.http.middlewares.trilium-headers.headers.customrequestheaders.X-Forwarded-Proto=https</code></pre>
<h3>Setup needed environment variables</h3>
<p>After setting up a reverse proxy, make sure to configure the&nbsp;<a class="reference-link"
href="Trusted%20proxy.md">[missing note]</a>.</p>
<h3>Example <code>docker-compose.yaml</code></h3><pre><code class="language-text-x-yaml">services:
trilium:
image: triliumnext/trilium
container_name: trilium
networks:
- traefik-proxy
environment:
- TRILIUM_NETWORK_TRUSTEDREVERSEPROXY=my-traefik-host-ip # e.g., 172.18.0.0/16
volumes:
- /path/to/data:/home/node/trilium-data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels:
- traefik.enable=true
- traefik.http.routers.trilium.entrypoints=https
- traefik.http.routers.trilium.rule=Host(`trilium.mydomain.tld`)
- traefik.http.routers.trilium.tls=true
- traefik.http.routers.trilium.service=trilium
- traefik.http.services.trilium.loadbalancer.server.port=8080
# scheme must be HTTP instead of the usual HTTPS because of how trilium works
- traefik.http.services.trilium.loadbalancer.server.scheme=http
- traefik.docker.network=traefik-proxy
# Tell Trilium the original request was HTTPS
- traefik.http.routers.trilium.middlewares=trilium-headers@docker
- traefik.http.middlewares.trilium-headers.headers.customrequestheaders.X-Forwarded-Proto=https
networks:
traefik-proxy:
external: true</code></pre>

View File

@@ -256,7 +256,9 @@
"multi-factor-authentication-title": "Autentificare multi-factor",
"ai-llm-title": "AI/LLM",
"localization": "Limbă și regiune",
"inbox-title": "Inbox"
"inbox-title": "Inbox",
"command-palette": "Deschide paleta de comenzi",
"zen-mode": "Mod zen"
},
"notes": {
"new-note": "Notiță nouă",
@@ -274,7 +276,8 @@
"export_filter": "Document PDF (*.pdf)",
"unable-to-export-message": "Notița curentă nu a putut fi exportată ca PDF.",
"unable-to-export-title": "Nu s-a putut exporta ca PDF",
"unable-to-save-message": "Nu s-a putut scrie fișierul selectat. Încercați din nou sau selectați altă destinație."
"unable-to-save-message": "Nu s-a putut scrie fișierul selectat. Încercați din nou sau selectați altă destinație.",
"unable-to-print": "Nu s-a putut imprima notița"
},
"tray": {
"bookmarks": "Semne de carte",
@@ -427,7 +430,8 @@
"presentation": "Prezentare",
"presentation_slide": "Slide de prezentare",
"presentation_slide_first": "Primul slide",
"presentation_slide_second": "Al doilea slide"
"presentation_slide_second": "Al doilea slide",
"background": "Fundal"
},
"sql_init": {
"db_not_initialized_desktop": "Baza de date nu este inițializată, urmați instrucțiunile de pe ecran.",

View File

@@ -5,6 +5,7 @@ import BBranch from "../becca/entities/bbranch.js";
import BNote from "../becca/entities/bnote.js";
import tree from "./tree.js";
import cls from "./cls.js";
import { buildNote } from "../test/becca_easy_mocking.js";
describe("Tree", () => {
let rootNote!: NoteBuilder;
@@ -73,4 +74,43 @@ describe("Tree", () => {
expect(order).toStrictEqual(expectedOrder);
}
});
it("pins to the top and bottom", () => {
const note = buildNote({
children: [
{ title: "bottom", "#bottom": "" },
{ title: "5" },
{ title: "3" },
{ title: "2" },
{ title: "1" },
{ title: "top", "#top": "" }
],
"#sorted": ""
});
cls.init(() => {
tree.sortNotesIfNeeded(note.noteId);
});
const orderedTitles = note.children.map((child) => child.title);
expect(orderedTitles).toStrictEqual([ "top", "1", "2", "3", "5", "bottom" ]);
});
it("pins to the top and bottom in reverse order", () => {
const note = buildNote({
children: [
{ title: "bottom", "#bottom": "" },
{ title: "1" },
{ title: "2" },
{ title: "3" },
{ title: "5" },
{ title: "top", "#top": "" }
],
"#sorted": "",
"#sortDirection": "desc"
});
cls.init(() => {
tree.sortNotesIfNeeded(note.noteId);
});
const orderedTitles = note.children.map((child) => child.title);
expect(orderedTitles).toStrictEqual([ "top", "5", "3", "2", "1", "bottom" ]);
});
});

View File

@@ -136,8 +136,8 @@ function sortNotes(parentNoteId: string, customSortBy: string = "title", reverse
const topBEl = fetchValue(b, "top");
if (topAEl !== topBEl) {
if (topAEl === null) return 1;
if (topBEl === null) return -1;
if (topAEl === null) return reverse ? -1 : 1;
if (topBEl === null) return reverse ? 1 : -1;
// since "top" should not be reversible, we'll reverse it once more to nullify this effect
return compare(topAEl, topBEl) * (reverse ? -1 : 1);
@@ -147,8 +147,8 @@ function sortNotes(parentNoteId: string, customSortBy: string = "title", reverse
const bottomBEl = fetchValue(b, "bottom");
if (bottomAEl !== bottomBEl) {
if (bottomAEl === null) return -1;
if (bottomBEl === null) return 1;
if (bottomAEl === null) return reverse ? 1 : -1;
if (bottomBEl === null) return reverse ? -1 : 1;
// since "bottom" should not be reversible, we'll reverse it once more to nullify this effect
return compare(bottomBEl, bottomAEl) * (reverse ? -1 : 1);

View File

@@ -342,8 +342,11 @@ async function registerGlobalShortcuts() {
return;
}
// window may be hidden / not in focus
if (action.actionName === "toggleTray") {
targetWindow.focus();
} else {
showAndFocusWindow(targetWindow);
}
targetWindow.webContents.send("globalShortcut", action.actionName);
})

View File

@@ -14,7 +14,7 @@
"preact": "10.27.2",
"preact-iso": "2.11.0",
"preact-render-to-string": "6.6.3",
"react-i18next": "16.3.1"
"react-i18next": "16.3.3"
},
"devDependencies": {
"@preact/preset-vite": "2.10.2",

View File

@@ -1,6 +1,20 @@
{
"hero_section": {
"github": "깃허브",
"dockerhub": "도커 허브"
"dockerhub": "도커 허브",
"get_started": "시작하기",
"title": "생각을 정리하고, 개인 지식 기반을 구축하세요.",
"subtitle": "Trilium은 개인 지식 베이스를 정리하고 노트를 작성하는 오픈소스 솔루션입니다. 데스크톱에서 로컬로 사용하거나, 자체 호스팅 서버와 동기화하여 어디에서나 노트를 보관할 수 있습니다.",
"screenshot_alt": "Trilium Notes 데스크톱 애플리케이션의 스크린샷"
},
"get-started": {
"title": "시작하기",
"desktop_title": "데스크탑 애플리케이션 내려받기 (v{{version}})",
"older_releases": "오래된 릴리즈 보기",
"architecture": "아키텍쳐:",
"server_title": "여러 기기에서 액세스할 수 있는 서버 설정"
},
"download_now": {
"text": "지금 내려받기 "
}
}

View File

@@ -51,7 +51,8 @@
"mermaid_description": "Creați diagrame precum flowchart-uri, diagrame de secvență sau de clase, Gantt și multe altele, folosind sintaxa Mermaid.",
"mindmap_title": "Hartă mentală",
"mindmap_description": "Organizați-vă gândurile vizual sau organizați o sesiune de brainstorming.",
"others_list": "și altele: <0>hartă a notițelor</0>, <1>hartă a relațiilor</1>, <2>căutări salvate</2>, <3>randare a notițelor</3>, și <4>vizualizări web</4>."
"others_list": "și altele: <0>hartă a notițelor</0>, <1>hartă a relațiilor</1>, <2>căutări salvate</2>, <3>randare a notițelor</3>, și <4>vizualizări web</4>.",
"title": "Multiple modalități de a reprezenta informația"
},
"extensibility_benefits": {
"title": "Partajare și extensibilitate",
@@ -72,7 +73,10 @@
"board_title": "Tabelă Kanban",
"board_description": "Organizați-vă sarcinile sau proiectele într-o tabelă Kanban cu o modalitate ușoară de a adăuga elemente și coloane noi și schimbarea stării acestora prin glisare cu mouse-ul.",
"geomap_title": "Hartă geografică",
"geomap_description": "Planificați-vă vacanțele sau marcați-vă punctele de interes direct pe o hartă geografică. Afișați traseele GPX înregistrate pentru a putea urmări itinerarii."
"geomap_description": "Planificați-vă vacanțele sau marcați-vă punctele de interes direct pe o hartă geografică. Afișați traseele GPX înregistrate pentru a putea urmări itinerarii.",
"title": "Colecții",
"presentation_title": "Prezentare",
"presentation_description": "Organizați informația în diapozitive și prezentați-le pe tot ecranul, cu tranziții fine. Diapozitivele pot fi ulterior exportate ca PDF pentru o partajare ușoară."
},
"faq": {
"title": "Întrebări frecvente",

View File

@@ -1,6 +1,6 @@
{
"formatVersion": 2,
"appVersion": "0.99.4",
"appVersion": "0.99.5",
"files": [
{
"isClone": false,
@@ -110,6 +110,13 @@
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "4nwtTJyjNDKd",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
@@ -117,13 +124,6 @@
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "4nwtTJyjNDKd",
"isInheritable": false,
"position": 30
},
{
"type": "label",
"name": "shareAlias",
@@ -1263,10 +1263,17 @@
{
"type": "relation",
"name": "internalLink",
"value": "zdQzavvHDl1k",
"value": "ccIoz7nqgDRK",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "zdQzavvHDl1k",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "iconClass",
@@ -1280,13 +1287,6 @@
"value": "releasing",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "ccIoz7nqgDRK",
"isInheritable": false,
"position": 50
}
],
"format": "markdown",
@@ -1961,6 +1961,13 @@
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "lXjOyKpUSKgE",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "iconClass",
@@ -2071,6 +2078,34 @@
"format": "markdown",
"dataFileName": "Server translations.md",
"attachments": []
},
{
"isClone": false,
"noteId": "lXjOyKpUSKgE",
"notePath": [
"jdjRLhLV3TtI",
"yeqU0zo0ZQ83",
"TLXJwBDo8Rdv",
"lXjOyKpUSKgE"
],
"title": "Adding a new locale",
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "new-locale",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Adding a new locale.md",
"attachments": []
}
]
},

View File

@@ -27,11 +27,7 @@ Follow the <a class="reference-link" href="Internationalisation%20%20Translatio
### Adding a new locale
To add a new locale, go to `src/public/translations` with your favorite text editor and copy the `en` directory.
Rename the copy to the ISO code (e.g. `fr`, `ro`) of the language being translated.
Translations with a country-language combination, using their corresponding ISO code (e.g. `fr_FR`, `fr_BE`), has not been tested yet.
See <a class="reference-link" href="Internationalisation%20%20Translations/Adding%20a%20new%20locale.md">Adding a new locale</a>.
### Changing the language

View File

@@ -0,0 +1,11 @@
# Adding a new locale
Once the Weblate translations for a single language have reached ~50% in coverage, it's time to add it to the application.
To do so:
1. In `packages/commons` look for `i18n.ts` and add a new entry to `UNSORTED_LOCALES` for the language.
2. In `apps/server` look for `services/i18n.ts` and add a mapping for the new language in `DAYJS_LOADER`. Sort the entire list.
3. In `apps/client`, look for `collections/calendar/index.tsx` and modify `LOCALE_MAPPINGS` to add support to the new language.
4. In `apps/client`, look for `widgets/type_widgets/canvas/i18n.ts` and modify `LANGUAGE_MAPPINGS`. A unit test ensures that the language is actually loadable.
5. In `apps/client`, look for `widgets/type_widgets/MindMap.tsx` and modify `LOCALE_MAPPINGS`. The type definitions should already validate if the new value is supported by Mind Elixir.
6. In `packages/ckeditor5`, look for `i18n.ts` and modify `LOCALE_MAPPINGS`. The import validation should already check if the new value is supported by CKEditor, and there's also a test to ensure it.

View File

@@ -1,5 +1,5 @@
# Documentation
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/E6pFkO6VwPFI/Documentation_image.png" width="205" height="162">
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/eyrnitqBQ2w6/Documentation_image.png" width="205" height="162">
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.

51
docs/README-ko.md vendored
View File

@@ -9,7 +9,7 @@
<hr />
# Trilium Notes
# 트릴리움 노트
![GitHub Sponsors](https://img.shields.io/github/sponsors/eliandoran)
![LiberaPay patrons](https://img.shields.io/liberapay/patrons/ElianDoran)\
@@ -20,36 +20,32 @@ releases)](https://img.shields.io/github/downloads/triliumnext/trilium/total)\
[![Translation
status](https://hosted.weblate.org/widget/trilium/svg-badge.svg)](https://hosted.weblate.org/engage/trilium/)
[English](./README.md) | [Chinese (Simplified)](./docs/README-ZH_CN.md) |
[Chinese (Traditional)](./docs/README-ZH_TW.md) | [Russian](./docs/README-ru.md)
| [Japanese](./docs/README-ja.md) | [Italian](./docs/README-it.md) |
[Spanish](./docs/README-es.md)
[영어](./README.md) | [중국어 (간체)](./docs/README-ZH_CN.md) | [중국어
(번체)](./docs/README-ZH_TW.md) | [러시아어](./docs/README-ru.md) |
[일본어](./docs/README-ja.md) | [이탈리아어](./docs/README-it.md) |
[스페인어](./docs/README-es.md)
Trilium Notes is a free and open-source, cross-platform hierarchical note taking
application with focus on building large personal knowledge bases.
Trilium Notes는 대규모 개인 지식 기반 구축에 중점을 둔 무료 오픈 소스 크로스 플랫폼 계층적 메모 작성 애플리케이션입니다.
See [screenshots](https://triliumnext.github.io/Docs/Wiki/screenshot-tour) for
quick overview:
<a href="https://triliumnext.github.io/Docs/Wiki/screenshot-tour"><img src="./docs/app.png" alt="Trilium Screenshot" width="1000"></a>
## ⏬ Download
- [Latest release](https://github.com/TriliumNext/Trilium/releases/latest)
stable version, recommended for most users.
- [Nightly build](https://github.com/TriliumNext/Trilium/releases/tag/nightly)
unstable development version, updated daily with the latest features and
fixes.
## ⏬ 내려받기
- [최신 릴리스](https://github.com/TriliumNext/Trilium/releases/latest) 안정된 버전으로
대부분의 사용자에게 권장됩니다.
- [야간 빌드](https://github.com/TriliumNext/Trilium/releases/tag/nightly) 불안정한 개발
버전으로, 최신 기능과 수정 사항이 매일 업데이트됩니다.
## 📚 Documentation
## 📚 문서
**Visit our comprehensive documentation at
[docs.triliumnotes.org](https://docs.triliumnotes.org/)**
**[docs.triliumnotes.org](https://docs.triliumnotes.org/)에서 포괄적인 문서를 방문하세요**
Our documentation is available in multiple formats:
- **Online Documentation**: Browse the full documentation at
[docs.triliumnotes.org](https://docs.triliumnotes.org/)
- **In-App Help**: Press `F1` within Trilium to access the same documentation
directly in the application
저희 문서는 다양한 형식으로 제공됩니다.
- **온라인 문서**: [docs.triliumnotes.org](https://docs.triliumnotes.org/)에서 모든 문서를
보여줍니다
- **도움말**: 트릴리움 어플리케이션에서 `F1` 버튼을 눌러 같은 문서를 직접 볼 수 있습니다
- **GitHub**: Navigate through the [User
Guide](./docs/User%20Guide/User%20Guide/) in this repository
@@ -133,7 +129,7 @@ related goodies:
themes, scripts, plugins and more.
- [TriliumRocks!](https://trilium.rocks/) for tutorials, guides, and much more.
## ❓Why TriliumNext?
## ❓ TriliumNext일까?
The original Trilium developer ([Zadam](https://github.com/zadam)) has
graciously given the Trilium repository to the community project which resides
@@ -169,7 +165,7 @@ features, suggestions, or issues you may have!
## 🏗 Installation
### Windows / MacOS
### 윈도우 / 맥OS
Download the binary release for your platform from the [latest release
page](https://github.com/TriliumNext/Trilium/releases/latest), unzip the package
@@ -197,7 +193,7 @@ interface (which is almost identical to the desktop app).
Currently only the latest versions of Chrome & Firefox are supported (and
tested).
### Mobile
### 모바일
To use TriliumNext on a mobile device, you can use a mobile web browser to
access the mobile interface of a server installation (see below).
@@ -212,7 +208,7 @@ repository](https://github.com/FliegendeWurst/TriliumDroid). Note: It is best to
disable automatic updates on your server installation (see below) when using
TriliumDroid since the sync version must match between Trilium and TriliumDroid.
### Server
### 서버
To install TriliumNext on your own server (including via Docker from
[Dockerhub](https://hub.docker.com/r/triliumnext/trilium)) follow [the server
@@ -263,8 +259,9 @@ pnpm install
pnpm run --filter desktop electron-forge:make --arch=x64 --platform=win32
```
For more details, see the [development
docs](https://github.com/TriliumNext/Trilium/tree/main/docs/Developer%20Guide/Developer%20Guide).
자세한 내용은 [development
docs](https://github.com/TriliumNext/Trilium/tree/main/docs/Developer%20Guide/Developer%20Guide)
참고하세요.
### Developer Documentation

11
docs/README-ro.md vendored
View File

@@ -34,12 +34,13 @@ ecran](https://triliumnext.github.io/Docs/Wiki/screenshot-tour):
<a href="https://triliumnext.github.io/Docs/Wiki/screenshot-tour"><img src="./docs/app.png" alt="Trilium Screenshot" width="1000"></a>
## ⏬ Download
## ⏬ Descarcă
- [Latest release](https://github.com/TriliumNext/Trilium/releases/latest)
stable version, recommended for most users.
- [Nightly build](https://github.com/TriliumNext/Trilium/releases/tag/nightly)
unstable development version, updated daily with the latest features and
fixes.
versiune stabilă, recomandată pentru majoritatea utilizatorilor.
- [Versiune
periodică](https://github.com/TriliumNext/Trilium/releases/tag/nightly)
versiune pentru dezvoltare și testare, actualizată zilnic și cu ultimele
funcționalități și buguri reparate.
## 📚 Documentație

View File

@@ -1,6 +1,6 @@
{
"formatVersion": 2,
"appVersion": "0.99.4",
"appVersion": "0.99.5",
"files": [
{
"isClone": false,

View File

@@ -1,6 +1,6 @@
{
"formatVersion": 2,
"appVersion": "0.99.4",
"appVersion": "0.99.5",
"files": [
{
"isClone": false,
@@ -681,6 +681,13 @@
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "Gzjqa934BdH4",
"isInheritable": false,
"position": 30
},
{
"type": "label",
"name": "shareAlias",
@@ -1044,6 +1051,35 @@
"format": "markdown",
"dataFileName": "Trusted proxy.md",
"attachments": []
},
{
"isClone": false,
"noteId": "5ERVJb9s4FRD",
"notePath": [
"pOsGYCXsbNQG",
"Otzi9La2YAUX",
"WOcw2SLH6tbX",
"vcjrb3VVYPZI",
"5ERVJb9s4FRD"
],
"title": "Traefik",
"notePosition": 40,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "shareAlias",
"value": "traefik",
"isInheritable": false,
"position": 30
}
],
"format": "markdown",
"dataFileName": "Traefik.md",
"attachments": []
}
]
},
@@ -9871,6 +9907,41 @@
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "IakOLONlIfGI",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "OFXdgB2nNk1F",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "Cq5X6iKQop6R",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "bdUJEHsAPYQR",
"isInheritable": false,
"position": 60
},
{
"type": "label",
"name": "iconClass",
@@ -9890,12 +9961,28 @@
"dataFileName": "Kanban Board.md",
"attachments": [
{
"attachmentId": "usSSa0WI6dDK",
"attachmentId": "3ze7RpkjIWdW",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Kanban Board_image.png"
},
{
"attachmentId": "IrIeh59VGjHq",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "1_Kanban Board_image.png"
},
{
"attachmentId": "usSSa0WI6dDK",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "2_Kanban Board_image.png"
}
]
},
@@ -9917,59 +10004,73 @@
{
"type": "relation",
"name": "internalLink",
"value": "KSZ04uQ2D1St",
"value": "zEY4DaJG4YT5",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "0ESUbbAxVnoK",
"value": "OFXdgB2nNk1F",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "XpOYSgsLkTJy",
"value": "KSZ04uQ2D1St",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"value": "0ESUbbAxVnoK",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "IakOLONlIfGI",
"value": "XpOYSgsLkTJy",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "lgKX7r3aL30x",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "ZjLYv08Rp3qC",
"value": "IakOLONlIfGI",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"value": "lgKX7r3aL30x",
"isInheritable": false,
"position": 80
},
{
"type": "relation",
"name": "internalLink",
"value": "ZjLYv08Rp3qC",
"isInheritable": false,
"position": 90
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 100
},
{
"type": "label",
"name": "iconClass",
@@ -11175,24 +11276,45 @@
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "OFXdgB2nNk1F",
"value": "eIg8jdvaoNNd",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"value": "CdNpE2pqjmI6",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "OFXdgB2nNk1F",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"isInheritable": false,
"position": 80
},
{
"type": "label",
"name": "shareAlias",
@@ -11654,10 +11776,38 @@
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "bwZpz2ajCEwO",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "GTwFsgaA0lCt",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "zP3PMqaG71Ct",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "R9pX4DGra2Vt",
"isInheritable": false,
"position": 60
},
{
"type": "label",
"name": "shareAlias",
@@ -11670,27 +11820,43 @@
"name": "iconClass",
"value": "bx bx-table",
"isInheritable": false,
"position": 40
"position": 20
}
],
"format": "markdown",
"dataFileName": "Promoted Attributes.md",
"attachments": [
{
"attachmentId": "4EcBRWF9iCk2",
"attachmentId": "8ue55DaAJ82K",
"title": "image.png",
"role": "image",
"mime": "image/jpg",
"mime": "image/png",
"position": 10,
"dataFileName": "Promoted Attributes_image.png"
},
{
"attachmentId": "Txf5Jdm2vqt2",
"title": "promoted-attributes.png",
"attachmentId": "bLMPNRtMAaKo",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Promoted Attributes_promot.png"
"dataFileName": "1_Promoted Attributes_image.png"
},
{
"attachmentId": "FbNQB8xcY0Nu",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "2_Promoted Attributes_image.png"
},
{
"attachmentId": "yBIe1DyxuL2e",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "3_Promoted Attributes_image.png"
}
]
}

View File

@@ -12,19 +12,30 @@ In Trilium, attributes are key-value pairs assigned to notes, providing addition
These attributes play a crucial role in organizing, categorizing, and enhancing the functionality of notes.
## Types of attributes
Conceptually there are two types of attributes (applying to both labels and relations):
1. **System attributes**
As the name suggest, these attributes have a special meaning since they are interpreted by Trilium. For example the `color` attribute will change the color of the note as displayed in the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree.md">Note Tree</a> and links, and `iconClass` will change the icon of a note.
2. **User-defined attributes**
These are free-form labels or relations that can be used by the user. They can be used purely for categorization purposes (especially if combined with <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Navigation/Search.md">Search</a>), or they can be given meaning through the use of <a class="reference-link" href="../Scripting.md">Scripting</a>.
In practice, Trilium makes no direct distinction of whether an attribute is a system one or a user-defined one. A label or relation is considered a system attribute if it matches one of the built-in names (e.g. like the aforementioned `iconClass`). Keep this in mind when creating  <a class="reference-link" href="Attributes/Promoted%20Attributes.md">Promoted Attributes</a> in order not to accidentally alter a system attribute (unless intended).
## Viewing the list of attributes
Both the labels and relations for the current note are displayed in the _Owned Attributes_ section of the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a>, where they can be viewed and edited. Inherited attributes are displayed in the _Inherited Attributes_ section of the ribbon, where they can only be viewed.
In the list of attributes, labels are prefixed with the `#` character whereas relations are prefixed with the `~` character.
## Multiplicity
Attributes in Trilium can be "multi-valued", meaning multiple attributes with the same name can co-exist.
## Attribute Definitions and Promoted Attributes
Special labels create "label/attribute" definitions, enhancing the organization and management of attributes. For more details, see <a class="reference-link" href="Attributes/Promoted%20Attributes.md">Promoted Attributes</a>.
<a class="reference-link" href="Attributes/Promoted%20Attributes.md">Promoted Attributes</a> create a form-like editing experience for attributes, which makes it easy to enhancing the organization and management of attributes
## Multiplicity
Attributes in Trilium can be "multi-valued", meaning multiple attributes with the same name can co-exist. This can be combined with <a class="reference-link" href="Attributes/Promoted%20Attributes.md">Promoted Attributes</a> to easily add them.
## Attribute Inheritance

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

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