diff --git a/apps/client/src/widgets/note_icon.ts.bak b/apps/client/src/widgets/note_icon.ts.bak index 0fd2b7c1f..785d1e4b5 100644 --- a/apps/client/src/widgets/note_icon.ts.bak +++ b/apps/client/src/widgets/note_icon.ts.bak @@ -26,13 +26,7 @@ export default class NoteIconWidget extends NoteContextAwareWidget { } }); } - - async refreshWithNote(note: FNote) { - this.$icon.removeClass().addClass(`${note.getIcon()} note-icon`); - this.$icon.prop("disabled", !!(this.noteContext?.viewScope?.viewMode !== "default")); - this.dropdown.hide(); - } - + async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { if (this.noteId && loadResults.isNoteReloaded(this.noteId)) { this.refresh(); diff --git a/apps/client/src/widgets/note_icon.tsx b/apps/client/src/widgets/note_icon.tsx index dc133be47..7a605c4b8 100644 --- a/apps/client/src/widgets/note_icon.tsx +++ b/apps/client/src/widgets/note_icon.tsx @@ -25,7 +25,7 @@ let fullIconData: { let iconToCountCache!: Promise | null; export default function NoteIcon() { - const { note } = useNoteContext(); + const { note, viewScope } = useNoteContext(); const [ icon, setIcon ] = useState("bx bx-empty"); const refreshIcon = useCallback(() => { @@ -43,6 +43,7 @@ export default function NoteIcon() { dropdownContainerStyle={{ width: "610px" }} buttonClassName={`note-icon ${icon}`} hideToggleArrow + disabled={viewScope?.viewMode !== "default"} > diff --git a/apps/client/src/widgets/react/Dropdown.tsx b/apps/client/src/widgets/react/Dropdown.tsx index 7fd39c141..4de382f3b 100644 --- a/apps/client/src/widgets/react/Dropdown.tsx +++ b/apps/client/src/widgets/react/Dropdown.tsx @@ -12,9 +12,10 @@ interface DropdownProps { title?: string; dropdownContainerStyle?: CSSProperties; hideToggleArrow?: boolean; + disabled?: boolean; } -export default function Dropdown({ className, buttonClassName, isStatic, children, title, dropdownContainerStyle, hideToggleArrow }: DropdownProps) { +export default function Dropdown({ className, buttonClassName, isStatic, children, title, dropdownContainerStyle, hideToggleArrow, disabled }: DropdownProps) { const dropdownRef = useRef(null); const triggerRef = useRef(null); @@ -63,6 +64,7 @@ export default function Dropdown({ className, buttonClassName, isStatic, childre aria-expanded="false" title={title} id={ariaId} + disabled={disabled} />