Skip to content

Build your personal knowledge base with Trilium Notes

feat(in_app_help): link to public pages (closes #5686)

Elian Doran2d6c2c4a88da
diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.css
index eec8922b1c..b63ebc1d6a 100644
--- a/apps/client/src/stylesheets/theme-next-dark.css
+++ b/apps/client/src/stylesheets/theme-next-dark.css
@@ -219,6 +219,7 @@
--badge-read-only-background-color: #af4340;
--badge-share-background-color: #4d4d4d;
--badge-clipped-note-background-color: #295773;
+ --badge-doc-url-background-color: #1e5c42;
--badge-execute-background-color: #604180;
--badge-active-content-background-color: rgb(12, 68, 70);
diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.css
index 9549c87e64..5133553546 100644
--- a/apps/client/src/stylesheets/theme-next-light.css
+++ b/apps/client/src/stylesheets/theme-next-light.css
@@ -211,6 +211,7 @@
--badge-read-only-background-color: #c8302c;
--badge-share-background-color: #6b6b6b;
--badge-clipped-note-background-color: #2284c0;
+ --badge-doc-url-background-color: #2e7d5e;
--badge-execute-background-color: #7b47af;
--badge-active-content-background-color: rgb(27, 164, 168);
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 241c2f88f6..a3f929bd5d 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2369,6 +2369,8 @@
"shared_unshare": "Remove share",
"clipped_note": "Web clip",
"clipped_note_description": "This note was originally taken from {{url}}.\n\nClick to navigate to the source webpage.",
+ "doc_url": "Online docs",
+ "doc_url_description": "Click to view this page on the online documentation website.",
"execute_script": "Run script",
"execute_script_description": "This note is a script note. Click to execute the script.",
"execute_sql": "Run SQL",
diff --git a/apps/client/src/widgets/layout/NoteBadges.css b/apps/client/src/widgets/layout/NoteBadges.css
index 1283ee99ee..9485b57c65 100644
--- a/apps/client/src/widgets/layout/NoteBadges.css
+++ b/apps/client/src/widgets/layout/NoteBadges.css
@@ -20,6 +20,7 @@
&.read-only-badge {--color: var(--badge-read-only-background-color);}
&.share-badge {--color: var(--badge-share-background-color);}
&.clipped-note-badge {--color: var(--badge-clipped-note-background-color);}
+ &.doc-url-badge {--color: var(--badge-doc-url-background-color);}
&.execute-badge {--color: var(--badge-execute-background-color);}
&.save-status-badge {
--default-opacity: 0.4;
diff --git a/apps/client/src/widgets/layout/NoteBadges.tsx b/apps/client/src/widgets/layout/NoteBadges.tsx
index 917c3ace1e..064a07d356 100644
--- a/apps/client/src/widgets/layout/NoteBadges.tsx
+++ b/apps/client/src/widgets/layout/NoteBadges.tsx
@@ -19,6 +19,7 @@ export default function NoteBadges() {
<ReadOnlyBadge />
<ShareBadge />
<ClippedNoteBadge />
+ <DocUrlBadge />
<ExecuteBadge />
<ActiveContentBadges />
</div>
@@ -92,6 +93,21 @@ function ClippedNoteBadge() {
);
}
+function DocUrlBadge() {
+ const { note } = useNoteContext();
+ const [ docUrl ] = useNoteLabel(note, "docUrl");
+
+ return (docUrl &&
+ <Badge
+ className="doc-url-badge"
+ icon="bx bx-file-find"
+ text={t("breadcrumb_badges.doc_url")}
+ tooltip={t("breadcrumb_badges.doc_url_description")}
+ href={docUrl}
+ />
+ );
+}
+
function ExecuteBadge() {
const { note, parentComponent } = useNoteContext();
const isScript = note?.isTriliumScript();
diff --git a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
index 1e5bb77500..d6ff6a8236 100644
--- a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
+++ b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
@@ -27,9 +27,7 @@ type AttributeCommandNames = FilteredCommandNames<CommandData>;
const HELP_TEXT = `
<p>${t("attribute_editor.help_text_body1")}</p>
-
<p>${t("attribute_editor.help_text_body2")}</p>
-
<p>${t("attribute_editor.help_text_body3")}</p>`;
const mentionSetup: MentionFeed[] = [
@@ -453,4 +451,4 @@ function getClickIndex(pos: ModelPosition) {
}
return clickIndex;
-}
\ No newline at end of file
+}
diff --git a/packages/commons/src/lib/attribute_names.ts b/packages/commons/src/lib/attribute_names.ts
index e5081f6c39..704dbb8d65 100644
--- a/packages/commons/src/lib/attribute_names.ts
+++ b/packages/commons/src/lib/attribute_names.ts
@@ -20,6 +20,7 @@ type Labels = {
language: string;
originalFileName: string;
pageUrl: string;
+ docUrl: string;
dateNote: string;
// Scripting