feat: close change editor menu once editor is selected (#907)

This commit is contained in:
Aman Harwara
2022-03-04 18:14:25 +05:30
committed by GitHub
parent d8caa31dc9
commit c150cd6867
3 changed files with 10 additions and 0 deletions

View File

@@ -148,6 +148,9 @@ export const ChangeEditorOption: FunctionComponent<ChangeEditorOptionProps> = ({
note={note}
groups={editorMenuGroups}
isOpen={changeEditorMenuVisible}
closeMenu={() => {
setChangeEditorMenuOpen(false);
}}
/>
)}
</DisclosurePanel>

View File

@@ -26,6 +26,7 @@ import { PLAIN_EDITOR_NAME } from './createEditorMenuGroups';
type ChangeEditorMenuProps = {
application: WebApplication;
closeOnBlur: (event: { relatedTarget: EventTarget | null }) => void;
closeMenu: () => void;
groups: EditorMenuGroup[];
isOpen: boolean;
currentEditor: SNComponent | undefined;
@@ -39,6 +40,7 @@ const getGroupId = (group: EditorMenuGroup) =>
export const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
application,
closeOnBlur,
closeMenu,
groups,
isOpen,
currentEditor,
@@ -169,6 +171,8 @@ export const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
if (shouldSelectEditor) {
selectComponent(itemToBeSelected.component ?? null, note);
}
closeMenu();
};
return (