레거시 본문 저장 형식 정규화
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<script setup>
|
||||
import { normalizeMarkdownContent } from '../../lib/markdown-content-normalizer.js'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
type: [String, Array, Object],
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
@@ -30,7 +32,7 @@ const imageWidthOptions = [
|
||||
]
|
||||
|
||||
const markdownValue = computed({
|
||||
get: () => props.modelValue || '',
|
||||
get: () => normalizeMarkdownContent(props.modelValue),
|
||||
set: (value) => emit('update:modelValue', value)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script setup>
|
||||
import { normalizeMarkdownContent } from '../../lib/markdown-content-normalizer.js'
|
||||
|
||||
const props = defineProps({
|
||||
initialPost: {
|
||||
type: Object,
|
||||
@@ -101,7 +103,7 @@ const form = reactive({
|
||||
title: props.initialPost.title || '',
|
||||
slug: props.initialPost.slug || '',
|
||||
excerpt: props.initialPost.excerpt || '',
|
||||
content: props.initialPost.content || '',
|
||||
content: normalizeMarkdownContent(props.initialPost.content),
|
||||
featuredImage: props.initialPost.featuredImage || '',
|
||||
noindex: Boolean(props.initialPost.noindex),
|
||||
status: props.initialPost.status || 'draft',
|
||||
@@ -297,7 +299,7 @@ const createPostPayload = () => {
|
||||
title: form.title.trim(),
|
||||
slug: toSlug(form.slug || form.title),
|
||||
excerpt: form.excerpt.trim(),
|
||||
content: form.content,
|
||||
content: normalizeMarkdownContent(form.content),
|
||||
featuredImage: form.featuredImage.trim() || null,
|
||||
seoTitle: form.title.trim(),
|
||||
seoDescription: form.excerpt.trim(),
|
||||
@@ -326,7 +328,7 @@ const createAutosavePayload = () => ({
|
||||
title: form.title,
|
||||
slug: form.slug,
|
||||
excerpt: form.excerpt,
|
||||
content: form.content,
|
||||
content: normalizeMarkdownContent(form.content),
|
||||
featuredImage: form.featuredImage,
|
||||
noindex: form.noindex,
|
||||
status: form.status,
|
||||
@@ -407,7 +409,10 @@ const restoreAutosave = () => {
|
||||
}
|
||||
|
||||
isRestoringAutosave.value = true
|
||||
Object.assign(form, autosaveNotice.value.payload)
|
||||
Object.assign(form, {
|
||||
...autosaveNotice.value.payload,
|
||||
content: normalizeMarkdownContent(autosaveNotice.value.payload.content)
|
||||
})
|
||||
slugTouched.value = Boolean(form.slug)
|
||||
autosaveStatus.value = `${formatAutosaveTime(autosaveNotice.value.savedAt)} 자동 저장본 복원됨`
|
||||
autosaveNotice.value = null
|
||||
|
||||
Reference in New Issue
Block a user