优化github action 逻辑
This commit is contained in:
1 parent
f91be983d4
commit
2c6bd1c964
12 files changed
+118
-775
No files matched your search
@@ -28,7 +28,6 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps)
|
||||
categories: initialData?.frontMatter.categories?.join("、") || "",
|
||||
tags: initialData?.frontMatter.tags?.join("、") || "",
|
||||
author: initialData?.frontMatter.author || "小赵",
|
||||
ai_comment: initialData?.frontMatter.ai_comment || "",
|
||||
});
|
||||
const [content, setContent] = useState(initialData?.content || "");
|
||||
const [uploading, setUploading] = useState(false);
|
||||
@@ -61,7 +60,7 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps)
|
||||
if (!form.title && !content) return;
|
||||
try {
|
||||
localStorage.setItem(cacheKey, JSON.stringify({
|
||||
form: { title: form.title, slug: form.slug, date: form.date, categories: form.categories, tags: form.tags, author: form.author, ai_comment: form.ai_comment },
|
||||
form: { title: form.title, slug: form.slug, date: form.date, categories: form.categories, tags: form.tags, author: form.author },
|
||||
content,
|
||||
dirPath,
|
||||
savedAt: Date.now(),
|
||||
@@ -174,7 +173,6 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps)
|
||||
author: form.author,
|
||||
layout: "post",
|
||||
};
|
||||
if (form.ai_comment) frontMatter.ai_comment = form.ai_comment;
|
||||
|
||||
const url = isEditing ? `/api/posts/${initialData!.frontMatter.slug}` : "/api/posts";
|
||||
const method = isEditing ? "PUT" : "POST";
|
||||
@@ -257,7 +255,6 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps)
|
||||
|
||||
const handleApplyMeta = (data: { summary?: string; tags?: string }) => {
|
||||
if (data.tags) setForm((f) => ({ ...f, tags: data.tags || "" }));
|
||||
if (data.summary) setForm((f) => ({ ...f, ai_comment: data.summary || "" }));
|
||||
};
|
||||
|
||||
const inputCls =
|
||||
@@ -332,10 +329,6 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps)
|
||||
<label className="block text-[12px] font-medium text-text/70 mb-1.5">标签</label>
|
||||
<input type="text" value={form.tags} onChange={(e) => setForm({ ...form, tags: e.target.value })} className={inputCls} placeholder="用顿号分隔" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<label className="block text-[12px] font-medium text-text/70 mb-1.5">AI 评论</label>
|
||||
<input type="text" value={form.ai_comment} onChange={(e) => setForm({ ...form, ai_comment: e.target.value })} className={inputCls} placeholder="可选" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Folder name preview */}
|
||||
|
||||
Reference in new issue
Block a user