fix(submit): let the editor iframe grow with the body instead of scrolling internally
正文超过 iframe 高度时会在编辑器内部出现第二根滚动条,正文应该随页面一起变长。 登录态实测确认了滚动来源与两个副作用: 1. 经典投稿表单完全没做高度同步(iframe 固定 504px,正文 1824px → 内滚动)。 在共用基础插件里补上 syncHeight():测量正文高度并同步 iframe, 下限取编辑器声明高度;图片加载后重新同步。工作台自带 syncEditorHeight() 负责块浮层定位,用 __jioStudioOwnsEditorHeight 让插件跳过,避免双写。 2. 直接量 scrollHeight 会把 body 的 min-height 撑满算进内容高度,形成 「撑高 → 再撑高」的反馈循环(实测涨到 22616px)。测量时临时把 min-height 归零、同帧恢复。 3. body 的 min-height 基准从 100% 改成 100vh:iframe 随正文变高, 百分比会跟着循环;同时把 WordPress content CSS 的 body 外边距改内边距, 外边距不计入高度,会让 html 比 iframe 高一截、长正文时又冒出内滚动。 登录态实测(studio 与经典两条路径): - iframe 2152px / 1874px,与正文一致,innerHasScrollbar=false; - 空正文占位符正常、点击空白落光标正常; - 只有页面级滚动。 测试:新增 iframe 随正文增长、测量忽略 min-height 两个回归用例;903 全通过。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
305896796c
commit
4f9347b6aa
7 files changed
+164
-38
No files matched your search
@@ -228,15 +228,17 @@ body[data-jio-empty="1"]::before {
|
||||
* body 撑满编辑区:内容很短时点击正文下方的空白区域也应落光标,
|
||||
* 否则只有文字所在的那一行能点。
|
||||
*
|
||||
* min-height:100% 依赖父级有确定高度,所以 html 必须 height:100%(只写
|
||||
* min-height 的话 html 的高度仍由内容决定,百分比会退化成 auto)。
|
||||
* 高度基准取 iframe 视口(100vh 而不是 100%):iframe 由插件随正文同步变高,
|
||||
* 用百分比会形成「撑高 → 再撑高」的循环。100vh 只保证空正文铺满一屏。
|
||||
*
|
||||
* 外边距改内边距:WordPress 的 content CSS 给 body 留了 9px 外边距,
|
||||
* 外边距不计入 body 高度,会让 html 的 scrollHeight 永远比 iframe 多出一截,
|
||||
* 长正文时又冒出内滚动条。
|
||||
*/
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body.mce-content-body {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
min-height: 100%;
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
padding: 9px 10px;
|
||||
}
|
||||
Reference in new issue
Block a user