mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 17:26:38 +01:00
refactor(react/collections/table): use class-based API
This commit is contained in:
@@ -324,6 +324,11 @@ export function useNoteLabel(note: FNote | undefined | null, labelName: string):
|
||||
] as const;
|
||||
}
|
||||
|
||||
export function useNoteLabelWithDefault(note: FNote | undefined | null, labelName: string, defaultValue: string): [string, (newValue: string | null | undefined) => void] {
|
||||
const [ labelValue, setLabelValue ] = useNoteLabel(note, labelName);
|
||||
return [ labelValue ?? defaultValue, setLabelValue];
|
||||
}
|
||||
|
||||
export function useNoteLabelBoolean(note: FNote | undefined | null, labelName: string): [ boolean, (newValue: boolean) => void] {
|
||||
const [ labelValue, setLabelValue ] = useState<boolean>(!!note?.hasLabel(labelName));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user