Skip to content

Commit

Permalink
Merge pull request #4149 from Expensify/cherry-pick-staging-4131
Browse files Browse the repository at this point in the history
  • Loading branch information
OSBotify authored Jul 20, 2021
2 parents 6f6269b + f1f8482 commit 2265484
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 30 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001007901
versionName "1.0.79-1"
versionCode 1001007902
versionName "1.0.79-2"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.79.1</string>
<string>1.0.79.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCashTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.79.1</string>
<string>1.0.79.2</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expensify.cash",
"version": "1.0.79-1",
"version": "1.0.79-2",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "Expensify.cash is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
30 changes: 6 additions & 24 deletions src/components/TextInputFocusable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ class TextInputFocusable extends React.Component {
end: initialValue.length,
},
};
this.selection = {
start: initialValue.length,
end: initialValue.length,
};
this.saveSelection = this.saveSelection.bind(this);
this.dragNDropListener = this.dragNDropListener.bind(this);
this.handlePaste = this.handlePaste.bind(this);
this.handlePastedHTML = this.handlePastedHTML.bind(this);
Expand Down Expand Up @@ -232,17 +227,6 @@ class TextInputFocusable extends React.Component {
}
}

/**
* Keeps track of user cursor position on the Composer
*
* @param {{nativeEvent: {selection: any}}} event
* @memberof TextInputFocusable
*/
saveSelection(event) {
this.selection = event.nativeEvent.selection;
this.props.onSelectionChange(event);
}

/**
* Manually place the pasted HTML into Composer
*
Expand All @@ -252,13 +236,11 @@ class TextInputFocusable extends React.Component {
handlePastedHTML(html) {
const parser = new ExpensiMark();
const markdownText = parser.htmlToMarkdown(html);
const beforeCursorText = this.textInput.value.substring(0, this.selection.start);
const afterCursorText = this.textInput.value.substring(this.selection.end);
this.textInput.value = beforeCursorText + markdownText + afterCursorText;
const newCursorPosition = beforeCursorText.length + markdownText.length;
this.setState({selection: {start: newCursorPosition, end: newCursorPosition}});
this.updateNumberOfLines();
this.props.onChangeText(this.textInput.value);
try {
document.execCommand('insertText', false, markdownText);
this.updateNumberOfLines();
// eslint-disable-next-line no-empty
} catch (e) {}
}

/**
Expand Down Expand Up @@ -353,7 +335,7 @@ class TextInputFocusable extends React.Component {
onChange={() => {
this.updateNumberOfLines();
}}
onSelectionChange={this.saveSelection}
onSelectionChange={this.onSelectionChange}
numberOfLines={this.state.numberOfLines}
style={propStyles}
/* eslint-disable-next-line react/jsx-props-no-spreading */
Expand Down

0 comments on commit 2265484

Please sign in to comment.