fix(creator-studio): 固定公众号式创作工具栏

- 顶部改为 fixed 创作工具栏:左侧返回/品牌/模式,中间文章标题与保存状态,
  右侧撤销/重做、保存草稿、预览、发布
- 新增工作台级撤销/重做快照栈,连续编辑合并记录;支持 Ctrl/Cmd+Z / Shift+Z,
  不覆盖 RichText 输入框自身的编辑历史
- 移动端收敛工具栏布局,保留撤销/重做、预览、发布
- 先保存草稿再请求审核/直接发布;请求使用服务端更新后的文章与版本 ID
- 固定工具栏以独立 chrome 层布局,正文避开顶部工具栏高度
- 补充固定工具栏、历史操作与键盘快捷键契约

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-06 17:36:15 +08:00
1 parent f5e9420266
commit 9e8913ea0a
9 files changed
+518 -50

No files matched your search

+31 -2
View File
@@ -3,6 +3,7 @@
* 并记录无法捕获的 promise 拒绝。
*/
const fs = require('fs');
const path = require('path');
const puppeteer = require('puppeteer-core');
const CANDIDATES = [
@@ -21,7 +22,31 @@ const URL = process.argv[2] || 'https://localhost/jio-preview.html';
args: ['--disable-gpu', '--no-sandbox'],
});
const page = await browser.newPage();
await page.setViewport({ width: 1440, height: 1000 });
await page.setViewport({ width: 1440, height: 560 });
if (process.env.JIO_USE_WORKTREE_BUILD === '1') {
await page.setRequestInterception(true);
page.on('request', (request) => {
const pathname = new URL(request.url()).pathname;
const jsSuffix = '/assets/creator-studio/build/index.js';
const cssSuffix = '/assets/creator-studio/build/index.css';
if (pathname.endsWith(jsSuffix)) {
request.respond({
status: 200,
contentType: 'application/javascript',
body: fs.readFileSync(path.join(__dirname, '../build/index.js')),
});
} else if (pathname.endsWith(cssSuffix)) {
request.respond({
status: 200,
contentType: 'text/css',
body: fs.readFileSync(path.join(__dirname, '../build/index.css')),
});
} else {
request.continue();
}
});
}
const errors = [];
page.on('pageerror', (e) => errors.push('pageerror: ' + e.message));
@@ -33,8 +58,12 @@ const URL = process.argv[2] || 'https://localhost/jio-preview.html';
blocks: document.querySelectorAll('.block-editor-block-list__block').length,
hasInsertBtn: !!document.querySelector('.jio-creator__insert'),
hasCover: !!document.querySelector('.jio-creator__cover'),
toolbarTop: document.querySelector('.jio-creator__bar')?.getBoundingClientRect().top,
}));
console.log('BEFORE ' + JSON.stringify(before));
await page.evaluate(() => window.scrollTo(0, 700));
await new Promise((r) => setTimeout(r, 300));
const toolbarAfterScroll = await page.$eval('.jio-creator__bar', (el) => el.getBoundingClientRect().top);
console.log('BEFORE ' + JSON.stringify({ ...before, toolbarAfterScroll }));
// 打开插入面板
await page.click('.jio-creator__insert');