Conversation
mountiny
left a comment
There was a problem hiding this comment.
@parasharrajat Tested based on instruction in here #3790.
I assume that copy pasting bold text from a message in E.cash is different problem, right?
|
Yes @mountiny That is a different issue. |
| try { | ||
| document.execCommand('insertText', false, markdownText); | ||
| this.updateNumberOfLines(); | ||
| // eslint-disable-next-line no-empty | ||
| } catch (e) {} |
There was a problem hiding this comment.
The execCommand API is deprecated. Is there an alternative to this?
Also, could you add a comment to explain why do we need an empty catch {} block here?
There was a problem hiding this comment.
@HorusGoul Its deprecated but I didn't find any direct alternative. If we don't use it then we have to implement our own framework to manage undo redo and other operations. There are few WYSIWYG editors out there which does this but we are not currently using it.
After a careful inspection I come to the decision of using it, previously I was doing the manual paste but it lacked Undo functionality..
This is still supported for almost all browsers https://caniuse.com/?search=execCommand.
Also, I checked RN-WEB to see how they manage Copy to clipboard. They are also using it https://github.com/necolas/react-native-web/blob/98dcefd9041c10cc95a2385202498b274d926a6b/packages/react-native-web/src/exports/Clipboard/index.js#L50
I just borrowed the catch block from RN-web.
We can think about of changing to different alternative when we redesign our composer but I would say ATM its the best bet.
There was a problem hiding this comment.
Great! Let's merge then :)
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
fix: paste and Ctrl+z (cherry picked from commit f9d0058)
|
🚀 Deployed to staging in version: 1.0.79-2🚀
|
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
This is working as intended in MacOS Desktop and Web only. Windows is still facing this same issue #4066 |
|
🚀 Deployed to production in version: 1.0.79-4🚀
|
|
🚀 Deployed to staging in version: 1.0.79-5🚀
|
|
🚀 Deployed to production in version: 1.0.80-2🚀
|
| this.updateNumberOfLines(); | ||
| }} | ||
| onSelectionChange={this.saveSelection} | ||
| onSelectionChange={this.onSelectionChange} |
There was a problem hiding this comment.
Shouldn't this be this.props.onSelectionChange? Because onSelectionChange does not exist as a method on Composer
There was a problem hiding this comment.
This component is deprecated.
There was a problem hiding this comment.
Actually while investigating Composer, I noticed that it has no this.onSelectionChange method, but it is being used in the component:
App/src/components/Composer/index.js
Lines 358 to 360 in 7b8f085
And found this PR, while checking out the git blame for it.
Could you please confirm that
this.onSelectionChange should be changed to this.props.onSelectionChange in Composer/index.js?
Details
Fixed Issues
$ Fixes #4120
Tests | QA Steps
Tested On
Screenshots
Web
paste.mp4
Mobile Web
Desktop
iOS
Android