Repository navigation
refactor(preview): 复用官方文档预览并修复自适应抖动 - #156
Merged
Merged
Conversation
Retain royhang's content-box measurement and iframe overflow fix for the legacy Office compatibility viewer, with its standalone zoom regression. Keep real scrollbar layout in the test and extend the official viewer's assembled-host regression to fractional CSS widths and heights as well. Adapted from #155, commits 0317ab3 and 4e65db3. Co-authored-by: royhang <[email protected]>
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与修改
对话和 Studio 的 Office 文件仍使用产品自有 HTML 查看器,覆盖了 DSH 0.2 已有的官方预览。这次把文档交回官方查看器:Word/PowerPoint 使用官方 Office → PDF 链路,表格使用官方表格视图,PDF、图片、HTML、Markdown 和文本继续使用官方实现。
关联 #121、#151。
验证
0.2.0-rc.2构建全部源插件并完成隔离产品装配。#、%)均打开成功,讲稿仍可查看。officeToPdf/render,Studio 打开预览不再调用exportArtifact('preview'),产品artifactPreview/read仅用于媒体。侧栏多次改变宽度后画布尺寸稳定,未出现前端异常。tests/official-preview-routing.mjs:官方格式归属、会话地址、旧标签原位替换、媒体重试、旧响应隔离、Studio 原文件打开及讲稿保留,全部通过。tests/official-preview-resize.mjs,使用已装配 Host 和合成 Office 附件,覆盖四档像素比例、两档滚动条宽度和临界高度前后逐像素变化,并检查画布是否持续重绘。实际装配产品的 160 组检查全部通过。测试显式保留真实占宽的滚动条,避免无头浏览器默认隐藏滚动条而漏检。npm ci/npm run typecheck、包维护检查、文档链接与源码回执审计通过。以上是合成资料上的本地 Web/组件验证,没有模型调用;未在原闪烁用户电脑及 macOS/Electron 壳上验收,不据此自动关闭 #151。
兼容性与后续事项
.doc的读取/工具支持属于另一条链路,不能由预览成功推定已解决。与 #155 的整合
#155(@royhang)和本 PR 处理同类尺寸反馈循环,但实现位置不同:#155 修复旧 HTML 查看器的小数尺寸取整和 iframe 溢出;本 PR 将当前产品预览迁移到官方查看器,并稳定官方滚动区宽度。
已吸收 #155 的修复与回归检查,为仍使用旧宿主的独立插件保留正确的兼容预览;当前产品主入口继续使用官方预览。集成提交保留来源提交说明,并加入
Co-authored-by: royhang。后续合并本 PR 即可包含这部分贡献,无需重复合入 #155。office-preview-client-smoke.mjs仍在“刷新后切换文件版本”断言失败;本机未修改版本同样失败,与 fix(office): 修复 DOCX 自动适应时缩放比例反复跳动与频闪 #155 作者报告一致。未把它记为通过,也未在此 PR 混入另一项修复。当前产品已经转交官方查看器,这项记录保留给旧兼容组件后续维护。