fix askview focus logic

This commit is contained in:
sanio 2025-07-14 02:47:37 +09:00
parent fbe5c22aa4
commit aa14a1d0b6
2 changed files with 18 additions and 6 deletions

View File

@ -148,7 +148,7 @@ class AskService {
async toggleAskButton() { async toggleAskButton() {
const askWindow = getWindowPool()?.get('ask'); const askWindow = getWindowPool()?.get('ask');
const hasContent = this.state.isStreaming || (this.state.currentResponse && this.state.currentResponse.length > 0); const hasContent = this.state.isLoading || this.state.isStreaming || (this.state.currentResponse && this.state.currentResponse.length > 0);
if (askWindow && askWindow.isVisible() && hasContent) { if (askWindow && askWindow.isVisible() && hasContent) {
this.state.showTextInput = !this.state.showTextInput; this.state.showTextInput = !this.state.showTextInput;

View File

@ -772,8 +772,10 @@ export class AskView extends LitElement {
console.log('📤 Show text input signal received'); console.log('📤 Show text input signal received');
if (!this.showTextInput) { if (!this.showTextInput) {
this.showTextInput = true; this.showTextInput = true;
this.requestUpdate(); this.updateComplete.then(() => this.focusTextInput());
} } else {
this.focusTextInput();
}
}); });
window.api.askView.onScrollResponseUp(() => this.handleScroll('up')); window.api.askView.onScrollResponseUp(() => this.handleScroll('up'));
@ -781,10 +783,20 @@ export class AskView extends LitElement {
window.api.askView.onAskStateUpdate((event, newState) => { window.api.askView.onAskStateUpdate((event, newState) => {
this.currentResponse = newState.currentResponse; this.currentResponse = newState.currentResponse;
this.currentQuestion = newState.currentQuestion; this.currentQuestion = newState.currentQuestion;
this.isLoading = newState.isLoading; this.isLoading = newState.isLoading;
this.isStreaming = newState.isStreaming; this.isStreaming = newState.isStreaming;
const wasHidden = !this.showTextInput;
this.showTextInput = newState.showTextInput; this.showTextInput = newState.showTextInput;
});
if (newState.showTextInput) {
if (wasHidden) {
this.updateComplete.then(() => this.focusTextInput());
} else {
this.focusTextInput();
}
}
});
console.log('✅ AskView: IPC 이벤트 리스너 등록 완료'); console.log('✅ AskView: IPC 이벤트 리스너 등록 완료');
} }
} }