mirror of
https://github.com/zadam/trilium.git
synced 2025-12-17 04:44:23 +01:00
client/status bar/note paths: replace the "Clone note to new location" button with a link
This commit is contained in:
parent
8fa6e38382
commit
d1ae2db587
@ -1,15 +1,19 @@
|
|||||||
import { ComponentChild } from "preact";
|
import { ComponentChild } from "preact";
|
||||||
|
import { CommandNames } from "../../components/app_context";
|
||||||
|
|
||||||
interface LinkButtonProps {
|
interface LinkButtonProps {
|
||||||
onClick: () => void;
|
onClick?: () => void;
|
||||||
text: ComponentChild;
|
text: ComponentChild;
|
||||||
|
triggerCommand?: CommandNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function LinkButton({ onClick, text }: LinkButtonProps) {
|
export default function LinkButton({ onClick, text, triggerCommand }: LinkButtonProps) {
|
||||||
return (
|
return (
|
||||||
<a class="tn-link" href="javascript:" onClick={(e) => {
|
<a class="tn-link" href="javascript:"
|
||||||
|
data-trigger-command={triggerCommand}
|
||||||
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
onClick();
|
if (onClick) onClick();
|
||||||
}}>
|
}}>
|
||||||
{text}
|
{text}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -3,11 +3,12 @@ import { useEffect, useMemo, useState } from "preact/hooks";
|
|||||||
import FNote, { NotePathRecord } from "../../entities/fnote";
|
import FNote, { NotePathRecord } from "../../entities/fnote";
|
||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
import { NOTE_PATH_TITLE_SEPARATOR } from "../../services/tree";
|
import { NOTE_PATH_TITLE_SEPARATOR } from "../../services/tree";
|
||||||
import Button from "../react/Button";
|
|
||||||
import { useTriliumEvent } from "../react/hooks";
|
import { useTriliumEvent } from "../react/hooks";
|
||||||
import NoteLink from "../react/NoteLink";
|
import NoteLink from "../react/NoteLink";
|
||||||
import { joinElements } from "../react/react_utils";
|
import { joinElements } from "../react/react_utils";
|
||||||
import { TabContext } from "./ribbon-interface";
|
import { TabContext } from "./ribbon-interface";
|
||||||
|
import LinkButton from "../react/LinkButton";
|
||||||
|
|
||||||
|
|
||||||
export default function NotePathsTab({ note, hoistedNoteId, notePath }: TabContext) {
|
export default function NotePathsTab({ note, hoistedNoteId, notePath }: TabContext) {
|
||||||
const sortedNotePaths = useSortedNotePaths(note, hoistedNoteId);
|
const sortedNotePaths = useSortedNotePaths(note, hoistedNoteId);
|
||||||
@ -35,9 +36,9 @@ export function NotePathsWidget({ sortedNotePaths, currentNotePath }: {
|
|||||||
)) : undefined}
|
)) : undefined}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<Button
|
<LinkButton
|
||||||
triggerCommand="cloneNoteIdsTo"
|
|
||||||
text={t("note_paths.clone_button")}
|
text={t("note_paths.clone_button")}
|
||||||
|
triggerCommand="cloneNoteIdsTo"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user