陶泥儿表单移除字段复制按钮
- 删除陶泥儿表单每个文本字段的「复制」按钮接线 - 移除 taonierFields 的 copyable 元数据 - 清理测试里无用的剪贴板与文件保存替身
This commit is contained in:
+1
-6
@@ -27,8 +27,6 @@ export type TaonierFieldMeta = {
|
||||
/** 字数上限;分类是枚举,没有自由字数上限。 */
|
||||
maxChars?: number;
|
||||
multiline: boolean;
|
||||
/** 是否给一颗「复制」按钮。分类是枚举,复制一段选项名没有意义。 */
|
||||
copyable: boolean;
|
||||
/** 分类的候选值:有这一项时渲染成下拉选择。 */
|
||||
options?: readonly string[];
|
||||
};
|
||||
@@ -41,7 +39,7 @@ export const TAONIER_SUMMARY_MAX_CHARS = 120;
|
||||
const TITLE_MAX_CHARS = TAONIER_TITLE_MAX_CHARS;
|
||||
const SUMMARY_MAX_CHARS = TAONIER_SUMMARY_MAX_CHARS;
|
||||
|
||||
/** 表单展示顺序。加字段时只改这里,保存与复制都按字段身份走。 */
|
||||
/** 表单展示顺序。加字段时只改这里,保存与沿用都按字段身份走。 */
|
||||
export const TAONIER_FORM_FIELDS: readonly TaonierFieldMeta[] = [
|
||||
{
|
||||
field: 'title',
|
||||
@@ -49,7 +47,6 @@ export const TAONIER_FORM_FIELDS: readonly TaonierFieldMeta[] = [
|
||||
placeholder: `游戏广场里显示的名字,最多 ${TITLE_MAX_CHARS} 个字`,
|
||||
maxChars: TITLE_MAX_CHARS,
|
||||
multiline: false,
|
||||
copyable: true,
|
||||
},
|
||||
{
|
||||
field: 'summary',
|
||||
@@ -57,13 +54,11 @@ export const TAONIER_FORM_FIELDS: readonly TaonierFieldMeta[] = [
|
||||
placeholder: `游戏广场卡片上的一句话,最多 ${SUMMARY_MAX_CHARS} 个字`,
|
||||
maxChars: SUMMARY_MAX_CHARS,
|
||||
multiline: true,
|
||||
copyable: true,
|
||||
},
|
||||
{
|
||||
field: 'category',
|
||||
label: '分类',
|
||||
multiline: false,
|
||||
copyable: false,
|
||||
options: GAME_DISTRIBUTION_CATEGORIES,
|
||||
},
|
||||
];
|
||||
|
||||
+3
-9
@@ -18,7 +18,6 @@ import type {
|
||||
TaonierOnlineValues,
|
||||
} from '../../state/useTaonierExport';
|
||||
import { PaneButton } from '../common/PaneButton';
|
||||
import { CopyButton } from '../xiaohongshu/CopyButton';
|
||||
import { IconPreview } from '../xiaohongshu/IconPreview';
|
||||
|
||||
/**
|
||||
@@ -206,14 +205,9 @@ export function FormCard({
|
||||
}
|
||||
return (
|
||||
<div key={meta.field} className="grid gap-1.5">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className="text-xs font-medium text-(--platform-text-base)">
|
||||
{meta.label}
|
||||
</span>
|
||||
{meta.copyable ? (
|
||||
<CopyButton value={value} label={meta.label} />
|
||||
) : null}
|
||||
</div>
|
||||
<span className="text-xs font-medium text-(--platform-text-base)">
|
||||
{meta.label}
|
||||
</span>
|
||||
{inputSlot}
|
||||
{showOnline ? (
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
* - 状态 hook 的自动保存与入队(宿主命令参数、`baseHash` 回传、「校验不过不触宿主」,以及
|
||||
* 「适配才叫 agent」)。
|
||||
*/
|
||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
|
||||
import { save as saveNativeFileDialog } from '@tauri-apps/plugin-dialog';
|
||||
import {
|
||||
act,
|
||||
cleanup,
|
||||
@@ -20,7 +18,7 @@ import {
|
||||
screen,
|
||||
waitFor,
|
||||
} from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import type { TauriInvoke } from '../src/app/types';
|
||||
import type { TaonierExportForm } from '../src/view/project-development/export/generated/TaonierExportForm';
|
||||
@@ -61,8 +59,6 @@ import {
|
||||
} from '../src/view/project-development/export/tabs/taonier/ArtifactsPane';
|
||||
import { installTauriRuntime, resetTauriRuntime } from './tauriRuntimeFake';
|
||||
|
||||
vi.mock('@tauri-apps/plugin-dialog', () => ({ save: vi.fn() }));
|
||||
vi.mock('@tauri-apps/plugin-clipboard-manager', () => ({ writeText: vi.fn() }));
|
||||
// 图片选择走公共 AssetImporter:这里只钉「打开的是它、导入回调把路径写回表单」这条接线,
|
||||
// 它内部的文件树与两个来源由 `tests/assetImporter.test.ts` 自己覆盖。
|
||||
// 返回的素材默认一张;用例可临时改成多张来覆盖多选截图。
|
||||
@@ -210,11 +206,6 @@ function createInvoke(options?: {
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.mocked(writeText).mockResolvedValue(undefined);
|
||||
vi.mocked(saveNativeFileDialog).mockResolvedValue('/tmp/taonier.zip');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
resetTauriRuntime();
|
||||
|
||||
Reference in New Issue
Block a user