Remove unneeded code now that attachment URL isn't appended to toots

This commit is contained in:
Thibaut Girka 2018-05-22 20:21:09 +02:00
parent a5c25242af
commit d8793e1bee
1 changed files with 1 additions and 15 deletions

View File

@ -195,16 +195,6 @@ class Composer extends React.Component {
this.textarea = null; 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. // Tells our state the composer has been mounted.
componentDidMount () { componentDidMount () {
const { onMount } = this.props; const { onMount } = this.props;
@ -228,9 +218,6 @@ class Composer extends React.Component {
// - Replying to more than one user, selects any usernames past // - Replying to more than one user, selects any usernames past
// the first; this provides a convenient shortcut to drop // the first; this provides a convenient shortcut to drop
// everyone else from the conversation. // 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) { componentDidUpdate (prevProps) {
const { const {
caretPos, caretPos,
@ -238,7 +225,6 @@ class Composer extends React.Component {
} = this; } = this;
const { const {
focusDate, focusDate,
isUploading,
isSubmitting, isSubmitting,
preselectDate, preselectDate,
text, text,
@ -246,7 +232,7 @@ class Composer extends React.Component {
let selectionEnd, selectionStart; let selectionEnd, selectionStart;
// Caret/selection handling. // Caret/selection handling.
if (focusDate !== prevProps.focusDate || (prevProps.isUploading && !isUploading && !isNaN(caretPos) && caretPos !== null)) { if (focusDate !== prevProps.focusDate) {
switch (true) { switch (true) {
case preselectDate !== prevProps.preselectDate: case preselectDate !== prevProps.preselectDate:
selectionStart = text.search(/\s/) + 1; selectionStart = text.search(/\s/) + 1;