PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/Agent/components/ChatInput.jsx +13 -1 3.1.4 → trunk View file →
@@ -1,8 +1,10 @@
1 +import { useCanvasAssist } from '@agent/components/Canvas';
1 2 import { PageDocument } from '@agent/components/PageDocument';
2 3 import { cancelRequest } from '@agent/icons';
3 4 import { useChatStore } from '@agent/state/chat';
4 5 import { useWorkflowStore } from '@agent/state/workflows';
6 +import { askAiTarget } from '@quick-edit/lib/hover-bar';
5 7 import { useQuickEditStore } from '@quick-edit/state/store';
6 8 import {
7 9 useCallback,
8 10 useEffect,
@@ -36,8 +38,9 @@
36 38 const [history, setHistory] = useState([]);
37 39 const dirtyRef = useRef(false);
38 40 const [historyIndex, setHistoryIndex] = useState(null);
39 41 const { workflow } = useWorkflowStore();
42 + const canvasAssist = useCanvasAssist();
40 43 const block = useQuickEditStore((s) => s.agentBlock);
41 44 // Quick Edit's modals mount off `selected` too, so this covers them.
42 45 const editing = useQuickEditStore((s) => Boolean(s.selected));
43 46 const INPUT_LIMIT = 1500;
@@ -42,9 +45,10 @@
42 45 const editing = useQuickEditStore((s) => Boolean(s.selected));
43 46 const INPUT_LIMIT = 1500;
44 47 const inputTrimmed = input.trim();
45 48 const overLimit = inputTrimmed.length > INPUT_LIMIT;
46 - const busy = disabled || Boolean(workflow?.id);
49 + // The workflow stays set with a canvas open, so this would show cancel.
50 + const busy = disabled || (Boolean(workflow?.id) && !canvasAssist);
47 51 const inputDisabled = disabled || editing;
48 52
49 53 // resize the height of the textarea based on the content
50 54 const adjustHeight = useCallback(() => {
@@ -149,8 +153,15 @@
149 153 },
150 154 [history, historyIndex, submitForm, overLimit],
151 155 );
152 156
157 + // Typing beside a pinned bar is a request about that block.
158 + const stagePinnedSelection = useCallback(() => {
159 + const { committedSelection, agentBlock } = useQuickEditStore.getState();
160 + if (!committedSelection?.el || agentBlock) return;
161 + askAiTarget(committedSelection.el);
162 + }, []);
163 +
153 164 const handleCancel = useCallback((e) => {
154 165 e.stopPropagation();
155 166 window.dispatchEvent(new CustomEvent('extendify-agent:cancel-workflow'));
156 167 }, []);
@@ -190,8 +201,9 @@
190 201 setHistoryIndex(null);
191 202 adjustHeight();
192 203 }}
193 204 onKeyDown={handleKeyDown}
205 + onFocus={stagePinnedSelection}
194 206 />
195 207 <div className="flex justify-between gap-4 px-2 pb-2">
196 208 <div className="ms-auto flex items-center gap-1">
197 209 <span