diff --git a/.github/workflows/main-docker.yml b/.github/workflows/main-docker.yml index f06e7b3e9..2fe298217 100644 --- a/.github/workflows/main-docker.yml +++ b/.github/workflows/main-docker.yml @@ -111,6 +111,9 @@ jobs: - dockerfile: Dockerfile platform: linux/arm/v7 image: ubuntu-24.04-arm + - dockerfile: Dockerfile + platform: linux/arm/v8 + image: ubuntu-24.04-arm runs-on: ${{ matrix.image }} needs: - test_docker diff --git a/_regroup/bin/build-docker.sh b/_regroup/bin/build-docker.sh deleted file mode 100644 index d95c289d4..000000000 --- a/_regroup/bin/build-docker.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e # Fail on any command error - -VERSION=`jq -r ".version" package.json` -SERIES=${VERSION:0:4}-latest - -sudo docker build -t triliumnext/notes:$VERSION --network host -t triliumnext/notes:$SERIES . - -if [[ $VERSION != *"beta"* ]]; then - sudo docker tag triliumnext/notes:$VERSION triliumnext/notes:latest -fi diff --git a/apps/client/src/menus/context_menu.ts b/apps/client/src/menus/context_menu.ts index 7d0bc0a2f..a8a37f462 100644 --- a/apps/client/src/menus/context_menu.ts +++ b/apps/client/src/menus/context_menu.ts @@ -192,13 +192,16 @@ class ContextMenu { // it's important to stop the propagation especially for sub-menus, otherwise the event // might be handled again by top-level menu return false; - }) - .on("mouseup", (e) =>{ + }); + + if (!this.isMobile) { + $item.on("mouseup", (e) =>{ e.stopPropagation(); // Hide the content menu on mouse up to prevent the mouse event from propagating to the elements below. this.hide(); return false; }); + } if ("enabled" in item && item.enabled !== undefined && !item.enabled) { $item.addClass("disabled"); diff --git a/apps/client/src/services/keyboard_actions.ts b/apps/client/src/services/keyboard_actions.ts index dfa888620..3cb0ffd33 100644 --- a/apps/client/src/services/keyboard_actions.ts +++ b/apps/client/src/services/keyboard_actions.ts @@ -115,6 +115,7 @@ function updateDisplayedShortcuts($container: JQuery) { export default { updateDisplayedShortcuts, setupActionsForElement, + getAction, getActions, getActionsForScope }; diff --git a/apps/client/src/services/utils.ts b/apps/client/src/services/utils.ts index ab6e45847..590c596b2 100644 --- a/apps/client/src/services/utils.ts +++ b/apps/client/src/services/utils.ts @@ -124,8 +124,12 @@ function formatDateISO(date: Date) { return `${date.getFullYear()}-${padNum(date.getMonth() + 1)}-${padNum(date.getDate())}`; } -function formatDateTime(date: Date) { - return `${formatDate(date)} ${formatTime(date)}`; +function formatDateTime(date: Date, userSuppliedFormat?: string): string { + if (userSuppliedFormat?.trim()) { + return dayjs(date).format(userSuppliedFormat); + } else { + return `${formatDate(date)} ${formatTime(date)}`; + } } function localNowDateTime() { diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 4d39265d1..13ee699d7 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -1431,6 +1431,12 @@ "label": "Automatic read-only size (text notes)", "unit": "characters" }, + "custom_date_time_format": { + "title": "Custom Date/Time Format", + "description": "Customize the format of the date and time inserted via or the toolbar. See Day.js docs for available format tokens.", + "format_string": "Format string:", + "formatted_time": "Formatted date/time:" + }, "i18n": { "title": "Localization", "language": "Language", diff --git a/apps/client/src/widgets/type_widgets/ckeditor/config.ts b/apps/client/src/widgets/type_widgets/ckeditor/config.ts index bd74d0512..210fac3bf 100644 --- a/apps/client/src/widgets/type_widgets/ckeditor/config.ts +++ b/apps/client/src/widgets/type_widgets/ckeditor/config.ts @@ -189,7 +189,7 @@ export function buildClassicToolbar(multilineToolbar: boolean) { { label: "Insert", icon: "plus", - items: ["imageUpload", "|", "link", "bookmark", "internallink", "includeNote", "|", "specialCharacters", "emoji", "math", "mermaid", "horizontalLine", "pageBreak"] + items: ["imageUpload", "|", "link", "bookmark", "internallink", "includeNote", "|", "specialCharacters", "emoji", "math", "mermaid", "horizontalLine", "pageBreak", "dateTime"] }, "|", "outdent", @@ -222,6 +222,7 @@ export function buildFloatingToolbar() { "|", "code", "link", + "bookmark", "removeFormat", "internallink", "cuttonote" @@ -243,7 +244,7 @@ export function buildFloatingToolbar() { { label: "Insert", icon: "plus", - items: ["bookmark", "internallink", "includeNote", "|", "math", "mermaid", "horizontalLine", "pageBreak"] + items: ["bookmark", "internallink", "includeNote", "|", "math", "mermaid", "horizontalLine", "pageBreak", "dateTime"] }, "|", "outdent", diff --git a/apps/client/src/widgets/type_widgets/content_widget.ts b/apps/client/src/widgets/type_widgets/content_widget.ts index 00c30f5f7..614159cb7 100644 --- a/apps/client/src/widgets/type_widgets/content_widget.ts +++ b/apps/client/src/widgets/type_widgets/content_widget.ts @@ -8,6 +8,7 @@ import HeadingStyleOptions from "./options/text_notes/heading_style.js"; import TableOfContentsOptions from "./options/text_notes/table_of_contents.js"; import HighlightsListOptions from "./options/text_notes/highlights_list.js"; import TextAutoReadOnlySizeOptions from "./options/text_notes/text_auto_read_only_size.js"; +import DateTimeFormatOptions from "./options/text_notes/date_time_format.js"; import CodeEditorOptions from "./options/code_notes/code_editor.js"; import CodeAutoReadOnlySizeOptions from "./options/code_notes/code_auto_read_only_size.js"; import CodeMimeTypesOptions from "./options/code_notes/code_mime_types.js"; @@ -88,7 +89,8 @@ const CONTENT_WIDGETS: Record { - if (!("isOpen" in item) || !item.isOpen ) { + if (!("isOpen" in item) || !item.isOpen) { return; } @@ -375,9 +375,10 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget { } } - insertDateTimeToTextCommand() { + insertDateTimeToTextCommand() { const date = new Date(); - const dateString = utils.formatDateTime(date); + const customDateTimeFormat = options.get("customDateTimeFormat"); + const dateString = utils.formatDateTime(date, customDateTimeFormat); this.addTextToEditor(dateString); } diff --git a/apps/client/src/widgets/type_widgets/options/text_notes/date_time_format.ts b/apps/client/src/widgets/type_widgets/options/text_notes/date_time_format.ts new file mode 100644 index 000000000..5728ac8b4 --- /dev/null +++ b/apps/client/src/widgets/type_widgets/options/text_notes/date_time_format.ts @@ -0,0 +1,67 @@ +import OptionsWidget from "../options_widget.js"; +import { t } from "../../../../services/i18n.js"; +import type { OptionMap } from "@triliumnext/commons"; +import utils from "../../../../services/utils.js"; +import keyboardActionsService from "../../../../services/keyboard_actions.js"; +import linkService from "../../../.././services/link.js"; + +const TPL = /*html*/` +
+

${t("custom_date_time_format.title")}

+ +

+ ${t("custom_date_time_format.description")} +

+ +
+
+ + +
+
+ +
+
+
+
+`; + +export default class DateTimeFormatOptions extends OptionsWidget { + + private $formatInput!: JQuery; + private $formattedDate!: JQuery; + + doRender() { + this.$widget = $(TPL); + + this.$formatInput = this.$widget.find("input.custom-date-time-format"); + this.$formattedDate = this.$widget.find(".formatted-date"); + + this.$formatInput.on("input", () => { + const dateString = utils.formatDateTime(new Date(), this.$formatInput.val()); + this.$formattedDate.text(dateString); + }); + + this.$formatInput.on('blur keydown', (e) => { + if (e.type === 'blur' || (e.type === 'keydown' && e.key === 'Enter')) { + this.updateOption("customDateTimeFormat", this.$formatInput.val()); + } + }); + + return this.$widget; + } + + async optionsLoaded(options: OptionMap) { + const shortcutKey = (await keyboardActionsService.getAction("insertDateTimeToText")).effectiveShortcuts.join(", "); + const $link = await linkService.createLink("_hidden/_options/_optionsShortcuts", { + "title": shortcutKey, + "showTooltip": false + }); + this.$widget.find(".description").find("kbd").replaceWith($link); + + const customDateTimeFormat = options.customDateTimeFormat || "YYYY-MM-DD HH:mm"; + this.$formatInput.val(customDateTimeFormat); + const dateString = utils.formatDateTime(new Date(), customDateTimeFormat); + this.$formattedDate.text(dateString); + } +} diff --git a/apps/edit-docs/demo/!!!meta.json b/apps/edit-docs/demo/!!!meta.json index 178f5bd51..166afb625 100644 --- a/apps/edit-docs/demo/!!!meta.json +++ b/apps/edit-docs/demo/!!!meta.json @@ -454,19 +454,19 @@ "isInheritable": false, "position": 10 }, - { - "type": "relation", - "name": "child:child:child:template", - "value": "kr6HIBBuXRwm", - "isInheritable": false, - "position": 20 - }, { "type": "label", "name": "iconClass", "value": "bx bx-calendar", "isInheritable": false, "position": 30 + }, + { + "type": "relation", + "name": "dateTemplate", + "value": "kr6HIBBuXRwm", + "isInheritable": false, + "position": 20 } ], "format": "html", diff --git a/apps/edit-docs/demo/root/Trilium Demo.html b/apps/edit-docs/demo/root/Trilium Demo.html index a99649f5e..59ef348b7 100644 --- a/apps/edit-docs/demo/root/Trilium Demo.html +++ b/apps/edit-docs/demo/root/Trilium Demo.html @@ -18,22 +18,28 @@ height="150">

Welcome to TriliumNext Notes! +

This is initial "demo" document provided by TriliumNext by default to showcase some of its features and also give you some ideas how you might structure your notes. You can play with it, modify note content and tree structure as you wish.

If you need any help, visit TriliumNext website: https://github.com/TriliumNext +

Cleanup

+

Once you're finished with experimenting and want to cleanup these pages, you can simply delete them all.

Formatting

+

TriliumNext supports classic formatting like italic, bold, bold and italic. Of course you can add links like this one pointing to google.com +

Lists

Ordered: +

  1. First Item
  2. @@ -48,6 +54,7 @@

Unordered: +

  • Item
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Books/Book template.html b/apps/edit-docs/demo/root/Trilium Demo/Books/Book template.html index 5f589ccde..b6ece231e 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Books/Book template.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Books/Book template.html @@ -14,17 +14,22 @@

    Main characters

    +

    … here put main characters …

     

    Plot

    +

    … describe main plot lines …

     

    Tone

    +

     

    Genre

    +

    scifi / drama / romance

     

    Similar books

    +
    diff --git a/apps/edit-docs/demo/root/Trilium Demo/Books/To read.html b/apps/edit-docs/demo/root/Trilium Demo/Books/To read.html index 17b164b6c..30cf1d0d1 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Books/To read.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Books/To read.html @@ -14,11 +14,14 @@

    Checkout Kindle daily deals: https://www.amazon.com/gp/feature.html?docId=1000677541 +

    diff --git a/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Checkbox lists.html b/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Checkbox lists.html index 62c728414..1a581a9d0 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Checkbox lists.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Checkbox lists.html @@ -18,21 +18,25 @@
diff --git a/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Code blocks.html b/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Code blocks.html index 6827fa8af..c323d02b5 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Code blocks.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Code blocks.html @@ -24,6 +24,7 @@ alert("Hello world"); } +

For larger pieces of code it is better to use a code note, which uses a fully-fledged code editor (CodeMirror). For an example of a code note, see Custom request handler.

diff --git a/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Math.html b/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Math.html index 54a28f3ff..e646e00b4 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Math.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Formatting examples/Math.html @@ -15,7 +15,9 @@

\(% \f is defined as #1f(#2) using the macro \f\relax{x} = \int_{-\infty}^\infty     \f\hat\xi\,e^{2 \pi i \xi x}     \,d\xi\)Some math examples:

\[\displaystyle \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }\] +

Another:

\[\displaystyle \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)\] +

Inline math is also possible: \(c^2 = a^2 + b^2\) 

 

diff --git a/apps/edit-docs/demo/root/Trilium Demo/Inbox/The Last Question.html b/apps/edit-docs/demo/root/Trilium Demo/Inbox/The Last Question.html index e0d736c1b..3cb00a8e4 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Inbox/The Last Question.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Inbox/The Last Question.html @@ -22,6 +22,7 @@

This page demonstrates two things:

diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal.html b/apps/edit-docs/demo/root/Trilium Demo/Journal.html index faac301b5..629b4870f 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal.html @@ -14,6 +14,7 @@

You can read some explanation on how this journal works here: https://github.com/zadam/trilium/wiki/Day-notes +

diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday.html index 5171b6ee2..e4a99c109 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Christmas gift ideas.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Christmas gift ideas.html index 2a2d08336..01ad36c16 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Christmas gift ideas.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Christmas gift ideas.html @@ -17,6 +17,7 @@
  • XBox
  • Candles
  • Portable speakers +
  • ...?
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Trusted timestamping.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Trusted timestamping.html index 0a85f8618..bae5a1ed0 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Trusted timestamping.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/11 - November/28 - Tuesday/Trusted timestamping.html @@ -14,8 +14,10 @@

    Wiki: https://en.wikipedia.org/wiki/Trusted_timestamping +

    Bozho: https://techblog.bozho.net/using-trusted-timestamping-java/ +

    Trusted timestamping is the process of securely keeping track of the creation and modification time of a document. Security here diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html index ae490681e..3722a62c0 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/18 - Monday.html @@ -16,6 +16,7 @@

    Miscellaneous notes done on monday ...

     

    Interesting video: https://www.youtube.com/watch?v=_eSAF_qT_FY&feature=youtu.be +

     

     

    diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/19 - Tuesday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/19 - Tuesday.html index f0309b26d..487b71530 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/19 - Tuesday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/19 - Tuesday.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/20 - Wednesday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/20 - Wednesday.html index 28245eb1a..ae559b3c1 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/20 - Wednesday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/20 - Wednesday.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/21 - Thursday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/21 - Thursday.html index 2ff2ac742..28b77ec56 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/21 - Thursday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/21 - Thursday.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/22 - Friday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/22 - Friday.html index f8ec2e8e5..3545fd3d7 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/22 - Friday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/22 - Friday.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/23 - Saturday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/23 - Saturday.html index 6973b8531..912b715c0 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/23 - Saturday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/23 - Saturday.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!.html index 29a1e0cd2..c243a035c 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!/DONE - Buy a board game for Al.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!/DONE - Buy a board game for Al.html index 55d9b2909..e7367a06c 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!/DONE - Buy a board game for Al.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/24 - Sunday - Christmas Eve!/DONE - Buy a board game for Al.html @@ -18,6 +18,7 @@ width="209" height="300">

    Maybe CodeNames? https://boardgamegeek.com/boardgame/178900/codenames +

    diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/30 - Thursday.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/30 - Thursday.html index 36cbd2ed6..133fae97b 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/30 - Thursday.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/2021/12 - December/30 - Thursday.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Journal/Day template.html b/apps/edit-docs/demo/root/Trilium Demo/Journal/Day template.html index 623273a9e..44bd101ae 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Journal/Day template.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Journal/Day template.html @@ -18,6 +18,7 @@
  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html index ab44bd638..3992ceed9 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Chichén Itzá, Mexico.html @@ -24,14 +24,17 @@ [1] +

    1. ^ +
    2. diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html index 3e1f1e905..cbaae70da 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Christ the Redeemer, Brazil.html @@ -26,13 +26,16 @@ been brought to its knees.[1] +

      1. ^ +
      2. diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html index 5e9817e5b..929103047 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Machu Picchu, Peru.html @@ -22,13 +22,16 @@ around 1450 in polished drystone walls.[1] +

        1. ^ +
        2. diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html index 1396c2691..55e0adafa 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/Petra, Jordan.html @@ -23,13 +23,16 @@ by earthquakes.[1] +

          1. ^ +
          2. diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html index 650a6623c..c9abd680d 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Colosseum, Rome, Italy.html @@ -26,14 +26,17 @@ [1] +

            1. ^ +
            2. diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html index 1f5d5886f..ccedb8388 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Great Wall of China.html @@ -23,14 +23,17 @@ [1] +

              1. ^ +
              2. diff --git a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html index 0d692392a..755184be0 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Note Types/Geo Map (The Seven Wonders of the World)/The Taj Mahal, India.html @@ -23,13 +23,16 @@ the complex.[1] +

                1. ^ +
                2. diff --git a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager.html b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager.html index 1b4822074..0194f9364 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager.html @@ -15,6 +15,7 @@

                  This is a simple TODO/Task manager. You can see some description and explanation here: https://github.com/zadam/trilium/wiki/Task-manager +

                  Please note that this is meant as scripting example only and feature/bug support is very limited.

                  diff --git a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html index 9cda89645..65b1819f2 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Done/Buy a board game for Alice.html @@ -18,6 +18,7 @@ width="209" height="300">

                  Maybe CodeNames? https://boardgamegeek.com/boardgame/178900/codenames +

                  diff --git a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html index ba291c1ae..51831b17f 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Scripting examples/Task manager/Locations/mall/Buy some book for Bob/Maybe Black Swan.html @@ -14,6 +14,7 @@

                  https://en.wikipedia.org/wiki/The_Black_Swan:_The_Impact_of_the_Highly_Improbable +

                  The Black Swan: The Impact of the Highly Improbable is a 2007 book by author and former options trader diff --git a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html index aaa6cd1ad..55c1364be 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting.html @@ -25,6 +25,7 @@ and Apple's macOS (formerly OS X). A version is also available for Windows 10.

                  Bash on Wikipedia +

                  diff --git a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/Bash startup modes.html b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/Bash startup modes.html index 4dad269df..2f686d2de 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/Bash startup modes.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/Bash startup modes.html @@ -14,6 +14,7 @@

                  Login shell

                  +

                  As a "login shell", Bash reads and sets (executes) the user's profile from /etc/profile and one of ~/.bash_profile, ~/.bash_login, or ~/.profile (in that order, using the first one that's readable!).

                  @@ -23,6 +24,7 @@ that only make sense for the initial user login. That's why all UNIX® shells have (should have) a "login" mode.

                  Methods to start Bash as a login shell: +

                  • the first character of argv[0] is - (a hyphen): traditional UNIX® shells @@ -31,17 +33,20 @@
                  • Bash is started with the --login option

                  Methods to test for login shell mode: +

                  Related switches: +

                  • --noprofile disables reading of all profile files

                  Interactive shell

                  +

                  When Bash starts as an interactive non-login shell, it reads and executes commands from ~/.bashrc. This file should contain, for example, aliases, since they need to be defined in every shell as they're not inherited from @@ -51,11 +56,13 @@ The classic way to have a system-wide rc file is to source /etc/bashrc from every user's ~/.bashrc.

                  Methods to test for interactive-shell mode: +

                  • the special parameter $- contains the letter i (lowercase I)

                  Related switches: +

                  • -i forces the interactive mode
                  • @@ -65,6 +72,7 @@ ~/.bashrc)

                  SH mode

                  +

                  When Bash starts in SH compatiblity mode, it tries to mimic the startup behaviour of historical versions of sh as closely as possible, while conforming to the POSIX® standard as well. The profile files read are /etc/profile @@ -74,6 +82,7 @@ file.

                  After the startup files are read, Bash enters the POSIX(r) compatiblity mode (for running, not for starting!).

                  Bash starts in sh compatiblity mode when: +

                  • diff --git a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/While loop.html b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/While loop.html index 6ab7cf106..7b0c06f5d 100644 --- a/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/While loop.html +++ b/apps/edit-docs/demo/root/Trilium Demo/Tech/Linux/Bash scripting/While loop.html @@ -14,6 +14,7 @@

                    Documentation: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_02.html +

                    #!/bin/bash
                     
                     # This script opens 4 terminal windows.
                    diff --git a/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html b/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html
                    index 1a977bccc..4b51ab5be 100644
                    --- a/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html	
                    +++ b/apps/edit-docs/demo/root/Trilium Demo/Tech/Node.js/Overview/Platform architecture.html	
                    @@ -20,6 +20,7 @@
                                 href="https://en.wikipedia.org/wiki/Node.js#cite_note-b1-31">[31]Developers can create scalable servers without using threading,
                                   by using a simplified model of event-driven programming that
                                   uses callbacks to signal the completion of a task.[31]
                    +
                             

                  diff --git a/apps/server/spec/db/document.db b/apps/server/spec/db/document.db index c1000f7f9..50b477ea7 100644 Binary files a/apps/server/spec/db/document.db and b/apps/server/spec/db/document.db differ diff --git a/apps/server/src/assets/db/demo.zip b/apps/server/src/assets/db/demo.zip index 8a0d61779..322fbe7de 100644 Binary files a/apps/server/src/assets/db/demo.zip and b/apps/server/src/assets/db/demo.zip differ diff --git a/apps/server/src/routes/api/options.ts b/apps/server/src/routes/api/options.ts index c69f7568f..42d4fb110 100644 --- a/apps/server/src/routes/api/options.ts +++ b/apps/server/src/routes/api/options.ts @@ -57,6 +57,7 @@ const ALLOWED_OPTIONS = new Set([ "headingStyle", "autoCollapseNoteTree", "autoReadonlySizeText", + "customDateTimeFormat", "autoReadonlySizeCode", "overrideThemeFonts", "dailyBackupEnabled", diff --git a/apps/server/src/share/routes.spec.ts b/apps/server/src/share/routes.spec.ts index 3cde4be23..987d1b12a 100644 --- a/apps/server/src/share/routes.spec.ts +++ b/apps/server/src/share/routes.spec.ts @@ -33,4 +33,13 @@ describe("Share API test", () => { expect(cannotSetHeadersCount).toBe(0); }); + it("renders custom share template", async () => { + const response = await supertest(app) + .get("/share/pQvNLLoHcMwH") + .expect(200); + expect(cannotSetHeadersCount).toBe(0); + expect(response.text).toContain("Content Start"); + expect(response.text).toContain("Content End"); + }); + }); diff --git a/apps/server/src/share/routes.ts b/apps/server/src/share/routes.ts index ee36621ed..614cd2101 100644 --- a/apps/server/src/share/routes.ts +++ b/apps/server/src/share/routes.ts @@ -16,6 +16,7 @@ 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"; function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } { if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) { @@ -135,7 +136,7 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: stri } function register(router: Router) { - function renderNote(note: SNote, req: Request, res: Response) { + async function renderNote(note: SNote, req: Request, res: Response) { if (!note) { console.log("Unable to find note ", note); res.status(404).render("share/404"); @@ -167,7 +168,8 @@ function register(router: Router) { subRoot, assetPath: isDev ? assetPath : `../${assetPath}`, appPath: isDev ? appPath : `../${appPath}`, - showLoginInShareTheme + showLoginInShareTheme, + t }; let useDefaultView = true; @@ -182,7 +184,7 @@ function register(router: Router) { // 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."); + 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(); @@ -195,11 +197,10 @@ function register(router: Router) { try { const content = templateNote.getContent(); if (typeof content === "string") { - import("ejs").then((ejs) => { - const ejsResult = ejs.render(content, opts, { includer }); - res.send(ejsResult); - useDefaultView = false; // Rendering went okay, don't use default view - }); + const ejs = await import("ejs"); + 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); diff --git a/packages/ckeditor5/src/icons/date-time.svg b/packages/ckeditor5/src/icons/date-time.svg new file mode 100644 index 000000000..8e8907da6 --- /dev/null +++ b/packages/ckeditor5/src/icons/date-time.svg @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/packages/ckeditor5/src/plugins.ts b/packages/ckeditor5/src/plugins.ts index 39932ef6d..3310493c0 100644 --- a/packages/ckeditor5/src/plugins.ts +++ b/packages/ckeditor5/src/plugins.ts @@ -5,6 +5,7 @@ import UploadimagePlugin from "./plugins/uploadimage.js"; import ItalicAsEmPlugin from "./plugins/italic_as_em.js"; import StrikethroughAsDel from "./plugins/strikethrough_as_del.js"; import InternalLinkPlugin from "./plugins/internallink.js"; +import InsertDateTimePlugin from "./plugins/insert_date_time.js"; import ReferenceLink from "./plugins/referencelink.js"; import RemoveFormatLinksPlugin from "./plugins/remove_format_links.js"; import IndentBlockShortcutPlugin from "./plugins/indent_block_shortcut.js"; @@ -36,6 +37,7 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [ ItalicAsEmPlugin, StrikethroughAsDel, InternalLinkPlugin, + InsertDateTimePlugin, RemoveFormatLinksPlugin, IndentBlockShortcutPlugin, MarkdownImportPlugin, diff --git a/packages/ckeditor5/src/plugins/insert_date_time.ts b/packages/ckeditor5/src/plugins/insert_date_time.ts new file mode 100644 index 000000000..e1417dbe7 --- /dev/null +++ b/packages/ckeditor5/src/plugins/insert_date_time.ts @@ -0,0 +1,31 @@ +import { ButtonView, Plugin } from 'ckeditor5'; +import dateTimeIcon from '../icons/date-time.svg?raw'; + +export default class InsertDateTimePlugin extends Plugin { + init() { + const editor = this.editor; + + editor.ui.componentFactory.add('dateTime', locale => { + const view = new ButtonView( locale ); + + view.set( { + label: 'Date time', + icon: dateTimeIcon, + tooltip: true + } ); + + // enable internal link only if the editor is not read only + view.bind('isEnabled').to(editor, 'isReadOnly', isReadOnly => !isReadOnly); + + view.on('execute', () => { + const editorEl = editor.editing.view.getDomRoot(); + const component = glob.getComponentByEl(editorEl); + + component.triggerCommand('insertDateTimeToText'); + editor.editing.view.focus(); + } ); + + return view; + }); + } +} \ No newline at end of file diff --git a/packages/commons/src/lib/options_interface.ts b/packages/commons/src/lib/options_interface.ts index 19125d125..32f731936 100644 --- a/packages/commons/src/lib/options_interface.ts +++ b/packages/commons/src/lib/options_interface.ts @@ -47,6 +47,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions