Skip to content

Commit 297cc57

Browse files
feat(editor): Auto-focus chat input when typing (#25317)
1 parent 794a8d6 commit 297cc57

4 files changed

Lines changed: 521 additions & 2 deletions

File tree

packages/frontend/editor-ui/src/features/ai/chatHub/ChatView.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import ChatGreetings from './components/ChatGreetings.vue';
6868
import { useChatPushHandler } from './composables/useChatPushHandler';
6969
import ChatArtifactViewer from './components/ChatArtifactViewer.vue';
7070
import { useChatArtifacts } from './composables/useChatArtifacts';
71+
import { useChatInputFocus } from './composables/useChatInputFocus';
7172
7273
const router = useRouter();
7374
const route = useRoute();
@@ -355,6 +356,10 @@ const canAcceptFiles = computed(() => {
355356
356357
const fileDrop = useFileDrop(canAcceptFiles, onFilesDropped);
357358
359+
useChatInputFocus(inputRef, {
360+
disabled: computed(() => showWelcomeScreen.value === true || messagingState.value !== 'idle'),
361+
});
362+
358363
function scrollToBottom(smooth: boolean) {
359364
scrollContainerRef.value?.scrollTo({
360365
top: scrollableRef.value?.scrollHeight,

packages/frontend/editor-ui/src/features/ai/chatHub/components/ChatPrompt.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ defineExpose({
209209
committedSpokenMessage.value = '';
210210
attachments.value = [];
211211
},
212-
setText: (text: string) => {
213-
message.value = text;
212+
appendText: (text: string) => {
213+
message.value += text;
214214
},
215215
addAttachments: (files: File[]) => {
216216
attachments.value.push(...files);

0 commit comments

Comments
 (0)