このコミットが含まれているのは:
2026-07-14 19:37:04 +09:00
コミット f9463f383f
11個のファイルの変更202行の追加92行の削除
+12 -7
ファイルの表示
@@ -24,7 +24,8 @@ import type { User } from '@/types'
type Props = { user: User | null }
type PostFormField = 'url'
type PostFormField =
'url'
| 'title'
| 'tags'
| 'parentPostIds'
@@ -54,9 +55,11 @@ const PostNewPage: FC<Props> = ({ user }) => {
const [url, setURL] = useState ('')
const thumbnailPreviewRef = useRef ('')
const videoFlg = useMemo (() =>
tags.split (/\s+/).some (
tag => tag.replace (/\[.*\]$/, '') === '動画'), [tags])
const videoFlg =
useMemo (() =>
tags.split (/\s+/).some (
tag => tag.replace (/\[.*\]$/, '') === '動画'),
[tags])
const handleSubmit = async () => {
clearValidationErrors ()
@@ -109,11 +112,13 @@ const PostNewPage: FC<Props> = ({ user }) => {
URL.revokeObjectURL (thumbnailPreviewRef.current)
try
{
const data = await apiGet<Blob> ('/preview/thumbnail', { params: { url },
responseType: 'blob' })
const data = await apiGet<Blob> ('/preview/thumbnail',
{ params: { url },
responseType: 'blob' })
const imageURL = URL.createObjectURL (data)
setThumbnailPreview (imageURL)
setThumbnailFile (new File ([data], 'thumbnail.png',
setThumbnailFile (new File ([data],
'thumbnail.png',
{ type: data.type || 'image/png' }))
}
finally