撤销 ce07f4a(lightbox 手机适配 + 正文图预览委托):真机上反复出问题(撑屏/缩放错乱),全部回退到原有简单预览;仅保留 lb-open 隐藏吸顶栏的亮带修复

This commit is contained in:
Sakurasan
2026-09-29 02:07:06 +08:00
parent c6eb0bbe5b
commit 84f88cb473
3 changed files with 16 additions and 85 deletions
+2 -25
View File
@@ -7,26 +7,9 @@ import ImgLightbox from './components/ImgLightbox.vue'
import YohakuTop from './ui/yohaku/YohakuTop.vue'
import YohakuFoot from './ui/yohaku/YohakuFoot.vue'
import { site, setAdminScope } from './site'
import { openLightbox } from './lightbox'
const route = useRoute()
// 正文图片点击预览(capture 阶段):时间线/详情页里 v-html 的正文图
// 都没有自己的点击入口,这里统一接管。capture + stopPropagation 是为了
// 压住整卡点击(时间线点图不该跳详情);配图网格有自己的 handler 不在
// .prose 内,天然不受影响。lightbox 用 data-fullsrc 原图(thumbify 保留)。
function onProseImgClick(e) {
const img = e.target
if (!img || img.tagName !== 'IMG') return
const scope = img.closest('.prose')
if (!scope || img.closest('.post-imgs') || img.closest('a')) return
const list = [...scope.querySelectorAll('img')].map((i) => i.dataset.fullsrc || i.currentSrc || i.src)
const cur = img.dataset.fullsrc || img.currentSrc || img.src
const idx = Math.max(0, list.indexOf(cur))
e.stopPropagation()
openLightbox(list, idx)
}
// 正文代码块复制按钮(事件委托:复制按钮是 enhanceProse 注入的静态 HTML)
function onCopyClick(e) {
const btn = e.target.closest?.('.pre-copy')
@@ -48,14 +31,8 @@ function onCopyClick(e) {
setTimeout(() => (btn.textContent = '复制'), 1600)
})
}
onMounted(() => {
document.addEventListener('click', onCopyClick)
document.addEventListener('click', onProseImgClick, true)
})
onBeforeUnmount(() => {
document.removeEventListener('click', onCopyClick)
document.removeEventListener('click', onProseImgClick, true)
})
onMounted(() => document.addEventListener('click', onCopyClick))
onBeforeUnmount(() => document.removeEventListener('click', onCopyClick))
const isAdmin = computed(() => route.path.startsWith('/admin'))
// vivid 只在公开前台生效:后台永远走 classic 那套(--admin-* token + 原 data-ui/data-theme),