mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 18:34:24 +01:00
feat(breadcrumb_badges): integrate note properties tab
This commit is contained in:
parent
1eee471018
commit
fa8287269f
@ -2146,6 +2146,8 @@
|
||||
"backlinks_one": "{{count}} backlink",
|
||||
"backlinks_other": "{{count}} backlinks",
|
||||
"backlinks_description_one": "This note is linked from {{count}} other note.\n\nClick to view the list of backlinks.",
|
||||
"backlinks_description_other": "This note is linked from {{count}} other notes.\n\nClick to view the list of backlinks."
|
||||
"backlinks_description_other": "This note is linked from {{count}} other notes.\n\nClick to view the list of backlinks.",
|
||||
"clipped_note": "Web clip",
|
||||
"clipped_note_description": "This note was originally taken from {{url}}.\n\nClick to navigate to the source webpage."
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
&.temporarily-editable-badge { --color: #4fa52b; }
|
||||
&.read-only-badge { --color: #e33f3b; }
|
||||
&.share-badge { --color: #3b82f6; }
|
||||
&.clipped-note-badge { --color: #57a2a5; }
|
||||
&.backlinks-badge { color: var(--badge-text-color); }
|
||||
|
||||
a {
|
||||
|
||||
@ -8,7 +8,7 @@ import { t } from "../services/i18n";
|
||||
import { formatDateTime } from "../utils/formatters";
|
||||
import { BacklinksList, useBacklinkCount } from "./FloatingButtonsDefinitions";
|
||||
import Dropdown, { DropdownProps } from "./react/Dropdown";
|
||||
import { useIsNoteReadOnly, useNoteContext, useStaticTooltip } from "./react/hooks";
|
||||
import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useStaticTooltip } from "./react/hooks";
|
||||
import Icon from "./react/Icon";
|
||||
import { NoteSizeWidget, useNoteMetadata } from "./ribbon/NoteInfoTab";
|
||||
import { useShareInfo } from "./shared_info";
|
||||
@ -20,6 +20,7 @@ export default function BreadcrumbBadges() {
|
||||
<ReadOnlyBadge />
|
||||
<ShareBadge />
|
||||
<BacklinksBadge />
|
||||
<ClippedNoteBadge />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -114,6 +115,21 @@ function BacklinksBadge() {
|
||||
);
|
||||
}
|
||||
|
||||
function ClippedNoteBadge() {
|
||||
const { note } = useNoteContext();
|
||||
const [ pageUrl ] = useNoteLabel(note, "pageUrl");
|
||||
|
||||
return (pageUrl &&
|
||||
<Badge
|
||||
className="clipped-note-badge"
|
||||
icon="bx bx-globe"
|
||||
text={t("breadcrumb_badges.clipped_note")}
|
||||
tooltip={t("breadcrumb_badges.clipped_note_description", { url: pageUrl })}
|
||||
href={pageUrl}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
interface BadgeProps {
|
||||
text?: string;
|
||||
icon?: string;
|
||||
|
||||
@ -67,7 +67,7 @@ export const RIBBON_TAB_DEFINITIONS: TabConfiguration[] = [
|
||||
title: t("note_properties.info"),
|
||||
icon: "bx bx-info-square",
|
||||
content: NotePropertiesTab,
|
||||
show: ({ note }) => !!note?.getLabelValue("pageUrl"),
|
||||
show: ({ note }) => !isNewLayout && !!note?.getLabelValue("pageUrl"),
|
||||
activate: true
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user