修复了一些问题

This commit is contained in:
2026-08-25 19:42:16 +08:00
parent ea83f2211c
commit f5746da0ae
4 changed files with 81 additions and 3 deletions
@@ -21,5 +21,19 @@ test('published post content reaches the front submit editor unchanged', () => {
const editor = read('templates/parts/submit/editor-main.php');
assert.match(context, /\$current_content\s*=\s*\$edit_post\s*\?\s*\$edit_post->post_content\s*:\s*'';/);
assert.match(editor, /wp_editor\(\(string\) \$ctx\['current_content'\], 'post_content', \$editor_settings\);/);
assert.match(editor, /\$initial_content\s*=\s*\(string\) \$ctx\['current_content'\]/);
assert.match(editor, /wp_editor\(\$initial_content, 'post_content', \$editor_settings\);/);
});
test('front submit restores published content when TinyMCE initializes empty', () => {
const editor = read('templates/parts/submit/editor-main.php');
const runtime = read('assets/js/front-submit.js');
const styles = read('assets/css/frontend/pages/submit.css');
assert.match(editor, /'quicktags'\s*=>\s*true/);
assert.match(editor, /id="aksrt-initial-post-content"/);
assert.match(runtime, /hydrateEditor:\s*function/);
assert.match(runtime, /editor\.setContent\(initialContent\)/);
assert.match(runtime, /switchEditors\.go\('post_content', 'html'\)/);
assert.match(styles, /textarea\.wp-editor-area\s*\{[^}]*opacity:\s*1/s);
});