summaryrefslogtreecommitdiffstats
path: root/webapp/components/textbox.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-11-04 12:35:38 -0400
committerChristopher Speller <crspeller@gmail.com>2016-11-04 12:35:38 -0400
commite63e80dee012b22aca94c0095e184c6a6a80d4d7 (patch)
treef58b48a042cdefa6a7f65f4b3876322362bc0b98 /webapp/components/textbox.jsx
parent7403bbce69baeabd7b4cd1ef316513a9fc6807c5 (diff)
downloadchat-e63e80dee012b22aca94c0095e184c6a6a80d4d7.tar.gz
chat-e63e80dee012b22aca94c0095e184c6a6a80d4d7.tar.bz2
chat-e63e80dee012b22aca94c0095e184c6a6a80d4d7.zip
PLT-4404/PLT-4578/PLT-4541/PLT-4542 Replaced third party autosizing textarea with a custom one (#4442)
* PLT-4578 Replaced third party autosizing textarea with a custom one * Fix Textbox.handleHeightChange not being called * Removed unused CSS * PLT-4541 Force EditPostModal to resize upon opening * Removed usage of jquery from AutosizeTextarea * Reverted changes made for PLT-4580 as they're no longer needed
Diffstat (limited to 'webapp/components/textbox.jsx')
-rw-r--r--webapp/components/textbox.jsx17
1 files changed, 11 insertions, 6 deletions
diff --git a/webapp/components/textbox.jsx b/webapp/components/textbox.jsx
index f11ef20ad..9192cd4f9 100644
--- a/webapp/components/textbox.jsx
+++ b/webapp/components/textbox.jsx
@@ -25,6 +25,7 @@ export default class Textbox extends React.Component {
super(props);
this.focus = this.focus.bind(this);
+ this.recalculateSize = this.recalculateSize.bind(this);
this.getStateFromStores = this.getStateFromStores.bind(this);
this.onRecievedError = this.onRecievedError.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this);
@@ -91,13 +92,10 @@ export default class Textbox extends React.Component {
}
}
- handleHeightChange(height) {
- const textbox = $(this.refs.message.getTextbox());
+ handleHeightChange(height, maxHeight) {
const wrapper = $(this.refs.wrapper);
- const maxHeight = parseInt(textbox.css('max-height'), 10);
-
- // move over attachment icon to compensate for the scrollbar
+ // Move over attachment icon to compensate for the scrollbar
if (height > maxHeight) {
wrapper.closest('.post-body__cell').addClass('scroll');
} else {
@@ -106,7 +104,14 @@ export default class Textbox extends React.Component {
}
focus() {
- this.refs.message.getTextbox().focus();
+ const textbox = this.refs.message.getTextbox();
+
+ textbox.focus();
+ Utils.placeCaretAtEnd(textbox);
+ }
+
+ recalculateSize() {
+ this.refs.message.recalculateSize();
}
showPreview(e) {