Skip to content

Commit

Permalink
chatbox height backspace bug
Browse files Browse the repository at this point in the history
  • Loading branch information
longy2k committed Mar 25, 2023
1 parent d426bdd commit 94af694
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Binary file added README_images/Screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ If your plugin does not need CSS, delete this file.
overflow-y: auto;
user-select: text;
max-height: calc(100% - 180px); /* subtract the height of chatbox and 100px */
word-wrap: break-word;
}


Expand Down
14 changes: 8 additions & 6 deletions view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,17 @@ export class BMOView extends ItemView {
}
});

chatboxElement.addEventListener("input", (event) => {
chatboxElement.style.height = `${chatboxElement.scrollHeight}px`;
});

chatboxElement.addEventListener("blur", (event) => {
if (!chatboxElement.value) {
chatboxElement.addEventListener("input", (event) => {
if (chatboxElement.value.indexOf('\n') === -1) {
chatboxElement.style.height = "36px";
}
chatboxElement.style.height = `${chatboxElement.scrollHeight}px`;
});

chatboxElement.addEventListener("blur", (event) => {
if (!chatboxElement.value) {
chatboxElement.style.height = "36px";
}});
}

async BMOchatbot(input: string) {
Expand Down

0 comments on commit 94af694

Please sign in to comment.