fix closr upload modal event

This commit is contained in:
ilya-bkv 2023-05-04 07:57:42 +03:00
parent 0de5cf76f2
commit 62f6c26c49
2 changed files with 4 additions and 9 deletions

View File

@ -52,14 +52,7 @@ export const EditorFloatingMenu = (props: FloatingMenuProps) => {
return (
<>
<div ref={props.ref} class={styles.editorFloatingMenu}>
<button
type="button"
onClick={() => {
console.log('!!! selectedMenuItem:', selectedMenuItem())
setMenuOpen(!menuOpen())
}}
>
<button type="button" onClick={() => setMenuOpen(!menuOpen())}>
<Icon name="editor-plus" />
</button>
<Show when={menuOpen()}>
@ -82,7 +75,7 @@ export const EditorFloatingMenu = (props: FloatingMenuProps) => {
</Show>
</div>
<Modal variant="narrow" name="uploadImage" onClose={closeUploadModalHandler}>
<UploadModalContent editor={props.editor} />
<UploadModalContent closeCallback={() => setSelectedMenuItem(null)} editor={props.editor} />
</Modal>
</>
)

View File

@ -14,6 +14,7 @@ import { verifyImg } from '../../../utils/verifyImg'
type Props = {
editor: Editor
closeCallback: () => void
}
export const UploadModalContent = (props: Props) => {
@ -103,6 +104,7 @@ export const UploadModalContent = (props: Props) => {
showInput={true}
onClose={() => {
hideModal()
props.closeCallback()
}}
validate={(value) => verifyImg(value)}
onSubmit={handleImageFormSubmit}