feat: close change editor menu once editor is selected (#907)
This commit is contained in:
@@ -130,6 +130,9 @@ export const ChangeEditorButton: FunctionComponent<Props> = observer(
|
|||||||
setSelectedEditor={setCurrentEditor}
|
setSelectedEditor={setCurrentEditor}
|
||||||
note={note}
|
note={note}
|
||||||
groups={editorMenuGroups}
|
groups={editorMenuGroups}
|
||||||
|
closeMenu={() => {
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</DisclosurePanel>
|
</DisclosurePanel>
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ export const ChangeEditorOption: FunctionComponent<ChangeEditorOptionProps> = ({
|
|||||||
note={note}
|
note={note}
|
||||||
groups={editorMenuGroups}
|
groups={editorMenuGroups}
|
||||||
isOpen={changeEditorMenuVisible}
|
isOpen={changeEditorMenuVisible}
|
||||||
|
closeMenu={() => {
|
||||||
|
setChangeEditorMenuOpen(false);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</DisclosurePanel>
|
</DisclosurePanel>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { PLAIN_EDITOR_NAME } from './createEditorMenuGroups';
|
|||||||
type ChangeEditorMenuProps = {
|
type ChangeEditorMenuProps = {
|
||||||
application: WebApplication;
|
application: WebApplication;
|
||||||
closeOnBlur: (event: { relatedTarget: EventTarget | null }) => void;
|
closeOnBlur: (event: { relatedTarget: EventTarget | null }) => void;
|
||||||
|
closeMenu: () => void;
|
||||||
groups: EditorMenuGroup[];
|
groups: EditorMenuGroup[];
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
currentEditor: SNComponent | undefined;
|
currentEditor: SNComponent | undefined;
|
||||||
@@ -39,6 +40,7 @@ const getGroupId = (group: EditorMenuGroup) =>
|
|||||||
export const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
export const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
||||||
application,
|
application,
|
||||||
closeOnBlur,
|
closeOnBlur,
|
||||||
|
closeMenu,
|
||||||
groups,
|
groups,
|
||||||
isOpen,
|
isOpen,
|
||||||
currentEditor,
|
currentEditor,
|
||||||
@@ -169,6 +171,8 @@ export const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
|||||||
if (shouldSelectEditor) {
|
if (shouldSelectEditor) {
|
||||||
selectComponent(itemToBeSelected.component ?? null, note);
|
selectComponent(itemToBeSelected.component ?? null, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user