mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
feat(react/ribbon): port edited notes
This commit is contained in:
21
apps/client/src/widgets/react/NoteLink.tsx
Normal file
21
apps/client/src/widgets/react/NoteLink.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { useEffect, useMemo, useState } from "preact/hooks";
|
||||
import link from "../../services/link";
|
||||
import RawHtml from "./RawHtml";
|
||||
|
||||
interface NoteLinkOpts {
|
||||
notePath: string | string[];
|
||||
showNotePath?: boolean;
|
||||
}
|
||||
|
||||
export default function NoteLink({ notePath, showNotePath }: NoteLinkOpts) {
|
||||
const stringifiedNotePath = Array.isArray(notePath) ? notePath.join("/") : notePath;
|
||||
const [ jqueryEl, setJqueryEl ] = useState<JQuery<HTMLElement>>();
|
||||
|
||||
useEffect(() => {
|
||||
link.createLink(stringifiedNotePath, { showNotePath: true })
|
||||
.then(setJqueryEl);
|
||||
}, [ stringifiedNotePath, showNotePath ])
|
||||
|
||||
return <RawHtml html={jqueryEl} />
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user