修复编辑器登录和背景设置回归
恢复编辑器接口 401 / 403 触发登录弹窗 补齐未登录上传登录后续传和上传失败提示 恢复画布背景设置面板并支持预设色、自定义颜色、HEX 输入和默认恢复 补充编辑器回归测试和 TRACKING 验证记录
This commit is contained in:
@@ -108,3 +108,4 @@
|
||||
- 2026-06-14 组件复用修正:编辑器侧栏素材和图层缩略图通过 `SidebarMediaItem` 改为复用 `PlatformMediaFrame`,删除缩略图内部图片填充的重复 CSS,统一媒体预览框和 fallback 结构;验证命令:`npm run test -- src/components/image-editor/ImageCanvasEditorPrimitives.test.tsx src/components/image-editor/ImageCanvasEditorView.test.tsx src/components/common/PlatformMediaFrame.test.tsx`、`npm run typecheck`。
|
||||
- 2026-06-14 组件复用修正:画布图片 hover 尺寸标签改为复用 `PlatformPillBadge tone="lightOverlay"`,局部 CSS 只保留定位和深色覆盖,不再重复维护 badge 的圆角、字号和基础排版;验证命令:`npm run test -- src/components/image-editor/ImageCanvasEditorView.test.tsx src/components/common/PlatformPillBadge.test.tsx`、`npm run typecheck`。
|
||||
- 2026-06-14 组件复用修正:生成跟随框的关闭按钮改为复用 `PlatformIconButton variant="surfaceFloating"`,编辑器薄包装 `EditorIconButton` 增加 variant 透传,删除局部关闭按钮基础 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-16 编辑器回归修正:工程 / 素材 / 上传等编辑器请求恢复全局 401 / 403 登录弹窗;未登录上传会先弹登录并在登录后续传;画布背景入口恢复为 `画布背景设置` 面板,支持预设色、自定义颜色、HEX 输入、非法值不应用、恢复默认和 Escape 关闭。验证命令:`npm run test -- src/components/image-editor/ImageCanvasEditorView.test.tsx src/services/image-editor/editorProjectClient.test.ts`、`npm run typecheck`、`npm run check:encoding`、`git diff --check`;浏览器 smoke:`http://127.0.0.1:10006/editor/canvas` 未登录打开 `账号入口`,登录后上传素材成功,背景面板打开后点击“暖灰”使画布背景变为 `rgb(243, 240, 234)`。
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
409
src/index.css
409
src/index.css
@@ -3329,6 +3329,7 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
}
|
||||
|
||||
.image-canvas-editor__icon-button,
|
||||
.image-canvas-editor__project-back-button,
|
||||
.image-canvas-editor__floating-toolbar button,
|
||||
.image-canvas-editor__bottom-toolbar button,
|
||||
.image-canvas-editor__reset-button {
|
||||
@@ -3440,6 +3441,38 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
font-weight: 820;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-folder--move-target
|
||||
> .image-canvas-editor__asset-folder-header {
|
||||
border-color: #93c5fd;
|
||||
background: #eff6ff;
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-folder-sticky-target {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 8;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 0.45rem;
|
||||
border: 1px solid #93c5fd;
|
||||
border-radius: 0.45rem;
|
||||
background: #eff6ff;
|
||||
padding: 0.38rem 0.5rem;
|
||||
color: #1d4ed8;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 880;
|
||||
box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-folder-sticky-target span {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-folder-list {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
@@ -3473,6 +3506,80 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
background: #dbeafe;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-row--uploading {
|
||||
border-color: #bfdbfe;
|
||||
background: #f8fbff;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-row--uploading:hover {
|
||||
transform: none;
|
||||
border-color: #93c5fd;
|
||||
background: #f8fbff;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-row--upload-failed {
|
||||
border-color: #fecaca;
|
||||
background: #fff7f7;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-drag-preview {
|
||||
position: fixed;
|
||||
z-index: 80;
|
||||
max-width: 11rem;
|
||||
transform: translate(-50%, -50%);
|
||||
border: 1px solid #bfdbfe;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.96);
|
||||
padding: 0.4rem 0.65rem;
|
||||
color: #1d4ed8;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 880;
|
||||
pointer-events: none;
|
||||
box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-upload-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgba(248, 250, 252, 0.74);
|
||||
color: #1d4ed8;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 880;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-upload-progress {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
color: #64748b;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 780;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-upload-progress > div {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-upload-progress progress {
|
||||
width: 100%;
|
||||
height: 0.35rem;
|
||||
overflow: hidden;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-upload-progress progress::-webkit-progress-bar {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-upload-progress progress::-webkit-progress-value {
|
||||
background: #2563eb;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-batch-toolbar {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
@@ -3496,6 +3603,41 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.image-canvas-editor__upload-drop-overlay {
|
||||
position: absolute;
|
||||
z-index: 30;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
align-content: center;
|
||||
gap: 0.25rem;
|
||||
border: 1px dashed #60a5fa;
|
||||
background: rgba(239, 246, 255, 0.72);
|
||||
color: #1d4ed8;
|
||||
text-align: center;
|
||||
pointer-events: none;
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
|
||||
.image-canvas-editor__upload-drop-overlay span {
|
||||
font-size: 0.82rem;
|
||||
font-weight: 820;
|
||||
}
|
||||
|
||||
.image-canvas-editor__upload-drop-overlay strong {
|
||||
font-size: 1rem;
|
||||
font-weight: 920;
|
||||
}
|
||||
|
||||
.image-canvas-editor__upload-drop-overlay--assets {
|
||||
inset: 0.45rem;
|
||||
border-radius: 0.55rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__upload-drop-overlay--canvas {
|
||||
inset: 0.85rem;
|
||||
border-radius: 0.65rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__asset-button {
|
||||
display: block;
|
||||
border: 0;
|
||||
@@ -3702,7 +3844,83 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
padding: 0.55rem 0.7rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__topbar-actions {
|
||||
display: inline-flex;
|
||||
min-width: 0;
|
||||
flex: 0 1 auto;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-back-button {
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
flex: 0 0 auto;
|
||||
border-radius: 0.45rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-title-row {
|
||||
display: inline-flex;
|
||||
min-width: 0;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-title-button {
|
||||
min-width: 0;
|
||||
max-width: min(24rem, 42vw);
|
||||
border: 0;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-title-button h1 {
|
||||
overflow: hidden;
|
||||
max-width: 100%;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-rename-button {
|
||||
opacity: 0;
|
||||
transition: opacity 140ms ease;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-title-row:hover
|
||||
.image-canvas-editor__project-rename-button,
|
||||
.image-canvas-editor__project-rename-button:focus-visible {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-title-form {
|
||||
display: inline-flex;
|
||||
min-width: 0;
|
||||
max-width: min(34rem, 58vw);
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-title-input {
|
||||
width: clamp(9rem, 28vw, 18rem);
|
||||
}
|
||||
|
||||
.image-canvas-editor__project-title-error {
|
||||
max-width: 10rem;
|
||||
overflow: hidden;
|
||||
color: #dc2626;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 760;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.image-canvas-editor__zoom-menu-wrap {
|
||||
margin-left: auto;
|
||||
position: relative;
|
||||
z-index: 20;
|
||||
display: inline-flex;
|
||||
@@ -3800,6 +4018,19 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.image-canvas-editor__layer--locked {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.image-canvas-editor__layer--locked::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -0.28rem;
|
||||
border: 1px dashed rgba(71, 85, 105, 0.55);
|
||||
border-radius: 0.32rem;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.image-canvas-editor__layer--generating {
|
||||
cursor: progress;
|
||||
}
|
||||
@@ -4227,30 +4458,104 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
height: 0.9rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-menu {
|
||||
display: inline-flex;
|
||||
gap: 0.25rem;
|
||||
padding: 0.32rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-menu-item {
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
border-radius: 0.4rem;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-menu-item[aria-pressed='true'] {
|
||||
border-color: #38bdf8;
|
||||
background: #e0f2fe;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-swatch {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-panel {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: calc(100% + 0.55rem);
|
||||
z-index: 24;
|
||||
display: grid;
|
||||
width: min(18.5rem, calc(100vw - 1.5rem));
|
||||
gap: 0.62rem;
|
||||
border: 1px solid rgba(148, 163, 184, 0.32);
|
||||
border-radius: 0.82rem;
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
padding: 0.72rem;
|
||||
color: #1f2937;
|
||||
box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 880;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-preview {
|
||||
width: 2rem;
|
||||
height: 1.35rem;
|
||||
flex: 0 0 auto;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 0.42rem;
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-presets {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 0.42rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-preset {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
justify-items: center;
|
||||
gap: 0.26rem;
|
||||
border: 1px solid #d7dfe9;
|
||||
border-radius: 0.58rem;
|
||||
background: #ffffff;
|
||||
padding: 0.44rem 0.28rem;
|
||||
color: #475569;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 820;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-preset[aria-pressed='true'] {
|
||||
border-color: #38bdf8;
|
||||
background: #e0f2fe;
|
||||
color: #0369a1;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-field {
|
||||
display: grid;
|
||||
grid-template-columns: 4.1rem minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
color: #64748b;
|
||||
font-size: 0.74rem;
|
||||
font-weight: 840;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-field input[type='color'] {
|
||||
width: 100%;
|
||||
height: 2rem;
|
||||
border: 1px solid #d7dfe9;
|
||||
border-radius: 0.56rem;
|
||||
background: #ffffff;
|
||||
padding: 0.16rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-field--hex .platform-text-field {
|
||||
font-family:
|
||||
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
|
||||
'Courier New', monospace;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
.image-canvas-editor__background-reset {
|
||||
justify-self: end;
|
||||
gap: 0.34rem;
|
||||
border-radius: 0.56rem;
|
||||
padding-inline: 0.65rem;
|
||||
}
|
||||
|
||||
.image-canvas-editor__panel-dock button:hover,
|
||||
.image-canvas-editor__panel-dock button[aria-pressed='true'] {
|
||||
transform: translateY(-1px);
|
||||
@@ -4951,8 +5256,51 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
|
||||
.image-canvas-editor__context-menu {
|
||||
position: fixed;
|
||||
z-index: 28;
|
||||
min-width: 9rem;
|
||||
z-index: 35;
|
||||
display: grid;
|
||||
width: 11.75rem;
|
||||
gap: 0.12rem;
|
||||
border: 1px solid rgba(203, 213, 225, 0.95);
|
||||
border-radius: 0.5rem;
|
||||
background: #ffffff;
|
||||
padding: 0.32rem;
|
||||
box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.image-canvas-editor__context-menu button {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
min-height: 1.82rem;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
border: 0;
|
||||
border-radius: 0.34rem;
|
||||
background: transparent;
|
||||
padding: 0 0.55rem;
|
||||
color: inherit;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 820;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.image-canvas-editor__context-menu button:hover:not(:disabled) {
|
||||
background: #eef6ff;
|
||||
color: #0f4a87;
|
||||
}
|
||||
|
||||
.image-canvas-editor__context-menu button:disabled {
|
||||
cursor: not-allowed;
|
||||
color: #a3acba;
|
||||
}
|
||||
|
||||
.image-canvas-editor__context-menu hr {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
margin: 0.18rem 0;
|
||||
border: 0;
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.image-canvas-editor__context-menu-item {
|
||||
@@ -4960,6 +5308,15 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.image-canvas-editor__context-menu-danger {
|
||||
color: #b42318 !important;
|
||||
}
|
||||
|
||||
.image-canvas-editor__context-menu-danger:hover:not(:disabled) {
|
||||
background: #fff1f2 !important;
|
||||
color: #991b1b !important;
|
||||
}
|
||||
|
||||
.image-canvas-editor__quick-edit-panel {
|
||||
position: absolute;
|
||||
z-index: 14;
|
||||
@@ -5126,7 +5483,10 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
}
|
||||
|
||||
.image-canvas-editor__metadata-dialog {
|
||||
border: 1px solid rgba(226, 232, 240, 0.92);
|
||||
background: #ffffff;
|
||||
color: #1f2937;
|
||||
box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
.image-canvas-editor__metadata-body {
|
||||
@@ -12497,3 +12857,10 @@ button {
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #3f3f46;
|
||||
}
|
||||
|
||||
.image-canvas-editor__metadata-dialog.platform-modal-shell {
|
||||
border-color: rgba(226, 232, 240, 0.92) !important;
|
||||
background: #ffffff !important;
|
||||
color: #1f2937 !important;
|
||||
box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18) !important;
|
||||
}
|
||||
|
||||
@@ -61,10 +61,6 @@ describe('editorProjectClient', () => {
|
||||
'/api/editor/projects/recent',
|
||||
{ method: 'GET' },
|
||||
'读取图片画布工程失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -102,10 +98,6 @@ describe('editorProjectClient', () => {
|
||||
body: JSON.stringify({ title: '未命名画布' }),
|
||||
}),
|
||||
'创建图片画布工程失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -151,10 +143,6 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
}),
|
||||
'保存图片画布工程失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -187,10 +175,6 @@ describe('editorProjectClient', () => {
|
||||
'/api/editor/projects',
|
||||
{ method: 'GET' },
|
||||
'读取图片画布工程列表失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -221,10 +205,6 @@ describe('editorProjectClient', () => {
|
||||
'/api/editor/projects/editor-project-1',
|
||||
{ method: 'GET' },
|
||||
'读取图片画布工程失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -262,14 +242,12 @@ describe('editorProjectClient', () => {
|
||||
body: JSON.stringify({ title: '新标题' }),
|
||||
}),
|
||||
'重命名图片画布工程失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(requestJsonMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
'/api/editor/projects/editor-project-1',
|
||||
{ method: 'DELETE' },
|
||||
'删除图片画布工程失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -316,10 +294,6 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
}),
|
||||
'创建图片画布资源失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -377,7 +351,6 @@ describe('editorProjectClient', () => {
|
||||
'/api/editor/assets/library',
|
||||
{ method: 'GET' },
|
||||
'读取图片画布素材库失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(requestJsonMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
@@ -387,7 +360,6 @@ describe('editorProjectClient', () => {
|
||||
body: JSON.stringify({ label: '角色', sortOrder: 100 }),
|
||||
}),
|
||||
'创建图片画布素材文件夹失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(requestJsonMock).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
@@ -397,14 +369,12 @@ describe('editorProjectClient', () => {
|
||||
body: JSON.stringify({ label: '角色参考', collapsed: true }),
|
||||
}),
|
||||
'更新图片画布素材文件夹失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(requestJsonMock).toHaveBeenNthCalledWith(
|
||||
4,
|
||||
'/api/editor/assets/folders/folder-role',
|
||||
{ method: 'DELETE' },
|
||||
'删除图片画布素材文件夹失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -473,7 +443,6 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
}),
|
||||
'创建图片画布素材失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(requestJsonMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
@@ -486,14 +455,12 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
}),
|
||||
'更新图片画布素材失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(requestJsonMock).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
'/api/editor/assets/asset-1',
|
||||
{ method: 'DELETE' },
|
||||
'删除图片画布素材失败',
|
||||
expect.any(Object),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -527,10 +494,6 @@ describe('editorProjectClient', () => {
|
||||
body: JSON.stringify({ title: '角色设定板' }),
|
||||
}),
|
||||
'创建图片画布工程失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -559,8 +522,6 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
'生成图片失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: { maxRetries: 0 },
|
||||
}),
|
||||
@@ -648,8 +609,6 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
'生成图标素材失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: { maxRetries: 0 },
|
||||
}),
|
||||
@@ -795,8 +754,6 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
'生成角色动画失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: { maxRetries: 0 },
|
||||
}),
|
||||
@@ -838,8 +795,6 @@ describe('editorProjectClient', () => {
|
||||
}),
|
||||
'修改图片失败',
|
||||
expect.objectContaining({
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: { maxRetries: 0 },
|
||||
}),
|
||||
|
||||
@@ -10,10 +10,6 @@ const EDITOR_CHARACTER_ANIMATION_GENERATION_API =
|
||||
'/api/editor/character-animations/generations';
|
||||
const EDITOR_IMAGE_MODEL_NANOBANANA2 = 'gemini-3.1-flash-image-preview';
|
||||
const DEFAULT_PROJECT_TITLE = '未命名画布';
|
||||
const EDITOR_PROJECT_REQUEST_OPTIONS = {
|
||||
clearAuthOnUnauthorized: false,
|
||||
notifyAuthStateChange: false,
|
||||
};
|
||||
|
||||
export type EditorCanvasViewport = {
|
||||
x: number;
|
||||
@@ -299,7 +295,6 @@ export async function listEditorProjects() {
|
||||
EDITOR_PROJECT_API_BASE,
|
||||
{ method: 'GET' },
|
||||
'读取图片画布工程列表失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.projects;
|
||||
}
|
||||
@@ -309,7 +304,6 @@ export async function loadRecentEditorProject() {
|
||||
`${EDITOR_PROJECT_API_BASE}/recent`,
|
||||
{ method: 'GET' },
|
||||
'读取图片画布工程失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -322,7 +316,6 @@ export async function createEditorProject(
|
||||
title: input.title?.trim() || DEFAULT_PROJECT_TITLE,
|
||||
}),
|
||||
'创建图片画布工程失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.project;
|
||||
}
|
||||
@@ -340,7 +333,6 @@ export async function loadEditorProject(projectId: string) {
|
||||
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}`,
|
||||
{ method: 'GET' },
|
||||
'读取图片画布工程失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.project;
|
||||
}
|
||||
@@ -350,7 +342,6 @@ export async function renameEditorProject(projectId: string, title: string) {
|
||||
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}/metadata`,
|
||||
jsonRequest('PATCH', { title }),
|
||||
'重命名图片画布工程失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.project;
|
||||
}
|
||||
@@ -360,7 +351,6 @@ export async function deleteEditorProject(projectId: string) {
|
||||
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}`,
|
||||
{ method: 'DELETE' },
|
||||
'删除图片画布工程失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.deletedProjectId;
|
||||
}
|
||||
@@ -376,7 +366,6 @@ export async function saveEditorProjectLayout(
|
||||
layers: input.layers,
|
||||
}),
|
||||
'保存图片画布工程失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.project;
|
||||
}
|
||||
@@ -389,7 +378,6 @@ export async function createEditorProjectResource(
|
||||
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}/resources`,
|
||||
jsonRequest('POST', { ...input }),
|
||||
'创建图片画布资源失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.resource;
|
||||
}
|
||||
@@ -399,7 +387,6 @@ export async function loadEditorAssetLibrary() {
|
||||
`${EDITOR_ASSET_API_BASE}/library`,
|
||||
{ method: 'GET' },
|
||||
'读取图片画布素材库失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.library;
|
||||
}
|
||||
@@ -412,7 +399,6 @@ export async function createEditorAssetFolder(
|
||||
`${EDITOR_ASSET_API_BASE}/folders`,
|
||||
jsonRequest('POST', { label, sortOrder }),
|
||||
'创建图片画布素材文件夹失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.folder;
|
||||
}
|
||||
@@ -425,7 +411,6 @@ export async function updateEditorAssetFolder(
|
||||
`${EDITOR_ASSET_API_BASE}/folders/${encodeURIComponent(folderId)}`,
|
||||
jsonRequest('PATCH', input),
|
||||
'更新图片画布素材文件夹失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.folder;
|
||||
}
|
||||
@@ -435,7 +420,6 @@ export async function deleteEditorAssetFolder(folderId: string) {
|
||||
`${EDITOR_ASSET_API_BASE}/folders/${encodeURIComponent(folderId)}`,
|
||||
{ method: 'DELETE' },
|
||||
'删除图片画布素材文件夹失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.library;
|
||||
}
|
||||
@@ -445,7 +429,6 @@ export async function createEditorAsset(input: EditorAssetCreateInput) {
|
||||
EDITOR_ASSET_API_BASE,
|
||||
jsonRequest('POST', input),
|
||||
'创建图片画布素材失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.asset;
|
||||
}
|
||||
@@ -458,7 +441,6 @@ export async function updateEditorAsset(
|
||||
`${EDITOR_ASSET_API_BASE}/${encodeURIComponent(assetId)}`,
|
||||
jsonRequest('PATCH', input),
|
||||
'更新图片画布素材失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.asset;
|
||||
}
|
||||
@@ -468,7 +450,6 @@ export async function deleteEditorAsset(assetId: string) {
|
||||
`${EDITOR_ASSET_API_BASE}/${encodeURIComponent(assetId)}`,
|
||||
{ method: 'DELETE' },
|
||||
'删除图片画布素材失败',
|
||||
EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
);
|
||||
return response.asset;
|
||||
}
|
||||
@@ -489,7 +470,6 @@ export async function generateEditorImage(input: EditorImageGenerationInput) {
|
||||
}),
|
||||
'生成图片失败',
|
||||
{
|
||||
...EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: {
|
||||
maxRetries: 0,
|
||||
@@ -512,7 +492,6 @@ export async function generateEditorIconSpritesheet(
|
||||
}),
|
||||
'生成图标素材失败',
|
||||
{
|
||||
...EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: {
|
||||
maxRetries: 0,
|
||||
@@ -532,7 +511,6 @@ export async function editEditorImage(input: EditorImageEditInput) {
|
||||
}),
|
||||
'修改图片失败',
|
||||
{
|
||||
...EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: {
|
||||
maxRetries: 0,
|
||||
@@ -549,7 +527,6 @@ export async function generateEditorCharacterAnimation(
|
||||
jsonRequest('POST', input),
|
||||
'生成角色动画失败',
|
||||
{
|
||||
...EDITOR_PROJECT_REQUEST_OPTIONS,
|
||||
timeoutMs: 1_200_000,
|
||||
retry: {
|
||||
maxRetries: 0,
|
||||
|
||||
Reference in New Issue
Block a user