forked from mystiq/hydrogen-web
only schedule one resize callback per frame
This commit is contained in:
parent
b22437840d
commit
c671596c6f
1 changed files with 6 additions and 1 deletions
|
@ -25,6 +25,7 @@ export class MessageComposer extends TemplateView {
|
||||||
this._input = null;
|
this._input = null;
|
||||||
this._attachmentPopup = null;
|
this._attachmentPopup = null;
|
||||||
this._focusInput = null;
|
this._focusInput = null;
|
||||||
|
this._rafResizeHandle = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
|
@ -112,10 +113,14 @@ export class MessageComposer extends TemplateView {
|
||||||
}
|
}
|
||||||
|
|
||||||
_adjustHeight() {
|
_adjustHeight() {
|
||||||
window.requestAnimationFrame(() => {
|
if (this._rafResizeHandle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._rafResizeHandle = window.requestAnimationFrame(() => {
|
||||||
this._input.style.height = "auto";
|
this._input.style.height = "auto";
|
||||||
const scrollHeight = this._input.scrollHeight;
|
const scrollHeight = this._input.scrollHeight;
|
||||||
this._input.style.height = `${scrollHeight}px`;
|
this._input.style.height = `${scrollHeight}px`;
|
||||||
|
this._rafResizeHandle = undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue