diff --git a/pkg/views/src/components/publish/ArticleEditor.vue b/pkg/views/src/components/publish/ArticleEditor.vue index 5fc876c..31cb352 100644 --- a/pkg/views/src/components/publish/ArticleEditor.vue +++ b/pkg/views/src/components/publish/ArticleEditor.vue @@ -25,37 +25,18 @@ You are editing a post with alias {{ editor.related.edit_to?.alias }} - + @@ -66,7 +47,8 @@

Your content will visible for public at

- {{ data.published_at ? new Date(data.published_at).toLocaleString() : new Date().toLocaleString() }} + {{ data.published_at ? new Date(data.published_at).toLocaleString() : new Date().toLocaleString() + }}

@@ -149,7 +131,7 @@ const data = ref({ }) const currentRealm = computed(() => { - if(data.value.realm_id) { + if (data.value.realm_id) { return realms.available.find((e: any) => e.id === data.value.realm_id) } else { return null @@ -187,16 +169,29 @@ async function postArticle(evt: SubmitEvent) { }) if (res.status === 200) { const data = await res.json() - form.reset() - router.push({ name: "posts.details.articles", params: { alias: data.alias } }) success.value = true editor.show.article = false + + resetEditor(form) + router.push({ name: "posts.details.articles", params: { alias: data.alias } }) } else { error.value = await res.text() } loading.value = false } +function resetEditor(target: HTMLFormElement) { + target.reset() + data.value = { + title: "", + content: "", + description: "", + realm_id: null, + published_at: null, + attachments: [] + } +} + const media = ref(null) function pasteMedia(evt: ClipboardEvent) { diff --git a/pkg/views/src/components/publish/MomentEditor.vue b/pkg/views/src/components/publish/MomentEditor.vue index 9ac21bf..a48f523 100644 --- a/pkg/views/src/components/publish/MomentEditor.vue +++ b/pkg/views/src/components/publish/MomentEditor.vue @@ -6,40 +6,20 @@ You are editing a post with alias {{ editor.related.edit_to?.alias }} - +