New post editor basis

This commit is contained in:
2024-03-02 21:40:09 +08:00
parent 3ae72cd9e0
commit e0bb05bee8
9 changed files with 105 additions and 7 deletions

View File

@ -13,7 +13,7 @@
<div>
<div class="font-bold">{{ props.item?.author.nick }}</div>
{{ props.item?.content }}
<div class="prose prose-post" v-html="parseContent(props.item.content)"></div>
</div>
</div>
</template>
@ -21,11 +21,24 @@
</template>
<script setup lang="ts">
import dompurify from "dompurify";
import { parse } from "marked";
const props = defineProps<{ item: any }>();
function parseContent(src: string): string {
return dompurify().sanitize(parse(src) as string);
}
</script>
<style scoped>
.rounded-card {
border-radius: 8px;
}
</style>
<style>
.prose.prose-post, p {
margin: 0 !important;
}
</style>

View File

@ -5,7 +5,7 @@
</div>
<v-infinite-scroll :items="props.posts" :onLoad="props.loader">
<template v-for="(item, index) in props.posts" :key="item">
<template v-for="item in props.posts" :key="item">
<div class="mb-3 px-1">
<post-item :item="item" />
</div>