게시판 수정
This commit is contained in:
parent
3681ed9031
commit
c97996f85d
@ -25,7 +25,7 @@
|
||||
</span>
|
||||
</h5>
|
||||
<!-- 본문 -->
|
||||
<p class="card-text str_wrap">{{ content }}</p>
|
||||
<div class="card-text str_wrap" v-html="$common.contentToHtml(content)"></div>
|
||||
<!-- 날짜 -->
|
||||
<div class="d-flex justify-content-between">
|
||||
<small class="text-muted">{{ formattedDate }}</small>
|
||||
|
||||
@ -11,7 +11,9 @@
|
||||
<div class="card-body">
|
||||
<h5 class="mb-4">{{ boardTitle }}</h5>
|
||||
<!-- HTML 콘텐츠 렌더링 -->
|
||||
<div class="board-content text-body" style="line-height: 1.6;" v-html="convertedContent"></div>
|
||||
<div class="board-content text-body" style="line-height: 1.6;" v-html="$common.contentToHtml(boardContent)">
|
||||
|
||||
</div>
|
||||
<!-- 첨부파일 목록 -->
|
||||
<ul v-if="attachments.length" class="attachments mt-4 list-unstyled">
|
||||
<li v-for="(attachment, index) in attachments" :key="index" class="mb-2">
|
||||
@ -40,7 +42,6 @@ import { ref, onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import axios from '@api';
|
||||
import Quill from 'quill';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
// 게시물 데이터 상태
|
||||
const profileName = ref('익명 사용자');
|
||||
@ -72,20 +73,6 @@ const fetchBoardDetails = async () => {
|
||||
boardTitle.value = boardDetail.title || '제목 없음';
|
||||
boardContent.value = boardDetail.content || '';
|
||||
|
||||
// Quill을 사용하여 Delta 데이터를 HTML로 변환
|
||||
if (boardContent.value) {
|
||||
try {
|
||||
const quillContainer = document.createElement('div');
|
||||
const quillInstance = new Quill(quillContainer);
|
||||
quillInstance.setContents(JSON.parse(boardContent.value));
|
||||
convertedContent.value = DOMPurify.sanitize(quillContainer.innerHTML);
|
||||
} catch (parseError) {
|
||||
console.error('Delta 데이터 변환 오류:', parseError);
|
||||
convertedContent.value = '내용을 표시할 수 없습니다.';
|
||||
}
|
||||
} else {
|
||||
convertedContent.value = '내용 없음';
|
||||
}
|
||||
|
||||
attachments.value = data.attachments || [];
|
||||
comments.value = data.comments || [];
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
import QEditor from '@c/editor/QEditor.vue';
|
||||
import FormInput from '@c/input/FormInput.vue';
|
||||
import FormFile from '@c/input/FormFile.vue';
|
||||
import { ref } from 'vue';
|
||||
import { getCurrentInstance, ref } from 'vue';
|
||||
import router from '@/router';
|
||||
import axios from '@api';
|
||||
|
||||
@ -100,6 +100,9 @@ const passwordAlert = ref(false);
|
||||
const contentAlert = ref(false);
|
||||
const attachFilesAlert = ref(false);
|
||||
|
||||
const { appContext } = getCurrentInstance();
|
||||
const $common = appContext.config.globalProperties.$common; // $common에 접근
|
||||
|
||||
const goList = () => {
|
||||
router.push('/board');
|
||||
};
|
||||
@ -116,7 +119,7 @@ const write = async () => {
|
||||
try {
|
||||
const boardData = {
|
||||
LOCBRDTTL: title.value,
|
||||
LOCBRDCON: content.value,
|
||||
LOCBRDCON: $common.deltaAsJson(content.value),
|
||||
LOCBRDPWD: category.value === 1 ? password.value : null,
|
||||
LOCBRDTYP: category.value === 1 ? 'S' : 'F',
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user