summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-09-03 15:30:58 -0400
committerChristopher Speller <crspeller@gmail.com>2015-09-03 15:30:58 -0400
commit9424fa92ab2bf404c600020d6b2428023b92bcc5 (patch)
treef670cafccd95fb011e17e1a1c1fce8db9fc8faa1 /web/react/components
parent2a62b00d76f4de921fbebc321f0c0debd30d41d6 (diff)
parente4336bbc84d00b3665b5f55e0220a67af030e33d (diff)
downloadchat-9424fa92ab2bf404c600020d6b2428023b92bcc5.tar.gz
chat-9424fa92ab2bf404c600020d6b2428023b92bcc5.tar.bz2
chat-9424fa92ab2bf404c600020d6b2428023b92bcc5.zip
Merge pull request #585 from mattermost/plt-37
PLT-37 Fix poor typing performance on iOS devices.
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/create_post.jsx8
-rw-r--r--web/react/components/textbox.jsx9
2 files changed, 9 insertions, 8 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx
index ce4ebac9e..8af9c36b3 100644
--- a/web/react/components/create_post.jsx
+++ b/web/react/components/create_post.jsx
@@ -117,7 +117,6 @@ export default class CreatePost extends React.Component {
Client.createPost(post, channel,
function handlePostSuccess(data) {
- this.resizePostHolder();
AsyncClient.getPosts();
let member = ChannelStore.getMember(channel.id);
@@ -129,7 +128,7 @@ export default class CreatePost extends React.Component {
type: ActionTypes.RECIEVED_POST,
post: data
});
- }.bind(this),
+ },
function handlePostError(err) {
let state = {};
@@ -149,9 +148,6 @@ export default class CreatePost extends React.Component {
);
}
}
- componentDidUpdate() {
- this.resizePostHolder();
- }
postMsgKeyPress(e) {
if (e.which === 13 && !e.shiftKey && !e.altKey) {
e.preventDefault();
@@ -166,7 +162,6 @@ export default class CreatePost extends React.Component {
}
}
handleUserInput(messageText) {
- this.resizePostHolder();
this.setState({messageText: messageText});
let draft = PostStore.getCurrentDraft();
@@ -317,6 +312,7 @@ export default class CreatePost extends React.Component {
<Textbox
onUserInput={this.handleUserInput}
onKeyPress={this.postMsgKeyPress}
+ onHeightChange={this.resizePostHolder}
messageText={this.state.messageText}
createMessage='Write a message...'
channelId={this.state.channelId}
diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx
index 0408a262d..b4518fe80 100644
--- a/web/react/components/textbox.jsx
+++ b/web/react/components/textbox.jsx
@@ -121,7 +121,6 @@ export default class Textbox extends React.Component {
}
this.addedMention = false;
this.refs.commands.getSuggestedCommands(nextProps.messageText);
- this.resize();
}
updateMentionTab(mentionText) {
// using setTimeout so dispatch isn't called during an in progress dispatch
@@ -135,7 +134,6 @@ export default class Textbox extends React.Component {
}
handleChange() {
this.props.onUserInput(React.findDOMNode(this.refs.message).value);
- this.resize();
}
handleKeyPress(e) {
const text = React.findDOMNode(this.refs.message).value;
@@ -244,6 +242,8 @@ export default class Textbox extends React.Component {
const e = React.findDOMNode(this.refs.message);
const w = React.findDOMNode(this.refs.wrapper);
+ let prevHeight = $(e).height();
+
const lht = parseInt($(e).css('lineHeight'), 10);
const lines = e.scrollHeight / lht;
let mod = 15;
@@ -259,6 +259,10 @@ export default class Textbox extends React.Component {
$(e).css({height: 'auto', 'overflow-y': 'scroll'}).height(167);
$(w).css({height: 'auto'}).height(167);
}
+
+ if (prevHeight !== $(e).height()) {
+ this.props.onHeightChange();
+ }
}
handleFocus() {
const elm = React.findDOMNode(this.refs.message);
@@ -316,5 +320,6 @@ Textbox.propTypes = {
messageText: React.PropTypes.string.isRequired,
onUserInput: React.PropTypes.func.isRequired,
onKeyPress: React.PropTypes.func.isRequired,
+ onHeightChange: React.PropTypes.func.isRequired,
createMessage: React.PropTypes.string.isRequired
};