From d8793e1bee742c8104efbe1c9d28915ab000248e Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Tue, 22 May 2018 20:21:09 +0200 Subject: [PATCH] Remove unneeded code now that attachment URL isn't appended to toots --- .../flavours/glitch/features/composer/index.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index de85340a3b..c9e2d62b08 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;