resolve conversation

This commit is contained in:
ilya-bkv 2023-05-09 14:25:40 +03:00
parent 28e0e4e33a
commit 21f84f2292
3 changed files with 7 additions and 10 deletions

View File

@ -110,7 +110,7 @@ export const EditorFloatingMenu = (props: FloatingMenuProps) => {
</div>
<Modal variant="narrow" name="uploadImage" onClose={closeUploadModalHandler}>
<UploadModalContent
closeCallback={(value) => {
onClose={(value) => {
renderImage(value)
setSelectedMenuItem()
}}

View File

@ -8,13 +8,11 @@ import { hideModal } from '../../../stores/ui'
import { createDropzone, createFileUploader, UploadFile } from '@solid-primitives/upload'
import { handleFileUpload } from '../../../utils/handleFileUpload'
import { useLocalize } from '../../../context/localize'
import { Editor } from '@tiptap/core'
import { Loading } from '../../_shared/Loading'
import { verifyImg } from '../../../utils/verifyImg'
import { imageProxy } from '../../../utils/imageProxy'
type Props = {
closeCallback: (imgUrl?: string) => void
onClose: (imgUrl?: string) => void
}
export const UploadModalContent = (props: Props) => {
@ -30,7 +28,7 @@ export const UploadModalContent = (props: Props) => {
setIsUploading(true)
const fileUrl = await handleFileUpload(file)
setIsUploading(false)
props.closeCallback(fileUrl)
props.onClose(fileUrl)
} catch (error) {
setIsUploading(false)
setUploadError(t('Error'))
@ -113,9 +111,9 @@ export const UploadModalContent = (props: Props) => {
showInput={true}
onClose={() => {
hideModal()
props.closeCallback()
props.onClose()
}}
// validate={(value) => verifyImg(value)}
validate={(value) => verifyImg(value)}
onSubmit={handleImageFormSubmit}
errorMessage={t('Invalid image link')}
/>

View File

@ -90,9 +90,8 @@ export const EditView = (props: EditViewProps) => {
setForm('slug', slug)
}
const handleSetCover = (imgUrl: string) => {
const handleUploadModalContentCloseSetCover = (imgUrl: string) => {
hideModal()
console.log('!!! imgUrl:', imgUrl)
setCoverImage(imgUrl)
setForm('coverImageUrl', imgUrl)
}
@ -253,7 +252,7 @@ export const EditView = (props: EditViewProps) => {
</form>
</div>
<Modal variant="narrow" name="uploadImage">
<UploadModalContent closeCallback={(value) => handleSetCover(value)} />
<UploadModalContent onClose={(value) => handleUploadModalContentCloseSetCover(value)} />
</Modal>
<Panel shoutSlug={props.shout.slug} />
</>