fix(creator-studio): render math/footnote shortcodes, inline code blocks, block deletion

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-06 23:52:39 +08:00
1 parent 7885f42cff
commit 6928127bfa
11 files changed
+235 -202

No files matched your search

@@ -168,19 +168,39 @@ test('fixed top toolbar has TinyMCE formatting, media, and extension actions', (
// 表格 / 公式 / 注释 / 代码都走参数弹窗,不再是固定内容。
assert.match(appSource, /<BlockDialog/);
assert.match(appSource, /setBlockDialog\(kind as BlockDialogKind\)/);
assert.match(appSource, /setCodeDialog\(\{ language: 'generic', code: '' \}\)/);
// 代码块直接插入,不弹窗。
assert.match(appSource, /insertHtml\(codeBlockMarkup\('generic'\)\)/);
assert.doesNotMatch(appSource, /setCodeDialog/);
assert.doesNotMatch(read('assets/creator-studio/src/components/block-dialog.tsx'), /kind === 'code'/);
assert.match(read('assets/creator-studio/src/components/block-dialog.tsx'), /onSubmit\(\{ kind, rows: clamp\(rows, 1, 20\), cols: clamp\(cols, 1, 10\), header, striped \}\)/);
assert.match(read('assets/creator-studio/src/components/block-dialog.tsx'), /kind === 'code'/);
assert.match(appSource, /onInsertBlock=\{insertBlock\}/);
assert.match(appSource, /onInsertQuote=\{insertQuote\}/);
const markup = read('assets/creator-studio/src/utils/block-markup.ts');
assert.match(markup, /jio-toc-placeholder/);
assert.match(markup, /jio-math/);
assert.match(markup, /jio_math/);
// 引用沿用主题的 quote_q 结构与配色类。
assert.match(markup, /quote_q/);
assert.match(markup, /qe_wzk_c-red/);
// 公式与注释用短代码落库,由服务端保证渲染。
assert.doesNotMatch(markup, /E = mc\^2/);
assert.doesNotMatch(markup, /注释内容', 'jio'\)\s*\+\s*'<\/p>'/);
assert.match(markup, /\[jio_math display="1"\]/);
assert.match(markup, /\[jio_footnote\]/);
assert.match(markup, /\[jio_toc\]/);
// 代码块角标不再输出固定「高亮代码」文案。
assert.doesNotMatch(read('assets/css/frontend/pages/submit-editor.css'), /高亮代码/);
assert.doesNotMatch(read('assets/css/tinymce.css'), /content:\s*'高亮代码'/);
const blocks = read('src/Content/ContentBlocks.php');
const shortcodes = read('src/Core/Shortcodes.php');
assert.match(shortcodes, /add_shortcode\('jio_math'/);
assert.match(shortcodes, /add_shortcode\('jio_footnote'/);
assert.match(shortcodes, /add_shortcode\('jio_toc'/);
assert.match(blocks, /function shortcode_math/);
assert.match(blocks, /function shortcode_footnote/);
assert.match(blocks, /function append_footnotes/);
assert.match(blocks, /<sup>\$1\$2<\/sup>/);
// 删除键必须能移除相邻的块级元素。
assert.match(appSource, /function removeAdjacentBlock/);
assert.match(appSource, /removeAdjacentBlock\(editor, event\)/);
// 工具栏按钮统一为「图标在上、文字在下」。
assert.match(editorToolbar, /jio-creator__tool-label/);
assert.match(read('assets/creator-studio/src/styles/studio.scss'), /\.jio-creator__tool-btn\s*\{[\s\S]*?flex-direction:\s*column/);