Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/status bar/note paths: replace the "Clone note to new location" button with a link
Adorian Dorand1ae2db587a7
diff --git a/apps/client/src/widgets/react/LinkButton.tsx b/apps/client/src/widgets/react/LinkButton.tsxindex a9596c972e..81e2943a17 100644--- a/apps/client/src/widgets/react/LinkButton.tsx+++ b/apps/client/src/widgets/react/LinkButton.tsx@@ -1,16 +1,20 @@import { ComponentChild } from "preact";+import { CommandNames } from "../../components/app_context";interface LinkButtonProps {- onClick: () => void;+ onClick?: () => void;text: ComponentChild;+ triggerCommand?: CommandNames;}-export default function LinkButton({ onClick, text }: LinkButtonProps) {+export default function LinkButton({ onClick, text, triggerCommand }: LinkButtonProps) {return (- <a class="tn-link" href="javascript:" onClick={(e) => {- e.preventDefault();- onClick();- }}>+ <a class="tn-link" href="javascript:"+ data-trigger-command={triggerCommand}+ onClick={(e) => {+ e.preventDefault();+ if (onClick) onClick();+ }}>{text}</a>)diff --git a/apps/client/src/widgets/ribbon/NotePathsTab.tsx b/apps/client/src/widgets/ribbon/NotePathsTab.tsxindex d639a89285..18d5086d61 100644--- a/apps/client/src/widgets/ribbon/NotePathsTab.tsx+++ b/apps/client/src/widgets/ribbon/NotePathsTab.tsx@@ -3,11 +3,12 @@ import { useEffect, useMemo, useState } from "preact/hooks";import FNote, { NotePathRecord } from "../../entities/fnote";import { t } from "../../services/i18n";import { NOTE_PATH_TITLE_SEPARATOR } from "../../services/tree";-import Button from "../react/Button";import { useTriliumEvent } from "../react/hooks";import NoteLink from "../react/NoteLink";import { joinElements } from "../react/react_utils";import { TabContext } from "./ribbon-interface";+import LinkButton from "../react/LinkButton";+export default function NotePathsTab({ note, hoistedNoteId, notePath }: TabContext) {const sortedNotePaths = useSortedNotePaths(note, hoistedNoteId);@@ -35,9 +36,9 @@ export function NotePathsWidget({ sortedNotePaths, currentNotePath }: {)) : undefined}</ul>- <Button- triggerCommand="cloneNoteIdsTo"+ <LinkButtontext={t("note_paths.clone_button")}+ triggerCommand="cloneNoteIdsTo"/></></div>