清理资源工作台合并残留
Project CI / Frontend tests (pull_request) Successful in 3m15s
Project CI / Backend tests (pull_request) Successful in 4m0s
Project CI / Repository checks (pull_request) Successful in 51s
Project CI / Native shell tests (pull_request) Failing after 11m18s

移除已被资源卡预览 Hook 替代的旧媒体辅助实现
按仓库规则统一资源工作台导入顺序
This commit is contained in:
2026-08-12 12:03:25 +08:00
parent 80403e5097
commit 40f5ec3146
@@ -61,6 +61,11 @@ import {
LocalGamePreviewFrame,
resolveEmbeddedPreviewUrl,
} from '../../features/project-workspace/LocalGamePreviewFrame';
import {
type ProjectManifestSnapshotMetadata,
resolveResourceFocusIntent,
type ResourceFocusIntent,
} from './projectResourceLiveUpdateModel';
import {
RESOURCE_CANVAS_CARD_HEIGHT,
RESOURCE_CANVAS_CARD_WIDTH,
@@ -71,11 +76,6 @@ import {
type ProjectResourceCardPreviewState,
summarizeProjectResourceDocument,
} from './resourceCardPreviewModel';
import {
type ProjectManifestSnapshotMetadata,
resolveResourceFocusIntent,
type ResourceFocusIntent,
} from './projectResourceLiveUpdateModel';
import {
EMPTY_PROJECT_RESOURCE_GRAPH,
normalizeProjectResourceGraph,
@@ -214,13 +214,6 @@ type NormalizeLocalProjectRasterResourceResult = {
manifest: GameCreationAppManifest;
};
type LocalProjectImagePreview = {
path: string;
mediaType: string;
byteLen: number;
dataUrl: string;
};
export type ProjectAgentRuntimeSummary = {
group: GameCreationAppAgentGroup;
label: string;
@@ -306,52 +299,11 @@ const approvalOptions: Array<{
},
];
function isRasterImageResource(resource: ProjectResource) {
const mediaType = resource.mediaType.toLowerCase();
return (
['image/png', 'image/jpeg', 'image/jpg', 'image/webp'].includes(
mediaType,
) || /\.(png|jpe?g|webp)$/iu.test(resource.path)
);
}
function assetNameFromLocalPath(localPath: string) {
const fileName = localPath.split(/[\\/]/u).filter(Boolean).pop() ?? '';
return fileName.replace(/\.[^.]+$/u, '').trim() || '';
}
function isExtendedArtMediaResource(resource: ProjectResource) {
const mediaType = resource.mediaType.toLowerCase();
return (
resource.category === 'art' &&
(mediaType === 'image/svg+xml' ||
mediaType.startsWith('video/') ||
/\.(gif|svg|avif|bmp|mp4|webm|mov)$/iu.test(resource.path))
);
}
function mediaPreviewErrorMessage(error: unknown) {
const message = error instanceof Error ? error.message : String(error);
if (message.includes('项目权限策略要求用户确认')) {
return '当前项目策略要求先确认读取资源';
}
if (message.includes('项目权限策略拒绝执行')) {
return '当前项目策略不允许读取资源';
}
if (message.includes('不能超过')) {
return message;
}
if (message.includes('UTF-8') || message.includes('只支持')) {
return message;
}
if (message.includes('脚本或外部资源引用')) {
return message;
}
if (message.includes('发生漂移') || message.includes('发生替换')) {
return '资源读取期间发生变化,请关闭后重试';
}
return '资源暂时无法读取,请关闭后重试';
}
function formatMediaDuration(duration: number | null) {
if (duration === null || !Number.isFinite(duration) || duration < 0) {
return '载入后显示';