diff --git a/apps/client/src/widgets/layout/ActiveContentBadges.tsx b/apps/client/src/widgets/layout/ActiveContentBadges.tsx index 088d97cd6e..daa787b927 100644 --- a/apps/client/src/widgets/layout/ActiveContentBadges.tsx +++ b/apps/client/src/widgets/layout/ActiveContentBadges.tsx @@ -5,7 +5,7 @@ import FNote from "../../entities/fnote"; import attributes from "../../services/attributes"; import { t } from "../../services/i18n"; import { openInAppHelpFromUrl } from "../../services/utils"; -import { Badge, BadgeWithDropdown } from "../react/Badge"; +import { BadgeWithDropdown } from "../react/Badge"; import { FormListItem } from "../react/FormList"; import FormToggle from "../react/FormToggle"; import { useNoteContext, useTriliumEvent } from "../react/hooks"; @@ -16,14 +16,21 @@ const activeContentLabels = [ "iconPack" ] as const; const typeMappings: Record = { iconPack: { icon: "bx bx-package", - helpPage: "g1mlRoU8CsqC" + helpPage: "g1mlRoU8CsqC", }, backendScript: { icon: "bx bx-server", - helpPage: "SPirpZypehBG" + helpPage: "SPirpZypehBG", + apiDocsPage: "MEtfsqa5VwNi" + }, + frontendScript: { + icon: "bx bx-window", + helpPage: "yIhgI5H7A2Sm", + apiDocsPage: "Q2z6av6JZVWm" } }; @@ -40,7 +47,7 @@ export function ActiveContentBadges() { } function ActiveContentBadge({ info }: { note: FNote, info: ActiveContentInfo }) { - const { icon, helpPage } = typeMappings[info.type]; + const { icon, helpPage, apiDocsPage } = typeMappings[info.type]; return ( openInAppHelpFromUrl(helpPage)} >{t("active_content_badges.menu_docs")} + + {apiDocsPage && openInAppHelpFromUrl(apiDocsPage)} + >{t("code_buttons.trilium_api_docs_button_title")}} ); } @@ -98,7 +110,7 @@ function getNameWithoutPrefix(name: string) { } interface ActiveContentInfo { - type: "iconPack" | "backendScript"; + type: "iconPack" | "backendScript" | "frontendScript"; isEnabled: boolean; } diff --git a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx index 2864e50eaf..482cd1a693 100644 --- a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx +++ b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx @@ -70,7 +70,6 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) { > - @@ -230,15 +229,6 @@ function SaveToNoteButton({ note, noteMime }: NoteActionsCustomInnerProps) { />; } -function OpenTriliumApiDocsButton({ noteMime }: NoteActionsCustomInnerProps) { - const isEnabled = noteMime.startsWith("application/javascript;env="); - return isEnabled && openInAppHelpFromUrl(noteMime.endsWith("frontend") ? "Q2z6av6JZVWm" : "MEtfsqa5VwNi")} - />; -} - function InAppHelpButton({ note }: NoteActionsCustomInnerProps) { const helpUrl = getHelpUrlForNote(note); const isEnabled = !!helpUrl;