mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
fix issue where entered message isn't immediately visible
This commit is contained in:
parent
dbc91d8a4e
commit
8b8b7ea2b6
@ -44,8 +44,8 @@
|
||||
}
|
||||
|
||||
.chat-msg {
|
||||
margin-top: calc(var(--termpad) * 2);
|
||||
margin-bottom: calc(var(--termpad) * 2);
|
||||
padding-top: calc(var(--termpad) * 2);
|
||||
padding-bottom: calc(var(--termpad) * 2);
|
||||
display: flex;
|
||||
|
||||
.chat-msg-header {
|
||||
|
@ -60,12 +60,12 @@ class ChatContent extends React.Component<{}, {}> {
|
||||
osInstance: OverlayScrollbars = null;
|
||||
|
||||
componentDidUpdate() {
|
||||
console.log("triggered");
|
||||
if (this.containerRef?.current && this.osInstance) {
|
||||
const { overflowAmount } = this.osInstance.state();
|
||||
const { viewport } = this.osInstance.elements();
|
||||
viewport.scrollTo({
|
||||
behavior: "auto",
|
||||
top: overflowAmount.y,
|
||||
top: this.chatWindowRef.current.scrollHeight,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -87,35 +87,6 @@ class ChatContent extends React.Component<{}, {}> {
|
||||
});
|
||||
}
|
||||
|
||||
submitChatMessage(messageStr: string) {
|
||||
const curLine = GlobalModel.inputModel.getCurLine();
|
||||
const prtn = GlobalModel.submitChatInfoCommand(messageStr, curLine, false);
|
||||
prtn.then((rtn) => {
|
||||
if (!rtn.success) {
|
||||
console.log("submit chat command error: " + rtn.error);
|
||||
}
|
||||
}).catch((_) => {});
|
||||
}
|
||||
|
||||
getLinePos(elem: any): { numLines: number; linePos: number } {
|
||||
const numLines = elem.value.split("\n").length;
|
||||
const linePos = elem.value.substr(0, elem.selectionStart).split("\n").length;
|
||||
return { numLines, linePos };
|
||||
}
|
||||
|
||||
onTextAreaFocused(e: any) {
|
||||
console.log("focused=====");
|
||||
mobx.action(() => {
|
||||
GlobalModel.inputModel.setAuxViewFocus(true);
|
||||
})();
|
||||
}
|
||||
|
||||
onTextAreaBlur(e: any) {
|
||||
mobx.action(() => {
|
||||
GlobalModel.inputModel.setAuxViewFocus(false);
|
||||
})();
|
||||
}
|
||||
|
||||
renderError(err: string): any {
|
||||
return <div className="chat-msg-error">{err}</div>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user