betancourtl / draft-js-custom-styles

Create custom inline styles for draft-js in a sane way
MIT License
34 stars 17 forks source link

Improve adding styles for proper undo/redo #13

Closed NadiaIvaniuckovich closed 5 years ago

NadiaIvaniuckovich commented 5 years ago

This changes should improve work of undo/redo available in draft-js.

Before this changes when you add red, then blue colors one by one and press Ctrl + Z you will see black color, only on second Ctrl + Z you will see red. The same for Ctrl + Y. (It seems like this happen because editor state receive one change on remove and second on add, so it will better to act with content state and push change to editor only once when we add style)

This changes should fix this issue and you will see red color on first Ctrl + Z like expected.

betancourtl commented 5 years ago

Awesome! thank you for taking your time to submit a PR. I will take a look at it tonight and if all goes well I will merge this into the main repo and publish to NPM.