正文超过 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>
245 lines
5.1 KiB
CSS
245 lines
5.1 KiB
CSS
/* Content shown inside the front-submit TinyMCE iframe. */
|
|
|
|
/* 隐藏内容:短代码留在 .hide-before / .hide-after,编辑器只显示可读标签。 */
|
|
.tinymce-hide {
|
|
position: relative;
|
|
margin: 18px 0;
|
|
padding: 38px 14px 14px;
|
|
border: 1px dashed rgba(240, 68, 148, 0.35);
|
|
border-radius: 6px;
|
|
background: rgba(240, 68, 148, 0.04);
|
|
}
|
|
|
|
.tinymce-hide > .hide-before,
|
|
.tinymce-hide > .hide-after {
|
|
margin: 0;
|
|
color: #f04494;
|
|
font-family: Consolas, Monaco, monospace;
|
|
font-size: 0;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.tinymce-hide > .hide-before {
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 14px;
|
|
}
|
|
|
|
.tinymce-hide > .hide-before::before {
|
|
content: attr(data-jio-hide-label);
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
letter-spacing: 0.02em;
|
|
}
|
|
|
|
.tinymce-hide > .hide-after {
|
|
display: none;
|
|
}
|
|
|
|
.tinymce-hide > [contenteditable="true"] {
|
|
min-height: 38px;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
background: rgba(255, 255, 255, 0.75);
|
|
outline: 0;
|
|
}
|
|
|
|
.tinymce-hide > [contenteditable="true"] > :first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.tinymce-hide > [contenteditable="true"] > :last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.quote_q {
|
|
position: relative;
|
|
margin: 10px 0 20px;
|
|
padding: 1.2em;
|
|
border-radius: 6px;
|
|
color: var(--quote-color);
|
|
--quote-color: #555;
|
|
}
|
|
|
|
.quote_q::before {
|
|
position: absolute;
|
|
inset: 0;
|
|
border-radius: 6px;
|
|
background: var(--quote-color);
|
|
content: '';
|
|
opacity: 0.04;
|
|
}
|
|
|
|
.quote_q.quote-mce::after {
|
|
position: absolute;
|
|
top: 20px;
|
|
left: 20px;
|
|
color: var(--quote-color);
|
|
content: '\201c';
|
|
font-size: 24px;
|
|
line-height: 1;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.quote_q > div {
|
|
position: relative;
|
|
min-height: 24px;
|
|
padding-left: 2em;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.quote_q > div > :first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.quote_q > div > :last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.quote_q [contenteditable="true"] {
|
|
outline: 0;
|
|
border-radius: 0;
|
|
box-shadow: none;
|
|
}
|
|
|
|
.qe_wzk_c-red {
|
|
--quote-color: #dc3f3f;
|
|
}
|
|
|
|
.qe_wzk_lan {
|
|
--quote-color: #0092ff;
|
|
}
|
|
|
|
.qe_wzk_lv {
|
|
--quote-color: #23790e;
|
|
}
|
|
|
|
/* 代码块:与前台文章页一致,只用 pre > code,由 EnlighterJS 在发布页高亮。 */
|
|
pre {
|
|
margin: 0 0 1.1em;
|
|
padding: 14px 18px;
|
|
overflow-x: auto;
|
|
border-radius: 8px;
|
|
background: #f2f4f5;
|
|
color: #2b2b2b;
|
|
font-family: Consolas, Monaco, "Courier New", monospace;
|
|
font-size: 13px;
|
|
line-height: 1.6;
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
pre code {
|
|
border: 0;
|
|
background: transparent;
|
|
color: inherit;
|
|
font-family: inherit;
|
|
font-size: inherit;
|
|
line-height: inherit;
|
|
padding: 0;
|
|
white-space: inherit;
|
|
}
|
|
|
|
.file-download-box {
|
|
margin-bottom: 20px;
|
|
padding: 15px;
|
|
border: 1px dashed #bbb;
|
|
border-radius: 6px;
|
|
background: #f5f5f5;
|
|
}
|
|
|
|
.file-download-box .file-download-icon {
|
|
font-size: 24px;
|
|
}
|
|
|
|
.file-download-box .file-download-name {
|
|
min-width: 80px;
|
|
outline: 0;
|
|
}
|
|
|
|
.new-dplayer.post-dplayer {
|
|
position: relative;
|
|
min-height: 220px;
|
|
margin-bottom: 20px;
|
|
border-radius: 6px;
|
|
background: #222;
|
|
}
|
|
|
|
.new-dplayer.post-dplayer::before {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #fff;
|
|
content: '视频';
|
|
opacity: 0.65;
|
|
}
|
|
|
|
.wp-block-embed.is-type-video {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.iframe-absbox {
|
|
position: relative;
|
|
height: 0;
|
|
overflow: hidden;
|
|
border-radius: 6px;
|
|
background: #222;
|
|
}
|
|
|
|
.iframe-absbox iframe {
|
|
position: absolute;
|
|
inset: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
/* 编辑器内的注释上标(发布后由服务端换成脚注列表) */
|
|
.mce-content-body sup.jio-footnote-ref,
|
|
.tox .jio-footnote-ref {
|
|
color: var(--theme-color, #267665);
|
|
font-size: 0.8em;
|
|
vertical-align: super;
|
|
}
|
|
|
|
/*
|
|
* 正文占位符。
|
|
*
|
|
* TinyMCE 4.9 没有内置 placeholder 插件,主题插件 front-submit-editor-basics.js
|
|
* 在正文为空时给 body 打上 data-jio-empty="1",这里用 ::before 渲染提示。
|
|
* 刻意不插 DOM 节点:插入的段落会被 setContent 清掉(首次加载不显示),
|
|
* 也会占住首行、挡住点击空白处落光标。
|
|
*
|
|
* 绝对定位覆盖在空段落上,与原生 placeholder 的观感一致。
|
|
*/
|
|
body[data-jio-empty="1"]::before {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
color: #b9bfbc;
|
|
content: attr(data-jio-placeholder);
|
|
pointer-events: none;
|
|
user-select: none;
|
|
}
|
|
|
|
/*
|
|
* body 撑满编辑区:内容很短时点击正文下方的空白区域也应落光标,
|
|
* 否则只有文字所在的那一行能点。
|
|
*
|
|
* 高度基准取 iframe 视口(100vh 而不是 100%):iframe 由插件随正文同步变高,
|
|
* 用百分比会形成「撑高 → 再撑高」的循环。100vh 只保证空正文铺满一屏。
|
|
*
|
|
* 外边距改内边距:WordPress 的 content CSS 给 body 留了 9px 外边距,
|
|
* 外边距不计入 body 高度,会让 html 的 scrollHeight 永远比 iframe 多出一截,
|
|
* 长正文时又冒出内滚动条。
|
|
*/
|
|
body.mce-content-body {
|
|
position: relative;
|
|
box-sizing: border-box;
|
|
min-height: 100vh;
|
|
margin: 0;
|
|
padding: 9px 10px;
|
|
}
|