Files
Aslam 711fe35e1a feat: feedback (#156)
* minimal tiptap

* wip

* img edit block

* wip

* fix
2024-09-10 13:58:58 +03:00

16 lines
346 B
TypeScript

import * as React from 'react'
export const useImageLoad = (src: string) => {
const [imgSize, setImgSize] = React.useState({ width: 0, height: 0 })
React.useEffect(() => {
const img = new Image()
img.src = src
img.onload = () => {
setImgSize({ width: img.width, height: img.height })
}
}, [src])
return imgSize
}