👔 Disabled preserve empty lines on the article posts

This commit is contained in:
2025-11-08 12:28:13 +08:00
parent 063faf4b8e
commit 749823aefa
3 changed files with 43 additions and 24 deletions

View File

@@ -139,7 +139,7 @@
</template>
<script setup lang="ts">
import { computed } from "vue"
import { computed, ref } from "vue" // Added ref
import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
import type { SnPost } from "~/types/api"
@@ -147,10 +147,14 @@ const route = useRoute()
const slugParts = route.params.slug as string[]
const id = slugParts.join("/")
const { render } = useMarkdownProcessor()
const apiServer = useSolarNetwork()
const preserveEmptyLinesRef = ref(true) // New ref for the option
const { render } = useMarkdownProcessor({
preserveEmptyLines: preserveEmptyLinesRef
})
const {
data: postData,
error,
@@ -159,6 +163,10 @@ const {
try {
const resp = await apiServer(`/sphere/posts/${id}`)
const post = resp as SnPost
// Update the ref based on post.type
preserveEmptyLinesRef.value = post.type !== 1
let html = ""
if (post.content) {
html = render(post.content)