Compare commits

..

1 Commits

Author SHA1 Message Date
Tim
abbdb224e0 fix: restrict image preview to markdown images 2025-09-12 10:50:15 +08:00
4 changed files with 20 additions and 17 deletions

View File

@@ -356,7 +356,7 @@ body {
}
.d2h-file-name {
font-size: 14px !important;
font-size: 12px !important;
}
.d2h-file-header {
@@ -371,14 +371,14 @@ body {
padding-left: 10px !important;
}
/* .d2h-diff-table {
.d2h-diff-table {
font-size: 6px !important;
}
.d2h-code-line ins {
height: 100%;
font-size: 13px !important;
} */
}
/* .d2h-code-line {
height: 12px;

View File

@@ -342,7 +342,7 @@ const copyCommentLink = () => {
const handleContentClick = (e) => {
handleMarkdownClick(e)
if (e.target.tagName === 'IMG') {
if (e.target.tagName === 'IMG' && !e.target.classList.contains('emoji')) {
const container = e.target.parentNode
const imgs = [...container.querySelectorAll('img')].map((i) => i.src)
lightboxImgs.value = imgs

View File

@@ -463,7 +463,11 @@ function minimize() {
function handleContentClick(e) {
handleMarkdownClick(e)
if (e.target.tagName === 'IMG') {
if (
e.target.tagName === 'IMG' &&
!e.target.classList.contains('emoji') &&
!e.target.closest('.reactions-container')
) {
const container = e.target.parentNode
const imgs = [...container.querySelectorAll('img')].map((i) => i.src)
lightboxImgs.value = imgs

View File

@@ -434,7 +434,7 @@ const removeCommentFromList = (id, list) => {
const handleContentClick = (e) => {
handleMarkdownClick(e)
if (e.target.tagName === 'IMG') {
if (e.target.tagName === 'IMG' && !e.target.classList.contains('emoji')) {
const container = e.target.parentNode
const imgs = [...container.querySelectorAll('img')].map((i) => i.src)
lightboxImgs.value = imgs
@@ -445,7 +445,7 @@ const handleContentClick = (e) => {
const onCommentDeleted = (id) => {
removeCommentFromList(Number(id), comments.value)
fetchTimeline()
fetchComments()
}
const {
@@ -557,7 +557,7 @@ const postComment = async (parentUserName, text, clear) => {
if (res.ok) {
const data = await res.json()
console.debug('Post comment response data', data)
await fetchTimeline()
await fetchComments()
clear()
if (data.reward && data.reward > 0) {
toast.success(`评论成功,获得 ${data.reward} 经验值`)
@@ -612,7 +612,7 @@ const approvePost = async () => {
status.value = 'PUBLISHED'
toast.success('已通过审核')
await refreshPost()
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}
@@ -628,7 +628,7 @@ const pinPost = async () => {
if (res.ok) {
toast.success('已置顶')
await refreshPost()
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}
@@ -644,7 +644,7 @@ const unpinPost = async () => {
if (res.ok) {
toast.success('已取消置顶')
await refreshPost()
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}
@@ -660,7 +660,7 @@ const excludeRss = async () => {
if (res.ok) {
rssExcluded.value = true
toast.success('已标记为rss不推荐')
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}
@@ -676,8 +676,7 @@ const includeRss = async () => {
if (res.ok) {
rssExcluded.value = false
toast.success('已标记为rss推荐')
await refreshPost()
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}
@@ -694,7 +693,7 @@ const closePost = async () => {
closed.value = true
toast.success('已关闭')
await refreshPost()
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}
@@ -711,7 +710,7 @@ const reopenPost = async () => {
closed.value = false
toast.success('已重新打开')
await refreshPost()
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}
@@ -756,7 +755,7 @@ const rejectPost = async () => {
status.value = 'REJECTED'
toast.success('已驳回')
await refreshPost()
await fetchTimeline()
await fetchChangeLogs()
} else {
toast.error('操作失败')
}