隐藏文字编辑实现细节并接通侧栏快捷按钮
This commit is contained in:
parent
927514ad6b
commit
a8b078b8ae
@ -293,14 +293,23 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理图片操作(占位函数,后续实现具体逻辑)
|
// 处理图片操作(通过事件分发到选中图片节点执行)
|
||||||
const handleAction = (action: string) => {
|
const handleAction = (action: string) => {
|
||||||
if (!selectedImageNode) {
|
if (!selectedImageNode) {
|
||||||
toast.error("请先选择一张图片");
|
toast.error("请先选择一张图片");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toast.info(`${action} 功能开发中...`);
|
|
||||||
// TODO: 实现具体的图片处理逻辑
|
if (typeof window !== "undefined") {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("canvas:image-action", {
|
||||||
|
detail: {
|
||||||
|
nodeId: selectedImageNode.id,
|
||||||
|
action,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// AI 生成图片
|
// AI 生成图片
|
||||||
|
|||||||
@ -742,6 +742,24 @@ export function ImageNode({ node, isSelected }: ImageNodeProps) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window === "undefined") return;
|
||||||
|
|
||||||
|
const onExternalAction = (event: Event) => {
|
||||||
|
const customEvent = event as CustomEvent<{ nodeId?: string; action?: string }>;
|
||||||
|
const targetNodeId = customEvent.detail?.nodeId;
|
||||||
|
const action = customEvent.detail?.action;
|
||||||
|
|
||||||
|
if (!targetNodeId || !action || targetNodeId !== node.id) return;
|
||||||
|
void handleAction(action);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("canvas:image-action", onExternalAction as EventListener);
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("canvas:image-action", onExternalAction as EventListener);
|
||||||
|
};
|
||||||
|
}, [handleAction, node.id]);
|
||||||
|
|
||||||
// 角度编辑完成回调
|
// 角度编辑完成回调
|
||||||
const handleAngleEditComplete = (resultUrl: string) => {
|
const handleAngleEditComplete = (resultUrl: string) => {
|
||||||
// 创建新的图片节点显示结果
|
// 创建新的图片节点显示结果
|
||||||
@ -1437,7 +1455,7 @@ export function ImageNode({ node, isSelected }: ImageNodeProps) {
|
|||||||
|
|
||||||
<div className="px-4 py-3 space-y-3 max-h-[360px] overflow-y-auto">
|
<div className="px-4 py-3 space-y-3 max-h-[360px] overflow-y-auto">
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
自动调用 Qwen3VL 识别图片文字。确认后将调用火山生图模型替换文字,并尽可能保持原字体形状。
|
识别图片文字后可逐条修改或删除,应用后会在保持画面风格的前提下完成文字更新。
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{isDetectingText && (
|
{isDetectingText && (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user