fix(creator-studio): 加载正文编辑格式工具栏

选中文字时的 RichText 加粗、斜体、链接等工具由 WordPress format-library 注册。
BlockTools 虽然提供 inline toolbar slot,但此前前台没有加载 wp-format-library,
因此正文选区没有格式工具。为 Creator Studio 前台显式加载该 script/style handle,
并将行内格式工具栏统一为深色圆角悬浮样式。

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

No files matched your search

+6 -2
View File
@@ -53,12 +53,16 @@ final class CreatorStudio {
$uri = get_template_directory_uri() . '/' . self::BUILD_DIR;
$meta = include $dir . '/index.asset.php';
$deps = is_array($meta['dependencies'] ?? null) ? $meta['dependencies'] : [];
$ver = (string) ($meta['version'] ?? AKSRT_VERSION);
// core/image 等块的行内 RichTextToolbarButton 由 WordPress 的格式库注册;
// BlockTools 负责浮层插槽,但必须显式入队前台 wp-format-library。
$deps[] = 'wp-format-library';
$deps = array_values(array_unique($deps));
$ver = (string) ($meta['version'] ?? AKSRT_VERSION);
// 区块样式是前台编辑体验的一部分;编辑器专属样式只在已注册时追加,
// 避免在没有注册该 handle 的前台请求上产生悬空依赖。
$style_deps = ['jio-public'];
foreach (['wp-block-library', 'wp-block-editor', 'wp-components'] as $handle) {
foreach (['wp-block-library', 'wp-block-editor', 'wp-components', 'wp-format-library'] as $handle) {
if (wp_style_is($handle, 'registered')) {
$style_deps[] = $handle;
}