Skip to content

Commit 8680c6b

Browse files
committed
fix: Fixed none display image at post and change code style
1 parent 2b880c0 commit 8680c6b

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/lib/css/tiptap.css

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@
9898
@apply text-2xl font-bold text-white;
9999
}
100100

101+
.tiptap-editor-content pre {
102+
@apply bg-gray-700 text-gray-200;
103+
}
104+
101105
@keyframes fadeIn {
102106
from {
103107
opacity: 0;

src/lib/utils/html.ts

+20-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,27 @@ export const textSanitizing = (rawHTML: string): string => {
33
return sanitize(rawHTML, {
44
sanitizeHtml: {
55
allowedAttributes: {
6-
target: ['_blank'],
6+
img: ['src', 'alt'],
77
},
8+
allowedTags: [
9+
'p',
10+
'h1',
11+
'h2',
12+
'h3',
13+
'h4',
14+
'h5',
15+
'h6',
16+
'strong',
17+
'em',
18+
's',
19+
'ul',
20+
'ol',
21+
'li',
22+
'br',
23+
'img',
24+
'pre',
25+
'code',
26+
],
827
},
928
})
1029
}

0 commit comments

Comments
 (0)