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
@@ -412,11 +412,11 @@ test('submit editor renders the configured body placeholder', () => {
|
||||
assert.match(styles, /body\[data-jio-empty="1"\]::before\s*\{/);
|
||||
assert.match(contentStyle, /body\[data-jio-empty="1"\]::before\s*\{/);
|
||||
// 两份 content CSS 都要让 body 撑满,否则正文下方的空白不属于 iframe。
|
||||
// min-height:100% 依赖父级确定高度,html 必须 height:100%。
|
||||
assert.match(styles, /html\s*\{[^}]*height:\s*100%/);
|
||||
assert.match(styles, /body\.mce-content-body\s*\{[^}]*min-height:\s*100%/);
|
||||
assert.match(contentStyle, /html\s*\{[^}]*height:\s*100%/);
|
||||
assert.match(contentStyle, /body\s*\{[^}]*min-height:\s*100%/);
|
||||
// 用 100vh 而不是 100%:iframe 随正文变高,百分比会形成撑高循环。
|
||||
assert.match(styles, /body\.mce-content-body\s*\{[^}]*min-height:\s*100vh/);
|
||||
assert.match(contentStyle, /body\s*\{[^}]*min-height:\s*100vh/);
|
||||
// 外边距不计入 body 高度,会让 html 比 iframe 高一截、长正文时出现内滚动。
|
||||
assert.match(styles, /body\.mce-content-body\s*\{[^}]*margin:\s*0/);
|
||||
|
||||
// 空正文时 iframe 不能缩到只剩一行:高度下限取编辑器声明的高度。
|
||||
assert.match(runtime, /getParam\?\.\('height', 0\)/);
|
||||
|
||||
Reference in new issue
Block a user