relayout whenever the input textarea's scrollheight increases
This commit is contained in:
parent
152872b342
commit
0d1c06d586
1 changed files with 4 additions and 4 deletions
|
@ -34,6 +34,8 @@ var TYPING_USER_TIMEOUT = 10000;
|
||||||
var TYPING_SERVER_TIMEOUT = 30000;
|
var TYPING_SERVER_TIMEOUT = 30000;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
oldScrollHeight: 0,
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
this.tabStruct = {
|
this.tabStruct = {
|
||||||
completing: false,
|
completing: false,
|
||||||
|
@ -211,16 +213,14 @@ module.exports = {
|
||||||
// kick gemini-scrollbar to re-layout
|
// kick gemini-scrollbar to re-layout
|
||||||
this.props.roomView.forceUpdate();
|
this.props.roomView.forceUpdate();
|
||||||
}
|
}
|
||||||
|
this.oldScrollHeight = this.refs.textarea.scrollHeight;
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyUp: function(ev) {
|
onKeyUp: function(ev) {
|
||||||
if (ev.keyCode === KeyCode.ENTER ||
|
if (this.refs.textarea.scrollHeight !== this.oldScrollHeight ||
|
||||||
ev.keyCode === KeyCode.DELETE ||
|
ev.keyCode === KeyCode.DELETE ||
|
||||||
ev.keyCode === KeyCode.BACKSPACE)
|
ev.keyCode === KeyCode.BACKSPACE)
|
||||||
{
|
{
|
||||||
// resize to fit.
|
|
||||||
// XXX: ideally we should fire this onChange, but as it's fairly heavy we
|
|
||||||
// optimise and only resie on enter or delete/backspace.
|
|
||||||
this.resizeInput();
|
this.resizeInput();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue