fix(canvas): restore home prompt in editor and preserve launch auto-send payload
This commit is contained in:
parent
fb7b9a2009
commit
82e6f5e947
@ -1621,8 +1621,6 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
pendingLaunchRef.current = null;
|
|
||||||
|
|
||||||
if (typeof window === "undefined") return;
|
if (typeof window === "undefined") return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1666,6 +1664,22 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
const editableDiv = textareaRef.current as HTMLDivElement | null;
|
||||||
|
if (editableDiv) {
|
||||||
|
editableDiv.innerHTML = "";
|
||||||
|
if (normalizedPrompt) {
|
||||||
|
editableDiv.appendChild(document.createTextNode(normalizedPrompt));
|
||||||
|
const selection = window.getSelection();
|
||||||
|
if (selection) {
|
||||||
|
const range = document.createRange();
|
||||||
|
range.selectNodeContents(editableDiv);
|
||||||
|
range.collapse(false);
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(range);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
normalizedAttachments.forEach((attachment, index) => {
|
normalizedAttachments.forEach((attachment, index) => {
|
||||||
insertImageTagInEditor(attachment.url, attachment.name, index);
|
insertImageTagInEditor(attachment.url, attachment.name, index);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user