feat(creator-studio): 公众号式插入面板与封面条
- 新增常驻「添加内容」按钮与插入面板:分组网格列出正文/标题/列表/引用、 图片/视频/嵌入、代码/分隔线/表格/付费内容;条目不满足能力时不出现在面板里 - 面板支持方向键在网格内移动焦点、Esc 关闭;桌面居中浮层,移动端贴底抽屉并 留出安全区 - 空文档插入区块时替换初始空白段落,不留空行 - 新增封面条:无封面时给低调入口,有封面时显示 2.35:1 缩略图,悬停出现 「更换封面」,右上角可移除 - 补充契约测试:头部/页脚/挂件区开关、插入面板真实区块名与能力过滤、 中文字数口径 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d07cffe99e
commit
79909f449e
10 files changed
+678
-7
No files matched your search
@@ -142,3 +142,39 @@ test('creator studio build artifacts and contracts exist', () => {
|
||||
assert.ok(exists('src/Core/PreviewToken.php'));
|
||||
assert.ok(exists('src/Admin/Native/SubmissionReview.php'));
|
||||
});
|
||||
|
||||
test('沉浸式布局屏蔽主题头部/页脚与挂件区', () => {
|
||||
const header = read('header.php');
|
||||
const footer = read('footer.php');
|
||||
// 工作台模式下这些输出必须可关闭,否则顶栏重复、正文被挂件挤压。
|
||||
assert.match(header, /apply_filters\('jio_render_header', true\)/);
|
||||
assert.match(header, /apply_filters\('jio_render_fluid_widgets', true\)/);
|
||||
assert.match(footer, /apply_filters\('jio_render_footer', true\)/);
|
||||
assert.match(pageSubmit, /add_filter\('jio_render_header', '__return_false'\)/);
|
||||
assert.match(pageSubmit, /add_filter\('jio_render_footer', '__return_false'\)/);
|
||||
assert.match(pageSubmit, /add_filter\('jio_render_fluid_widgets', '__return_false'\)/);
|
||||
});
|
||||
|
||||
test('插入面板与封面条走真实区块名与服务端能力', () => {
|
||||
const insertItems = read('assets/creator-studio/src/utils/insert-items.ts');
|
||||
const insertPanel = read('assets/creator-studio/src/panels/insert-panel.tsx');
|
||||
const cover = read('assets/creator-studio/src/components/cover-strip.tsx');
|
||||
|
||||
assert.match(appSource, /createBlock/);
|
||||
assert.match(insertItems, /'core\/paragraph'/);
|
||||
assert.match(insertItems, /'core\/heading'/);
|
||||
assert.match(insertItems, /'core\/image'/);
|
||||
assert.match(insertItems, /'jio\/paid-fragment'/);
|
||||
// 没有能力的条目不能出现在面板里。
|
||||
assert.match(insertItems, /if \(capabilities\.canUploadImage\)/);
|
||||
assert.match(insertItems, /if \(capabilities\.canPay\)/);
|
||||
assert.match(insertPanel, /role="dialog"/);
|
||||
assert.match(insertPanel, /event\.key === 'Escape'/);
|
||||
assert.match(cover, /添加封面/);
|
||||
assert.match(appSource, /<CoverStrip/);
|
||||
});
|
||||
|
||||
test('中文字数按字符统计而非按空格分词', () => {
|
||||
assert.match(appSource, /characters_excluding_spaces/);
|
||||
assert.doesNotMatch(appSource, /countWords\([^)]*'words'/);
|
||||
});
|
||||
Reference in new issue
Block a user