fix: fixed behaviour of bundled app for decrypt and ai chat

This commit is contained in:
2026-05-31 17:26:50 +02:00
parent 040b5db37b
commit 5e99cb7a09
16 changed files with 189 additions and 49 deletions

View File

@@ -3,6 +3,9 @@ export const ChatSurface = {
this.stickToBottom = true;
this.scrollContainer = null;
this._enterKeyHandled = false;
this._prevInputValue = "";
this.autoResize = () => {
const textarea = this.el.querySelector(".chat-input");
@@ -85,11 +88,34 @@ export const ChatSurface = {
this.stickToBottom = distanceFromBottom < 48;
};
this._submitChat = () => {
const form = this.el.querySelector(".chat-input-wrapper");
if (form && typeof form.requestSubmit === "function") {
form.requestSubmit();
} else {
const sendButton = this.el.querySelector("[data-testid='chat-send-button']");
if (sendButton) sendButton.click();
}
};
this.handleInput = (event) => {
if (!event.target.closest(".chat-input")) {
return;
}
const textarea = event.target;
if (!this._enterKeyHandled && textarea.value.includes("\n") && !this._prevInputValue.includes("\n")) {
textarea.value = textarea.value.replace(/\n/g, "");
this._prevInputValue = textarea.value;
this.stickToBottom = true;
this.autoResize();
this._submitChat();
return;
}
this._enterKeyHandled = false;
this._prevInputValue = textarea.value;
this.stickToBottom = true;
this.autoResize();
};
@@ -101,12 +127,8 @@ export const ChatSurface = {
if (event.key === "Enter" && !event.shiftKey && !event.isComposing) {
event.preventDefault();
const sendButton = this.el.querySelector("[data-testid='chat-send-button']");
if (sendButton && !sendButton.disabled) {
sendButton.click();
}
this._enterKeyHandled = true;
this._submitChat();
}
};