about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-22 20:21:09 +0200
committerThibaut Girka <thib@sitedethib.com>2018-05-26 12:17:03 +0200
commitd8793e1bee742c8104efbe1c9d28915ab000248e (patch)
tree35a9f8cdbd8af4620816fcc3f46290a21a114e25
parenta5c25242af65b20c3157321b566f739a27f21e21 (diff)
Remove unneeded code now that attachment URL isn't appended to toots
-rw-r--r--app/javascript/flavours/glitch/features/composer/index.js16
1 files changed, 1 insertions, 15 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js
index de85340a3..c9e2d62b0 100644
--- a/app/javascript/flavours/glitch/features/composer/index.js
+++ b/app/javascript/flavours/glitch/features/composer/index.js
@@ -195,16 +195,6 @@ class Composer extends React.Component {
     this.textarea = null;
   }
 
-  //  If this is the update where we've finished uploading,
-  //  save the last caret position so we can restore it below!
-  componentWillReceiveProps (nextProps) {
-    const { textarea } = this;
-    const { isUploading } = this.props;
-    if (textarea && isUploading && !nextProps.isUploading) {
-      this.caretPos = textarea.selectionStart;
-    }
-  }
-
   //  Tells our state the composer has been mounted.
   componentDidMount () {
     const { onMount } = this.props;
@@ -228,9 +218,6 @@ class Composer extends React.Component {
   //      - Replying to more than one user, selects any usernames past
   //        the first; this provides a convenient shortcut to drop
   //        everyone else from the conversation.
-  // - If we've just finished uploading an image, and have a saved
-  //   caret position, restores the cursor to that position after the
-  //   text changes.
   componentDidUpdate (prevProps) {
     const {
       caretPos,
@@ -238,7 +225,6 @@ class Composer extends React.Component {
     } = this;
     const {
       focusDate,
-      isUploading,
       isSubmitting,
       preselectDate,
       text,
@@ -246,7 +232,7 @@ class Composer extends React.Component {
     let selectionEnd, selectionStart;
 
     //  Caret/selection handling.
-    if (focusDate !== prevProps.focusDate || (prevProps.isUploading && !isUploading && !isNaN(caretPos) && caretPos !== null)) {
+    if (focusDate !== prevProps.focusDate) {
       switch (true) {
       case preselectDate !== prevProps.preselectDate:
         selectionStart = text.search(/\s/) + 1;