fix(submit): detect empty body without editor chrome and let body fill the frame

登录态实测(Edge + 真实 TinyMCE)复现了上一版没修好的两点:

1. 占位符仍不显示:editor-runtime 会把块级删除浮层插进 body,它带
   data-mce-bogus 但含「✕ 选中此块」文字,body.textContent 因此永远非空,
   data-jio-empty 一直没被打上。判断正文是否为空时先剔除 data-mce-bogus 节点。

2. 点空白落不到正文:body 高度只有 29px。`min-height:100%` 的父级 html
   没有确定高度,百分比退化成 auto。改为 html{height:100%} +
   body{min-height:100%},body 现在铺满 520px 的 iframe。

实测结果(登录态 https://localhost/submit/):
- 首次加载 data-jio-empty=1、::before 渲染「请输入正文」;
- 点击正文中部空白,光标落进 P 并可继续输入;
- 引用块内编辑后点空白,光标落到引用之后的段落;
- 清空内容后占位符恢复。

测试:新增「编辑器辅助节点不算正文」回归用例;900 → 901 全通过。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-09 21:16:45 +08:00
1 parent 5afa7ab9df
commit 305896796c
5 files changed
+52 -10

No files matched your search

+6 -3
View File
@@ -227,13 +227,16 @@ body[data-jio-empty="1"]::before {
/*
* body 撑满编辑区:内容很短时点击正文下方的空白区域也应落光标,
* 否则只有文字所在的那一行能点。
*
* min-height:100% 依赖父级有确定高度,所以 html 必须 height:100%(只写
* min-height 的话 html 的高度仍由内容决定,百分比会退化成 auto)。
*/
html,
body.mce-content-body {
min-height: 100%;
html {
height: 100%;
}
body.mce-content-body {
position: relative;
box-sizing: border-box;
min-height: 100%;
}