fix: change editor button icon & selection
This commit is contained in:
@@ -26,7 +26,9 @@ const ChangeEditorButton: FunctionComponent<Props> = ({
|
||||
const [selectedEditor, setSelectedEditor] = useState(() => {
|
||||
return note ? application.componentManager.editorForNote(note) : undefined
|
||||
})
|
||||
const [selectedEditorIcon, selectedEditorIconTint] = getIconAndTintForNoteType(selectedEditor?.package_info.note_type)
|
||||
const [selectedEditorIcon, selectedEditorIconTint] = getIconAndTintForNoteType(
|
||||
note?.noteType || selectedEditor?.package_info.note_type,
|
||||
)
|
||||
const [isClickOutsideDisabled, setIsClickOutsideDisabled] = useState(false)
|
||||
|
||||
const toggleMenu = useCallback(async () => {
|
||||
|
||||
@@ -59,7 +59,11 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
||||
return item.component?.identifier === currentComponent.identifier
|
||||
}
|
||||
|
||||
return item.noteType === note?.noteType || (!note?.noteType && item.noteType === NoteType.Plain)
|
||||
const itemNoteTypeIsSameAsCurrentNoteType = item.noteType === note?.noteType
|
||||
const noteDoesntHaveTypeAndItemIsPlain = !note?.noteType && item.noteType === NoteType.Plain
|
||||
const unknownNoteTypeAndItemIsPlain = note?.noteType === NoteType.Unknown && item.noteType === NoteType.Plain
|
||||
|
||||
return itemNoteTypeIsSameAsCurrentNoteType || noteDoesntHaveTypeAndItemIsPlain || unknownNoteTypeAndItemIsPlain
|
||||
},
|
||||
[currentComponent, note],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user