Compare commits

...

91 Commits

Author SHA1 Message Date
Elian Doran
52a6f2597e fix(share): template directory in production 2025-10-26 21:38:16 +02:00
Elian Doran
ba26c478d6 fix(export/share): assets incorrectly rewritten 2025-10-26 12:15:35 +02:00
Elian Doran
055fcb7b2a fix(export/share): handling of fonts 2025-10-26 11:34:09 +02:00
Elian Doran
f4468706ef fix(export/share): asset path for styles and scripts 2025-10-26 11:07:08 +02:00
Elian Doran
212956201a chore(export/share): export full share script & styles 2025-10-26 11:02:19 +02:00
Elian Doran
1182592fc5 chore(share): fix another typecheck issue 2025-10-26 10:07:42 +02:00
Elian Doran
0c399a676a chore(share): fix typecheck issue 2025-10-24 23:28:42 +03:00
Elian Doran
395f33cd5b chore(share): bring back boxicons 2025-10-24 22:32:42 +03:00
Elian Doran
21b20cf575 chore(share): bring back most of the logic 2025-10-24 21:18:06 +03:00
Elian Doran
e3dd25b591 chore(share): set up math 2025-10-24 21:13:40 +03:00
Elian Doran
b9a4e7ab11 chore(share): enable code splitting 2025-10-24 20:52:54 +03:00
Elian Doran
6ae67c410c chore(share): load Mermaid only when necessary 2025-10-24 20:52:47 +03:00
Elian Doran
4ef7667484 chore(share): bring back inline mermaid rendering 2025-10-24 19:09:19 +03:00
Elian Doran
3660e2f127 refactor(share): store assets at /share/asset level 2025-10-24 19:00:26 +03:00
Elian Doran
357d294f2d chore(export/share): address review 2025-10-24 18:25:16 +03:00
Elian Doran
bb636128b0 fix(export/share): missing files and wrong meta handling 2025-10-24 16:02:20 +03:00
Elian Doran
aa102ab393 fix(export/share): missing templates after merge 2025-10-24 14:54:20 +03:00
Elian Doran
ea53665e64 Merge remote-tracking branch 'origin/main' into feature/export_with_share_theme 2025-10-24 14:43:20 +03:00
Elian Doran
1e8f179f81 Translations update from Hosted Weblate (#7469) 2025-10-23 20:37:39 +03:00
Elian Doran
54c906de8d Apply suggestion from @gemini-code-assist[bot]
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-23 20:35:34 +03:00
Elian Doran
114b3ef4d1 Apply suggestion from @gemini-code-assist[bot]
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-23 20:33:43 +03:00
Elian Doran
f6fa1e69b3 Apply suggestion from @gemini-code-assist[bot]
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-23 20:33:03 +03:00
Elian Doran
fcc8086f9c Apply suggestion from @gemini-code-assist[bot]
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-23 20:32:21 +03:00
Bond
7eefff0a74 Translated using Weblate (Vietnamese)
Currently translated at 10.9% (16 of 146 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/vi/
2025-10-23 19:28:31 +02:00
Микола Копитін
1b842e35ff Translated using Weblate (Ukrainian)
Currently translated at 26.0% (38 of 146 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/uk/
2025-10-23 19:28:30 +02:00
Bond
c9021ca742 Translated using Weblate (Vietnamese)
Currently translated at 55.9% (66 of 118 strings)

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/vi/
2025-10-23 19:28:29 +02:00
Микола Копитін
b229ab3c02 Translated using Weblate (Ukrainian)
Currently translated at 32.2% (38 of 118 strings)

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/uk/
2025-10-23 19:28:29 +02:00
Bond
6825f28ba0 Translated using Weblate (Vietnamese)
Currently translated at 3.0% (50 of 1621 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/vi/
2025-10-23 19:28:28 +02:00
Микола Копитін
5e72f271ea Translated using Weblate (Ukrainian)
Currently translated at 21.9% (32 of 146 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/uk/
2025-10-23 19:28:27 +02:00
Микола Копитін
9ad6dfd5e9 Translated using Weblate (Ukrainian)
Currently translated at 27.9% (33 of 118 strings)

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/uk/
2025-10-23 19:28:27 +02:00
Marc
81031673c3 Translated using Weblate (French)
Currently translated at 100.0% (146 of 146 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/fr/
2025-10-23 19:28:26 +02:00
Микола Копитін
1a6423fd36 Translated using Weblate (Ukrainian)
Currently translated at 20.5% (30 of 146 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/uk/
2025-10-23 19:28:26 +02:00
onlyfranz
9b872617e6 Translated using Weblate (German)
Currently translated at 2.7% (4 of 146 strings)

Translation: Trilium Notes/Website
Translate-URL: https://hosted.weblate.org/projects/trilium/website/de/
2025-10-23 19:28:25 +02:00
Sarah Hussein
57be2e2474 Translated using Weblate (Arabic)
Currently translated at 25.4% (30 of 118 strings)

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/ar/
2025-10-23 19:28:25 +02:00
Микола Копитін
1d65afef53 Translated using Weblate (Ukrainian)
Currently translated at 26.2% (31 of 118 strings)

Translation: Trilium Notes/README
Translate-URL: https://hosted.weblate.org/projects/trilium/readme/uk/
2025-10-23 19:28:24 +02:00
Sarah Hussein
b6385618d1 Translated using Weblate (Arabic)
Currently translated at 63.5% (1030 of 1621 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ar/
2025-10-23 19:28:23 +02:00
Giovi
e3d7c7419f Translated using Weblate (Italian)
Currently translated at 100.0% (387 of 387 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/it/
2025-10-23 19:28:22 +02:00
Giovi
2a6c295967 Translated using Weblate (Italian)
Currently translated at 100.0% (1621 of 1621 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/it/
2025-10-23 19:28:22 +02:00
green
f5f32df847 Translated using Weblate (Japanese)
Currently translated at 100.0% (1621 of 1621 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ja/
2025-10-23 19:28:21 +02:00
Francis C
1f350b2730 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 100.0% (1621 of 1621 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/zh_Hant/
2025-10-23 19:28:20 +02:00
Marc
386992255e Translated using Weblate (French)
Currently translated at 100.0% (387 of 387 strings)

Translation: Trilium Notes/Server
Translate-URL: https://hosted.weblate.org/projects/trilium/server/fr/
2025-10-23 19:28:20 +02:00
Bilal Janati
eb505c4615 Translated using Weblate (French)
Currently translated at 100.0% (1621 of 1621 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/fr/
2025-10-23 19:28:19 +02:00
Marc
003d2b5354 Translated using Weblate (French)
Currently translated at 100.0% (1621 of 1621 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/fr/
2025-10-23 19:28:19 +02:00
Elian Doran
b452f78242 feat(mobile/search): search definitions always shown 2025-10-23 20:24:16 +03:00
Elian Doran
7d1abee8e4 feat(mobile/search): show results (closes #5655) 2025-10-23 20:16:17 +03:00
Elian Doran
d503993a74 chore(mobile/search): further improve the layout 2025-10-23 20:03:44 +03:00
Elian Doran
fe98ba8c8c chore(mobile/search): improve actions fit 2025-10-23 19:15:38 +03:00
Elian Doran
18608ecb34 feat(mobile): render search definition 2025-10-23 19:07:40 +03:00
Elian Doran
ab6da26a25 refactor(client): standalone rendering mechanism for ribbon 2025-10-23 18:09:32 +03:00
Elian Doran
f95082ccdb fix(server): calendar tooltip positioning (closes #5675) 2025-10-23 16:57:48 +03:00
Elian Doran
e94b5ac07a fix(server): edited notes listing automatically generated hidden notes (closes #5683) 2025-10-23 16:42:27 +03:00
Elian Doran
5d0669b464 fix(canvas): images appearing muted in dark mode (closes #5708) 2025-10-23 16:11:05 +03:00
Elian Doran
af95d85b73 chore(client): disable import/export for help notes 2025-10-23 14:43:04 +03:00
Elian Doran
aae90ede19 chore(share): keep diacritics in slug instead of stripping them in 2025-10-23 14:29:47 +03:00
Elian Doran
0fa1c0f5c4 chore(share): improve slugification to strip diacritics cleanly 2025-10-23 14:26:15 +03:00
Elian Doran
d2b6014b49 fix(share): HTML tags displayed escaped in headings 2025-10-23 14:19:54 +03:00
Elian Doran
94d62f810a fix(share): heading and navigation not supporting CJK (closes #6430) 2025-10-23 14:06:13 +03:00
Elian Doran
e953f0cc1a Merge branch 'main' of https://github.com/TriliumNext/Trilium 2025-10-23 13:22:26 +03:00
Elian Doran
347da8abde fix(collections/list): excessive spacing in empty note content (closes #7319) 2025-10-23 08:16:26 +03:00
Elian Doran
9cf7fa1997 fix(export/share): use right extension for clones 2025-06-24 22:14:15 +03:00
Elian Doran
fded714f18 fix(export/share): use right extension for images 2025-06-24 19:53:21 +03:00
Elian Doran
06de06b501 refactor(export/share): share type for format 2025-06-24 19:21:09 +03:00
Elian Doran
9abdbbbc5b refactor(export/share): fix type 2025-06-24 19:06:18 +03:00
Elian Doran
3ebfee8bd2 fix(export/share): tree error in prod 2025-06-24 18:49:19 +03:00
Elian Doran
6d446c5b27 fix(export/share): asset path in prod 2025-06-24 18:49:11 +03:00
Elian Doran
3a55490bbf refactor(share): use a string cache for templates 2025-06-24 18:08:29 +03:00
Elian Doran
bc4643fed2 refactor(share): use internal rendering method for subtemplates 2025-06-24 17:48:52 +03:00
Elian Doran
a2110ca631 fix(export/share): tree not expanding properly 2025-06-24 17:45:06 +03:00
Elian Doran
413137ac64 chore(nx): sync tsconfig 2025-06-23 21:23:44 +03:00
Elian Doran
9bc966491d fix(edit-docs): import error 2025-06-23 21:22:45 +03:00
Elian Doran
61dbc15fc6 feat(export/share): use translation 2025-06-23 20:14:13 +03:00
Elian Doran
b475037127 feat(export/share): render non-text note types 2025-06-23 20:00:40 +03:00
Elian Doran
35622a2122 feat(export/share): always render empty files 2025-06-23 19:38:47 +03:00
Elian Doran
77e4c3d0ec refactor(export/share): use different URL rewriting mechanism 2025-06-23 19:28:45 +03:00
Elian Doran
8523050ab2 fix(export/share): note children preview links not working 2025-06-23 19:00:20 +03:00
Elian Doran
0efdf65202 refactor(export/share): build index file 2025-06-23 18:46:21 +03:00
Elian Doran
acb0991d05 refactor(export/zip): separate building provider into own method 2025-06-23 18:24:59 +03:00
Elian Doran
a9f68f5487 feat(export/zip): add option to export with share theme 2025-06-23 18:13:47 +03:00
Elian Doran
55bb2fdb9b refactor(export/zip): extract prepare content into providers 2025-06-23 16:22:42 +03:00
Elian Doran
e529633b8b chore(export/zip): bring back markdown exporter 2025-06-23 16:17:29 +03:00
Elian Doran
dfd575b6eb refactor(export/zip): extract into separate provider 2025-06-23 16:08:31 +03:00
Elian Doran
c5196721d4 chore(nx): sync tsconfig 2025-06-23 15:36:10 +03:00
Elian Doran
968c75b618 Merge remote-tracking branch 'origin/main' into feature/export_with_share_theme 2025-06-23 15:35:30 +03:00
Elian Doran
01beebf660 feat(export/zip): load script as well 2025-06-14 01:23:02 +03:00
Elian Doran
d3115e834a feat(export/zip): get logo to work 2025-06-14 01:01:12 +03:00
Elian Doran
01a552ceb5 feat(export/zip): get boxicons to work 2025-06-14 00:52:56 +03:00
Elian Doran
d8958adea5 feat(export/zip): basic tree navigation 2025-06-14 00:07:55 +03:00
Elian Doran
4d5e866db6 feat(export/zip): get CSS to load 2025-06-13 23:47:04 +03:00
Elian Doran
f189deb415 feat(export/zip): get tree to render 2025-06-13 23:22:44 +03:00
Elian Doran
9c460dbc87 feat(export/zip): get same rendering engine as share 2025-06-13 23:10:14 +03:00
Elian Doran
2c6ba9ba2c refactor(share): extract note rendering logic 2025-06-13 17:48:19 +03:00
65 changed files with 1987 additions and 878 deletions

View File

@@ -29,8 +29,9 @@ import PromotedAttributesWidget from "../widgets/promoted_attributes.js";
import NoteDetailWidget from "../widgets/note_detail.js";
import CallToActionDialog from "../widgets/dialogs/call_to_action.jsx";
import NoteTitleWidget from "../widgets/note_title.jsx";
import { PopupEditorFormattingToolbar } from "../widgets/ribbon/FormattingToolbar.js";
import FormattingToolbar from "../widgets/ribbon/FormattingToolbar.js";
import NoteList from "../widgets/collections/NoteList.jsx";
import StandaloneRibbonAdapter from "../widgets/ribbon/components/StandaloneRibbonAdapter.jsx";
export function applyModals(rootContainer: RootContainer) {
rootContainer
@@ -63,7 +64,7 @@ export function applyModals(rootContainer: RootContainer) {
.cssBlock(".title-row > * { margin: 5px; }")
.child(<NoteIconWidget />)
.child(<NoteTitleWidget />))
.child(<PopupEditorFormattingToolbar />)
.child(<StandaloneRibbonAdapter component={FormattingToolbar} />)
.child(new PromotedAttributesWidget())
.child(new NoteDetailWidget())
.child(<NoteList media="screen" displayOnlyCollections />))

View File

@@ -24,6 +24,9 @@ import CloseZenModeButton from "../widgets/close_zen_button.js";
import NoteWrapperWidget from "../widgets/note_wrapper.js";
import MobileDetailMenu from "../widgets/mobile_widgets/mobile_detail_menu.js";
import NoteList from "../widgets/collections/NoteList.jsx";
import StandaloneRibbonAdapter from "../widgets/ribbon/components/StandaloneRibbonAdapter.jsx";
import SearchDefinitionTab from "../widgets/ribbon/SearchDefinitionTab.jsx";
import SearchResult from "../widgets/search_result.jsx";
const MOBILE_CSS = `
<style>
@@ -155,6 +158,8 @@ export default class MobileLayout {
.contentSized()
.child(new NoteDetailWidget())
.child(<NoteList media="screen" />)
.child(<StandaloneRibbonAdapter component={SearchDefinitionTab} />)
.child(<SearchResult />)
.child(<FilePropertiesWrapper />)
)
.child(<MobileEditorToolbar />)

View File

@@ -9,16 +9,6 @@ async function ensureJQuery() {
(window as any).$ = $;
}
async function applyMath() {
const anyMathBlock = document.querySelector("#content .math-tex");
if (!anyMathBlock) {
return;
}
const renderMathInElement = (await import("./services/math.js")).renderMathInElement;
renderMathInElement(document.getElementById("content"));
}
async function formatCodeBlocks() {
const anyCodeBlock = document.querySelector("#content pre");
if (!anyCodeBlock) {
@@ -31,54 +21,4 @@ async function formatCodeBlocks() {
async function setupTextNote() {
formatCodeBlocks();
applyMath();
const setupMermaid = (await import("./share/mermaid.js")).default;
setupMermaid();
}
/**
* Fetch note with given ID from backend
*
* @param noteId of the given note to be fetched. If false, fetches current note.
*/
async function fetchNote(noteId: string | null = null) {
if (!noteId) {
noteId = document.body.getAttribute("data-note-id");
}
const resp = await fetch(`api/notes/${noteId}`);
return await resp.json();
}
document.addEventListener(
"DOMContentLoaded",
() => {
const noteType = determineNoteType();
if (noteType === "text") {
setupTextNote();
}
const toggleMenuButton = document.getElementById("toggleMenuButton");
const layout = document.getElementById("layout");
if (toggleMenuButton && layout) {
toggleMenuButton.addEventListener("click", () => layout.classList.toggle("showMenu"));
}
},
false
);
function determineNoteType() {
const bodyClass = document.body.className;
const match = bodyClass.match(/type-([^\s]+)/);
return match ? match[1] : null;
}
// workaround to prevent webpack from removing "fetchNote" as dead code:
// add fetchNote as property to the window object
Object.defineProperty(window, "fetchNote", {
value: fetchNote
});

View File

@@ -2432,4 +2432,8 @@ iframe.print-iframe {
bottom: 0;
width: 0;
height: 0;
}
.excalidraw.theme--dark canvas {
--theme-filter: invert(100%) hue-rotate(180deg);
}

View File

@@ -63,7 +63,7 @@
/* Button bar */
.search-definition-widget .search-setting-table tbody:last-child div {
justify-content: flex-end !important;
justify-content: flex-end;
gap: 8px;
}

View File

@@ -655,7 +655,11 @@
"google": "جوجل",
"save_button": "حفظ",
"baidu": "Baidu",
"title": "محرك البحث"
"title": "محرك البحث",
"predefined_templates_label": "قوالب محرك البحث المعرفة مسبقا",
"custom_name_label": "اسم محرك البحث المخصص",
"custom_name_placeholder": "اسم محرك البحث المخصص",
"custom_url_placeholder": "تخصيص عنوان URL لمحرك البحث"
},
"heading_style": {
"plain": "بسيط",
@@ -676,7 +680,8 @@
"wednesday": "الاربعاء",
"thursday": "الخميس",
"friday": "الجمعة",
"saturday": "السبت"
"saturday": "السبت",
"formatting-locale": "تنسيق التاريخ والارقام"
},
"backup": {
"path": "مسار",
@@ -699,7 +704,8 @@
"token_name": "اسم الرمز",
"default_token_name": "رمز جديد",
"rename_token_title": "اعادة تسمية الرمز",
"rename_token": "اعادة تسمية هذا الرمز"
"rename_token": "اعادة تسمية هذا الرمز",
"create_token": "انشاء رمز PEAPI جديد"
},
"password": {
"heading": "كلمة المرور",
@@ -731,7 +737,8 @@
"timeout": "انتهاء مهلة المزامنة",
"test_title": "اختبار المزامنة",
"test_button": "اختبار المزامنة",
"server_address": "عنوان نسخة الخادم"
"server_address": "عنوان نسخة الخادم",
"proxy_label": "خادم وكيل المزامنة (اخياري)"
},
"api_log": {
"close": "أغلاق"
@@ -751,7 +758,8 @@
"new_tab": "تبويب جديد",
"close_all_tabs": "اغلاق كل علامات التبويب",
"add_new_tab": "اضافة علامة تبويب جديدة",
"close_other_tabs": "اغلاق علامات التبويب الاخرى"
"close_other_tabs": "اغلاق علامات التبويب الاخرى",
"reopen_last_tab": "اعادة فتح اخر علامة تبويب مغلقة"
},
"toc": {
"options": "خيارات",
@@ -791,7 +799,8 @@
},
"call_to_action": {
"dismiss": "تجاهل",
"background_effects_button": "تفعيل مؤثرات الخلفية"
"background_effects_button": "تفعيل مؤثرات الخلفية",
"next_theme_button": "جرب النسق الجديد"
},
"units": {
"percentage": "%"
@@ -835,7 +844,8 @@
"search-in-subtree": "‍البحث في الشجرة الفرعية",
"edit-branch-prefix": "تعديل بادئة الفرع",
"convert-to-attachment": "التحويل الى مرفق",
"apply-bulk-actions": "‌تطبيق الاجراءات الجماعية"
"apply-bulk-actions": "‌تطبيق الاجراءات الجماعية",
"recent-changes-in-subtree": "التغييرات الاخيرة في الشجرة الفرعية"
},
"note_types": {
"text": "نص",
@@ -884,7 +894,8 @@
"quick-search": {
"searching": "جار البحث...",
"placeholder": "البحث السريع",
"no-results": "لم يتم العثور على نتائج"
"no-results": "لم يتم العثور على نتائج",
"show-in-full-search": "عرض في البحث الكامل"
},
"note_tree": {
"unhoist": "ارجاع الى الترتيب الطبيعي",
@@ -893,7 +904,12 @@
"collapse-title": "طي شجرة الملاحظة",
"hide-archived-notes": "اخفاء الملاحظات المؤرشفة",
"automatically-collapse-notes": "طي الملاحظات تلقائيا",
"create-child-note": "انشاء ملاحظة فرعية"
"create-child-note": "انشاء ملاحظة فرعية",
"scroll-active-title": "تمرير الى الملاحظة النشطة",
"save-changes": "حفظ وتطبيق التغييرات",
"saved-search-note-refreshed": "تم تحديث ملاحظة البحث المحفوظة.",
"hoist-this-note-workspace": "تثبيت هذه الملاحظة (مساحة العمل)",
"refresh-saved-search-results": "تحديث نتائج البحث المحفوظة"
},
"sql_table_schemas": {
"tables": "جداول"
@@ -901,7 +917,13 @@
"launcher_context_menu": {
"reset": "اعادة ضبط",
"add-spacer": "اضافة فاصل",
"delete": "حذف\n<kbd data-command=\"deleteNotes\">"
"delete": "حذف\n<kbd data-command=\"deleteNotes\">",
"add-note-launcher": "اضافة مشغل الملاحظة",
"add-script-launcher": "اضافة مشغل السكريبت",
"add-custom-widget": "اضافة عنصر واجهة مخصص",
"move-to-visible-launchers": "نقل الى المشغلات المرئية",
"move-to-available-launchers": "نقل الى المشغلات المتوفرة",
"duplicate-launcher": "تكرار المشغل <kbd data-command=\"duplicateSubtree\">"
},
"editable-text": {
"auto-detect-language": "تم اكتشافه تلقائيا"
@@ -927,7 +949,9 @@
"cut": "قص",
"copy": "نسخ",
"paste": "لصق",
"copy-link": "نسخ الرابط"
"copy-link": "نسخ الرابط",
"add-term-to-dictionary": "اضافة \"{{term}}\" الى القاموس",
"paste-as-plain-text": "لصق كنص عادي"
},
"promoted_attributes": {
"url_placeholder": "http://website...",
@@ -977,7 +1001,11 @@
"totp_secret_regenerate": "اعادة توليد TOTP السري",
"totp_secret_generated": "تم انشاء TOTP السري",
"oauth_missing_vars": "اعدادات مفقودة: {{-variables}}",
"totp_secret_title": "توليد TOTP سري"
"totp_secret_title": "توليد TOTP سري",
"totp_title": "كلمة مرور لمرة واحدة معتمدة على الوقت (TOTP)",
"recovery_keys_title": "مفاتيح استرداد تسجيل الدخول الاحادي",
"recovery_keys_error": "حدث خطأ اثناء توليد رموز الاسترجاع",
"recovery_keys_no_key_set": "لاتوجد رموز استرجاع معينة"
},
"execute_script": {
"execute_script": "تنفيذ السكريبت"
@@ -1119,7 +1147,12 @@
"title": "اخفاء هوية البيانات",
"full_anonymization": "الاخفاء الكامل للهوية",
"light_anonymization": "الاخفاء الجزئي للهوية",
"existing_anonymized_databases": "قواعد البيانات المجهولة الحالية"
"existing_anonymized_databases": "قواعد البيانات المجهولة الحالية",
"save_fully_anonymized_database": "حفظ قاعدة البيانات بعد اخفاء كل الهويات",
"save_lightly_anonymized_database": "حفظ قاعدةةبيانات مخفية جزئيا",
"creating_fully_anonymized_database": "انشاء قاعدة بيانات مجهولة بالكامل",
"creating_lightly_anonymized_database": "انشاء قاعدةة بيانات مجهولة جزئيا...",
"no_anonymized_database_yet": "لاتوجد قاعدة بيانات مجهولة بعد."
},
"vacuum_database": {
"title": "تحرير مساحة قاعدة البيانات",
@@ -1146,7 +1179,8 @@
"italic": "نص مائل",
"underline": "خط تحت النص",
"color": "نص ملون",
"visibility_title": "اظهار قائمة التضليلات"
"visibility_title": "اظهار قائمة التضليلات",
"bg_color": "نص مع لون خلفية"
},
"revisions_button": {
"note_revisions": "مراجعات الملاحظة"
@@ -1163,7 +1197,8 @@
"title": "التدقيق الاملائي",
"enable": "تفعيل التدقيق الاملائي",
"language_code_label": "رمز اللغة او رموز اللغات",
"available_language_codes_label": "رموز اللغات المتاحة:"
"available_language_codes_label": "رموز اللغات المتاحة:",
"language_code_placeholder": "على سبيل المثال \"en-US\", \"de-AI\""
},
"note-map": {
"button-link-map": "خريطة الروابط",
@@ -1177,7 +1212,9 @@
},
"branches": {
"delete-status": "حالة الحذف",
"delete-finished-successfully": "تم الحذف بنجاح."
"delete-finished-successfully": "تم الحذف بنجاح.",
"cannot-move-notes-here": "لايمكن نقل الملاحظات الى هنا.",
"undeleting-notes-finished-successfully": "تم استرجاع الملاحظات بنجاح."
},
"highlighting": {
"title": "كتل الكود",
@@ -1199,14 +1236,16 @@
"native-title-bar": "شريط العنوان الاصلي"
},
"note_tooltip": {
"quick-edit": "التحرير السريع"
"quick-edit": "التحرير السريع",
"note-has-been-deleted": "تم حذف الملاحظة."
},
"geo-map-context": {
"open-location": "فتح الموقع",
"remove-from-map": "ازالة من الخريطة"
},
"share": {
"title": "اعدادات المشاركة"
"title": "اعدادات المشاركة",
"check_share_root": "التحقق من حالة جذر المشاركة"
},
"note_language": {
"not_set": "غير محدد",
@@ -1251,7 +1290,8 @@
"search_subtree_title": "بحث في الشجرة الفرعية",
"search_history_title": "عرص سجل البحث",
"search_history_description": "عرض البحث السابق",
"configure_launch_bar_title": "تكوين شريط الاطلاق"
"configure_launch_bar_title": "تكوين شريط الاطلاق",
"search_subtree_description": "البحث ضمن الشجرة الفرعية الحالية"
},
"content_renderer": {
"open_externally": "فتح خارجيا"
@@ -1295,7 +1335,8 @@
"database_integrity_check": {
"title": "فحص سلامة قاعدة البيانات",
"check_button": "التحقق من سلامة قاعدة البيانات",
"checking_integrity": "جار التحقق من سلامة قاعدة البيانات..."
"checking_integrity": "جار التحقق من سلامة قاعدة البيانات...",
"integrity_check_failed": "فشل التحقق من السلامة: {{results}}"
},
"watched_file_update_status": {
"upload_modified_file": "رفع الملف المعدل",
@@ -1328,7 +1369,8 @@
"button_exit": "الخروج من وضع Zen"
},
"attachment_erasure_timeout": {
"attachment_erasure_timeout": "مهلة مسح المرفقات"
"attachment_erasure_timeout": "مهلة مسح المرفقات",
"erase_attachments_after": "حذف المرفقات الغير مستخدمة بعد:"
},
"note_erasure_timeout": {
"note_erasure_timeout_title": "مهلة مسح الملاحظة",
@@ -1366,5 +1408,31 @@
},
"revisions_snapshot_interval": {
"note_revisions_snapshot_interval_title": "الفاصل الزمني لنسخ الملاحظات الاحتياطية"
},
"note_detail": {
"printing": "جار الطباعة ..."
},
"attachment_detail_2": {
"role_and_size": "الدور: {{role}}، الحجم: {{size}}",
"unrecognized_role": "دور المرفق '{{role}}'الغير معروف."
},
"title_bar_buttons": {
"window-on-top": "ابقاء النافذة في الاعلى"
},
"note_title": {
"placeholder": "اكتب عنوان الملاحظة هنا..."
},
"image_context_menu": {
"copy_reference_to_clipboard": "نسخ المرجع الى الحافظة",
"copy_image_to_clipboard": "نسخ الصورة الى الحافظة"
},
"geo-map": {
"unable-to-load-map": "تعذر تحميل الخريطة."
},
"content_widget": {
"unknown_widget": "عنصر واجهة غير معروف للمعرف \"{{id}}\"."
},
"png_export_button": {
"button_title": "تصدير المخطط كملف PNG"
}
}

View File

@@ -104,7 +104,8 @@
"export_status": "Export status",
"export_in_progress": "Export in progress: {{progressCount}}",
"export_finished_successfully": "Export finished successfully.",
"format_pdf": "PDF - for printing or sharing purposes."
"format_pdf": "PDF - for printing or sharing purposes.",
"share-format": "HTML for web publishing - uses the same theme that is used shared notes, but can be published as a static website."
},
"help": {
"title": "Cheatsheet",

View File

@@ -280,8 +280,8 @@
"delete_button": "Supprimer",
"diff_on": "Afficher les différences",
"diff_off": "Afficher le contenu",
"diff_on_hint": "Cliquez pour afficher les différences de la note d'origine",
"diff_off_hint": "Cliquez pour afficher le contenu de la note",
"diff_on_hint": "Cliquer pour afficher les différences avec la note d'origine",
"diff_off_hint": "Cliquer pour afficher le contenu de la note",
"diff_not_available": "La comparaison n'est pas disponible."
},
"sort_child_notes": {
@@ -647,7 +647,9 @@
"about": "À propos de Trilium Notes",
"logout": "Déconnexion",
"show-cheatsheet": "Afficher l'aide rapide",
"toggle-zen-mode": "Zen Mode"
"toggle-zen-mode": "Zen Mode",
"new-version-available": "Nouvelle mise à jour disponible",
"download-update": "Obtenir la version {{latestVersion}}"
},
"zen_mode": {
"button_exit": "Sortir du Zen mode"
@@ -674,7 +676,7 @@
"search_in_note": "Rechercher dans la note",
"note_source": "Code source",
"note_attachments": "Pièces jointes",
"open_note_externally": "Ouverture externe",
"open_note_externally": "Ouvrir la note en externe",
"open_note_externally_title": "Le fichier sera ouvert dans une application externe et les modifications apportées seront surveillées. Vous pourrez ensuite téléverser la version modifiée dans Trilium.",
"open_note_custom": "Ouvrir la note avec",
"import_files": "Importer des fichiers",
@@ -767,7 +769,8 @@
"table": "Tableau",
"geo-map": "Carte géographique",
"board": "Tableau de bord",
"include_archived_notes": "Afficher les notes archivées"
"include_archived_notes": "Afficher les notes archivées",
"presentation": "Présentation"
},
"edited_notes": {
"no_edited_notes_found": "Aucune note modifiée ce jour-là...",
@@ -1142,7 +1145,8 @@
"code_auto_read_only_size": {
"title": "Taille pour la lecture seule automatique",
"description": "La taille pour la lecture seule automatique est le seuil au-delà de laquelle les notes seront affichées en mode lecture seule (pour optimiser les performances).",
"label": "Taille pour la lecture seule automatique (notes de code)"
"label": "Taille pour la lecture seule automatique (notes de code)",
"unit": "caractères"
},
"code_mime_types": {
"title": "Types MIME disponibles dans la liste déroulante"
@@ -1435,8 +1439,8 @@
"open-in-popup": "Modification rapide"
},
"shared_info": {
"shared_publicly": "Cette note est partagée publiquement sur {{- link}}",
"shared_locally": "Cette note est partagée localement sur {{- link}}",
"shared_publicly": "Cette note est partagée publiquement sur {{- link}}.",
"shared_locally": "Cette note est partagée localement sur {{- link}}.",
"help_link": "Pour obtenir de l'aide, visitez le <a href=\"https://triliumnext.github.io/Docs/Wiki/sharing.html\">wiki</a>."
},
"note_types": {
@@ -1460,7 +1464,9 @@
"beta-feature": "Beta",
"task-list": "Liste de tâches",
"book": "Collection",
"ai-chat": "Chat IA"
"ai-chat": "Chat IA",
"new-feature": "Nouveau",
"collections": "Collections"
},
"protect_note": {
"toggle-on": "Protéger la note",
@@ -1513,13 +1519,16 @@
"hoist-this-note-workspace": "Focus cette note (espace de travail)",
"refresh-saved-search-results": "Rafraîchir les résultats de recherche enregistrée",
"create-child-note": "Créer une note enfant",
"unhoist": "Désactiver le focus"
"unhoist": "Désactiver le focus",
"toggle-sidebar": "Basculer la barre latérale"
},
"title_bar_buttons": {
"window-on-top": "Épingler cette fenêtre au premier plan"
},
"note_detail": {
"could_not_find_typewidget": "Impossible de trouver typeWidget pour le type '{{type}}'"
"could_not_find_typewidget": "Impossible de trouver typeWidget pour le type '{{type}}'",
"printing": "Impression en cours...",
"printing_pdf": "Export au format PDF en cours..."
},
"note_title": {
"placeholder": "saisir le titre de la note ici..."
@@ -1570,7 +1579,9 @@
},
"clipboard": {
"cut": "Les note(s) ont été coupées dans le presse-papiers.",
"copied": "Les note(s) ont été coupées dans le presse-papiers."
"copied": "Les note(s) ont été coupées dans le presse-papiers.",
"copy_failed": "Impossible de copier dans le presse-papiers en raison de problèmes d'autorisation.",
"copy_success": "Copié dans le presse-papiers."
},
"entrypoints": {
"note-revision-created": "La version de la note a été créée.",
@@ -1592,7 +1603,9 @@
"ws": {
"sync-check-failed": "Le test de synchronisation a échoué !",
"consistency-checks-failed": "Les tests de cohérence ont échoué ! Consultez les journaux pour plus de détails.",
"encountered-error": "Erreur \"{{message}}\", consultez la console."
"encountered-error": "Erreur \"{{message}}\", consultez la console.",
"lost-websocket-connection-title": "Connexion au serveur perdue",
"lost-websocket-connection-message": "Vérifiez la configuration de votre proxy inverse (par exemple nginx ou Apache) pour vous assurer que les connexions WebSocket sont correctement autorisées et ne sont pas bloquées."
},
"hoisted_note": {
"confirm_unhoisting": "La note demandée «{{requestedNote}}» est en dehors du sous-arbre de la note focus «{{hoistedNote}}». Le focus doit être désactivé pour accéder à la note. Voulez-vous enlever le focus ?"
@@ -1614,13 +1627,15 @@
},
"highlighting": {
"description": "Contrôle la coloration syntaxique des blocs de code à l'intérieur des notes texte, les notes de code ne seront pas affectées.",
"color-scheme": "Jeu de couleurs"
"color-scheme": "Jeu de couleurs",
"title": "Blocs de code"
},
"code_block": {
"word_wrapping": "Saut à la ligne automatique suivant la largeur",
"theme_none": "Pas de coloration syntaxique",
"theme_group_light": "Thèmes clairs",
"theme_group_dark": "Thèmes sombres"
"theme_group_dark": "Thèmes sombres",
"copy_title": "Copier dans le presse-papiers"
},
"classic_editor_toolbar": {
"title": "Mise en forme"
@@ -1679,7 +1694,8 @@
"full-text-search": "Recherche dans le texte"
},
"note_tooltip": {
"note-has-been-deleted": "La note a été supprimée."
"note-has-been-deleted": "La note a été supprimée.",
"quick-edit": "Edition rapide"
},
"geo-map": {
"create-child-note-title": "Créer une nouvelle note enfant et l'ajouter à la carte",
@@ -1688,7 +1704,8 @@
},
"geo-map-context": {
"open-location": "Ouvrir la position",
"remove-from-map": "Retirer de la carte"
"remove-from-map": "Retirer de la carte",
"add-note": "Ajouter un marqueur à cet endroit"
},
"help-button": {
"title": "Ouvrir la page d'aide correspondante"
@@ -1748,7 +1765,8 @@
"oauth_user_not_logged_in": "Pas connecté!"
},
"modal": {
"close": "Fermer"
"close": "Fermer",
"help_title": "Afficher plus d'informations sur cet écran"
},
"ai_llm": {
"not_started": "Non démarré",
@@ -1828,13 +1846,76 @@
"reprocessing_index": "Mise à jour...",
"reprocess_index_started": "L'optimisation de l'indice de recherche à commencer en arrière-plan",
"reprocess_index_error": "Erreur dans le rafraichissement de l'indice de recherche",
"failed_notes": "Notes échouées",
"failed_notes": "Notes en erreur",
"last_processed": "Dernier traitement",
"restore_provider": "Restaurer le fournisseur de la recherche",
"restore_provider": "Restaurer le fournisseur de recherche",
"index_rebuild_progress": "Progression de la reconstruction de l'index",
"index_rebuilding": "Optimisation de l'index ({{percentage}}%)",
"index_rebuild_complete": "Optimisation de l'index terminée",
"index_rebuild_status_error": "Erreur lors de la vérification de l'état de reconstruction de l'index"
"index_rebuild_status_error": "Erreur lors de la vérification de l'état de reconstruction de l'index",
"provider_precedence": "Priorité du fournisseur",
"never": "Jamais",
"processing": "Traitement en cours ({{percentage}}%)",
"incomplete": "Incomplet ({{percentage}}%)",
"complete": "Terminé (100%)",
"refreshing": "Mise à jour...",
"auto_refresh_notice": "Actualisation automatique toutes les {{seconds}} secondes",
"note_queued_for_retry": "Note mise en file d'attente pour une nouvelle tentative",
"failed_to_retry_note": "Échec de la nouvelle tentative de note",
"all_notes_queued_for_retry": "Toutes les notes ayant échoué sont mises en file d'attente pour une nouvelle tentative",
"failed_to_retry_all": "Échec du ré essai des notes",
"ai_settings": "Paramètres IA",
"api_key_tooltip": "Clé API pour accéder au service",
"empty_key_warning": {
"anthropic": "La clé API Anthropic est vide. Veuillez saisir une clé API valide.",
"openai": "La clé API OpenAI est vide. Veuillez saisir une clé API valide.",
"voyage": "La clé API Voyage est vide. Veuillez saisir une clé API valide.",
"ollama": "La clé API Ollama est vide. Veuillez saisir une clé API valide."
},
"agent": {
"processing": "Traitement...",
"thinking": "Réflexion...",
"loading": "Chargement...",
"generating": "Génération..."
},
"name": "IA",
"openai": "OpenAI",
"use_enhanced_context": "Utiliser un contexte amélioré",
"enhanced_context_description": "Fournit à l'IA plus de contexte à partir de la note et de ses notes associées pour de meilleures réponses",
"show_thinking": "Montrer la réflexion",
"show_thinking_description": "Montrer la chaîne de pensée de l'IA",
"enter_message": "Entrez votre message...",
"error_contacting_provider": "Erreur lors de la connexion au fournisseur d'IA. Veuillez vérifier vos paramètres et votre connexion Internet.",
"error_generating_response": "Erreur lors de la génération de la réponse de l'IA",
"index_all_notes": "Indexer toutes les notes",
"index_status": "Statut de l'index",
"indexed_notes": "Notes indexées",
"indexing_stopped": "Arrêt de l'indexation",
"indexing_in_progress": "Indexation en cours...",
"last_indexed": "Dernière indexée",
"note_chat": "Note discussion",
"sources": "Sources",
"start_indexing": "Démarrage de l'indexation",
"use_advanced_context": "Utiliser le contexte avancé",
"ollama_no_url": "Ollama n'est pas configuré. Veuillez saisir une URL valide.",
"chat": {
"root_note_title": "Discussions IA",
"root_note_content": "Cette note contient vos conversations de chat IA enregistrées.",
"new_chat_title": "Nouvelle discussion",
"create_new_ai_chat": "Créer une nouvelle discussion IA"
},
"create_new_ai_chat": "Créer une nouvelle discussion IA",
"configuration_warnings": "Il y a quelques problèmes avec la configuration de votre IA. Veuillez vérifier vos paramètres.",
"experimental_warning": "La fonctionnalité LLM est actuellement expérimentale vous êtes prévenu.",
"selected_provider": "Fournisseur sélectionné",
"selected_provider_description": "Choisissez le fournisseur dIA pour les fonctionnalités de discussion et de complétion",
"select_model": "Sélectionner le modèle...",
"select_provider": "Sélectionnez un fournisseur...",
"ai_enabled": "Fonctionnalités d'IA activées",
"ai_disabled": "Fonctionnalités d'IA désactivées",
"no_models_found_online": "Aucun modèle trouvé. Veuillez vérifier votre clé API et vos paramètres.",
"no_models_found_ollama": "Aucun modèle Ollama trouvé. Veuillez vérifier si Ollama est en cours d'exécution.",
"error_fetching": "Erreur lors de la récupération des modèles : {{error}}"
},
"ui-performance": {
"title": "Performance",
@@ -1846,8 +1927,165 @@
},
"custom_date_time_format": {
"title": "Format de date/heure personnalisé",
"description": "Personnalisez le format de la date et de l'heure insérées via <shortcut /> ou la barre d'outils. Consultez la <doc>documentation Day.js</doc> pour connaître les formats disponibles.",
"description": "Personnalisez le format de la date et de l'heure insérées via <shortcut /> ou la barre d'outils. Consultez la <doc>Day.js docs</doc> pour connaître les formats disponibles.",
"format_string": "Chaîne de format :",
"formatted_time": "Date/heure formatée :"
},
"table_view": {
"delete_column_confirmation": "Êtes-vous sûr de vouloir supprimer cette colonne ? L'attribut correspondant sera supprimé de toutes les notes.",
"delete-column": "Supprimer la colonne",
"new-column-label": "Étiquette",
"new-column-relation": "Relation",
"edit-column": "Editer la colonne",
"add-column-to-the-right": "Ajouter une colonne à droite",
"new-row": "Nouvelle ligne",
"new-column": "Nouvelle colonne",
"sort-column-by": "Trier par « {{title}} »",
"sort-column-ascending": "Ascendant",
"sort-column-descending": "Descendant",
"sort-column-clear": "Annuler le tri",
"hide-column": "Masquer la colonne \"{{title}}\"",
"show-hide-columns": "Afficher/masquer les colonnes",
"row-insert-above": "Insérer une ligne au-dessus",
"row-insert-below": "Insérer une ligne au-dessous",
"row-insert-child": "Insérer une note enfant",
"add-column-to-the-left": "Ajouter une colonne à gauche"
},
"book_properties_config": {
"hide-weekends": "Masquer les week-ends",
"display-week-numbers": "Afficher les numéros de semaine",
"map-style": "Style de carte :",
"max-nesting-depth": "Profondeur d'imbrication maximale :",
"raster": "Trame",
"vector_light": "Vecteur (clair)",
"vector_dark": "Vecteur (foncé)",
"show-scale": "Afficher l'échelle"
},
"table_context_menu": {
"delete_row": "Supprimer la ligne"
},
"board_view": {
"delete-note": "Supprimer la note...",
"remove-from-board": "Retirer du tableau",
"archive-note": "Note archivée",
"unarchive-note": "Note désarchivée",
"move-to": "Déplacer vers",
"insert-above": "Insérer au-dessus",
"insert-below": "Insérer au-dessous",
"delete-column": "Supprimer la colonne",
"delete-column-confirmation": "Êtes-vous sûr de vouloir supprimer cette colonne? L'attribut correspondant sera également supprimé dans les notes sous cette colonne.",
"new-item": "Nouvel article",
"new-item-placeholder": "Entrez le titre de note...",
"add-column": "Ajouter une colonne",
"add-column-placeholder": "Entrez le nom de la colonne...",
"edit-note-title": "Cliquez pour modifier le titre de la note",
"edit-column-title": "Cliquez pour modifier le titre de la colonne"
},
"presentation_view": {
"edit-slide": "Modifier cette diapositive",
"start-presentation": "Démarrer la présentation",
"slide-overview": "Afficher un aperçu des diapositives"
},
"command_palette": {
"tree-action-name": "Arborescence : {{name}}",
"export_note_title": "Exporter la note",
"export_note_description": "Exporter la note actuelle",
"show_attachments_title": "Afficher les pièces jointes",
"show_attachments_description": "Afficher les pièces jointes des notes",
"search_notes_title": "Rechercher des notes",
"search_notes_description": "Ouvrir la recherche avancée",
"search_subtree_title": "Rechercher dans la sous-arborescence",
"search_subtree_description": "Rechercher dans la sous-arborescence actuelle",
"search_history_title": "Afficher l'historique de recherche",
"search_history_description": "Afficher les recherches précédentes",
"configure_launch_bar_title": "Configurer la barre de lancement",
"configure_launch_bar_description": "Ouvrir la configuration de la barre de lancement pour ajouter ou supprimer des éléments."
},
"content_renderer": {
"open_externally": "Ouverture externe"
},
"call_to_action": {
"next_theme_title": "Essayez le nouveau thème Trilium",
"next_theme_message": "Vous utilisez actuellement le thème hérité de l'ancienne version, souhaitez-vous essayer le nouveau thème?",
"next_theme_button": "Essayez le nouveau thème",
"background_effects_title": "Les effets d'arrière-plan sont désormais stables",
"background_effects_message": "Sur les appareils Windows, les effets d'arrière-plan sont désormais parfaitement stables. Ils ajoutent une touche de couleur à l'interface utilisateur en floutant l'arrière-plan. Cette technique est également utilisée dans d'autres applications comme l'Explorateur Windows.",
"background_effects_button": "Activer les effets d'arrière-plan",
"dismiss": "Rejeter"
},
"settings": {
"related_settings": "Paramètres associés"
},
"settings_appearance": {
"related_code_blocks": "Schéma de coloration syntaxique pour les blocs de code dans les notes de texte",
"related_code_notes": "Schéma de couleurs pour les notes de code"
},
"units": {
"percentage": "%"
},
"pagination": {
"page_title": "Page de {{startIndex}} - {{endIndex}}",
"total_notes": "{{count}} notes"
},
"collections": {
"rendering_error": "Impossible d'afficher le contenu en raison d'une erreur."
},
"code-editor-options": {
"title": "Éditeur"
},
"tasks": {
"due": {
"today": "Aujourd'hui",
"tomorrow": "Demain",
"yesterday": "Hier"
}
},
"content_widget": {
"unknown_widget": "Widget inconnu pour « {{id}} »."
},
"note_language": {
"not_set": "Non défini",
"configure-languages": "Configurer les langues..."
},
"content_language": {
"title": "Contenu des langues",
"description": "Sélectionnez une ou plusieurs langues à afficher dans la section « Propriétés de base » d'une note textuelle en lecture seule ou modifiable. Cela permettra d'utiliser des fonctionnalités telles que la vérification orthographique ou la prise en charge de l'écriture de droite à gauche."
},
"switch_layout_button": {
"title_vertical": "Déplacer le volet d'édition vers le bas",
"title_horizontal": "Déplacer le panneau d'édition vers la gauche"
},
"toggle_read_only_button": {
"unlock-editing": "Déverrouiller l'édition",
"lock-editing": "Verrouiller l'édition"
},
"png_export_button": {
"button_title": "Exporter le diagramme au format PNG"
},
"svg": {
"export_to_png": "Le diagramme n'a pas pu être exporté au format PNG."
},
"code_theme": {
"title": "Apparence",
"word_wrapping": "retour à la ligne automatique",
"color-scheme": "Jeu de couleurs"
},
"cpu_arch_warning": {
"title": "Veuillez télécharger la version ARM64",
"message_macos": "TriliumNext fonctionne actuellement sous Rosetta 2, ce qui signifie que vous utilisez la version Intel (x64) sur un Mac Apple Silicon. Cela aura un impact significatif sur les performances et l'autonomie de la batterie.",
"message_windows": "TriliumNext fonctionne actuellement en mode émulation, ce qui signifie que vous utilisez la version Intel (x64) sur un appareil Windows sur ARM. Cela aura un impact significatif sur les performances et l'autonomie de la batterie.",
"recommendation": "Pour une expérience optimale, veuillez télécharger la version ARM64 native de TriliumNext depuis notre page de versions.",
"download_link": "Télécharger la version native",
"continue_anyway": "Continuer quand même",
"dont_show_again": "Ne plus afficher cet avertissement"
},
"editorfeatures": {
"title": "Caractéristiques",
"emoji_completion_enabled": "Activer la saisie semi-automatique des emojis",
"emoji_completion_description": "Si cette option est activée, les emojis peuvent être facilement insérés dans le texte en tapant `:` , suivi du nom d'un emoji.",
"note_completion_enabled": "Activer la saisie semi-automatique des notes",
"note_completion_description": "Si cette option est activée, des liens vers des notes peuvent être créés en tapant `@` suivi du titre d'une note.",
"slash_commands_enabled": "Activer les commandes slash",
"slash_commands_description": "Si cette option est activée, les commandes d'édition telles que l'insertion de sauts de ligne ou d'en-têtes peuvent être activées en tapant `/`."
}
}

View File

@@ -221,7 +221,7 @@
"emoji_completion_description": "Se abilitata, è possibile inserire facilmente gli emoji nel testo digitando `:`, seguito dal nome dell'emoji.",
"note_completion_description": "Se abilitato, è possibile creare collegamenti alle note digitando `@` seguito dal titolo di una nota.",
"slash_commands_enabled": "Abilita i comandi slash",
"slash_commands_description": "Se abilitato, i comandi di modifica come l'inserimento di interruzioni di riga o intestazioni possono essere attivati digitando `/`."
"slash_commands_description": "Se abilitato, i comandi di modifica come l'inserimento di interruzioni di riga o intestazioni possono essere attivati digitando `/`."
},
"table_view": {
"new-row": "Nuova riga",
@@ -381,8 +381,8 @@
},
"attachment_detail": {
"open_help_page": "Apri la pagina di aiuto sugli allegati",
"owning_note": "Nota di proprietà:",
"you_can_also_open": ", puoi anche aprire il",
"owning_note": "Nota di proprietà: ",
"you_can_also_open": ", puoi anche aprire il ",
"list_of_all_attachments": "Elenco di tutti gli allegati",
"attachment_deleted": "Questo allegato è stato eliminato."
},
@@ -703,7 +703,7 @@
"last_attempt": "Ultimo tentativo",
"actions": "Azioni",
"retry": "Riprova",
"partial": "{{ percentuale }}% completato",
"partial": "{{ percentage }}% completato",
"retry_queued": "Nota in coda per un nuovo tentativo",
"retry_failed": "Impossibile mettere in coda la nota per un nuovo tentativo",
"max_notes_per_llm_query": "Numero massimo di note per query",
@@ -719,12 +719,12 @@
"reprocess_index_started": "Ottimizzazione dell'indice di ricerca avviata in background",
"reprocess_index_error": "Errore durante la ricostruzione dell'indice di ricerca",
"index_rebuild_progress": "Progresso nella ricostruzione dell'indice",
"index_rebuilding": "Indice di ottimizzazione ({{percentuale}}%)",
"index_rebuilding": "Indice di ottimizzazione ({{percentage}}%)",
"index_rebuild_complete": "Ottimizzazione dell'indice completata",
"index_rebuild_status_error": "Errore durante il controllo dello stato di ricostruzione dell'indice",
"never": "Mai",
"processing": "Elaborazione ({{percentuale}}%)",
"incomplete": "Incompleto ({{percentuale}}%)",
"processing": "Elaborazione ({{percentage}}%)",
"incomplete": "Incompleto ({{percentage}}%)",
"complete": "Completato (100%)",
"refreshing": "Rinfrescante...",
"auto_refresh_notice": "Si aggiorna automaticamente ogni {{seconds}} secondi",
@@ -761,9 +761,7 @@
"indexing_stopped": "Indicizzazione interrotta",
"indexing_in_progress": "Indicizzazione in corso...",
"last_indexed": "Ultimo indicizzato",
"n_notes_queued": "{{ count }} nota in coda per l'indicizzazione",
"note_chat": "Nota Chat",
"notes_indexed": "{{ count }} nota indicizzata",
"sources": "Fonti",
"start_indexing": "Avvia l'indicizzazione",
"use_advanced_context": "Usa contesto avanzato",
@@ -811,7 +809,8 @@
"codeImportedAsCode": "Importa i file di codice riconosciuti (ad esempio <code>.json</code>) come note di codice se non è chiaro dai metadati",
"replaceUnderscoresWithSpaces": "Sostituisci i trattini bassi con spazi nei nomi delle note importate",
"import": "Importa",
"failed": "Importazione fallita: {{message}}."
"failed": "Importazione fallita: {{message}}.",
"importZipRecommendation": "Quando si importa un file ZIP, la gerarchia delle note rifletterà la struttura delle sottodirectory all'interno dell'archivio."
},
"include_note": {
"dialog_title": "Includi nota",
@@ -1478,7 +1477,7 @@
},
"attachment_list": {
"open_help_page": "Apri la pagina di aiuto sugli allegati",
"owning_note": "Nota di proprietà:",
"owning_note": "Nota di proprietà: ",
"upload_attachments": "Carica allegati",
"no_attachments": "Questa nota non ha allegati."
},
@@ -1710,7 +1709,7 @@
"for_more_info": "per maggiori informazioni.",
"protected_session_timeout_label": "Timeout della sessione protetta:",
"reset_confirmation": "Reimpostando la password perderai per sempre l'accesso a tutte le tue note protette. Vuoi davvero reimpostare la password?",
"reset_success_message": "La password è stata reimpostata. Imposta una nuova password.",
"reset_success_message": "La password è stata resettata. Imposta una nuova password",
"change_password_heading": "Cambiare la password",
"set_password_heading": "Imposta password",
"set_password": "Imposta password",
@@ -1740,14 +1739,14 @@
"recovery_keys_no_key_set": "Nessun codice di ripristino impostato",
"recovery_keys_generate": "Genera codici di recupero",
"recovery_keys_regenerate": "Rigenera i codici di recupero",
"recovery_keys_used": "Utilizzato: {{data}}",
"recovery_keys_used": "Utilizzato: {{date}}",
"recovery_keys_unused": "Il codice di ripristino {{index}} non è utilizzato",
"oauth_title": "OAuth/OpenID",
"oauth_description": "OpenID è un metodo standardizzato che ti consente di accedere ai siti web utilizzando un account di un altro servizio, come Google, per verificare la tua identità. L'emittente predefinito è Google, ma puoi cambiarlo con qualsiasi altro provider OpenID. Per ulteriori informazioni, consulta <a href=\"#root/_hidden/_help/_help_Otzi9La2YAUX/_help_WOcw2SLH6tbX/_help_7DAiwaf8Z7Rz\">qui</a>. Segui queste <a href=\"https://developers.google.com/identity/openid-connect/openid-connect\">istruzioni</a> per configurare un servizio OpenID tramite Google.",
"oauth_description_warning": "Per abilitare OAuth/OpenID, è necessario impostare l'URL di base di OAuth/OpenID, l'ID client e il segreto client nel file config.ini e riavviare l'applicazione. Per impostare le variabili d'ambiente, impostare TRILIUM_OAUTH_BASE_URL, TRILIUM_OAUTH_CLIENT_ID e TRILIUM_OAUTH_CLIENT_SECRET.",
"oauth_missing_vars": "Impostazioni mancanti: {{-variabili}}",
"oauth_user_account": "Account utente:",
"oauth_user_email": "Email utente:",
"oauth_missing_vars": "Impostazioni mancanti: {{-variables}}",
"oauth_user_account": "Account utente: ",
"oauth_user_email": "Email utente: ",
"oauth_user_not_logged_in": "Non hai effettuato l'accesso!"
},
"spellcheck": {
@@ -1756,7 +1755,7 @@
"enable": "Abilita il controllo ortografico",
"language_code_label": "Codice/i della lingua",
"language_code_placeholder": "ad esempio \"en-US\", \"de-AT\"",
"multiple_languages_info": "È possibile separare più lingue con una virgola, ad esempio \"en-US, de-DE, cs\".",
"multiple_languages_info": "È possibile separare più lingue con una virgola, ad esempio \"en-US, de-DE, cs\". ",
"available_language_codes_label": "Codici lingua disponibili:",
"restart-required": "Le modifiche alle opzioni di controllo ortografico avranno effetto dopo il riavvio dell'applicazione."
},
@@ -1858,7 +1857,9 @@
"window-on-top": "Mantieni la finestra in primo piano"
},
"note_detail": {
"could_not_find_typewidget": "Impossibile trovare typeWidget per il tipo '{{type}}'"
"could_not_find_typewidget": "Impossibile trovare typeWidget per il tipo '{{type}}'",
"printing": "Stampa in corso...",
"printing_pdf": "Esportazione in PDF in corso..."
},
"note_title": {
"placeholder": "scrivi qui il titolo della nota..."
@@ -1909,7 +1910,7 @@
},
"frontend_script_api": {
"async_warning": "Stai passando una funzione asincrona a `api.runOnBackend()` che probabilmente non funzionerà come previsto.\\nRendi la funzione sincrona (rimuovendo la parola chiave `async`) oppure usa `api.runAsyncOnBackendWithManualTransactionHandling()`.",
"sync_warning": "Stai passando una funzione sincrona a `api.runAsyncOnBackendWithManualTransactionHandling()`, mentre probabilmente dovresti usare `api.runOnBackend()`."
"sync_warning": "Stai passando una funzione sincrona a `api.runAsyncOnBackendWithManualTransactionHandling()`, \\nmentre probabilmente dovresti usare `api.runOnBackend()`."
},
"ws": {
"sync-check-failed": "Controllo di sincronizzazione fallito!",
@@ -2044,7 +2045,7 @@
"slide-overview": "Attiva/disattiva una panoramica delle diapositive"
},
"command_palette": {
"tree-action-name": "Albero: {{nome}}",
"tree-action-name": "Albero: {{name}}",
"export_note_title": "Nota di esportazione",
"export_note_description": "Esporta la nota corrente",
"show_attachments_title": "Mostra allegati",
@@ -2087,4 +2088,4 @@
"collections": {
"rendering_error": "Impossibile mostrare il contenuto a causa di un errore."
}
}
}

View File

@@ -73,7 +73,7 @@
},
"left_pane_toggle": {
"show_panel": "パネルを表示",
"hide_panel": "パネルを隠す"
"hide_panel": "パネルを非表示"
},
"move_pane_button": {
"move_left": "左に移動",
@@ -741,7 +741,7 @@
"new-column": "新しい列",
"sort-column-by": "\"{{title}}\" で並べ替え",
"sort-column-clear": "並べ替えをクリア",
"hide-column": "列 \"{{title}}\" を隠す",
"hide-column": "列 \"{{title}}\" を非表示",
"show-hide-columns": "列を表示/非表示",
"row-insert-above": "上に行を挿入",
"row-insert-below": "下に行を挿入",
@@ -1200,7 +1200,7 @@
"collapse-title": "ノートツリーを折りたたむ",
"scroll-active-title": "アクティブノートまでスクロール",
"tree-settings-title": "ツリーの設定",
"hide-archived-notes": "アーカイブノートを隠す",
"hide-archived-notes": "アーカイブノートを非表示",
"automatically-collapse-notes": "ノートを自動的に折りたたむ",
"automatically-collapse-notes-title": "一定期間使用されないと、ツリーを整理するためにノートは折りたたまれます。",
"save-changes": "変更を保存して適用",

View File

@@ -184,7 +184,8 @@
},
"import-status": "匯入狀態",
"in-progress": "正在匯入:{{progress}}",
"successful": "匯入成功。"
"successful": "匯入成功。",
"importZipRecommendation": "匯入 ZIP 檔案時,筆記層級將反映壓縮檔內的子目錄結構。"
},
"include_note": {
"dialog_title": "內嵌筆記",

View File

@@ -11,7 +11,8 @@
},
"add_link": {
"add_link": "Thêm liên kết",
"button_add_link": "Thêm liên kết"
"button_add_link": "Thêm liên kết",
"help_on_links": "Trợ giúp về các liên kết"
},
"bulk_actions": {
"other": "Khác"
@@ -41,7 +42,13 @@
"message": "Đã xảy ra lỗi nghiêm trọng ngăn ứng dụng client khởi động\n\n{{message}}\n\nĐiều này có khả năng bị gây ra bởi một script hoạt động không như mong đợi. Hãy thử khởi động ứng dụng ở chế độ an toàn và giải quyết vấn đề."
},
"widget-error": {
"title": "Khởi tạo widget thất bại"
"title": "Khởi tạo widget thất bại",
"message-custom": "Tiện ích tùy chỉnh từ ghi chú với ID \"{{id}}\", tiêu đề \"{{title}}\" không thể khởi tạo vì:\n\n{{message}}",
"message-unknown": "Tiện ích chưa biết không thể được khởi tạo vì:\n\n{{message}}"
},
"bundle-error": {
"title": "Tải script tùy chọn thất bại",
"message": "Script từ ghi chú ID \"{{id}}\", tiêu đề \"{{title}}\" không thể chạy được vì:\n\n{{message}}"
}
},
"import": {

View File

@@ -47,8 +47,9 @@ export default class RightDropdownButtonWidget extends BasicWidget {
}
});
this.$tooltip = this.$widget.find(".tooltip-trigger").attr("title", this.title);
this.tooltip = new Tooltip(this.$tooltip[0], {
this.$widget.attr("title", this.title);
this.tooltip = Tooltip.getOrCreateInstance(this.$widget[0], {
trigger: "hover",
placement: handleRightToLeftPlacement(this.settings.titlePlacement),
fallbackPlacements: [ handleRightToLeftPlacement(this.settings.titlePlacement) ]
});
@@ -56,9 +57,7 @@ export default class RightDropdownButtonWidget extends BasicWidget {
this.$widget
.find(".right-dropdown-button")
.addClass(this.iconClass)
.on("click", () => this.tooltip.hide())
.on("mouseenter", () => this.tooltip.show())
.on("mouseleave", () => this.tooltip.hide());
.on("click", () => this.tooltip.hide());
this.$widget.on("show.bs.dropdown", async () => {
await this.dropdownShown();

View File

@@ -141,7 +141,11 @@ function NoteContent({ note, trim, noChildrenList, highlightedTokens }: { note:
})
.then(({ $renderedContent, type }) => {
if (!contentRef.current) return;
contentRef.current.replaceChildren(...$renderedContent);
if ($renderedContent[0].innerHTML) {
contentRef.current.replaceChildren(...$renderedContent);
} else {
contentRef.current.replaceChildren();
}
contentRef.current.classList.add(`type-${type}`);
highlightSearch(contentRef.current);
})

View File

@@ -79,7 +79,8 @@ export default function ExportDialog() {
values={[
{ value: "html", label: t("export.format_html_zip") },
{ value: "markdown", label: t("export.format_markdown") },
{ value: "opml", label: t("export.format_opml") }
{ value: "opml", label: t("export.format_opml") },
{ value: "share", label: t("export.share-format") }
]}
/>

View File

@@ -1,4 +1,5 @@
import { useNoteContext, useTriliumOption } from "../react/hooks";
import { useTriliumOption } from "../react/hooks";
import { TabContext } from "./ribbon-interface";
/**
* Handles the editing toolbar when the CKEditor is in decoupled mode.
@@ -6,19 +7,13 @@ import { useNoteContext, useTriliumOption } from "../react/hooks";
* This toolbar is only enabled if the user has selected the classic CKEditor.
*
* The ribbon item is active by default for text notes, as long as they are not in read-only mode.
*
*
* ! The toolbar is not only used in the ribbon, but also in the quick edit feature.
*/
export default function FormattingToolbar({ hidden }: { hidden?: boolean }) {
export default function FormattingToolbar({ hidden }: TabContext) {
const [ textNoteEditorType ] = useTriliumOption("textNoteEditorType");
return (textNoteEditorType === "ckeditor-classic" &&
<div className={`classic-toolbar-widget ${hidden ? "hidden-ext" : ""}`} />
)
};
export function PopupEditorFormattingToolbar() {
// TODO: Integrate this directly once we migrate away from class components.
const { note } = useNoteContext();
return <FormattingToolbar hidden={note?.type !== "text"} />;
}

View File

@@ -46,7 +46,7 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not
const parentComponent = useContext(ParentComponent);
const canBeConvertedToAttachment = note?.isEligibleForConversionToAttachment();
const isSearchable = ["text", "code", "book", "mindMap", "doc"].includes(note.type);
const isInOptions = note.noteId.startsWith("_options");
const isInOptionsOrHelp = note?.noteId.startsWith("_options") || note?.noteId.startsWith("_help");
const isPrintable = ["text", "code"].includes(note.type) || (note.type === "book" && note.getLabelValue("viewType") === "presentation");
const isElectron = getIsElectron();
const isMac = getIsMac();
@@ -69,10 +69,10 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not
<FormDropdownDivider />
<CommandItem icon="bx bx-import" text={t("note_actions.import_files")}
disabled={isInOptions || note.type === "search"}
disabled={isInOptionsOrHelp || note.type === "search"}
command={() => parentComponent?.triggerCommand("showImportDialog", { noteId: note.noteId })} />
<CommandItem icon="bx bx-export" text={t("note_actions.export_note")}
disabled={isInOptions || note.noteId === "_backendLog"}
disabled={isInOptionsOrHelp || note.noteId === "_backendLog"}
command={() => noteContext?.notePath && parentComponent?.triggerCommand("showExportDialog", {
notePath: noteContext.notePath,
defaultType: "single"
@@ -84,14 +84,14 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not
<CommandItem command="showNoteSource" icon="bx bx-code" disabled={!hasSource} text={t("note_actions.note_source")} />
<FormDropdownDivider />
<CommandItem command="forceSaveRevision" icon="bx bx-save" disabled={isInOptions} text={t("note_actions.save_revision")} />
<CommandItem command="forceSaveRevision" icon="bx bx-save" disabled={isInOptionsOrHelp} text={t("note_actions.save_revision")} />
<CommandItem icon="bx bx-trash destructive-action-icon" text={t("note_actions.delete_note")} destructive
disabled={isInOptions}
disabled={isInOptionsOrHelp}
command={() => branches.deleteNotes([note.getParentBranches()[0].branchId])}
/>
<FormDropdownDivider />
<CommandItem command="showAttachments" icon="bx bx-paperclip" disabled={isInOptions} text={t("note_actions.note_attachments")} />
<CommandItem command="showAttachments" icon="bx bx-paperclip" disabled={isInOptionsOrHelp} text={t("note_actions.note_attachments")} />
</Dropdown>
);
}

View File

@@ -1,163 +1,15 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
import { t } from "../../services/i18n";
import { useNoteContext, useNoteProperty, useStaticTooltipWithKeyboardShortcut, useTriliumEvents } from "../react/hooks";
import "./style.css";
import { VNode } from "preact";
import BasicPropertiesTab from "./BasicPropertiesTab";
import FormattingToolbar from "./FormattingToolbar";
import { numberObjectsInPlace } from "../../services/utils";
import { TabContext } from "./ribbon-interface";
import options from "../../services/options";
import { EventNames } from "../../components/app_context";
import FNote from "../../entities/fnote";
import ScriptTab from "./ScriptTab";
import EditedNotesTab from "./EditedNotesTab";
import NotePropertiesTab from "./NotePropertiesTab";
import NoteInfoTab from "./NoteInfoTab";
import SimilarNotesTab from "./SimilarNotesTab";
import FilePropertiesTab from "./FilePropertiesTab";
import ImagePropertiesTab from "./ImagePropertiesTab";
import NotePathsTab from "./NotePathsTab";
import NoteMapTab from "./NoteMapTab";
import OwnedAttributesTab from "./OwnedAttributesTab";
import InheritedAttributesTab from "./InheritedAttributesTab";
import CollectionPropertiesTab from "./CollectionPropertiesTab";
import SearchDefinitionTab from "./SearchDefinitionTab";
import NoteActions from "./NoteActions";
import { KeyboardActionNames } from "@triliumnext/commons";
import { RIBBON_TAB_DEFINITIONS } from "./RibbonDefinition";
import { TabConfiguration, TitleContext } from "./ribbon-interface";
interface TitleContext {
note: FNote | null | undefined;
}
interface TabConfiguration {
title: string | ((context: TitleContext) => string);
icon: string;
content: (context: TabContext) => VNode | false;
show: boolean | ((context: TitleContext) => boolean | null | undefined);
toggleCommand?: KeyboardActionNames;
activate?: boolean | ((context: TitleContext) => boolean);
/**
* By default the tab content will not be rendered unless the tab is active (i.e. selected by the user). Setting to `true` will ensure that the tab is rendered even when inactive, for cases where the tab needs to be accessible at all times (e.g. for the detached editor toolbar) or if event handling is needed.
*/
stayInDom?: boolean;
}
const TAB_CONFIGURATION = numberObjectsInPlace<TabConfiguration>([
{
title: t("classic_editor_toolbar.title"),
icon: "bx bx-text",
show: ({ note }) => note?.type === "text" && options.get("textNoteEditorType") === "ckeditor-classic",
toggleCommand: "toggleRibbonTabClassicEditor",
content: FormattingToolbar,
activate: true,
stayInDom: true
},
{
title: ({ note }) => note?.isTriliumSqlite() ? t("script_executor.query") : t("script_executor.script"),
icon: "bx bx-play",
content: ScriptTab,
activate: true,
show: ({ note }) => note &&
(note.isTriliumScript() || note.isTriliumSqlite()) &&
(note.hasLabel("executeDescription") || note.hasLabel("executeButton"))
},
{
title: t("search_definition.search_parameters"),
icon: "bx bx-search",
content: SearchDefinitionTab,
activate: true,
show: ({ note }) => note?.type === "search"
},
{
title: t("edited_notes.title"),
icon: "bx bx-calendar-edit",
content: EditedNotesTab,
show: ({ note }) => note?.hasOwnedLabel("dateNote"),
activate: ({ note }) => (note?.getPromotedDefinitionAttributes().length === 0 || !options.is("promotedAttributesOpenInRibbon")) && options.is("editedNotesOpenInRibbon")
},
{
title: t("book_properties.book_properties"),
icon: "bx bx-book",
content: CollectionPropertiesTab,
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",
content: FilePropertiesTab,
show: ({ note }) => note?.type === "file",
toggleCommand: "toggleRibbonTabFileProperties",
activate: ({ note }) => note?.mime !== "application/pdf"
},
{
title: t("image_properties.title"),
icon: "bx bx-image",
content: ImagePropertiesTab,
show: ({ note }) => note?.type === "image",
toggleCommand: "toggleRibbonTabImageProperties",
activate: true,
},
{
// BasicProperties
title: t("basic_properties.basic_properties"),
icon: "bx bx-slider",
content: BasicPropertiesTab,
show: ({note}) => !note?.isLaunchBarConfig(),
toggleCommand: "toggleRibbonTabBasicProperties"
},
{
title: t("owned_attribute_list.owned_attributes"),
icon: "bx bx-list-check",
content: OwnedAttributesTab,
show: ({note}) => !note?.isLaunchBarConfig(),
toggleCommand: "toggleRibbonTabOwnedAttributes",
stayInDom: true
},
{
title: t("inherited_attribute_list.title"),
icon: "bx bx-list-plus",
content: InheritedAttributesTab,
show: ({note}) => !note?.isLaunchBarConfig(),
toggleCommand: "toggleRibbonTabInheritedAttributes"
},
{
title: t("note_paths.title"),
icon: "bx bx-collection",
content: NotePathsTab,
show: true,
toggleCommand: "toggleRibbonTabNotePaths"
},
{
title: t("note_map.title"),
icon: "bx bxs-network-chart",
content: NoteMapTab,
show: true,
toggleCommand: "toggleRibbonTabNoteMap"
},
{
title: t("similar_notes.title"),
icon: "bx bx-bar-chart",
show: ({ note }) => note?.type !== "search" && !note?.isLabelTruthy("similarNotesWidgetDisabled"),
content: SimilarNotesTab,
toggleCommand: "toggleRibbonTabSimilarNotes"
},
{
title: t("note_info_widget.title"),
icon: "bx bx-info-circle",
show: ({ note }) => !!note,
content: NoteInfoTab,
toggleCommand: "toggleRibbonTabNoteInfo"
}
]);
const TAB_CONFIGURATION = numberObjectsInPlace<TabConfiguration>(RIBBON_TAB_DEFINITIONS);
export default function Ribbon() {
const { note, ntxId, hoistedNoteId, notePath, noteContext, componentId } = useNoteContext();

View File

@@ -0,0 +1,134 @@
import ScriptTab from "./ScriptTab";
import EditedNotesTab from "./EditedNotesTab";
import NotePropertiesTab from "./NotePropertiesTab";
import NoteInfoTab from "./NoteInfoTab";
import SimilarNotesTab from "./SimilarNotesTab";
import FilePropertiesTab from "./FilePropertiesTab";
import ImagePropertiesTab from "./ImagePropertiesTab";
import NotePathsTab from "./NotePathsTab";
import NoteMapTab from "./NoteMapTab";
import OwnedAttributesTab from "./OwnedAttributesTab";
import InheritedAttributesTab from "./InheritedAttributesTab";
import CollectionPropertiesTab from "./CollectionPropertiesTab";
import SearchDefinitionTab from "./SearchDefinitionTab";
import BasicPropertiesTab from "./BasicPropertiesTab";
import FormattingToolbar from "./FormattingToolbar";
import options from "../../services/options";
import { t } from "../../services/i18n";
import { TabConfiguration } from "./ribbon-interface";
export const RIBBON_TAB_DEFINITIONS: TabConfiguration[] = [
{
title: t("classic_editor_toolbar.title"),
icon: "bx bx-text",
show: ({ note }) => note?.type === "text" && options.get("textNoteEditorType") === "ckeditor-classic",
toggleCommand: "toggleRibbonTabClassicEditor",
content: FormattingToolbar,
activate: true,
stayInDom: true
},
{
title: ({ note }) => note?.isTriliumSqlite() ? t("script_executor.query") : t("script_executor.script"),
icon: "bx bx-play",
content: ScriptTab,
activate: true,
show: ({ note }) => note &&
(note.isTriliumScript() || note.isTriliumSqlite()) &&
(note.hasLabel("executeDescription") || note.hasLabel("executeButton"))
},
{
title: t("search_definition.search_parameters"),
icon: "bx bx-search",
content: SearchDefinitionTab,
activate: true,
show: ({ note }) => note?.type === "search"
},
{
title: t("edited_notes.title"),
icon: "bx bx-calendar-edit",
content: EditedNotesTab,
show: ({ note }) => note?.hasOwnedLabel("dateNote"),
activate: ({ note }) => (note?.getPromotedDefinitionAttributes().length === 0 || !options.is("promotedAttributesOpenInRibbon")) && options.is("editedNotesOpenInRibbon")
},
{
title: t("book_properties.book_properties"),
icon: "bx bx-book",
content: CollectionPropertiesTab,
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",
content: FilePropertiesTab,
show: ({ note }) => note?.type === "file",
toggleCommand: "toggleRibbonTabFileProperties",
activate: ({ note }) => note?.mime !== "application/pdf"
},
{
title: t("image_properties.title"),
icon: "bx bx-image",
content: ImagePropertiesTab,
show: ({ note }) => note?.type === "image",
toggleCommand: "toggleRibbonTabImageProperties",
activate: true,
},
{
// BasicProperties
title: t("basic_properties.basic_properties"),
icon: "bx bx-slider",
content: BasicPropertiesTab,
show: ({note}) => !note?.isLaunchBarConfig(),
toggleCommand: "toggleRibbonTabBasicProperties"
},
{
title: t("owned_attribute_list.owned_attributes"),
icon: "bx bx-list-check",
content: OwnedAttributesTab,
show: ({note}) => !note?.isLaunchBarConfig(),
toggleCommand: "toggleRibbonTabOwnedAttributes",
stayInDom: true
},
{
title: t("inherited_attribute_list.title"),
icon: "bx bx-list-plus",
content: InheritedAttributesTab,
show: ({note}) => !note?.isLaunchBarConfig(),
toggleCommand: "toggleRibbonTabInheritedAttributes"
},
{
title: t("note_paths.title"),
icon: "bx bx-collection",
content: NotePathsTab,
show: true,
toggleCommand: "toggleRibbonTabNotePaths"
},
{
title: t("note_map.title"),
icon: "bx bxs-network-chart",
content: NoteMapTab,
show: true,
toggleCommand: "toggleRibbonTabNoteMap"
},
{
title: t("similar_notes.title"),
icon: "bx bx-bar-chart",
show: ({ note }) => note?.type !== "search" && !note?.isLabelTruthy("similarNotesWidgetDisabled"),
content: SimilarNotesTab,
toggleCommand: "toggleRibbonTabSimilarNotes"
},
{
title: t("note_info_widget.title"),
icon: "bx bx-info-circle",
show: ({ note }) => !!note,
content: NoteInfoTab,
toggleCommand: "toggleRibbonTabNoteInfo"
}
];

View File

@@ -115,7 +115,7 @@ function SearchOption({ note, title, titleIcon, children, help, attributeName, a
additionalAttributesToDelete?: { type: "label" | "relation", name: string }[]
}) {
return (
<tr>
<tr className={attributeName}>
<td className="title-column">
{titleIcon && <><Icon icon={titleIcon} />{" "}</>}
{title}

View File

@@ -0,0 +1,174 @@
.search-setting-table {
margin-top: 0;
margin-bottom: 7px;
width: 100%;
border-collapse: separate;
border-spacing: 10px;
}
.search-setting-table div {
white-space: nowrap;
}
.search-setting-table .title-column {
/* minimal width so that table remains static sized and most space remains for middle column with settings */
width: 50px;
white-space: nowrap;
}
.search-setting-table .button-column {
/* minimal width so that table remains static sized and most space remains for middle column with settings */
width: 50px;
white-space: nowrap;
text-align: end;
vertical-align: middle;
}
.search-setting-table .button-column .dropdown {
display: inline-block !important;
}
.search-setting-table .button-column .dropdown-menu {
white-space: normal;
}
.search-setting-table .button-column > * {
vertical-align: middle;
}
.attribute-list hr {
height: 1px;
border-color: var(--main-border-color);
position: relative;
top: 4px;
margin-top: 5px;
margin-bottom: 0;
}
.search-definition-widget input:invalid {
border: 3px solid red;
}
.add-search-option button {
margin: 3px;
}
.dropdown-header {
background-color: var(--accented-background-color);
}
.search-actions-container {
display: flex;
justify-content: space-evenly;
}
body.mobile .search-definition-widget {
contain: none;
}
@media (max-width: 720px) {
.search-setting-table {
display: block;
font-size: 0.9em;
}
.search-setting-table tr {
padding: 0.5em 0;
border-bottom: 1px solid var(--main-border-color);
}
.search-setting-table tr,
.search-setting-table td {
display: block;
}
.search-setting-table tbody {
display: block;
padding: 0 1em;
}
.search-setting-table tbody:first-of-type {
display: block;
overflow: auto;
}
.search-setting-table .add-search-option {
display: flex;
}
.search-setting-table .add-search-option button {
font-size: 0.75em;
}
.search-options tr,
.action-options tr {
display: flex;
align-items: center;
}
.action-options tr > td > div {
flex-wrap: wrap;
gap: 0.5em 0;
}
.action-options input {
max-width: 75vw;
}
.search-setting-table .title-column {
width: unset;
margin-right: 0.5em;
min-width: 30%;
flex-shrink: 0;
}
.search-setting-table .button-column {
flex-grow: 1;
justify-content: end;
overflow: hidden;
flex-shrink: 0;
}
.search-setting-table .button-column .bx-help-circle {
display: none;
}
.search-setting-table tr.orderBy td:nth-of-type(2) {
display: flex;
flex-direction: column;
overflow: hidden;
gap: 0.5em;
}
.search-setting-table tr.searchString td:nth-of-type(2) {
flex-grow: 1;
}
.search-setting-table tr.searchString .button-column {
flex-grow: 0;
flex-shrink: 0;
width: 64px;
}
.search-setting-table tr.ancestor > td > div {
flex-direction: column;
align-items: flex-start !important;
}
.search-actions tr {
border-bottom: 0;
}
.search-actions-container {
align-items: center;
justify-content: center !important;
}
.search-result-widget,
.note-list.list-view,
.note-list-wrapper {
overflow: unset;
height: unset !important;
}
}

View File

@@ -20,8 +20,9 @@ import bulk_action, { ACTION_GROUPS } from "../../services/bulk_action";
import { FormListHeader, FormListItem } from "../react/FormList";
import RenameNoteBulkAction from "../bulk_actions/note/rename_note";
import { getErrorMessage } from "../../services/utils";
import "./SearchDefinitionTab.css";
export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext) {
const parentComponent = useContext(ParentComponent);
const [ searchOptions, setSearchOptions ] = useState<{ availableOptions: SearchOption[], activeOptions: SearchOption[] }>();
const [ error, setError ] = useState<{ message: string }>();
@@ -75,7 +76,7 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
return (
<div className="search-definition-widget">
<div className="search-settings">
{note &&
{note && !hidden &&
<table className="search-setting-table">
<tbody>
<tr>
@@ -110,10 +111,10 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
})}
</tbody>
<BulkActionsList note={note} />
<tbody>
<tbody className="search-actions">
<tr>
<td colSpan={3}>
<div style={{ display: "flex", justifyContent: "space-evenly" }}>
<div className="search-actions-container">
<Button
icon="bx bx-search"
text={t("search_definition.search_button")}

View File

@@ -0,0 +1,43 @@
import { ComponentChildren } from "preact";
import { useNoteContext } from "../../react/hooks";
import { TabContext, TitleContext } from "../ribbon-interface";
import { useEffect, useMemo, useState } from "preact/hooks";
import { RIBBON_TAB_DEFINITIONS } from "../RibbonDefinition";
interface StandaloneRibbonAdapterProps {
component: (props: TabContext) => ComponentChildren;
}
/**
* Takes in any ribbon tab component and renders it in standalone mod using the note context, thus requiring no inputs.
* Especially useful on mobile to detach components that would normally fit in the ribbon.
*/
export default function StandaloneRibbonAdapter({ component }: StandaloneRibbonAdapterProps) {
const Component = component;
const { note, ntxId, hoistedNoteId, notePath, noteContext, componentId } = useNoteContext();
const definition = useMemo(() => RIBBON_TAB_DEFINITIONS.find(def => def.content === component), [ component ]);
const [ shown, setShown ] = useState(unwrapShown(definition?.show, { note }));
useEffect(() => {
setShown(unwrapShown(definition?.show, { note }));
}, [ note ]);
return (
<Component
note={note}
hidden={!shown}
ntxId={ntxId}
hoistedNoteId={hoistedNoteId}
notePath={notePath}
noteContext={noteContext}
componentId={componentId}
activate={() => {}}
/>
);
}
function unwrapShown(value: boolean | ((context: TitleContext) => boolean | null | undefined) | undefined, context: TitleContext) {
if (!value) return true;
if (typeof value === "boolean") return value;
return !!value(context);
}

View File

@@ -1,5 +1,7 @@
import { KeyboardActionNames } from "@triliumnext/commons";
import NoteContext from "../../components/note_context";
import FNote from "../../entities/fnote";
import { VNode } from "preact";
export interface TabContext {
note: FNote | null | undefined;
@@ -11,3 +13,20 @@ export interface TabContext {
componentId: string;
activate(): void;
}
export interface TitleContext {
note: FNote | null | undefined;
}
export interface TabConfiguration {
title: string | ((context: TitleContext) => string);
icon: string;
content: (context: TabContext) => VNode | false;
show: boolean | ((context: TitleContext) => boolean | null | undefined);
toggleCommand?: KeyboardActionNames;
activate?: boolean | ((context: TitleContext) => boolean);
/**
* By default the tab content will not be rendered unless the tab is active (i.e. selected by the user). Setting to `true` will ensure that the tab is rendered even when inactive, for cases where the tab needs to be accessible at all times (e.g. for the detached editor toolbar) or if event handling is needed.
*/
stayInDom?: boolean;
}

View File

@@ -376,67 +376,6 @@ body[dir=rtl] .attribute-list-editor {
}
/* #endregion */
/* #region Search definition */
.search-setting-table {
margin-top: 0;
margin-bottom: 7px;
width: 100%;
border-collapse: separate;
border-spacing: 10px;
}
.search-setting-table div {
white-space: nowrap;
}
.search-setting-table .title-column {
/* minimal width so that table remains static sized and most space remains for middle column with settings */
width: 50px;
white-space: nowrap;
}
.search-setting-table .button-column {
/* minimal width so that table remains static sized and most space remains for middle column with settings */
width: 50px;
white-space: nowrap;
text-align: end;
vertical-align: middle;
}
.search-setting-table .button-column .dropdown {
display: inline-block !important;
}
.search-setting-table .button-column .dropdown-menu {
white-space: normal;
}
.search-setting-table .button-column > * {
vertical-align: middle;
}
.attribute-list hr {
height: 1px;
border-color: var(--main-border-color);
position: relative;
top: 4px;
margin-top: 5px;
margin-bottom: 0;
}
.search-definition-widget input:invalid {
border: 3px solid red;
}
.add-search-option button {
margin: 3px;
}
.dropdown-header {
background-color: var(--accented-background-color);
}
/* #endregion */
/* #region Note actions */
.note-actions {
width: 35px;

View File

@@ -6,7 +6,7 @@ import { initializeTranslations } from "@triliumnext/server/src/services/i18n.js
import debounce from "@triliumnext/client/src/services/debounce.js";
import { extractZip, importData, initializeDatabase, startElectron } from "./utils.js";
import cls from "@triliumnext/server/src/services/cls.js";
import type { AdvancedExportOptions } from "@triliumnext/server/src/services/export/zip.js";
import type { AdvancedExportOptions, ExportFormat } from "@triliumnext/server/src/services/export/zip/abstract_provider.js";
import { parseNoteMetaFile } from "@triliumnext/server/src/services/in_app_help.js";
import type NoteMeta from "@triliumnext/server/src/services/meta/note_meta.js";
@@ -75,7 +75,7 @@ async function setOptions() {
optionsService.setOption("compressImages", "false");
}
async function exportData(noteId: string, format: "html" | "markdown", outputPath: string, ignoredFiles?: Set<string>) {
async function exportData(noteId: string, format: ExportFormat, outputPath: string, ignoredFiles?: Set<string>) {
const zipFilePath = "output.zip";
try {

View File

@@ -7,6 +7,7 @@ async function main() {
// Copy assets
build.copy("src/assets", "assets/");
build.triggerBuildAndCopyTo("packages/share-theme", "share-theme/assets/");
build.copy("/packages/share-theme/src/templates", "share-theme/templates/");
// Copy node modules dependencies

View File

@@ -274,7 +274,8 @@
"export_filter": "Document PDF (*.pdf)",
"unable-to-export-message": "La note actuelle n'a pas pu être exportée en format PDF.",
"unable-to-export-title": "Impossible d'exporter au format PDF",
"unable-to-save-message": "Le fichier sélectionné n'a pas pu être écrit. Réessayez ou sélectionnez une autre destination."
"unable-to-save-message": "Le fichier sélectionné n'a pas pu être écrit. Réessayez ou sélectionnez une autre destination.",
"unable-to-print": "Impossible d'imprimer la note"
},
"tray": {
"tooltip": "Trilium Notes",
@@ -283,7 +284,8 @@
"bookmarks": "Signets",
"today": "Ouvrir la note du journal du jour",
"new-note": "Nouvelle note",
"show-windows": "Afficher les fenêtres"
"show-windows": "Afficher les fenêtres",
"open_new_window": "Ouvrir une nouvelle fenêtre"
},
"migration": {
"old_version": "La migration directe à partir de votre version actuelle n'est pas prise en charge. Veuillez d'abord mettre à jour vers la version v0.60.4, puis vers cette nouvelle version.",
@@ -398,5 +400,42 @@
"instance_already_running": "Une instance est déjà en cours d'execution, ouverture de cette instance à la place."
},
"weekdayNumber": "Semaine {weekNumber}",
"quarterNumber": "Trimestre {quarterNumber}"
"quarterNumber": "Trimestre {quarterNumber}",
"share_theme": {
"site-theme": "Thème du site",
"search_placeholder": "Recherche...",
"image_alt": "Image de l'article",
"last-updated": "Dernière mise à jour le {{- date}}",
"subpages": "Sous-pages:",
"on-this-page": "Sur cette page",
"expand": "Développer"
},
"hidden_subtree_templates": {
"text-snippet": "Extrait de texte",
"description": "Description",
"list-view": "Vue en liste",
"grid-view": "Vue en grille",
"calendar": "Calendrier",
"table": "Tableau",
"geo-map": "Carte géographique",
"start-date": "Date de début",
"end-date": "Date de fin",
"start-time": "Heure de début",
"end-time": "Heure de fin",
"geolocation": "Géolocalisation",
"built-in-templates": "Modèles intégrés",
"board": "Tableau de bord",
"status": "État",
"board_note_first": "Première note",
"board_note_second": "Deuxième note",
"board_note_third": "Troisième note",
"board_status_todo": "A faire",
"board_status_progress": "En cours",
"board_status_done": "Terminé",
"presentation": "Présentation",
"presentation_slide": "Diapositive de présentation",
"presentation_slide_first": "Première diapositive",
"presentation_slide_second": "Deuxième diapositive",
"background": "Arrière-plan"
}
}

View File

@@ -165,7 +165,8 @@
"export_filter": "Documento PDF (*.pdf)",
"unable-to-export-message": "La nota corrente non può essere esportata come PDF.",
"unable-to-export-title": "Impossibile esportare come PDF",
"unable-to-save-message": "Il file selezionato non può essere salvato. Prova di nuovo o seleziona un'altra destinazione."
"unable-to-save-message": "Il file selezionato non può essere salvato. Prova di nuovo o seleziona un'altra destinazione.",
"unable-to-print": "Impossibile stampare la nota"
},
"tray": {
"tooltip": "Trilium Notes",
@@ -430,7 +431,8 @@
"presentation": "Presentazione",
"presentation_slide": "Diapositiva di presentazione",
"presentation_slide_first": "Prima diapositiva",
"presentation_slide_second": "Seconda diapositiva"
"presentation_slide_second": "Seconda diapositiva",
"background": "Contesto"
},
"sql_init": {
"db_not_initialized_desktop": "Database non inizializzato, seguire le istruzioni a schermo.",

View File

@@ -278,6 +278,11 @@ class BBranch extends AbstractBeccaEntity<BBranch> {
});
}
}
getParentNote() {
return this.parentNote;
}
}
export default BBranch;

View File

@@ -1758,6 +1758,26 @@ class BNote extends AbstractBeccaEntity<BNote> {
return childBranches;
}
get encodedTitle() {
return encodeURIComponent(this.title);
}
getVisibleChildBranches() {
return this.getChildBranches().filter((branch) => !branch.getNote().isLabelTruthy("shareHiddenFromTree"));
}
getVisibleChildNotes() {
return this.getVisibleChildBranches().map((branch) => branch.getNote());
}
hasVisibleChildren() {
return this.getVisibleChildNotes().length > 0;
}
get shareId() {
return this.noteId;
}
/**
* Return an attribute by it's attributeId. Requires the attribute cache to be available.
* @param attributeId - the id of the attribute owned by this note

View File

@@ -14,6 +14,7 @@ import type { ParsedQs } from "qs";
import type { NoteParams } from "../services/note-interface.js";
import type { SearchParams } from "../services/search/services/types.js";
import type { ValidatorMap } from "./etapi-interface.js";
import type { ExportFormat } from "../services/export/zip/abstract_provider.js";
function register(router: Router) {
eu.route(router, "get", "/etapi/notes", (req, res, next) => {
@@ -149,7 +150,7 @@ function register(router: Router) {
const note = eu.getAndCheckNote(req.params.noteId);
const format = req.query.format || "html";
if (typeof format !== "string" || !["html", "markdown"].includes(format)) {
if (typeof format !== "string" || !["html", "markdown", "share"].includes(format)) {
throw new eu.EtapiError(400, "UNRECOGNIZED_EXPORT_FORMAT", `Unrecognized export format '${format}', supported values are 'html' (default) or 'markdown'.`);
}
@@ -159,7 +160,7 @@ function register(router: Router) {
// (e.g. branchIds are not seen in UI), that we export "note export" instead.
const branch = note.getParentBranches()[0];
zipExportService.exportToZip(taskContext, branch, format as "html" | "markdown", res);
zipExportService.exportToZip(taskContext, branch, format as ExportFormat, res);
});
eu.route(router, "post", "/etapi/notes/:noteId/import", (req, res, next) => {

View File

@@ -26,7 +26,7 @@ function exportBranch(req: Request, res: Response) {
const taskContext = new TaskContext(taskId, "export", null);
try {
if (type === "subtree" && (format === "html" || format === "markdown")) {
if (type === "subtree" && (format === "html" || format === "markdown" || format === "share")) {
zipExportService.exportToZip(taskContext, branch, format, res);
} else if (type === "single") {
if (format !== "html" && format !== "markdown") {

View File

@@ -152,14 +152,14 @@ function restoreRevision(req: Request) {
}
function getEditedNotesOnDate(req: Request) {
const noteIds = sql.getColumn<string>(
`
const noteIds = sql.getColumn<string>(/*sql*/`\
SELECT notes.*
FROM notes
WHERE noteId IN (
SELECT noteId FROM notes
WHERE notes.dateCreated LIKE :date
OR notes.dateModified LIKE :date
WHERE
(notes.dateCreated LIKE :date OR notes.dateModified LIKE :date)
AND (noteId NOT LIKE '_%')
UNION ALL
SELECT noteId FROM revisions
WHERE revisions.dateLastEdited LIKE :date

View File

@@ -44,6 +44,7 @@ async function register(app: express.Application) {
app.use(`/${assetUrlFragment}/translations/`, persistentCacheStatic(path.join(publicDir, "translations")));
app.use(`/node_modules/`, persistentCacheStatic(path.join(publicDir, "node_modules")));
}
app.use(`/share/assets/`, express.static(getShareThemeAssetDir()));
app.use(`/${assetUrlFragment}/images`, persistentCacheStatic(path.join(resourceDir, "assets", "images")));
app.use(`/${assetUrlFragment}/doc_notes`, persistentCacheStatic(path.join(resourceDir, "assets", "doc_notes")));
app.use(`/assets/vX/fonts`, express.static(path.join(srcRoot, "public/fonts")));
@@ -51,6 +52,16 @@ async function register(app: express.Application) {
app.use(`/assets/vX/stylesheets`, express.static(path.join(srcRoot, "public/stylesheets")));
}
export function getShareThemeAssetDir() {
if (process.env.NODE_ENV === "development") {
const srcRoot = path.join(__dirname, "..", "..");
return path.join(srcRoot, "../../packages/share-theme/dist");
} else {
const resourceDir = getResourceDir();
return path.join(resourceDir, "share-theme/assets");
}
}
export default {
register
};

View File

@@ -9,8 +9,9 @@ import type TaskContext from "../task_context.js";
import type BBranch from "../../becca/entities/bbranch.js";
import type { Response } from "express";
import type BNote from "../../becca/entities/bnote.js";
import type { ExportFormat } from "./zip/abstract_provider.js";
function exportSingleNote(taskContext: TaskContext<"export">, branch: BBranch, format: "html" | "markdown", res: Response) {
function exportSingleNote(taskContext: TaskContext<"export">, branch: BBranch, format: ExportFormat, res: Response) {
const note = branch.getNote();
if (note.type === "image" || note.type === "file") {
@@ -33,7 +34,7 @@ function exportSingleNote(taskContext: TaskContext<"export">, branch: BBranch, f
taskContext.taskSucceeded(null);
}
export function mapByNoteType(note: BNote, content: string | Buffer<ArrayBufferLike>, format: "html" | "markdown") {
export function mapByNoteType(note: BNote, content: string | Buffer<ArrayBufferLike>, format: ExportFormat) {
let payload, extension, mime;
if (typeof content !== "string") {

View File

@@ -1,12 +1,9 @@
"use strict";
import html from "html";
import dateUtils from "../date_utils.js";
import path from "path";
import mimeTypes from "mime-types";
import mdService from "./markdown.js";
import packageInfo from "../../../package.json" with { type: "json" };
import { getContentDisposition, escapeHtml, getResourceDir, isDev } from "../utils.js";
import { getContentDisposition } from "../utils.js";
import protectedSessionService from "../protected_session.js";
import sanitize from "sanitize-filename";
import fs from "fs";
@@ -18,39 +15,48 @@ import ValidationError from "../../errors/validation_error.js";
import type NoteMeta from "../meta/note_meta.js";
import type AttachmentMeta from "../meta/attachment_meta.js";
import type AttributeMeta from "../meta/attribute_meta.js";
import type BBranch from "../../becca/entities/bbranch.js";
import BBranch from "../../becca/entities/bbranch.js";
import type { Response } from "express";
import type { NoteMetaFile } from "../meta/note_meta.js";
import HtmlExportProvider from "./zip/html.js";
import { AdvancedExportOptions, type ExportFormat, ZipExportProviderData } from "./zip/abstract_provider.js";
import MarkdownExportProvider from "./zip/markdown.js";
import ShareThemeExportProvider from "./zip/share_theme.js";
import type BNote from "../../becca/entities/bnote.js";
import { NoteType } from "@triliumnext/commons";
type RewriteLinksFn = (content: string, noteMeta: NoteMeta) => string;
export interface AdvancedExportOptions {
/**
* If `true`, then only the note's content will be kept. If `false` (default), then each page will have its own <html> template.
*/
skipHtmlTemplate?: boolean;
/**
* Provides a custom function to rewrite the links found in HTML or Markdown notes. This method is called for every note imported, if it's of the right type.
*
* @param originalRewriteLinks the original rewrite links function. Can be used to access the default behaviour without having to reimplement it.
* @param getNoteTargetUrl the method to obtain a note's target URL, used internally by `originalRewriteLinks` but can be used here as well.
* @returns a function to rewrite the links in HTML or Markdown notes.
*/
customRewriteLinks?: (originalRewriteLinks: RewriteLinksFn, getNoteTargetUrl: (targetNoteId: string, sourceMeta: NoteMeta) => string | null) => RewriteLinksFn;
}
async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch, format: "html" | "markdown", res: Response | fs.WriteStream, setHeaders = true, zipExportOptions?: AdvancedExportOptions) {
if (!["html", "markdown"].includes(format)) {
throw new ValidationError(`Only 'html' and 'markdown' allowed as export format, '${format}' given`);
async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch, format: ExportFormat, res: Response | fs.WriteStream, setHeaders = true, zipExportOptions?: AdvancedExportOptions) {
if (!["html", "markdown", "share"].includes(format)) {
throw new ValidationError(`Only 'html', 'markdown' and 'share' allowed as export format, '${format}' given`);
}
const archive = archiver("zip", {
zlib: { level: 9 } // Sets the compression level.
});
const rewriteFn = (zipExportOptions?.customRewriteLinks ? zipExportOptions?.customRewriteLinks(rewriteLinks, getNoteTargetUrl) : rewriteLinks);
const provider = buildProvider();
const noteIdToMeta: Record<string, NoteMeta> = {};
function buildProvider() {
const providerData: ZipExportProviderData = {
getNoteTargetUrl,
archive,
branch,
rewriteFn
};
switch (format) {
case "html":
return new HtmlExportProvider(providerData);
case "markdown":
return new MarkdownExportProvider(providerData);
case "share":
return new ShareThemeExportProvider(providerData);
default:
throw new Error();
}
}
function getUniqueFilename(existingFileNames: Record<string, number>, fileName: string) {
const lcFileName = fileName.toLowerCase();
@@ -72,7 +78,7 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
}
}
function getDataFileName(type: string | null, mime: string, baseFileName: string, existingFileNames: Record<string, number>): string {
function getDataFileName(type: NoteType | null, mime: string, baseFileName: string, existingFileNames: Record<string, number>): string {
let fileName = baseFileName.trim();
if (!fileName) {
fileName = "note";
@@ -90,36 +96,14 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
}
let existingExtension = path.extname(fileName).toLowerCase();
let newExtension;
// the following two are handled specifically since we always want to have these extensions no matter the automatic detection
// and/or existing detected extensions in the note name
if (type === "text" && format === "markdown") {
newExtension = "md";
} else if (type === "text" && format === "html") {
newExtension = "html";
} else if (mime === "application/x-javascript" || mime === "text/javascript") {
newExtension = "js";
} else if (type === "canvas" || mime === "application/json") {
newExtension = "json";
} else if (existingExtension.length > 0) {
// if the page already has an extension, then we'll just keep it
newExtension = null;
} else {
if (mime?.toLowerCase()?.trim() === "image/jpg") {
newExtension = "jpg";
} else if (mime?.toLowerCase()?.trim() === "text/mermaid") {
newExtension = "txt";
} else {
newExtension = mimeTypes.extension(mime) || "dat";
}
}
const newExtension = provider.mapExtension(type, mime, existingExtension, format);
// if the note is already named with the extension (e.g. "image.jpg"), then it's silly to append the exact same extension again
if (newExtension && existingExtension !== `.${newExtension.toLowerCase()}`) {
fileName += `.${newExtension}`;
}
return getUniqueFilename(existingFileNames, fileName);
}
@@ -145,7 +129,8 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
const notePath = parentMeta.notePath.concat([note.noteId]);
if (note.noteId in noteIdToMeta) {
const fileName = getUniqueFilename(existingFileNames, `${baseFileName}.clone.${format === "html" ? "html" : "md"}`);
const extension = provider.mapExtension("text", "text/html", "", format);
const fileName = getUniqueFilename(existingFileNames, `${baseFileName}.clone.${extension}`);
const meta: NoteMeta = {
isClone: true,
@@ -155,7 +140,7 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
prefix: branch.prefix,
dataFileName: fileName,
type: "text", // export will have text description
format: format
format: (format === "markdown" ? "markdown" : "html")
};
return meta;
}
@@ -185,7 +170,7 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
taskContext.increaseProgressCount();
if (note.type === "text") {
meta.format = format;
meta.format = (format === "markdown" ? "markdown" : "html");
}
noteIdToMeta[note.noteId] = meta as NoteMeta;
@@ -194,10 +179,13 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
note.sortChildren();
const childBranches = note.getChildBranches().filter((branch) => branch?.noteId !== "_hidden");
const available = !note.isProtected || protectedSessionService.isProtectedSessionAvailable();
let shouldIncludeFile = (!note.isProtected || protectedSessionService.isProtectedSessionAvailable());
if (format !== "share") {
shouldIncludeFile = shouldIncludeFile && (note.getContent().length > 0 || childBranches.length === 0);
}
// if it's a leaf, then we'll export it even if it's empty
if (available && (note.getContent().length > 0 || childBranches.length === 0)) {
if (shouldIncludeFile) {
meta.dataFileName = getDataFileName(note.type, note.mime, baseFileName, existingFileNames);
}
@@ -273,8 +261,6 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
return url;
}
const rewriteFn = (zipExportOptions?.customRewriteLinks ? zipExportOptions?.customRewriteLinks(rewriteLinks, getNoteTargetUrl) : rewriteLinks);
function rewriteLinks(content: string, noteMeta: NoteMeta): string {
content = content.replace(/src="[^"]*api\/images\/([a-zA-Z0-9_]+)\/[^"]*"/g, (match, targetNoteId) => {
const url = getNoteTargetUrl(targetNoteId, noteMeta);
@@ -316,53 +302,15 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
}
}
function prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta): string | Buffer {
if (["html", "markdown"].includes(noteMeta?.format || "")) {
function prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta, note?: BNote): string | Buffer {
const isText = ["html", "markdown"].includes(noteMeta?.format || "");
if (isText) {
content = content.toString();
content = rewriteFn(content, noteMeta);
}
if (noteMeta.format === "html" && typeof content === "string") {
if (!content.substr(0, 100).toLowerCase().includes("<html") && !zipExportOptions?.skipHtmlTemplate) {
if (!noteMeta?.notePath?.length) {
throw new Error("Missing note path.");
}
content = provider.prepareContent(title, content, noteMeta, note, branch);
const cssUrl = `${"../".repeat(noteMeta.notePath.length - 1)}style.css`;
const htmlTitle = escapeHtml(title);
// <base> element will make sure external links are openable - https://github.com/zadam/trilium/issues/1289#issuecomment-704066809
content = `<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="${cssUrl}">
<base target="_parent">
<title data-trilium-title>${htmlTitle}</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>${htmlTitle}</h1>
<div class="ck-content">${content}</div>
</div>
</body>
</html>`;
}
return content.length < 100_000 ? html.prettyPrint(content, { indent_size: 2 }) : content;
} else if (noteMeta.format === "markdown" && typeof content === "string") {
let markdownContent = mdService.toMarkdown(content);
if (markdownContent.trim().length > 0 && !markdownContent.startsWith("# ")) {
markdownContent = `# ${title}\r
${markdownContent}`;
}
return markdownContent;
} else {
return content;
}
return content;
}
function saveNote(noteMeta: NoteMeta, filePathPrefix: string) {
@@ -377,7 +325,7 @@ ${markdownContent}`;
let content: string | Buffer = `<p>This is a clone of a note. Go to its <a href="${targetUrl}">primary location</a>.</p>`;
content = prepareContent(noteMeta.title, content, noteMeta);
content = prepareContent(noteMeta.title, content, noteMeta, undefined);
archive.append(content, { name: filePathPrefix + noteMeta.dataFileName });
@@ -393,7 +341,7 @@ ${markdownContent}`;
}
if (noteMeta.dataFileName) {
const content = prepareContent(noteMeta.title, note.getContent(), noteMeta);
const content = prepareContent(noteMeta.title, note.getContent(), noteMeta, note);
archive.append(content, {
name: filePathPrefix + noteMeta.dataFileName,
@@ -429,138 +377,21 @@ ${markdownContent}`;
}
}
function saveNavigation(rootMeta: NoteMeta, navigationMeta: NoteMeta) {
if (!navigationMeta.dataFileName) {
return;
}
function saveNavigationInner(meta: NoteMeta) {
let html = "<li>";
const escapedTitle = escapeHtml(`${meta.prefix ? `${meta.prefix} - ` : ""}${meta.title}`);
if (meta.dataFileName && meta.noteId) {
const targetUrl = getNoteTargetUrl(meta.noteId, rootMeta);
html += `<a href="${targetUrl}" target="detail">${escapedTitle}</a>`;
} else {
html += escapedTitle;
}
if (meta.children && meta.children.length > 0) {
html += "<ul>";
for (const child of meta.children) {
html += saveNavigationInner(child);
}
html += "</ul>";
}
return `${html}</li>`;
}
const fullHtml = `<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<ul>${saveNavigationInner(rootMeta)}</ul>
</body>
</html>`;
const prettyHtml = fullHtml.length < 100_000 ? html.prettyPrint(fullHtml, { indent_size: 2 }) : fullHtml;
archive.append(prettyHtml, { name: navigationMeta.dataFileName });
const existingFileNames: Record<string, number> = format === "html" ? { navigation: 0, index: 1 } : {};
const rootMeta = createNoteMeta(branch, { notePath: [] }, existingFileNames);
if (!rootMeta) {
throw new Error("Unable to create root meta.");
}
function saveIndex(rootMeta: NoteMeta, indexMeta: NoteMeta) {
let firstNonEmptyNote;
let curMeta = rootMeta;
const metaFile: NoteMetaFile = {
formatVersion: 2,
appVersion: packageInfo.version,
files: [rootMeta]
};
if (!indexMeta.dataFileName) {
return;
}
while (!firstNonEmptyNote) {
if (curMeta.dataFileName && curMeta.noteId) {
firstNonEmptyNote = getNoteTargetUrl(curMeta.noteId, rootMeta);
}
if (curMeta.children && curMeta.children.length > 0) {
curMeta = curMeta.children[0];
} else {
break;
}
}
const fullHtml = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<frameset cols="25%,75%">
<frame name="navigation" src="navigation.html">
<frame name="detail" src="${firstNonEmptyNote}">
</frameset>
</html>`;
archive.append(fullHtml, { name: indexMeta.dataFileName });
}
function saveCss(rootMeta: NoteMeta, cssMeta: NoteMeta) {
if (!cssMeta.dataFileName) {
return;
}
const cssFile = isDev
? path.join(__dirname, "../../../../../node_modules/ckeditor5/dist/ckeditor5-content.css")
: path.join(getResourceDir(), "ckeditor5-content.css");
archive.append(fs.readFileSync(cssFile, "utf-8"), { name: cssMeta.dataFileName });
}
provider.prepareMeta(metaFile);
try {
const existingFileNames: Record<string, number> = format === "html" ? { navigation: 0, index: 1 } : {};
const rootMeta = createNoteMeta(branch, { notePath: [] }, existingFileNames);
if (!rootMeta) {
throw new Error("Unable to create root meta.");
}
const metaFile: NoteMetaFile = {
formatVersion: 2,
appVersion: packageInfo.version,
files: [rootMeta]
};
let navigationMeta: NoteMeta | null = null;
let indexMeta: NoteMeta | null = null;
let cssMeta: NoteMeta | null = null;
if (format === "html") {
navigationMeta = {
noImport: true,
dataFileName: "navigation.html"
};
metaFile.files.push(navigationMeta);
indexMeta = {
noImport: true,
dataFileName: "index.html"
};
metaFile.files.push(indexMeta);
cssMeta = {
noImport: true,
dataFileName: "style.css"
};
metaFile.files.push(cssMeta);
}
for (const noteMeta of Object.values(noteIdToMeta)) {
// filter out relations which are not inside this export
noteMeta.attributes = (noteMeta.attributes || []).filter((attr) => {
@@ -584,34 +415,6 @@ ${markdownContent}`;
}
return;
}
const metaFileJson = JSON.stringify(metaFile, null, "\t");
archive.append(metaFileJson, { name: "!!!meta.json" });
saveNote(rootMeta, "");
if (format === "html") {
if (!navigationMeta || !indexMeta || !cssMeta) {
throw new Error("Missing meta.");
}
saveNavigation(rootMeta, navigationMeta);
saveIndex(rootMeta, indexMeta);
saveCss(rootMeta, cssMeta);
}
const note = branch.getNote();
const zipFileName = `${branch.prefix ? `${branch.prefix} - ` : ""}${note.getTitleOrProtected() || "note"}.zip`;
if (setHeaders && "setHeader" in res) {
res.setHeader("Content-Disposition", getContentDisposition(zipFileName));
res.setHeader("Content-Type", "application/zip");
}
archive.pipe(res);
await archive.finalize();
taskContext.taskSucceeded(null);
} catch (e: unknown) {
const message = `Export failed with error: ${e instanceof Error ? e.message : String(e)}`;
log.error(message);
@@ -623,9 +426,30 @@ ${markdownContent}`;
res.status(500).send(message);
}
}
const metaFileJson = JSON.stringify(metaFile, null, "\t");
archive.append(metaFileJson, { name: "!!!meta.json" });
saveNote(rootMeta, "");
provider.afterDone(rootMeta);
const note = branch.getNote();
const zipFileName = `${branch.prefix ? `${branch.prefix} - ` : ""}${note.getTitleOrProtected()}.zip`;
if (setHeaders && "setHeader" in res) {
res.setHeader("Content-Disposition", getContentDisposition(zipFileName));
res.setHeader("Content-Type", "application/zip");
}
archive.pipe(res);
await archive.finalize();
taskContext.taskSucceeded(null);
}
async function exportToZipFile(noteId: string, format: "markdown" | "html", zipFilePath: string, zipExportOptions?: AdvancedExportOptions) {
async function exportToZipFile(noteId: string, format: ExportFormat, zipFilePath: string, zipExportOptions?: AdvancedExportOptions) {
const fileOutputStream = fs.createWriteStream(zipFilePath);
const taskContext = new TaskContext("no-progress-reporting", "export", null);

View File

@@ -0,0 +1,89 @@
import { Archiver } from "archiver";
import type { default as NoteMeta, NoteMetaFile } from "../../meta/note_meta.js";
import type BNote from "../../../becca/entities/bnote.js";
import type BBranch from "../../../becca/entities/bbranch.js";
import mimeTypes from "mime-types";
import { NoteType } from "@triliumnext/commons";
type RewriteLinksFn = (content: string, noteMeta: NoteMeta) => string;
export type ExportFormat = "html" | "markdown" | "share";
export interface AdvancedExportOptions {
/**
* If `true`, then only the note's content will be kept. If `false` (default), then each page will have its own <html> template.
*/
skipHtmlTemplate?: boolean;
/**
* Provides a custom function to rewrite the links found in HTML or Markdown notes. This method is called for every note imported, if it's of the right type.
*
* @param originalRewriteLinks the original rewrite links function. Can be used to access the default behaviour without having to reimplement it.
* @param getNoteTargetUrl the method to obtain a note's target URL, used internally by `originalRewriteLinks` but can be used here as well.
* @returns a function to rewrite the links in HTML or Markdown notes.
*/
customRewriteLinks?: (originalRewriteLinks: RewriteLinksFn, getNoteTargetUrl: (targetNoteId: string, sourceMeta: NoteMeta) => string | null) => RewriteLinksFn;
}
export interface ZipExportProviderData {
branch: BBranch;
getNoteTargetUrl: (targetNoteId: string, sourceMeta: NoteMeta) => string | null;
archive: Archiver;
zipExportOptions?: AdvancedExportOptions;
rewriteFn: RewriteLinksFn;
}
export abstract class ZipExportProvider {
branch: BBranch;
getNoteTargetUrl: (targetNoteId: string, sourceMeta: NoteMeta) => string | null;
archive: Archiver;
zipExportOptions?: AdvancedExportOptions;
rewriteFn: RewriteLinksFn;
constructor(data: ZipExportProviderData) {
this.branch = data.branch;
this.getNoteTargetUrl = data.getNoteTargetUrl;
this.archive = data.archive;
this.zipExportOptions = data.zipExportOptions;
this.rewriteFn = data.rewriteFn;
}
abstract prepareMeta(metaFile: NoteMetaFile): void;
abstract prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta, note: BNote | undefined, branch: BBranch): string | Buffer;
abstract afterDone(rootMeta: NoteMeta): void;
/**
* Determines the extension of the resulting file for a specific note type.
*
* @param type the type of the note.
* @param mime the mime type of the note.
* @param existingExtension the existing extension, including the leading period character.
* @param format the format requested for export (e.g. HTML, Markdown).
* @returns an extension *without* the leading period character, or `null` to preserve the existing extension instead.
*/
mapExtension(type: NoteType | null, mime: string, existingExtension: string, format: ExportFormat) {
// the following two are handled specifically since we always want to have these extensions no matter the automatic detection
// and/or existing detected extensions in the note name
if (type === "text" && format === "markdown") {
return "md";
} else if (type === "text" && format === "html") {
return "html";
} else if (mime === "application/x-javascript" || mime === "text/javascript") {
return "js";
} else if (type === "canvas" || mime === "application/json") {
return "json";
} else if (existingExtension.length > 0) {
// if the page already has an extension, then we'll just keep it
return null;
} else {
if (mime?.toLowerCase()?.trim() === "image/jpg") {
return "jpg";
} else if (mime?.toLowerCase()?.trim() === "text/mermaid") {
return "txt";
} else {
return mimeTypes.extension(mime) || "dat";
}
}
}
}

View File

@@ -0,0 +1,176 @@
import type NoteMeta from "../../meta/note_meta.js";
import { escapeHtml, getResourceDir, isDev } from "../../utils";
import html from "html";
import { ZipExportProvider } from "./abstract_provider.js";
import path from "path";
import fs from "fs";
export default class HtmlExportProvider extends ZipExportProvider {
private navigationMeta: NoteMeta | null = null;
private indexMeta: NoteMeta | null = null;
private cssMeta: NoteMeta | null = null;
prepareMeta(metaFile) {
this.navigationMeta = {
noImport: true,
dataFileName: "navigation.html"
};
metaFile.files.push(this.navigationMeta);
this.indexMeta = {
noImport: true,
dataFileName: "index.html"
};
metaFile.files.push(this.indexMeta);
this.cssMeta = {
noImport: true,
dataFileName: "style.css"
};
metaFile.files.push(this.cssMeta);
}
prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta): string | Buffer {
if (noteMeta.format === "html" && typeof content === "string") {
if (!content.substr(0, 100).toLowerCase().includes("<html") && !this.zipExportOptions?.skipHtmlTemplate) {
if (!noteMeta?.notePath?.length) {
throw new Error("Missing note path.");
}
const cssUrl = `${"../".repeat(noteMeta.notePath.length - 1)}style.css`;
const htmlTitle = escapeHtml(title);
// <base> element will make sure external links are openable - https://github.com/zadam/trilium/issues/1289#issuecomment-704066809
content = `<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="${cssUrl}">
<base target="_parent">
<title data-trilium-title>${htmlTitle}</title>
</head>
<body>
<div class="content">
<h1 data-trilium-h1>${htmlTitle}</h1>
<div class="ck-content">${content}</div>
</div>
</body>
</html>`;
}
if (content.length < 100_000) {
content = html.prettyPrint(content, { indent_size: 2 })
}
content = this.rewriteFn(content as string, noteMeta);
return content;
} else {
return content;
}
}
afterDone(rootMeta: NoteMeta) {
if (!this.navigationMeta || !this.indexMeta || !this.cssMeta) {
throw new Error("Missing meta.");
}
this.#saveNavigation(rootMeta, this.navigationMeta);
this.#saveIndex(rootMeta, this.indexMeta);
this.#saveCss(rootMeta, this.cssMeta);
}
#saveNavigationInner(rootMeta: NoteMeta, meta: NoteMeta) {
let html = "<li>";
const escapedTitle = escapeHtml(`${meta.prefix ? `${meta.prefix} - ` : ""}${meta.title}`);
if (meta.dataFileName && meta.noteId) {
const targetUrl = this.getNoteTargetUrl(meta.noteId, rootMeta);
html += `<a href="${targetUrl}" target="detail">${escapedTitle}</a>`;
} else {
html += escapedTitle;
}
if (meta.children && meta.children.length > 0) {
html += "<ul>";
for (const child of meta.children) {
html += this.#saveNavigationInner(rootMeta, child);
}
html += "</ul>";
}
return `${html}</li>`;
}
#saveNavigation(rootMeta: NoteMeta, navigationMeta: NoteMeta) {
if (!navigationMeta.dataFileName) {
return;
}
const fullHtml = `<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<ul>${this.#saveNavigationInner(rootMeta, rootMeta)}</ul>
</body>
</html>`;
const prettyHtml = fullHtml.length < 100_000 ? html.prettyPrint(fullHtml, { indent_size: 2 }) : fullHtml;
this.archive.append(prettyHtml, { name: navigationMeta.dataFileName });
}
#saveIndex(rootMeta: NoteMeta, indexMeta: NoteMeta) {
let firstNonEmptyNote;
let curMeta = rootMeta;
if (!indexMeta.dataFileName) {
return;
}
while (!firstNonEmptyNote) {
if (curMeta.dataFileName && curMeta.noteId) {
firstNonEmptyNote = this.getNoteTargetUrl(curMeta.noteId, rootMeta);
}
if (curMeta.children && curMeta.children.length > 0) {
curMeta = curMeta.children[0];
} else {
break;
}
}
const fullHtml = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<frameset cols="25%,75%">
<frame name="navigation" src="navigation.html">
<frame name="detail" src="${firstNonEmptyNote}">
</frameset>
</html>`;
this.archive.append(fullHtml, { name: indexMeta.dataFileName });
}
#saveCss(rootMeta: NoteMeta, cssMeta: NoteMeta) {
if (!cssMeta.dataFileName) {
return;
}
const cssFile = isDev
? path.join(__dirname, "../../../../../../node_modules/ckeditor5/dist/ckeditor5-content.css")
: path.join(getResourceDir(), "ckeditor5-content.css");
const cssContent = fs.readFileSync(cssFile, "utf-8");
this.archive.append(cssContent, { name: cssMeta.dataFileName });
}
}

View File

@@ -0,0 +1,27 @@
import NoteMeta from "../../meta/note_meta"
import { ZipExportProvider } from "./abstract_provider.js"
import mdService from "../markdown.js";
export default class MarkdownExportProvider extends ZipExportProvider {
prepareMeta() { }
prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta): string | Buffer {
if (noteMeta.format === "markdown" && typeof content === "string") {
let markdownContent = mdService.toMarkdown(content);
if (markdownContent.trim().length > 0 && !markdownContent.startsWith("# ")) {
markdownContent = `# ${title}\r
${markdownContent}`;
}
markdownContent = this.rewriteFn(markdownContent, noteMeta);
return markdownContent;
} else {
return content;
}
}
afterDone() { }
}

View File

@@ -0,0 +1,122 @@
import { join } from "path";
import NoteMeta, { NoteMetaFile } from "../../meta/note_meta";
import { ExportFormat, ZipExportProvider } from "./abstract_provider.js";
import { RESOURCE_DIR } from "../../resource_dir";
import { getResourceDir, isDev } from "../../utils";
import fs, { readdirSync } from "fs";
import { renderNoteForExport } from "../../../share/content_renderer";
import type BNote from "../../../becca/entities/bnote.js";
import type BBranch from "../../../becca/entities/bbranch.js";
import { getShareThemeAssetDir } from "../../../routes/assets";
const shareThemeAssetDir = getShareThemeAssetDir();
export default class ShareThemeExportProvider extends ZipExportProvider {
private assetsMeta: NoteMeta[] = [];
private indexMeta: NoteMeta | null = null;
prepareMeta(metaFile: NoteMetaFile): void {
const assets = [
"icon-color.svg"
];
for (const file of readdirSync(shareThemeAssetDir)) {
assets.push(`assets/${file}`);
}
for (const asset of assets) {
const assetMeta = {
noImport: true,
dataFileName: asset
};
this.assetsMeta.push(assetMeta);
metaFile.files.push(assetMeta);
}
this.indexMeta = {
noImport: true,
dataFileName: "index.html"
};
metaFile.files.push(this.indexMeta);
}
prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta, note: BNote | undefined, branch: BBranch): string | Buffer {
if (!noteMeta?.notePath?.length) {
throw new Error("Missing note path.");
}
const basePath = "../".repeat(noteMeta.notePath.length - 1);
if (note) {
content = renderNoteForExport(note, branch, basePath, noteMeta.notePath.slice(0, -1));
if (typeof content === "string") {
content = content.replace(/href="[^"]*\.\/([a-zA-Z0-9_\/]{12})[^"]*"/g, (match, id) => {
if (match.includes("/assets/")) return match;
return `href="#root/${id}"`;
});
content = this.rewriteFn(content, noteMeta);
}
}
return content;
}
afterDone(rootMeta: NoteMeta): void {
this.#saveAssets(rootMeta, this.assetsMeta);
this.#saveIndex(rootMeta);
}
mapExtension(type: string | null, mime: string, existingExtension: string, format: ExportFormat): string | null {
if (mime.startsWith("image/")) {
return null;
}
return "html";
}
#saveIndex(rootMeta: NoteMeta) {
if (!this.indexMeta?.dataFileName) {
return;
}
const note = this.branch.getNote();
const fullHtml = this.prepareContent(rootMeta.title ?? "", note.getContent(), rootMeta, note, this.branch);
this.archive.append(fullHtml, { name: this.indexMeta.dataFileName });
}
#saveAssets(rootMeta: NoteMeta, assetsMeta: NoteMeta[]) {
for (const assetMeta of assetsMeta) {
if (!assetMeta.dataFileName) {
continue;
}
let cssContent = getShareThemeAssets(assetMeta.dataFileName);
this.archive.append(cssContent, { name: assetMeta.dataFileName });
}
}
}
function getShareThemeAssets(nameWithExtension: string) {
// Rename share.css to style.css.
if (nameWithExtension === "style.css") {
nameWithExtension = "share.css";
} else if (nameWithExtension === "script.js") {
nameWithExtension = "share.js";
}
let path: string | undefined;
if (nameWithExtension === "icon-color.svg") {
path = join(RESOURCE_DIR, "images", nameWithExtension);
} else if (nameWithExtension.startsWith("assets")) {
path = join(shareThemeAssetDir, nameWithExtension.replace(/^assets\//, ""));
} else if (isDev) {
path = join(getResourceDir(), "..", "..", "client", "dist", "src", nameWithExtension);
} else {
path = join(getResourceDir(), "public", "src", nameWithExtension);
}
return fs.readFileSync(path);
}

View File

@@ -1,6 +1,7 @@
import type { NoteType } from "@triliumnext/commons";
import type AttachmentMeta from "./attachment_meta.js";
import type AttributeMeta from "./attribute_meta.js";
import type { ExportFormat } from "../export/zip/abstract_provider.js";
export interface NoteMetaFile {
formatVersion: number;
@@ -19,7 +20,7 @@ export default interface NoteMeta {
type?: NoteType;
mime?: string;
/** 'html' or 'markdown', applicable to text notes only */
format?: "html" | "markdown";
format?: ExportFormat;
dataFileName?: string;
dirFileName?: string;
/** this file should not be imported (e.g., HTML navigation) */

View File

@@ -681,3 +681,34 @@ describe("#normalizeCustomHandlerPattern", () => {
});
});
});
describe("#slugify", () => {
it("should return a slugified string", () => {
const testString = "This is a Test String! With unicode & Special #Chars.";
const expectedSlug = "this-is-a-test-string-with-unicode-special-chars";
const result = utils.slugify(testString);
expect(result).toBe(expectedSlug);
});
it("supports CJK characters without alteration", () => {
const testString = "测试中文字符";
const expectedSlug = "测试中文字符";
const result = utils.slugify(testString);
expect(result).toBe(expectedSlug);
});
it("supports Cyrillic characters without alteration", () => {
const testString = "Тестирование кириллических символов";
const expectedSlug = "тестирование-кириллических-символов";
const result = utils.slugify(testString);
expect(result).toBe(expectedSlug);
});
// preserves diacritic marks
it("preserves diacritic marks", () => {
const testString = "Café naïve façade jalapeño";
const expectedSlug = "café-naïve-façade-jalapeño";
const result = utils.slugify(testString);
expect(result).toBe(expectedSlug);
});
});

View File

@@ -497,6 +497,14 @@ export function formatSize(size: number | null | undefined) {
}
}
function slugify(text: string) {
return text
.normalize("NFC") // keep composed form, preserves accents
.toLowerCase()
.replace(/[^\p{Letter}\p{Number}]+/gu, "-") // replace non-letter/number with "-"
.replace(/(^-|-$)+/g, ""); // trim dashes
}
export default {
compareVersions,
crash,
@@ -532,6 +540,7 @@ export default {
safeExtractMessageAndStackFromError,
sanitizeSqlIdentifier,
stripTags,
slugify,
timeLimit,
toBase64,
toMap,

View File

@@ -1,10 +1,22 @@
import { parse, HTMLElement, TextNode } from "node-html-parser";
import shaca from "./shaca/shaca.js";
import assetPath from "../services/asset_path.js";
import assetPath, { assetUrlFragment } from "../services/asset_path.js";
import shareRoot from "./share_root.js";
import escapeHtml from "escape-html";
import type SNote from "./shaca/entities/snote.js";
import BNote from "../becca/entities/bnote.js";
import type BBranch from "../becca/entities/bbranch.js";
import { t } from "i18next";
import SBranch from "./shaca/entities/sbranch.js";
import options from "../services/options.js";
import utils, { getResourceDir, isDev, safeExtractMessageAndStackFromError } from "../services/utils.js";
import ejs from "ejs";
import log from "../services/log.js";
import { join } from "path";
import { readFileSync } from "fs";
const shareAdjustedAssetPath = isDev ? assetPath : `../${assetPath}`;
const templateCache: Map<string, string> = new Map();
/**
* Represents the output of the content renderer.
@@ -16,7 +28,192 @@ export interface Result {
isEmpty?: boolean;
}
export function getContent(note: SNote) {
interface Subroot {
note?: SNote | BNote;
branch?: SBranch | BBranch
}
function getSharedSubTreeRoot(note: SNote | BNote | undefined): Subroot {
if (!note || note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
// share root itself is not shared
return {};
}
// every path leads to share root, but which one to choose?
// for the sake of simplicity, URLs are not note paths
const parentBranch = note.getParentBranches()[0];
if (note instanceof BNote) {
return {
note,
branch: parentBranch
}
}
if (parentBranch.parentNoteId === shareRoot.SHARE_ROOT_NOTE_ID) {
return {
note,
branch: parentBranch
};
}
return getSharedSubTreeRoot(parentBranch.getParentNote());
}
export function renderNoteForExport(note: BNote, parentBranch: BBranch, basePath: string, ancestors: string[]) {
const subRoot: Subroot = {
branch: parentBranch,
note: parentBranch.getNote()
};
return renderNoteContentInternal(note, {
subRoot,
rootNoteId: parentBranch.noteId,
cssToLoad: [
`${basePath}assets/styles.css`,
`${basePath}assets/scripts.css`,
],
jsToLoad: [
`${basePath}assets/scripts.js`
],
logoUrl: `${basePath}icon-color.svg`,
ancestors
});
}
export function renderNoteContent(note: SNote) {
const subRoot = getSharedSubTreeRoot(note);
const ancestors: string[] = [];
let notePointer = note;
while (notePointer.parents[0]?.noteId !== subRoot.note?.noteId) {
const pointerParent = notePointer.parents[0];
if (!pointerParent) {
break;
}
ancestors.push(pointerParent.noteId);
notePointer = pointerParent;
}
// Determine CSS to load.
const cssToLoad: string[] = [];
if (!note.isLabelTruthy("shareOmitDefaultCss")) {
cssToLoad.push(`assets/styles.css`);
cssToLoad.push(`assets/scripts.css`);
}
for (const cssRelation of note.getRelations("shareCss")) {
cssToLoad.push(`api/notes/${cssRelation.value}/download`);
}
// Determine JS to load.
const jsToLoad: string[] = [
"assets/scripts.js"
];
for (const jsRelation of note.getRelations("shareJs")) {
jsToLoad.push(`api/notes/${jsRelation.value}/download`);
}
const customLogoId = note.getRelation("shareLogo")?.value;
const logoUrl = customLogoId ? `api/images/${customLogoId}/image.png` : `../${assetUrlFragment}/images/icon-color.svg`;
return renderNoteContentInternal(note, {
subRoot,
rootNoteId: "_share",
cssToLoad,
jsToLoad,
logoUrl,
ancestors
});
}
interface RenderArgs {
subRoot: Subroot;
rootNoteId: string;
cssToLoad: string[];
jsToLoad: string[];
logoUrl: string;
ancestors: string[];
}
function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs) {
const { header, content, isEmpty } = getContent(note);
const showLoginInShareTheme = options.getOption("showLoginInShareTheme");
const opts = {
note,
header,
content,
isEmpty,
assetPath: shareAdjustedAssetPath,
assetUrlFragment,
showLoginInShareTheme,
t,
isDev,
utils,
...renderArgs
};
// Check if the user has their own template.
if (note.hasRelation("shareTemplate")) {
// Get the template note and content
const templateId = note.getRelation("shareTemplate")?.value;
const templateNote = templateId && shaca.getNote(templateId);
// Make sure the note type is correct
if (templateNote && templateNote.type === "code" && templateNote.mime === "application/x-ejs") {
// EJS caches the result of this so we don't need to pre-cache
const includer = (path: string) => {
const childNote = templateNote.children.find((n) => path === n.title);
if (!childNote) throw new Error(`Unable to find child note: ${path}.`);
if (childNote.type !== "code" || childNote.mime !== "application/x-ejs") throw new Error("Incorrect child note type.");
const template = childNote.getContent();
if (typeof template !== "string") throw new Error("Invalid template content type.");
return { template };
};
// Try to render user's template, w/ fallback to default view
try {
const content = templateNote.getContent();
if (typeof content === "string") {
return ejs.render(content, opts, { includer });
}
} catch (e: unknown) {
const [errMessage, errStack] = safeExtractMessageAndStackFromError(e);
log.error(`Rendering user provided share template (${templateId}) threw exception ${errMessage} with stacktrace: ${errStack}`);
}
}
}
// Render with the default view otherwise.
const templatePath = getDefaultTemplatePath("page");
return ejs.render(readTemplate(templatePath), opts, {
includer: (path) => {
// Path is relative to apps/server/dist/assets/views
return { template: readTemplate(getDefaultTemplatePath(path)) };
}
});
}
function getDefaultTemplatePath(template: string) {
// Path is relative to apps/server/dist/assets/views
return process.env.NODE_ENV === "development"
? join(__dirname, `../../../../packages/share-theme/src/templates/${template}.ejs`)
: join(getResourceDir(), `share-theme/templates/${template}.ejs`);
}
function readTemplate(path: string) {
const cachedTemplate = templateCache.get(path);
if (cachedTemplate) {
return cachedTemplate;
}
const templateString = readFileSync(path, "utf-8");
templateCache.set(path, templateString);
return templateString;
}
export function getContent(note: SNote | BNote) {
if (note.isProtected) {
return {
header: "",
@@ -65,7 +262,7 @@ function renderIndex(result: Result) {
result.content += "</ul>";
}
function renderText(result: Result, note: SNote) {
function renderText(result: Result, note: SNote | BNote) {
if (typeof result.content !== "string") return;
const document = parse(result.content || "");
@@ -174,7 +371,7 @@ export function renderCode(result: Result) {
}
}
function renderMermaid(result: Result, note: SNote) {
function renderMermaid(result: Result, note: SNote | BNote) {
if (typeof result.content !== "string") {
return;
}
@@ -188,11 +385,11 @@ function renderMermaid(result: Result, note: SNote) {
</details>`;
}
function renderImage(result: Result, note: SNote) {
function renderImage(result: Result, note: SNote | BNote) {
result.content = `<img src="api/images/${note.noteId}/${note.encodedTitle}?${note.utcDateModified}">`;
}
function renderFile(note: SNote, result: Result) {
function renderFile(note: SNote | BNote, result: Result) {
if (note.mime === "application/pdf") {
result.content = `<iframe class="pdf-view" src="api/notes/${note.noteId}/view"></iframe>`;
} else {

View File

@@ -4,41 +4,12 @@ import type { Request, Response, Router } from "express";
import shaca from "./shaca/shaca.js";
import shacaLoader from "./shaca/shaca_loader.js";
import shareRoot from "./share_root.js";
import contentRenderer from "./content_renderer.js";
import assetPath, { assetUrlFragment } from "../services/asset_path.js";
import appPath from "../services/app_path.js";
import searchService from "../services/search/services/search.js";
import SearchContext from "../services/search/search_context.js";
import log from "../services/log.js";
import type SNote from "./shaca/entities/snote.js";
import type SBranch from "./shaca/entities/sbranch.js";
import type SAttachment from "./shaca/entities/sattachment.js";
import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/utils.js";
import options from "../services/options.js";
import { t } from "i18next";
import ejs from "ejs";
import { join } from "path";
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
// share root itself is not shared
return {};
}
// every path leads to share root, but which one to choose?
// for the sake of simplicity, URLs are not note paths
const parentBranch = note.getParentBranches()[0];
if (parentBranch.parentNoteId === shareRoot.SHARE_ROOT_NOTE_ID) {
return {
note,
branch: parentBranch
};
}
return getSharedSubTreeRoot(parentBranch.getParentNote());
}
import { renderNoteContent } from "./content_renderer.js";
import utils from "../services/utils.js";
function addNoIndexHeader(note: SNote, res: Response) {
if (note.isLabelTruthy("shareDisallowRobotIndexing")) {
@@ -109,8 +80,7 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: stri
let svgString = "<svg/>";
const attachment = image.getAttachmentByTitle(attachmentName);
if (!attachment) {
res.status(404);
renderDefault(res, "404");
return;
}
const content = attachment.getContent();
@@ -138,12 +108,19 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: stri
res.send(svg);
}
function render404(res: Response) {
res.status(404);
const shareThemePath = `../../share-theme/templates/404.ejs`;
res.render(shareThemePath);
}
function register(router: Router) {
function renderNote(note: SNote, req: Request, res: Response) {
if (!note) {
console.log("Unable to find note ", note);
res.status(404);
renderDefault(res, "404");
render404(res);
return;
}
@@ -161,62 +138,7 @@ function register(router: Router) {
return;
}
const { header, content, isEmpty } = contentRenderer.getContent(note);
const subRoot = getSharedSubTreeRoot(note);
const showLoginInShareTheme = options.getOption("showLoginInShareTheme");
const opts = {
note,
header,
content,
isEmpty,
subRoot,
assetPath: isDev ? assetPath : `../${assetPath}`,
assetUrlFragment,
appPath: isDev ? appPath : `../${appPath}`,
showLoginInShareTheme,
t,
isDev
};
let useDefaultView = true;
// Check if the user has their own template
if (note.hasRelation("shareTemplate")) {
// Get the template note and content
const templateId = note.getRelation("shareTemplate")?.value;
const templateNote = templateId && shaca.getNote(templateId);
// Make sure the note type is correct
if (templateNote && templateNote.type === "code" && templateNote.mime === "application/x-ejs") {
// EJS caches the result of this so we don't need to pre-cache
const includer = (path: string) => {
const childNote = templateNote.children.find((n) => path === n.title);
if (!childNote) throw new Error(`Unable to find child note: ${path}.`);
if (childNote.type !== "code" || childNote.mime !== "application/x-ejs") throw new Error("Incorrect child note type.");
const template = childNote.getContent();
if (typeof template !== "string") throw new Error("Invalid template content type.");
return { template };
};
// Try to render user's template, w/ fallback to default view
try {
const content = templateNote.getContent();
if (typeof content === "string") {
const ejsResult = ejs.render(content, opts, { includer });
res.send(ejsResult);
useDefaultView = false; // Rendering went okay, don't use default view
}
} catch (e: unknown) {
const [errMessage, errStack] = safeExtractMessageAndStackFromError(e);
log.error(`Rendering user provided share template (${templateId}) threw exception ${errMessage} with stacktrace: ${errStack}`);
}
}
}
if (useDefaultView) {
renderDefault(res, "page", opts);
}
res.send(renderNoteContent(note));
}
router.get("/share/", (req, res) => {
@@ -400,14 +322,6 @@ function register(router: Router) {
});
}
function renderDefault(res: Response<any, Record<string, any>>, template: "page" | "404", opts: any = {}) {
// Path is relative to apps/server/dist/assets/views
const shareThemePath = process.env.NODE_ENV === "development"
? join(__dirname, `../../../../packages/share-theme/src/templates/${template}.ejs`)
: `../../share-theme/templates/${template}.ejs`;
res.render(shareThemePath, opts);
}
export default {
register
};

View File

@@ -1 +1,8 @@
{}
{
"get-started": {
"title": "Loslegen",
"desktop_title": "Die Desktop-App herunterladen (v{{version}})",
"architecture": "Architektur:",
"older_releases": "Ältere Releases anzeigen"
}
}

View File

@@ -2,7 +2,7 @@
"get-started": {
"title": "Commencer",
"desktop_title": "Télécharger l'application de bureau (v{{version}})",
"architecture": "Architecture:",
"architecture": "Architecture :",
"older_releases": "Voir les versions plus anciennes",
"server_title": "Configurer un serveur pour accéder à plusieurs appareils"
},
@@ -41,7 +41,17 @@
"note_types": {
"text_title": "Notes de texte",
"text_description": "Les notes sont éditées à l'aide d'un éditeur visuel (WYSIWYG) prenant en charge les tableaux, les images, les expressions mathématiques et les blocs de code avec coloration syntaxique. Formatez rapidement le texte grâce à une syntaxe de type Markdown ou à des commandes slash.",
"code_title": "Notes de code"
"code_title": "Notes de code",
"code_description": "De grands échantillons de code source ou de scripts utilisent un éditeur dédié, avec une coloration syntaxique pour de nombreux langages de programmation et avec différents thèmes de couleurs.",
"file_title": "Notes de fichier",
"file_description": "Intégrez des fichiers multimédias tels que des PDF, des images, des vidéos avec un aperçu intégré à l'application.",
"canvas_title": "Canvas",
"canvas_description": "Agencez formes, images et textes sur une surface infinie grâce à la même technologie qu'excalidraw.com. Idéal pour les diagrammes, les croquis et la planification visuelle.",
"mermaid_title": "Diagrammes Mermaid",
"mermaid_description": "Créez des diagrammes tels que des organigrammes, des diagrammes de classes et de séquences, des diagrammes de Gantt et bien d'autres, en utilisant la syntaxe Mermaid.",
"mindmap_title": "Carte mentale",
"mindmap_description": "Organisez vos pensées visuellement ou faites une séance de brainstorming.",
"others_list": "et autres : <0>carte de notes</0>, <1>carte de relations</1>, <2>recherches enregistrées</2>, <3>note de rendu</3> et <4>vues Web</4>."
},
"faq": {
"database_question": "Où sont les données stockées?",
@@ -64,7 +74,8 @@
"get_started": "Commencer"
},
"components": {
"link_learn_more": "En savoir plus..."
"link_learn_more": "En savoir plus...",
"list_with_screenshot_alt": "Capture d'écran de la fonctionnalité sélectionnée"
},
"support_us": {
"financial_donations_title": "Dons financiers",
@@ -72,7 +83,8 @@
"financial_donations_cta": "Envisagez de soutenir le développeur principal (<Link>eliandoran</Link>) de l'application via :",
"github_sponsors": "Sponsors GitHub",
"paypal": "PayPal",
"buy_me_a_coffee": "Offrez-moi un café"
"buy_me_a_coffee": "Offrez-moi un café",
"title": "Soutenez-nous"
},
"contribute": {
"title": "Autres façons de contribuer",
@@ -137,5 +149,44 @@
"description": "Notes Trilium hébergées sur PikaPods, un service payant pour un accès et une gestion simplifiés. Non affilié directement à l'équipe Trilium.",
"download_pikapod": "Installé sur PikaPods",
"download_triliumcc": "Voir également trilium.cc"
},
"extensibility_benefits": {
"title": "Partage et extensibilité",
"import_export_title": "Import/export",
"import_export_description": "Interagissez facilement avec d'autres applications utilisant les formats Markdown, ENEX, OML.",
"share_title": "Partager des notes sur le Web",
"share_description": "Si vous disposez d'un serveur, vous pouvez l'utiliser pour partager un sous-ensemble de vos notes avec d'autres personnes.",
"scripting_title": "Scripts avancés",
"scripting_description": "Créez vos propres intégrations dans Trilium avec des widgets personnalisés ou une logique côté serveur.",
"api_title": "REST API",
"api_description": "Interagissez avec Trilium par programmation à l'aide de son API REST intégrée."
},
"collections": {
"calendar_title": "Calendrier",
"calendar_description": "Organisez vos événements personnels ou professionnels grâce à un calendrier compatible avec les événements d'une journée ou de plusieurs jours. Visualisez vos événements en un coup d'œil grâce aux vues hebdomadaire, mensuelle et annuelle. Ajoutez ou déplacez facilement des événements.",
"table_title": "Tableau",
"table_description": "Affichez et modifiez les informations relatives aux notes dans une structure tabulaire, avec différents types de colonnes (texte, nombre, cases à cocher, date et heure, liens, couleurs) et la prise en charge des relations. Vous pouvez également afficher les notes sous forme d'arborescence à l'intérieur du tableau.",
"board_title": "Tableau de bord",
"board_description": "Organisez vos tâches ou l'état de vos projets dans un tableau Kanban avec un moyen simple de créer de nouveaux éléments et colonnes et de modifier simplement leur état en les faisant glisser sur le tableau.",
"geomap_title": "Géocarte",
"geomap_description": "Planifiez vos vacances ou marquez vos points d'intérêt directement sur une carte géographique grâce à des marqueurs personnalisables. Affichez les traces GPX enregistrées pour suivre vos itinéraires."
},
"download_now": {
"text": "Télécharger maintenant. ",
"platform_big": "v{{version}} pour {{platform}}",
"platform_small": "pour {{platform}}",
"linux_big": "v{{version}} pour Linux",
"linux_small": "pour Linux",
"more_platforms": "Plus de plateformes et de configuration de serveur"
},
"footer": {
"copyright_and_the": " et le ",
"copyright_community": "communauté"
},
"social_buttons": {
"github": "GitHub",
"github_discussions": "Discussions GitHub",
"matrix": "Matrix",
"reddit": "Reddit"
}
}

View File

@@ -1 +1,50 @@
{}
{
"get-started": {
"title": "Почати",
"desktop_title": "Завантажити програму для ПК (v{{version}})",
"architecture": "Архітектура:",
"older_releases": "Дивитися старіші випуски",
"server_title": "Налаштуйте сервер для доступу на кількох пристроях"
},
"hero_section": {
"title": "Упорядкуйте свої думки. Створіть свою особисту базу знань.",
"subtitle": "Trilium — це рішення з відкритим кодом для ведення нотаток та організації особистої бази знань. Використовуйте його локально на своєму робочому столі або синхронізуйте зі своїм власним сервером, щоб мати свої нотатки під рукою, де б ви не були.",
"get_started": "Почати",
"github": "GitHub",
"dockerhub": "Docker Hub",
"screenshot_alt": "Знімок екрана програми Trilium Notes для ПК"
},
"organization_benefits": {
"title": "Організація",
"note_structure_title": "Структура нотатки",
"note_structure_description": "Нотатки можна впорядковувати ієрархічно. Немає потреби в папках, оскільки кожна нотатка може містити піднотатки. Одну нотатку можна додати в кілька місць в ієрархії.",
"attributes_title": "Мітки та зв'язки нотаток",
"attributes_description": "Використовуйте зв'язки між нотатками або додавайте мітки для легкої категоризації. Використовуйте підвищені атрибути для введення структурованої інформації, яку можна використовувати в таблицях, на дошках.",
"hoisting_title": "Робочі області та хостинг",
"hoisting_description": "Легко розділяйте особисті нотатки та робочі, групуючи їх у робочій області, що фокусує ваше дерево нотаток на відображенні лише певного набору нотаток."
},
"productivity_benefits": {
"title": "Продуктивність та безпека",
"revisions_title": "Ревізії нотаток",
"revisions_content": "Нотатки періодично зберігаються у фоновому режимі, а ревізії можна використовувати для перегляду або скасування випадкових змін. Ревізії також можна створювати на вимогу.",
"sync_title": "Синхронізація",
"sync_content": "Використовуйте власний або хмарний екземпляр, щоб легко синхронізувати нотатки на кількох пристроях та отримувати до них доступ з мобільного телефону за допомогою PWA.",
"protected_notes_title": "Захищені нотатки",
"protected_notes_content": "Захистіть конфіденційну особисту інформацію, зашифрувавши нотатки та заблокувавши їх за сеансом, захищеним паролем.",
"jump_to_title": "Швидкий пошук і команди",
"jump_to_content": "Швидко переходьте до нотаток або команд інтерфейсу користувача в ієрархії, шукаючи їх за назвою, з нечітким зіставленням для врахування друкарських помилок або незначних відмінностей.",
"search_title": "Потужний пошук",
"search_content": "Або шукайте текст усередині нотаток та звузьте пошук, відфільтрувавши за батьківською нотаткою чи за глибиною.",
"web_clipper_title": "Web-кліпер",
"web_clipper_content": "Зберіть веб-сторінки (або скріншоти) та розмістіть їх безпосередньо в Trilium за допомогою розширення браузера Web Clipper."
},
"note_types": {
"text_title": "Текстові нотатки",
"text_description": "Нотатки редагуються за допомогою візуального (WYSIWYG) редактора з підтримкою таблиць, зображень, математичних виразів, блоків коду з підсвічуванням синтаксису. Швидко форматуйте текст, використовуючи синтаксис, подібний до Markdown, або використовуючи команди зі слеш-рисками.",
"code_title": "Нотатки з кодом",
"code_description": "Великі зразки вихідного коду або скриптів використовують спеціальний редактор із підсвічуванням синтаксису для багатьох мов програмування та різними колірними темами.",
"file_title": "Файлові нотатки",
"file_description": "Вбудовуйте мультимедійні файли, такі як PDF-файли, зображення, відео, з попереднім переглядом у програмі.",
"canvas_title": "Полотно"
}
}

View File

@@ -13,5 +13,12 @@
"github": "Github",
"dockerhub": "Kho Docker",
"screenshot_alt": "Ảnh chụp màn hình ứng dụng Trilium Notes (desktop)"
},
"organization_benefits": {
"title": "Tổ chức",
"note_structure_title": "Cấu trúc ghi chú",
"note_structure_description": "Ghi chú có thể được sắp xếp theo thứ bậc. Không cần thư mục, vì mỗi ghi chú có thể chứa các ghi chú phụ. Một ghi chú có thể được thêm vào nhiều vị trí trong hệ thống phân cấp.",
"attributes_title": "Các nhãn ghi chú và các mối quan hệ",
"attributes_description": "Sử dụng mối quan hệ giữa các ghi chú hoặc thêm nhãn để phân loại dễ dàng. Sử dụng các thuộc tính được khuyến khích để nhập thông tin có cấu trúc có thể được sử dụng trong bảng, bảng biểu."
}
}

2
docs/README-ar.md vendored
View File

@@ -33,7 +33,7 @@ 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)

149
docs/README-uk.md vendored
View File

@@ -11,103 +11,104 @@
# Trilium Notes
![GitHub Sponsors](https://img.shields.io/github/sponsors/eliandoran)
![LiberaPay patrons](https://img.shields.io/liberapay/patrons/ElianDoran)\
![Спонсори GitHub](https://img.shields.io/github/sponsors/eliandoran)
![Користувачі LiberaPay](https://img.shields.io/liberapay/patrons/ElianDoran)\
![Docker Pulls](https://img.shields.io/docker/pulls/triliumnext/trilium)
![GitHub Downloads (all assets, all
releases)](https://img.shields.io/github/downloads/triliumnext/trilium/total)\
![Завантаження GitHub (всі ресурси, всі
релізи)](https://img.shields.io/github/downloads/triliumnext/trilium/total)\
[![RelativeCI](https://badges.relative-ci.com/badges/Di5q7dz9daNDZ9UXi0Bp?branch=develop)](https://app.relative-ci.com/projects/Di5q7dz9daNDZ9UXi0Bp)
[![Translation
status](https://hosted.weblate.org/widget/trilium/svg-badge.svg)](https://hosted.weblate.org/engage/trilium/)
[![Статус
перекладу](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)
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:
Див. [скріншоти](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
## ⏬ Завантажити
- [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.
нестабільна версія для розробників, щодня оновлюється найновішими функціями та
виправленнями.
## 📚 Documentation
## 📚 Документація
**Visit our comprehensive documentation at
**Відвідайте нашу вичерпну документацію за адресою
[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
- **GitHub**: Navigate through the [User
Guide](./docs/User%20Guide/User%20Guide/) in this repository
- **Довідка в додатку**: Натисніть `F1` у Trilium, щоб отримати доступ до тієї ж
документації безпосередньо в додатку
- **GitHub**: Перегляд [Посібника
користувача](./docs/User%20Guide/User%20Guide/) у цьому репозиторії
### Quick Links
- [Getting Started Guide](https://docs.triliumnotes.org/)
- [Installation
Instructions](./docs/User%20Guide/User%20Guide/Installation%20&%20Setup/Server%20Installation.md)
- [Docker
Setup](./docs/User%20Guide/User%20Guide/Installation%20&%20Setup/Server%20Installation/1.%20Installing%20the%20server/Using%20Docker.md)
- [Upgrading
### Швидкі посилання
- [Посібник із початку роботи](https://docs.triliumnotes.org/)
- [Інструкції з
встановлення](./docs/User%20Guide/User%20Guide/Installation%20&%20Setup/Server%20Installation.md)
- [Налаштування
Docker](./docs/User%20Guide/User%20Guide/Installation%20&%20Setup/Server%20Installation/1.%20Installing%20the%20server/Using%20Docker.md)
- [Оновлення
TriliumNext](./docs/User%20Guide/User%20Guide/Installation%20%26%20Setup/Upgrading%20TriliumNext.md)
- [Basic Concepts and
Features](./docs/User%20Guide/User%20Guide/Basic%20Concepts%20and%20Features/Notes.md)
- [Patterns of Personal Knowledge
Base](https://triliumnext.github.io/Docs/Wiki/patterns-of-personal-knowledge)
- [Основні поняття та
функції](./docs/User%20Guide/User%20Guide/Basic%20Concepts%20and%20Features/Notes.md)
- [Шаблони особистої бази
знань](https://triliumnext.github.io/Docs/Wiki/patterns-of-personal-knowledge)
## 🎁 Features
## 🎁 Можливості
* Notes can be arranged into arbitrarily deep tree. Single note can be placed
into multiple places in the tree (see
[cloning](https://triliumnext.github.io/Docs/Wiki/cloning-notes))
* Rich WYSIWYG note editor including e.g. tables, images and
[math](https://triliumnext.github.io/Docs/Wiki/text-notes) with markdown
[autoformat](https://triliumnext.github.io/Docs/Wiki/text-notes#autoformat)
* Support for editing [notes with source
code](https://triliumnext.github.io/Docs/Wiki/code-notes), including syntax
highlighting
* Fast and easy [navigation between
notes](https://triliumnext.github.io/Docs/Wiki/note-navigation), full text
search and [note
hoisting](https://triliumnext.github.io/Docs/Wiki/note-hoisting)
* Seamless [note
versioning](https://triliumnext.github.io/Docs/Wiki/note-revisions)
* Note [attributes](https://triliumnext.github.io/Docs/Wiki/attributes) can be
used for note organization, querying and advanced
[scripting](https://triliumnext.github.io/Docs/Wiki/scripts)
* UI available in English, German, Spanish, French, Romanian, and Chinese
(simplified and traditional)
* Direct [OpenID and TOTP
integration](./docs/User%20Guide/User%20Guide/Installation%20%26%20Setup/Server%20Installation/Multi-Factor%20Authentication.md)
for more secure login
* [Synchronization](https://triliumnext.github.io/Docs/Wiki/synchronization)
with self-hosted sync server
* there's a [3rd party service for hosting synchronisation
server](https://trilium.cc/paid-hosting)
* [Sharing](https://triliumnext.github.io/Docs/Wiki/sharing) (publishing) notes
to public internet
* Strong [note
encryption](https://triliumnext.github.io/Docs/Wiki/protected-notes) with
per-note granularity
* Sketching diagrams, based on [Excalidraw](https://excalidraw.com/) (note type
"canvas")
* [Relation maps](https://triliumnext.github.io/Docs/Wiki/relation-map) and
[link maps](https://triliumnext.github.io/Docs/Wiki/link-map) for visualizing
notes and their relations
* Mind maps, based on [Mind Elixir](https://docs.mind-elixir.com/)
* [Geo maps](./docs/User%20Guide/User%20Guide/Note%20Types/Geo%20Map.md) with
location pins and GPX tracks
* Нотатки можна розташувати в дерево довільної глибини. Одну нотатку можна
розмістити в кількох місцях дерева (див.
[клонування](https://triliumnext.github.io/Docs/Wiki/cloning-notes))
* Багатий WYSIWYG-редактор нотаток, включаючи, наприклад, таблиці, зображення та
[математику](https://triliumnext.github.io/Docs/Wiki/text-notes) з markdown
[автоформат](https://triliumnext.github.io/Docs/Wiki/text-notes#autoformat)
* Підтримка редагування [нотатки з вихідним
кодом](https://triliumnext.github.io/Docs/Wiki/code-notes), включаючи
підсвічування синтаксису
* Швидка та проста [навігація між
нотатками](https://triliumnext.github.io/Docs/Wiki/note-navigation),
повнотекстовий пошук та [хостінг
нотаток](https://triliumnext.github.io/Docs/Wiki/note-hoisting)
* Безшовне [керування версіями
нотаток](https://triliumnext.github.io/Docs/Wiki/note-revisions)
* [Атрибути](https://triliumnext.github.io/Docs/Wiki/attributes) нотатки можна
використовувати для організації нотаток, запитів та розширеного
[сриптінгу](https://triliumnext.github.io/Docs/Wiki/scripts)
* Інтерфейс користувача доступний англійською, німецькою, іспанською,
французькою, румунською та китайською (спрощеною та традиційною) мовами
* Пряма [OpenID та TOTP
інтеграція](./docs/User%20Guide/User%20Guide/Installation%20%26%20Setup/Server%20Installation/Multi-Factor%20Authentication.md)
для безпечнішого входу
* [Синхронізація](https://triliumnext.github.io/Docs/Wiki/synchronization) із
власним сервером синхронізації
* існує [сторонній сервіс для розміщення сервера
синхронізації](https://trilium.cc/paid-hosting)
* [Спільне використання](https://triliumnext.github.io/Docs/Wiki/sharing)
(публікація) нотаток у загальнодоступному інтернеті
* Надійне [шифрування
нотаток](https://triliumnext.github.io/Docs/Wiki/protected-notes) з
деталізацією для кожної нотатки
* Створення ескізних схем на основі [Excalidraw](https://excalidraw.com/) (тип
нотатки "полотно")
* [Карти зв'язків](https://triliumnext.github.io/Docs/Wiki/relation-map) та
[карти посилань](https://triliumnext.github.io/Docs/Wiki/link-map) для
візуалізації нотаток та їх зв'язків
* Інтелект-карти, засновані на [Mind Elixir](https://docs.mind-elixir.com/)
* [Геокарти](./docs/User%20Guide/User%20Guide/Note%20Types/Geo%20Map.md) з
географічними позначками та GPX-треками
* [Scripting](https://triliumnext.github.io/Docs/Wiki/scripts) - see [Advanced
showcases](https://triliumnext.github.io/Docs/Wiki/advanced-showcases)
* [REST API](https://triliumnext.github.io/Docs/Wiki/etapi) for automation

14
docs/README-vi.md vendored
View File

@@ -33,12 +33,14 @@ Xem [ảnh chụp màn hình](https://triliumnext.github.io/Docs/Wiki/screenshot
<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.
## ⏬ Tải xuống
- [Bản phát hành mới
nhất](https://github.com/TriliumNext/Trilium/releases/latest) phiên bản ổn
định, được khuyên dùng cho hầu hết người dùng.
- [Bản dựng
nightly](https://github.com/TriliumNext/Trilium/releases/tag/nightly) phiên
bản phát triển kém ổn định, được cập nhật hàng ngày với các tính năng mới nhất
và sửa lỗi.
## 📚 Tài Liệu

View File

@@ -21,6 +21,11 @@
"Zerebos <me@zerebos.com>"
],
"license": "Apache-2.0",
"dependencies": {
"katex": "0.16.25",
"mermaid": "11.12.0",
"boxicons": "2.1.4"
},
"devDependencies": {
"@digitak/esrun": "3.2.26",
"@types/swagger-ui": "5.21.1",

View File

@@ -1,4 +1,3 @@
import fs from "node:fs";
import path from "node:path";
// import {fileURLToPath} from "node:url";
@@ -51,15 +50,18 @@ async function runBuild() {
await esbuild.build({
entryPoints: entryPoints,
bundle: true,
splitting: true,
outdir: path.join(rootDir, "dist"),
format: "cjs",
format: "esm",
target: ["chrome96"],
loader: {
".png": "dataurl",
".gif": "dataurl",
".woff": "dataurl",
".woff2": "dataurl",
".ttf": "dataurl",
".woff": "file",
".woff2": "file",
".ttf": "file",
".eot": "empty",
".svg": "empty",
".html": "text",
".css": "css"
},

View File

@@ -3,6 +3,10 @@ import setupExpanders from "./modules/expanders";
import setupMobileMenu from "./modules/mobile";
import setupSearch from "./modules/search";
import setupThemeSelector from "./modules/theme";
import setupMermaid from "./modules/mermaid";
import setupMath from "./modules/math";
import api from "./modules/api";
import "boxicons/css/boxicons.min.css";
function $try<T extends (...a: unknown[]) => unknown>(func: T, ...args: Parameters<T>) {
try {
@@ -13,8 +17,39 @@ function $try<T extends (...a: unknown[]) => unknown>(func: T, ...args: Paramete
}
}
Object.assign(window, api);
$try(setupThemeSelector);
$try(setupToC);
$try(setupExpanders);
$try(setupMobileMenu);
$try(setupSearch);
function setupTextNote() {
$try(setupMermaid);
$try(setupMath);
}
document.addEventListener(
"DOMContentLoaded",
() => {
const noteType = determineNoteType();
if (noteType === "text") {
setupTextNote();
}
const toggleMenuButton = document.getElementById("toggleMenuButton");
const layout = document.getElementById("layout");
if (toggleMenuButton && layout) {
toggleMenuButton.addEventListener("click", () => layout.classList.toggle("showMenu"));
}
},
false
);
function determineNoteType() {
const bodyClass = document.body.className;
const match = bodyClass.match(/type-([^\s]+)/);
return match ? match[1] : null;
}

View File

@@ -0,0 +1,18 @@
/**
* Fetch note with given ID from backend
*
* @param noteId of the given note to be fetched. If false, fetches current note.
*/
async function fetchNote(noteId: string | null = null) {
if (!noteId) {
noteId = document.body.getAttribute("data-note-id");
}
const resp = await fetch(`api/notes/${noteId}`);
return await resp.json();
}
export default {
fetchNote
};

View File

@@ -0,0 +1,16 @@
import "katex/dist/katex.min.css";
export default async function setupMath() {
const anyMathBlock = document.querySelector("#content .math-tex");
if (!anyMathBlock) {
return;
}
const renderMathInElement = (await import("katex/contrib/auto-render")).default;
await import("katex/contrib/mhchem");
const contentEl = document.getElementById("content");
if (!contentEl) return;
renderMathInElement(contentEl);
document.body.classList.add("math-loaded");
}

View File

@@ -1,7 +1,12 @@
import mermaid from "mermaid";
export default async function setupMermaid() {
const mermaidEls = document.querySelectorAll("#content pre code.language-mermaid");
if (mermaidEls.length === 0) {
return;
}
export default function setupMermaid() {
for (const codeBlock of document.querySelectorAll("#content pre code.language-mermaid")) {
const mermaid = (await import("mermaid")).default;
for (const codeBlock of mermaidEls) {
const parentPre = codeBlock.parentElement;
if (!parentPre) {
continue;

View File

@@ -46,4 +46,8 @@
#content img {
max-width: 100%;
}
body:not(.math-loaded) .math-tex {
visibility: hidden;
}

View File

@@ -30,17 +30,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="<% if (note.hasRelation("shareFavicon")) { %>api/notes/<%= note.getRelation("shareFavicon").value %>/download<% } else { %>../favicon.ico<% } %>">
<script src="../<%= appPath %>/share.js" type="module"></script>
<% if (!isDev && !note.isLabelTruthy("shareOmitDefaultCss")) { %>
<link href="<%= assetPath %>/src/share.css" rel="stylesheet">
<link href="<%= assetPath %>/src/boxicons.css" rel="stylesheet">
<% for (const url of cssToLoad) { %>
<link href="<%= url %>" rel="stylesheet">
<% } %>
<% for (const cssRelation of note.getRelations("shareCss")) { %>
<link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet">
<% } %>
<% for (const jsRelation of note.getRelations("shareJs")) { %>
<script type="module" src="api/notes/<%= jsRelation.value %>/download"></script>
<% for (const url of jsToLoad) { %>
<script type="module" src="<%= url %>"></script>
<% } %>
<% if (note.hasLabel("shareDisallowRobotIndexing")) { %>
<meta name="robots" content="noindex,follow" />
@@ -80,8 +74,6 @@
<%- renderSnippets("head:end") %>
</head>
<%
const customLogoId = subRoot.note.getRelation("shareLogo")?.value;
const logoUrl = customLogoId ? `api/images/${customLogoId}/image.png` : `../${assetUrlFragment}/images/icon-color.svg`;
const logoWidth = subRoot.note.getLabelValue("shareLogoWidth") ?? 53;
const logoHeight = subRoot.note.getLabelValue("shareLogoHeight") ?? 40;
const mobileLogoHeight = logoHeight && logoWidth ? 32 / (logoWidth / logoHeight) : "";
@@ -90,9 +82,9 @@ const currentTheme = note.getLabel("shareTheme") === "light" ? "light" : "dark";
const themeClass = currentTheme === "light" ? " theme-light" : " theme-dark";
const headingRe = /(<h[1-6]>)(.+?)(<\/h[1-6]>)/g;
const headingMatches = [...content.matchAll(headingRe)];
const slugify = (text) => text.toLowerCase().replace(/[^\w]/g, "-");
content = content.replaceAll(headingRe, (...match) => {
match[0] = match[0].replace(match[3], `<a id="${slugify(match[2])}" class="toc-anchor" name="${slugify(match[2])}" href="#${slugify(match[2])}">#</a>${match[3]}`);
const slug = utils.slugify(utils.stripTags(match[2]));
match[0] = match[0].replace(match[3], `<a id="${slug}" class="toc-anchor" name="${slug}" href="#${slug}">#</a>${match[3]}`);
return match[0];
});
%>
@@ -131,16 +123,7 @@ content = content.replaceAll(headingRe, (...match) => {
</div>
<% if (hasTree) { %>
<nav id="menu">
<%
const ancestors = [];
let notePointer = note;
while (notePointer.parents[0].noteId !== "_share") {
const pointerParent = notePointer.parents[0];
ancestors.push(pointerParent.noteId);
notePointer = pointerParent;
}
%>
<%- include("tree_item", {note: subRoot.note, activeNote: note, subRoot: subRoot, ancestors: ancestors}) %>
<%- include("tree_item", {note: subRoot.note, activeNote: note, subRoot: subRoot, ancestors}) %>
</nav>
<% } %>
</div>

View File

@@ -1,12 +1,11 @@
<%
const slugify = (text) => text.toLowerCase().replace(/[^\w]/g, "-");
const slug = slugify(entry.name);
const strippedName = utils.stripTags(entry.name);
const slug = utils.slugify(strippedName);
%>
<li>
<a href="#<%= slug %>">
<span><%= entry.name %></span>
<span><%= strippedName %></span>
</a>
<% if (entry.children.length) { %>

View File

@@ -1,7 +1,16 @@
<%
const linkClass = `type-${note.type}` + (activeNote.noteId === note.noteId ? " active" : "");
const isExternalLink = note.hasLabel("shareExternal");
const linkHref = isExternalLink ? note.getLabelValue("shareExternal") : `./${note.shareId}`;
let linkHref;
if (isExternalLink) {
linkHref = note.getLabelValue("shareExternal");
} else if (note.shareId) {
linkHref = `./${note.shareId}`;
} else {
linkHref = `#${note.getBestNotePath().join("/")}`;
}
const target = isExternalLink ? ` target="_blank" rel="noopener noreferrer"` : "";
%>

5
packages/share-theme/src/types.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
declare module "katex/contrib/auto-render" {
export default function renderMathInElement(elem: HTMLElement, options?: {})
}
declare module "katex/contrib/mhchem" {}

14
pnpm-lock.yaml generated
View File

@@ -1328,6 +1328,16 @@ importers:
version: 1.2.0
packages/share-theme:
dependencies:
boxicons:
specifier: 2.1.4
version: 2.1.4
katex:
specifier: 0.16.25
version: 0.16.25
mermaid:
specifier: 11.12.0
version: 11.12.0
devDependencies:
'@digitak/esrun':
specifier: 3.2.26
@@ -15335,6 +15345,8 @@ snapshots:
'@ckeditor/ckeditor5-utils': 47.1.0
ckeditor5: 47.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)
es-toolkit: 1.39.5
transitivePeerDependencies:
- supports-color
'@ckeditor/ckeditor5-editor-multi-root@47.1.0':
dependencies:
@@ -15831,6 +15843,8 @@ snapshots:
'@ckeditor/ckeditor5-ui': 47.1.0
'@ckeditor/ckeditor5-utils': 47.1.0
ckeditor5: 47.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)
transitivePeerDependencies:
- supports-color
'@ckeditor/ckeditor5-restricted-editing@47.1.0':
dependencies: