From 130cc8e40490b8d0be4d5f82c9c77373975d9a29 Mon Sep 17 00:00:00 2001 From: Yone Date: Wed, 20 Dec 2023 09:43:49 +0800 Subject: [PATCH] fix: Error when pasting images in the user interface --- console/uc-src/modules/contents/posts/PostEditor.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/console/uc-src/modules/contents/posts/PostEditor.vue b/console/uc-src/modules/contents/posts/PostEditor.vue index 81765e96fd..cd23c6a55f 100644 --- a/console/uc-src/modules/contents/posts/PostEditor.vue +++ b/console/uc-src/modules/contents/posts/PostEditor.vue @@ -338,6 +338,15 @@ async function handleUploadImage(file: File) { if (!currentUserHasPermission(["uc:attachments:manage"])) { return; } + + // Set default title and slug + if (!formState.value.post.spec.title) { + formState.value.post.spec.title = t("core.post_editor.untitled"); + } + if (!formState.value.post.spec.slug) { + formState.value.post.spec.slug = new Date().getTime().toString(); + } + if (!isUpdateMode.value) { formState.value.metadata.annotations = { ...formState.value.metadata.annotations,