Skip to content

History stack is not empty (and broke) on a fresh start of the editor, and on new RichText block #887

@daniloercoli

Description

@daniloercoli

History stack is not empty on a clean start of the editor.

Problem 1:

  • Start the demo app
  • Tap on a RichText block
  • Boom ---> you will see the Undo button available
  • if you tap on it "an action" is actually executed, the Redo button slightly visible for a fraction of second, and the the "undo" is available again
  • See the first seconds of the GIF attached below

Problem 2:
If you add a new empty block it's hard to get rid of hit by tapping on Undo.

For the same reason of above, it seems two actions are executed in a sequence in a very small time. If you want to get rid of the block you need to tap "undo" many times, very fast. (The GIF below does show this behavior at the end).

history mess up

Investigated a bit, and I think the problem is due to the onSelectionChange called at init and every time the user adds new text - onSelectionChange is called right after the onChange callback. So basically we're updating the JS side lot of times 🤔
Not quite sure why we're calling this.props.onChange( this.lastContent ); when the selection does change.

cc @marecar3 @mkevins

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions