Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"START_OF_SELECTED_AREA" character appears after undo #15619

Closed
hypest opened this issue May 14, 2019 · 3 comments
Closed

"START_OF_SELECTED_AREA" character appears after undo #15619

hypest opened this issue May 14, 2019 · 3 comments
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable Needs Testing Needs further testing to be confirmed.

Comments

@hypest
Copy link
Contributor

hypest commented May 14, 2019

Describe the bug
Undoing a paragraph merge leaves behind a copy of the START_OF_SELECTED_AREA (0x0086) char.

To reproduce
Steps to reproduce the behavior:

  1. Start off with this html:
<p>Word</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Press</p>
<!-- /wp:paragraph -->
  1. Merge the “Press” block to the one above it
  2. Undo
  3. Inspect the html via the browser dev tools and verify that the special char is there before the Press word in the second block

Expected behavior
No copies of the special char should be left in the text/markup.

Screenshots
Screenshot 2019-05-14 at 11 09 31

Desktop (please complete the following information):

  • OS: macOS 10.14.4
  • Browser Firefox 66.0.5
  • Version on hash eea04cf
@hypest hypest added the [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable label May 14, 2019
@aduth
Copy link
Member

aduth commented May 15, 2019

It was mentioned that this may have been fixed by #15599 . Needs additional testing or confirmation from @ellatrix .

An underlying cause is the mutation of the original block object in the logic of block-editor's effects.js, which has the negative impact of unintentionally mangling Undo history.

There is some direct mutation which still occurs in this file, which is concerning to me:

selectedBlock.attributes[ attributeKey ] = toHTMLString( {

selectedBlock.attributes[ attributeKey ] = html;

@aduth aduth added the Needs Testing Needs further testing to be confirmed. label May 15, 2019
@ellatrix
Copy link
Member

@aduth Yes, it was a bit more challenging to not mutate. I just wanted to add a line in the other PR so it's fixed.

@ellatrix
Copy link
Member

This is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable Needs Testing Needs further testing to be confirmed.
Projects
None yet
Development

No branches or pull requests

3 participants