Fix preview: keep article title and tags, adjust scroll height

This commit is contained in:
Yuzhiran Dev
2026-05-20 15:37:26 +08:00
parent 63f074e4df
commit 2244736318
+3 -3
View File
@@ -9,7 +9,7 @@
<style> <style>
.selected-count { color: var(--color-text-secondary); font-size: var(--font-size-body); margin-left: auto; } .selected-count { color: var(--color-text-secondary); font-size: var(--font-size-body); margin-left: auto; }
.preview-dialog-custom .el-dialog__body { overflow-y: auto; max-height: calc(90vh - 120px); padding: 16px 20px; } .preview-dialog-custom .el-dialog__body { overflow-y: auto; max-height: calc(90vh - 120px); padding: 16px 20px; }
.preview-dialog-custom .preview-body { max-height: calc(90vh - 200px); min-height: 300px; overflow-y: auto; } .preview-dialog-custom .preview-body { max-height: calc(90vh - 180px); min-height: 300px; overflow: auto; }
.preview-dialog-custom .preview-body img { max-width: 100%; } .preview-dialog-custom .preview-body img { max-width: 100%; }
.topic-card-list { display: none; } .topic-card-list { display: none; }
@media (max-width: 768px) { @media (max-width: 768px) {
@@ -230,7 +230,7 @@ const TopicsApp = {
const doc = parser.parseFromString(html, 'text/html'); const doc = parser.parseFromString(html, 'text/html');
const body = doc.body; const body = doc.body;
if (!body) return html; if (!body) return html;
body.querySelectorAll('script, nav, .header, footer, .interaction').forEach(el => el.remove()); body.querySelectorAll('script, nav, footer, .interaction').forEach(el => el.remove());
const headHtml = doc.querySelector('head') ? doc.querySelector('head').innerHTML : ''; const headHtml = doc.querySelector('head') ? doc.querySelector('head').innerHTML : '';
const bodyHtml = body.innerHTML; const bodyHtml = body.innerHTML;
const ending = '<p style="margin-top:24px;padding-top:16px;border-top:1px solid #eee;color:#666;font-size:14px;">感兴趣可以收藏关注我们,欢迎在评论区分享你的实践经验和改进建议!</p>'; const ending = '<p style="margin-top:24px;padding-top:16px;border-top:1px solid #eee;color:#666;font-size:14px;">感兴趣可以收藏关注我们,欢迎在评论区分享你的实践经验和改进建议!</p>';
@@ -247,7 +247,7 @@ const TopicsApp = {
const body = doc.body; const body = doc.body;
if (!body) return html; if (!body) return html;
if (body.innerHTML.length < 30) return '<div style="padding:40px;text-align:center;color:#909399;"><p style="font-size:36px;margin:0 0 12px;">📝</p><p>内容为空,请编辑或重新生成</p></div>'; if (body.innerHTML.length < 30) return '<div style="padding:40px;text-align:center;color:#909399;"><p style="font-size:36px;margin:0 0 12px;">📝</p><p>内容为空,请编辑或重新生成</p></div>';
body.querySelectorAll('script, nav, .header, .tags, footer, .interaction').forEach(el => el.remove()); body.querySelectorAll('script, nav, footer, .interaction').forEach(el => el.remove());
return body.innerHTML; return body.innerHTML;
} catch (e) { console.error('解析 HTML 失败:', e); return html; } } catch (e) { console.error('解析 HTML 失败:', e); return html; }
}, },