修复快速编辑润色结果未回填
- 为快速编辑输入区绑定编辑器句柄 - 润色回调同时更新面板状态与编辑器文本
This commit is contained in:
@@ -105,7 +105,10 @@ import {
|
||||
type LocalGamePreviewInspectSelection,
|
||||
resolveEmbeddedPreviewUrl,
|
||||
} from '../../features/project-workspace/LocalGamePreviewFrame';
|
||||
import { ResourceReferenceInput } from '../../features/project-workspace/ResourceReferenceInput';
|
||||
import {
|
||||
ResourceReferenceInput,
|
||||
type ResourceReferenceInputHandle,
|
||||
} from '../../features/project-workspace/ResourceReferenceInput';
|
||||
import {
|
||||
type ChatComposerDraft,
|
||||
dispatchResourceReferenceInsert,
|
||||
@@ -1554,6 +1557,9 @@ export default function ProjectDevelopmentView({
|
||||
useState<CanvasLayer | null>(null);
|
||||
const [quickEditPanel, setQuickEditPanel] =
|
||||
useState<QuickEditPanelState | null>(null);
|
||||
const quickEditPromptInputRef = useRef<ResourceReferenceInputHandle | null>(
|
||||
null,
|
||||
);
|
||||
/**
|
||||
* 快速编辑提示词里的 `@` 资源引用。
|
||||
*
|
||||
@@ -6484,6 +6490,7 @@ export default function ProjectDevelopmentView({
|
||||
* 失败的那份请求,状态回到 idle、错误清空——同时提交侧会按新提示词重铸请求身份。
|
||||
*/
|
||||
const applyResourceQuickEditPrompt = useCallback((text: string) => {
|
||||
quickEditPromptInputRef.current?.replaceText(text);
|
||||
setQuickEditPanel((current) =>
|
||||
current
|
||||
? {
|
||||
@@ -8122,6 +8129,7 @@ export default function ProjectDevelopmentView({
|
||||
// 由它拼装,因此出站 payload 与聊天 `@` 一致。
|
||||
<div className="resource-canvas-quick-edit-prompt-input">
|
||||
<ResourceReferenceInput
|
||||
ref={quickEditPromptInputRef}
|
||||
key={quickEditSourceLayer?.id}
|
||||
ariaLabel="快速编辑提示词"
|
||||
initialDraft={{
|
||||
|
||||
Reference in New Issue
Block a user