fix(creator-studio): caret overlap in toolbar and hidden sub-categories

工具条下拉触发器的下三角原本绝对定位在按钮右下角,按钮宽度不够时会压到
居中的文字上。改为文字 + 三角同行排版(.jio-creator__tool-meta),宽度不足
时只压缩文字。

分类只查询 parent=0,导致二级 / 三级分类在投稿页完全不可选。新增
SubmitCategories 统一解析:
- 取全部分类并按父子关系深度优先展平,带上 depth / path;
- 白名单按"选了上级即包含其全部子级"展开,未配置白名单时不做额外过滤;
- 创作者工作台、经典投稿表单、保存校验与审核应用共用同一份结果。

选择器按 depth 缩进,搜索同时匹配完整路径。

同时把 assets/creator-studio/build 与 assets/admin/build 统一为整目录忽略
(不再跟踪 .gitkeep),避免构建产物反复被误提交。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-09 18:10:19 +08:00
1 parent 330df53195
commit beb898b1ab
12 files changed
+291 -53

No files matched your search

Whitespace-only changes.
@@ -13,7 +13,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { useAnchoredPanel } from '../hooks/use-anchored-panel';
export type CategoryOption = { id: number; name: string };
export type CategoryOption = { id: number; name: string; depth?: number; path?: string };
type Props = {
options: CategoryOption[];
@@ -42,7 +42,8 @@ export function CategorySelect({ options, value, onChange }: Props) {
if (keyword === '') {
return options;
}
return options.filter((option) => option.name.toLowerCase().includes(keyword));
// 同时匹配完整路径:搜上级分类名也能把它的子分类带出来。
return options.filter((option) => (option.path || option.name).toLowerCase().includes(keyword));
}, [options, query]);
// 每次打开都从干净的搜索词开始,避免上次的过滤条件把列表藏起来。
@@ -87,6 +88,8 @@ export function CategorySelect({ options, value, onChange }: Props) {
<label
key={option.id}
className={`jio-creator-picker__item${active ? ' is-active' : ''}`}
style={{ paddingLeft: `${10 + (option.depth || 0) * 16}px` }}
title={option.path || option.name}
>
<input type="checkbox" checked={active} onChange={() => toggle(option.id)} />
<span className="jio-creator-picker__name">{option.name}</span>
@@ -134,7 +137,9 @@ export function CategorySelect({ options, value, onChange }: Props) {
) : (
chosen.map((option) => (
<span key={option.id} className="jio-creator-select__token">
<span className="jio-creator-select__token-label">{option.name}</span>
<span className="jio-creator-select__token-label" title={option.path || option.name}>
{option.name}
</span>
<button
type="button"
className="jio-creator-select__token-x"
@@ -130,8 +130,11 @@ export function ToolMenu({
aria-expanded={open ? 'true' : 'false'}
>
<i className={icon} aria-hidden="true" />
<span className="jio-creator__tool-label">{label}</span>
<i className="fa fas fa-caret-down jio-creator__tool-caret" aria-hidden="true" />
{/* 下三角与文字同一行参与排版:按钮再窄也只会压缩文字,不会压到三角上。 */}
<span className="jio-creator__tool-meta">
<span className="jio-creator__tool-label">{label}</span>
<i className="fa fas fa-caret-down jio-creator__tool-caret" aria-hidden="true" />
</span>
</button>
{menu}
</div>
+17 -5
View File
@@ -283,11 +283,19 @@ body.jio-page-submit.has-static-nav {
white-space: nowrap;
}
/* 下拉触发器右下角的小三角:告诉作者这里还有更多选项。 */
.jio-creator__tool-caret {
position: absolute;
right: 3px;
bottom: 4px;
/* 文字 + 下三角同处一行:三角参与排版,不会再被绝对定位盖到文字上。 */
.jio-creator__tool-meta {
display: inline-flex;
max-width: 100%;
align-items: center;
justify-content: center;
gap: 2px;
min-width: 0;
}
/* 三角要压过 `.jio-creator__tool-btn i` 的图标字号,所以带上按钮前缀。 */
.jio-creator__tool-btn .jio-creator__tool-caret {
flex: 0 0 auto;
color: #b0b9b6;
font-size: 8px;
line-height: 1;
@@ -857,6 +865,10 @@ body.jio-page-submit.has-static-nav {
font-size: 10px;
}
.jio-creator__tool-meta {
gap: 1px;
}
.jio-creator__canvas {
width: calc(100% - 20px);
margin: 14px auto 0;