Skip to content

Editor undo does not properly restore selection #77

@ktrieu

Description

@ktrieu

Describe the bug
When undoing formatting, the selection is not restored to the proper location.

To Reproduce
Steps to reproduce the behavior:

  1. Open an empty editor and type a few words into it
  2. Format two separate sections of the text with inline formatting
  3. Press undo twice

Expected behavior
The selection covers the very first section formatted. Instead the selection "bridges" the two separate formatted sections.

Screenshots
https://streamable.com/i7o7f1

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version [85

Additional context
In general, selections and undo/redo don't seem to interact well, and this bug likely appears in other forms. ianstormtaylor/slate#3534 and ianstormtaylor/slate#3756 are some upstream issues that describe this same issue.

In terms of workarounds, I got nothing, short of trying to patch Slate ourselves to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingunit: editorupstreamRequires a change from upstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions