mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 06:45:49 +01:00
chore(react/note_icon): reintroduce read-only
This commit is contained in:
@@ -27,12 +27,6 @@ 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">) {
|
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
|
||||||
if (this.noteId && loadResults.isNoteReloaded(this.noteId)) {
|
if (this.noteId && loadResults.isNoteReloaded(this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ let fullIconData: {
|
|||||||
let iconToCountCache!: Promise<IconToCountCache> | null;
|
let iconToCountCache!: Promise<IconToCountCache> | null;
|
||||||
|
|
||||||
export default function NoteIcon() {
|
export default function NoteIcon() {
|
||||||
const { note } = useNoteContext();
|
const { note, viewScope } = useNoteContext();
|
||||||
const [ icon, setIcon ] = useState("bx bx-empty");
|
const [ icon, setIcon ] = useState("bx bx-empty");
|
||||||
|
|
||||||
const refreshIcon = useCallback(() => {
|
const refreshIcon = useCallback(() => {
|
||||||
@@ -43,6 +43,7 @@ export default function NoteIcon() {
|
|||||||
dropdownContainerStyle={{ width: "610px" }}
|
dropdownContainerStyle={{ width: "610px" }}
|
||||||
buttonClassName={`note-icon ${icon}`}
|
buttonClassName={`note-icon ${icon}`}
|
||||||
hideToggleArrow
|
hideToggleArrow
|
||||||
|
disabled={viewScope?.viewMode !== "default"}
|
||||||
>
|
>
|
||||||
<NoteIconList />
|
<NoteIconList />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ interface DropdownProps {
|
|||||||
title?: string;
|
title?: string;
|
||||||
dropdownContainerStyle?: CSSProperties;
|
dropdownContainerStyle?: CSSProperties;
|
||||||
hideToggleArrow?: boolean;
|
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<HTMLDivElement | null>(null);
|
const dropdownRef = useRef<HTMLDivElement | null>(null);
|
||||||
const triggerRef = useRef<HTMLButtonElement | null>(null);
|
const triggerRef = useRef<HTMLButtonElement | null>(null);
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ export default function Dropdown({ className, buttonClassName, isStatic, childre
|
|||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
title={title}
|
title={title}
|
||||||
id={ariaId}
|
id={ariaId}
|
||||||
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user