|
|
|
@@ -3,7 +3,6 @@ import { useEffect, useMemo, useState } from 'react'
|
|
|
|
|
import { useLocale } from '@/lib/useLocale'
|
|
|
|
|
import PostOriginalCreatedTimeField from '@/components/PostOriginalCreatedTimeField'
|
|
|
|
|
import FieldError from '@/components/common/FieldError'
|
|
|
|
|
import FieldWarning from '@/components/common/FieldWarning'
|
|
|
|
|
import PostDurationField from '@/components/posts/PostDurationField'
|
|
|
|
|
import PostTagsField from '@/components/posts/PostTagsField'
|
|
|
|
|
import PostTextField from '@/components/posts/PostTextField'
|
|
|
|
@@ -154,6 +153,23 @@ const PostEditForm: FC<Props> = ({ post, onSave }) => {
|
|
|
|
|
setDisabled (true)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
const titleMissing = !title?.trim ()
|
|
|
|
|
const thumbnailMissing =
|
|
|
|
|
!(post.thumbnail?.trim () || post.thumbnailBase?.trim ())
|
|
|
|
|
|
|
|
|
|
if ((titleMissing || thumbnailMissing)
|
|
|
|
|
&& !(await dialogue.confirm ({
|
|
|
|
|
title: titleMissing
|
|
|
|
|
? label ('edit.titleMissingConfirmation')
|
|
|
|
|
: label ('shared:labels.thumbnailMissing'),
|
|
|
|
|
description: (titleMissing && thumbnailMissing)
|
|
|
|
|
? label ('shared:labels.thumbnailMissing')
|
|
|
|
|
: undefined,
|
|
|
|
|
confirmText: label ('shared:actions.update'),
|
|
|
|
|
cancelText: label ('shared:actions.cancel'),
|
|
|
|
|
closeLabel: label ('settings:actions.close') })))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
await update ({ id: post.id, title, tags, parentPostIds,
|
|
|
|
|
duration: videoFlg ? duration : null,
|
|
|
|
|
originalCreatedFrom, originalCreatedBefore },
|
|
|
|
@@ -173,9 +189,6 @@ const PostEditForm: FC<Props> = ({ post, onSave }) => {
|
|
|
|
|
return (
|
|
|
|
|
<form onSubmit={handleSubmit} className="max-w-xl pt-2 space-y-4">
|
|
|
|
|
<FieldError messages={baseErrors}/>
|
|
|
|
|
{!(post.thumbnail?.trim () || post.thumbnailBase?.trim ()) && (
|
|
|
|
|
<FieldWarning
|
|
|
|
|
messages={[label ('shared:labels.thumbnailMissing')]}/>)}
|
|
|
|
|
|
|
|
|
|
<PostTextField
|
|
|
|
|
label={label ('shared:labels.title')}
|
|
|
|
|