Fix preview: keep article title and tags, adjust scroll height
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<style>
|
||||
.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 .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%; }
|
||||
.topic-card-list { display: none; }
|
||||
@media (max-width: 768px) {
|
||||
@@ -230,7 +230,7 @@ const TopicsApp = {
|
||||
const doc = parser.parseFromString(html, 'text/html');
|
||||
const body = doc.body;
|
||||
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 bodyHtml = body.innerHTML;
|
||||
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;
|
||||
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>';
|
||||
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;
|
||||
} catch (e) { console.error('解析 HTML 失败:', e); return html; }
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user