react-markdown icon indicating copy to clipboard operation
react-markdown copied to clipboard

Text becomes uneditable after it has been copy-pasted via hotkey combination

Open mpritchin-sc opened this issue 7 years ago • 2 comments

Meta-Info Value
ExtProjectId JCPIM-01.3
Original Estimation ???h
Remaining Estimation ???h

Overview

Text becomes uneditable after it has been copy-pasted via hotkey combination Ctrl+C/Ctrl+V in Edge browser, please, see attachment.

Preconditions

Microsoft Edge version: 42.17134.1.0 ⚡️ Please note, that the issue is not reproduced on MS Edge version 41.16299.248.0! ⚡️ User is using Edge browser. User is logged into PIM. There is a markdown attribute created in the installation.

Steps to Reproduce

  1. Open Product Search page
  2. Create any product
  3. Open newly created product on Product Editor page on Attributes tab
  4. Press New button and add a markdown attribute
  5. Copy provided text below and paste it into markdown attribute value:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque interdum mattis justo sit amet facilisis. Sed ultricies, sapien sed dignissim blandit, sapien felis tristique dolor, sed condimentum purus nulla eu diam.

  1. Put text cursor into center of a paragraph and try to press Delete, Backspace, Left Arrow, Right Arrow.

Actual Result

Text is not edited.

Expected Result

Text is edited in the way relevant to the last key pressed.

  1. Press Save button

Actual Result

Text is not saved.

Expected Result

Text is saved. User can still use hotkeys mapped to the markdown toolbar formatting buttons.

Edge version: 42.x

Original issue: https://github.com/OpusCapita/pimline/issues/405

mpritchin-sc avatar Jun 26 '18 10:06 mpritchin-sc

The source of this bug is inside [email protected] which is a dependency of react-markdown. In Edge 42 DataTransfer.types is not an array (as it should be according to MDN), but an object. Therefore it doesn't have array-specific methods, namely Array.prototype.indexOf, and code trying to access it throws an error. Filed issue at MS.

In latest slate demo this bug is not reproduced.

Possible solutions are presumably time-consuming. I see two options:

  • update react-markdown to latest slate. This is not a trivial task: every release of slate introduces breaking changes, and it's been 12 releases since version 0.1.0. This is unclear how much time it can take, and it can probably introduce new bugs, and future slate updates can also consume time because of its constant API changes.
  • replace slate with some alternative. One of them is CodeMirror, which is used in SimpleMDE markdown editor. This requires a huge rewrite of react-markdown, and will be unpredictably time-consuming also. This is also not a React module, so it will require additional effort for hooking it up with React components in react-markdown, and implementing non-standard features from scratch (autocomplete dropdowns, etc).

This issue will be postponed until a clear decision.

estambakio-sc avatar Jul 06 '18 09:07 estambakio-sc

Update

This should be tested again when next Edge release comes; according to issue tracker this bug should not be reproduced in future version.

estambakio-sc avatar Jul 19 '18 10:07 estambakio-sc