Skip to content

"START_OF_SELECTED_AREA" character appears after undo #15619

Closed

Description

@hypest

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

Activity

  1. added
    [Feature] Rich Text
    on May 14, 2019
  2. aduth commented on May 15, 2019

    @aduth
    Member

    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;

  3. added
    Needs Testing
    on May 15, 2019
  4. ellatrix commented on May 17, 2019

    @ellatrix
    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.

  5. ellatrix commented on Jun 18, 2019

    @ellatrix
    Member

    This is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Testing[Feature] Rich Text

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions