mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-08-06 01:14:36 +08:00
feat(canvas): retain prompt input after node generation completion
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
+ [新增] 左侧画布面板新增「提示词库」Tab,按来源折叠分组。
|
+ [新增] 左侧画布面板新增「提示词库」Tab,按来源折叠分组。
|
||||||
+ [修复] 处于「提示词库/资产」Tab 时拖动画布元素卡顿,面板内容不再随节点更新重渲染。
|
+ [修复] 处于「提示词库/资产」Tab 时拖动画布元素卡顿,面板内容不再随节点更新重渲染。
|
||||||
+ [新增] 提示词来源增加自定义脚本抓取功能、支持新增来源。
|
+ [新增] 提示词来源增加自定义脚本抓取功能、支持新增来源。
|
||||||
|
+ [优化] 画布节点生成完成后,输入框保留提示词内容,不再自动清空。
|
||||||
|
|
||||||
## v0.9.0 - 2026-07-17
|
## v0.9.0 - 2026-07-17
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ export function CanvasNodePromptPanel({ node, isRunning, onPromptChange, onConfi
|
|||||||
const isEditingExistingContent = hasTextContent || hasImageContent;
|
const isEditingExistingContent = hasTextContent || hasImageContent;
|
||||||
const [prompt, setPrompt] = useState(isEditingExistingContent ? "" : node.metadata?.prompt || "");
|
const [prompt, setPrompt] = useState(isEditingExistingContent ? "" : node.metadata?.prompt || "");
|
||||||
|
|
||||||
|
// 仅在切换到其它节点时重置输入框;同一节点生成完成后(内容写回自身导致 isEditingExistingContent 变化)保留用户输入
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPrompt(isEditingExistingContent ? "" : node.metadata?.prompt || "");
|
setPrompt(isEditingExistingContent ? "" : node.metadata?.prompt || "");
|
||||||
}, [isEditingExistingContent, node.id]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [node.id]);
|
||||||
|
|
||||||
const updatePrompt = (value: string) => {
|
const updatePrompt = (value: string) => {
|
||||||
setPrompt(value);
|
setPrompt(value);
|
||||||
@@ -52,7 +54,6 @@ export function CanvasNodePromptPanel({ node, isRunning, onPromptChange, onConfi
|
|||||||
const text = prompt.trim();
|
const text = prompt.trim();
|
||||||
if (!text || isRunning) return;
|
if (!text || isRunning) return;
|
||||||
onGenerate(node.id, mode, text);
|
onGenerate(node.id, mode, text);
|
||||||
setPrompt("");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user