feat(creator-studio): multi-select category picker and creatable tag input

分类从平铺复选标签改为带搜索的多选下拉(触发器内是已选令牌),
标签改为令牌输入框:回车 / 逗号 / 顿号 / 分号 / 换行切分,输入时列出
站点已有标签作为建议,面板内可一键新建。

- 抽出 useAnchoredPanel,工具条下拉与新的选择器共用同一套 portal 定位
- bootstrap 的 tags 增加 suggestions(按使用量取前 200 个已有标签)
- 清理 .jio-creator-inline 与 chip 内的死样式

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-09 17:35:52 +08:00
1 parent 8bb4b98fc9
commit 330df53195
10 files changed
+888 -170

No files matched your search

+18 -1
View File
@@ -574,6 +574,19 @@ final class CreatorRest {
$tags = $source instanceof \WP_Post && $snapshot === []
? wp_get_post_tags($source->ID, ['fields' => 'names'])
: array_map('strval', (array) ($snapshot['tags'] ?? []));
$tag_enabled = !empty($settings['allow_tags']);
// 标签是"没有就建"的自由词条,但仍然把站点已有标签交给前端做输入建议,
// 避免同一概念散成多个近义标签。
$tag_suggestions = $tag_enabled
? get_terms([
'taxonomy' => 'post_tag',
'hide_empty' => false,
'number' => 200,
'orderby' => 'count',
'order' => 'DESC',
'fields' => 'names',
])
: [];
$custom_defs = [];
$custom = [];
@@ -601,7 +614,11 @@ final class CreatorRest {
return [
'categories' => ['items' => $categories, 'selected' => $current],
'tags' => ['items' => is_array($tags) ? array_values($tags) : [], 'enabled' => !empty($settings['allow_tags'])],
'tags' => [
'items' => is_array($tags) ? array_values($tags) : [],
'enabled' => $tag_enabled,
'suggestions' => is_array($tag_suggestions) ? array_values($tag_suggestions) : [],
],
'custom' => $custom,
'customDefs' => $custom_defs,
];