Commit Graph
8 Commits
Author SHA1 Message Date
kate522andClaude Opus 5 305896796c 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>
2026-11-09 21:16:45 +08:00
kate522andClaude Opus 5 5afa7ab9df fix(submit): show body placeholder on first load and restore caret on blank clicks
两个前台投稿编辑器的缺陷,根因都在占位符的实现方式:

1. 首次加载不显示占位符,输入一个再删掉才出现。
   旧实现往正文插了一个 data-mce-bogus 占位段落,而 TinyMCE 在
   setContent(studio 初始化时必调)与清理 bogus 元素时会把它移除。

2. 光标在块级结构里时,点击正文空白处无法落回正文。
   占位段落占着首行、且 pointer-events:none,点击落不到可编辑元素上;
   正文以表格 / 代码块这类结构块结尾时也没有可承载光标的段落。

改为 front-submit-editor-basics.js(替换 front-submit-placeholder.js):
- 占位符改成 body 属性 + content CSS 的 ::before,正文 DOM 不含占位节点;
- 点击空白处(事件目标是 body)且光标不在普通文本里时,补一个可编辑尾段
  并把光标放进去;
- 两份 content CSS 让 html/body 撑满编辑区,studio 的 syncEditorHeight
  以编辑器声明高度为下限,空正文时 iframe 不会缩成一行。

新增 tests/widget-system/submit-placeholder-behavior.test.cjs(jsdom 跑真实插件)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 20:38:02 +08:00
kate522andClaude Opus 5 44a03fd5f4 fix(submit): render the configured body placeholder in TinyMCE
WordPress 打包的 TinyMCE 4.9 不含官方 placeholder 插件,tinymce.init 里的
placeholder 配置被静默忽略,投稿页「投稿内容占位符」从未显示过。

新增主题插件 assets/js/front-submit-placeholder.js:正文为空时插入一个
data-mce-bogus 的占位段落,有内容即移除;序列化 / 解析都剔除该段落,
字数统计也跳过它,提示文字不会写进文章。

- 经典投稿表单与创作者工作台都通过 external_plugins 加载
  (WordPress 会丢弃名字已在 plugins 列表里的外部插件)
- 占位样式写进 iframe 的 content CSS:submit-editor.css 与
  editor-content-style.ts

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 19:01:28 +08:00
kate522 c5bdbc0457 feat(creator-studio): portal dropdowns, hidden content, two-step block delete
Toolbar
- New ToolMenu renders menus through a portal on body, so they are no longer
  clipped by the horizontally scrolling toolbar and no longer fall back to a
  native <select>. Triggers reuse .jio-creator__tool-btn geometry, fixing the
  heading button's mismatched height/size/position.
- Heading / list / align / quote / hidden-content are all dropdowns.
- Lists: unordered + ordered via InsertOrderedList/InsertUnorderedList.
  The TOC button is removed (it also used the wrong icon).
- Adds left / center / right alignment.
- Adds hidden content: comment / login / VIP / paid, wired to the existing
  [reply], [jio_hide mode="login"], [vip] and [payshow] shortcodes.

Editor content
- Quote blocks now match the live article: full .quote_q structure, four
  colour variables, and an SVG-mask quote mark that does not depend on the
  Font Awesome font being present inside the iframe.
- Block math is centred on a transparent background instead of a full-width
  grey bar.
- Code blocks are plain <pre><code>, identical to the article page; language
  and theme selection is gone and EnlighterJS handles highlighting globally.
  The classic submit editor's code modal follows the same shape.
- Hidden content reuses the .tinymce-hide structure and shows a readable label
  while keeping the shortcode text in the DOM for saving.

Block deletion
- Two-step delete, WPS style: the first click only selects and highlights the
  block, the second click removes it. Clicking elsewhere or Esc cancels.

Contracts updated and extended; 884 widget-system tests pass.
2026-11-09 15:03:50 +08:00
kate522andClaude Opus 5 6928127bfa fix(creator-studio): render math/footnote shortcodes, inline code blocks, block deletion
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 23:52:39 +08:00
kate522 7c0c21e984 进行了一些小修复 2026-08-26 18:06:44 +08:00
kate522 fb2bbb64c5 进行了一些小修复 2026-08-26 17:57:29 +08:00
kate522 5121b33ad5 进行了一些小修复 2026-08-26 16:59:42 +08:00