mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 16:14:23 +01:00
client/note color picker menu item: fix current selection
This commit is contained in:
parent
870fef3ea6
commit
87afc64f16
@ -17,13 +17,11 @@ export default function ColorPickerMenuItem(props: ColorPickerMenuItemProps) {
|
|||||||
const [note, setNote] = useState<FNote | null>(null);
|
const [note, setNote] = useState<FNote | null>(null);
|
||||||
const [currentColor, setCurrentColor] = useState<string | null>(null);
|
const [currentColor, setCurrentColor] = useState<string | null>(null);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const retrieveNote = async (noteId: string) => {
|
const retrieveNote = async (noteId: string) => {
|
||||||
const result = await froca.getNote(noteId, true);
|
const result = await froca.getNote(noteId, true);
|
||||||
if (result) {
|
if (result) {
|
||||||
setNote(result);
|
setNote(result);
|
||||||
setCurrentColor(result.getLabel("color")?.value ?? "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +32,10 @@ export default function ColorPickerMenuItem(props: ColorPickerMenuItemProps) {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCurrentColor(note?.getLabel("color")?.value ?? "");
|
||||||
|
}, [note]);
|
||||||
|
|
||||||
const onColorCellClicked = (color: string) => {
|
const onColorCellClicked = (color: string) => {
|
||||||
if (note) {
|
if (note) {
|
||||||
attributes.setLabel(note.noteId, "color", color);
|
attributes.setLabel(note.noteId, "color", color);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user