复用平台图标按钮收口参考图入口

编辑器生成输入框参考图按钮改为 PlatformIconButton surfaceFloating。

保留生成器局部尺寸和浅灰覆盖,避免重复维护图标按钮基础 chrome。

补充测试覆盖参考图按钮平台浮动按钮 class,并更新 TRACKING。
This commit is contained in:
2026-06-14 14:38:06 +08:00
parent 8157622718
commit 80d3a06e29
4 changed files with 14 additions and 5 deletions

View File

@@ -97,3 +97,4 @@
- 2026-06-14 素材库与画布持久化修正:新增 `editor_asset_folder` / `editor_asset` 账号级素材库表、SpacetimeDB procedure、spacetime-client facade 和 api-server `/api/editor/assets*` BFF编辑器接入文件夹新建 / 折叠 / 重命名 / 删除、素材重命名 / 删除、多文件上传、拖拽定向上传、拖入画布生成图层、素材框选批量删除、图层打组、小地图拖拽、普通滚轮纵向滚动与 Ctrl/Cmd 滚轮缩放。验证命令:`npm run spacetime:generate -- --rust-only``npm run test -- src/components/image-editor/ImageCanvasEditorView.test.tsx src/services/image-editor/editorProjectClient.test.ts``npm run typecheck``npm run check:spacetime-schema``npm run check:encoding``cargo check -p spacetime-client -p api-server --manifest-path server-rs/Cargo.toml``git diff --check`
- 2026-06-14 组件复用修正:编辑器 `EditorIconButton` 改为委托 `PlatformIconButton` 的薄包装,保留编辑器局部 class 与调用方式,但不再维护重复的原生图标按钮可访问性和基础 chrome验证命令`npm run test -- src/components/image-editor/ImageCanvasEditorPrimitives.test.tsx src/components/image-editor/ImageCanvasEditorView.test.tsx src/components/common/PlatformIconButton.test.tsx``npm run typecheck`
- 2026-06-14 组件复用修正:编辑器生成输入框的提交按钮改为复用 `PlatformActionButton`,仅保留生成器局部尺寸和 Lovart 式浅灰覆盖,不再直接维护原生 submit 按钮基础 chrome验证命令`npm run test -- src/components/image-editor/ImageCanvasEditorView.test.tsx src/components/common/PlatformActionButton.test.tsx``npm run typecheck`
- 2026-06-14 组件复用修正:编辑器生成输入框的“参考图”按钮改为复用 `PlatformIconButton variant="surfaceFloating"`,用 children 承载短标签,仅保留生成器局部尺寸和浅灰覆盖;验证命令:`npm run test -- src/components/image-editor/ImageCanvasEditorView.test.tsx src/components/common/PlatformIconButton.test.tsx``npm run typecheck`

View File

@@ -731,6 +731,12 @@ describe('ImageCanvasEditorView', () => {
);
expect(screen.getByLabelText('图像生成占位图')).toBeTruthy();
expect(within(generateDialog).getByText('参考图')).toBeTruthy();
expect(
within(generateDialog).getByRole('button', { name: '添加参考图' }).className,
).toContain('bg-white/94');
expect(
within(generateDialog).getByRole('button', { name: '添加参考图' }).className,
).toContain('image-canvas-editor__generation-ref');
expect(within(generateDialog).getByRole('button', { name: '生成比例 1:1 2k 1张' })).toBeTruthy();
expect(within(generateDialog).getByRole('button', { name: '生成模型 GPT Image' })).toBeTruthy();
expect(within(generateDialog).getByRole('button', { name: '生成' }).className).toContain(

View File

@@ -69,6 +69,7 @@ import {
PlatformFloatingMenu,
PlatformFloatingMenuItem,
} from '../common/PlatformFloatingMenu';
import { PlatformIconButton } from '../common/PlatformIconButton';
import { PlatformStatusMessage } from '../common/PlatformStatusMessage';
import { UnifiedModal } from '../common/UnifiedModal';
@@ -2784,16 +2785,16 @@ export function ImageCanvasEditorView() {
}
}}
>
<button
type="button"
<PlatformIconButton
variant="surfaceFloating"
className="image-canvas-editor__generation-ref"
aria-label="添加参考图"
label="添加参考图"
disabled={generateDialog.status === 'generating'}
onClick={() => uploadInputRef.current?.click()}
icon={<ImageIcon className="h-4 w-4" />}
>
<ImageIcon className="h-4 w-4" />
<span></span>
</button>
</PlatformIconButton>
<textarea
aria-label="生成提示词"
value={generateDialog.prompt}

View File

@@ -4059,6 +4059,7 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
color: #a3a3a3;
font-size: 0.72rem;
font-weight: 760;
box-shadow: none;
}
.image-canvas-editor__generation-ref span {