feat(canvas): 新增画布设置入口、区域选择滚轮平移与提交流程快捷键
Publish container images / Quality checks (push) Has been cancelled
Publish container images / Resolve build version (push) Has been cancelled
Publish container images / Build open-ai-canvas-backend (amd64) (push) Has been cancelled
Publish container images / Build open-ai-canvas-backend (arm64) (push) Has been cancelled
Publish container images / Build open-ai-canvas-web (multi) (push) Has been cancelled
Publish container images / Publish open-ai-canvas-backend manifest (push) Has been cancelled
Publish container images / Publish open-ai-canvas-web manifest (push) Has been cancelled
Publish container images / Publish release assets (push) Has been cancelled

This commit is contained in:
tongtong committed 2026-09-22 13:17:56 +08:00
1 parent 3c25511f47
commit c8cde54c41
6 files changed
+40 -5

No files matched your search

@@ -1,5 +1,5 @@
import { motion, useReducedMotion } from "motion/react";
import { useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode, type RefObject } from "react";
import { useLayoutEffect, useRef, useState, type CSSProperties, type KeyboardEvent as ReactKeyboardEvent, type ReactNode, type RefObject } from "react";
import { Clapperboard, Image as ImageIcon, List, Music2, Pencil, Table2, Video, WandSparkles, Workflow as WorkflowIcon } from "lucide-react";
import { useCanvasOverlayLayer } from "@/components/canvas/canvas-overlay-layer";
@@ -160,6 +160,19 @@ export function CanvasNodePanelOverlay({
};
}, [containerRef, dragOffset?.x, dragOffset?.y, isDragging, node.height, node.id, node.position.x, node.position.y, node.width, panelHeight, panelWidth, viewport]);
// 面板内任意位置按下 ⌘/Ctrl + Enter 时直接提交,避免先把手移回输入框或生成按钮。
// 只有面板自己声明了主按钮([data-canvas-panel-submit])才生效,且按钮禁用时不拦截按键。
const handleSubmitShortcut = (event: ReactKeyboardEvent<HTMLDivElement>) => {
if (event.key !== "Enter" || event.shiftKey || event.altKey) return;
if (!(event.ctrlKey || event.metaKey)) return;
if (event.nativeEvent.isComposing) return;
const submit = panelRef.current?.querySelector<HTMLButtonElement>("[data-canvas-panel-submit]");
if (!submit || submit.disabled || submit.getAttribute("aria-disabled") === "true") return;
event.preventDefault();
event.stopPropagation();
submit.click();
};
return (
<div
ref={panelRef}
@@ -167,6 +180,7 @@ export function CanvasNodePanelOverlay({
data-canvas-node-panel
className={`thin-scrollbar absolute max-w-[calc(100%_-_24px)] ${allowOverflow ? "overflow-visible" : "overflow-y-auto"}`}
style={{ left: 0, top: 0, transform: `translate3d(${initialPosition.left}px, ${initialPosition.top}px, 0)`, width: initialWidth, maxHeight: allowOverflow ? "none" : "calc(100% - 84px)", zIndex }}
onKeyDownCapture={handleSubmitShortcut}
onMouseDown={(event) => event.stopPropagation()}
onPointerDownCapture={bringToFront}
onFocusCapture={bringToFront}