mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 07:09:54 +01:00
chore(react/launch_bar): port custom widget
This commit is contained in:
@@ -370,6 +370,16 @@ export function useNoteRelation(note: FNote | undefined | null, relationName: Re
|
||||
] as const;
|
||||
}
|
||||
|
||||
export function useNoteRelationTarget(note: FNote, relationName: RelationNames) {
|
||||
const [ targetNote, setTargetNote ] = useState<FNote | null>();
|
||||
|
||||
useEffect(() => {
|
||||
note.getRelationTarget(relationName).then(setTargetNote);
|
||||
}, [ note ]);
|
||||
|
||||
return [ targetNote ] as const;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows a React component to read or write a note's label while also reacting to changes in value.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user