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

View File

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