2
2
import { inject , onMounted , type PropType , ref , watch } from ' vue'
3
3
import { bgLight , btnSecondary } from ' @/utils/cssMixins.ts'
4
4
import type { FileInfo } from ' @/store/types/work_github.ts'
5
- import { humanizeFileSize } from ' @/utils/baseMixins.ts'
5
+ import { cutString , humanizeFileSize } from ' @/utils/baseMixins.ts'
6
+ import sanitizeHtml from ' sanitize-html'
6
7
import hljs from ' highlight.js'
7
8
8
9
const props = defineProps ({
65
66
<CRow class =" py-2" >
66
67
<CCol >
67
68
<h5 >
68
- <router-link to =" " >Git 저장소</router-link >
69
+ <router-link to =" " @click = " emit('file-view-close') " >Git 저장소</router-link >
69
70
/ {{ fileData?.name }}
70
71
</h5 >
71
72
</CCol >
@@ -84,14 +85,16 @@ watch(
84
85
<div class =" file-viewer" >
85
86
<table :class =" bgLight" style =" width : 100% " >
86
87
<tr >
87
- <td class =" py-2 px-5 strong" style =" width : 500 px " >{{ fileData.path }}</td >
88
- <td class =" px-5" style =" width : 150px " >SHA: {{ fileData.sha }}</td >
88
+ <td class =" py-2 px-5 strong" style =" width : 400 px " >{{ fileData.path }}</td >
89
+ <td class =" px-5" style =" width : 150px " >SHA: {{ cutString( fileData.sha, 7) }}</td >
89
90
<td class =" px-5" >Size: {{ humanizeFileSize(fileData.size) }}</td >
90
91
</tr >
91
92
</table >
92
- <pre v-if =" fileData.content" class =" code-block" >
93
- <code ref =" codeBlock" class =" language-python" >{{ fileData.content }}</code >
94
- </pre >
93
+ <pre
94
+ v-if =" fileData.content"
95
+ class =" code-block"
96
+ ><code ref =" codeBlock" class =" language-python"
97
+ v-html =" sanitizeHtml(fileData.content)" /></pre >
95
98
<p v-else >Loading file...</p >
96
99
</div >
97
100
</CCol >
0 commit comments