virtru / virtuoso-design-system

Virtuoso Design System curated by @virtru UX & engineering
https://virtru.github.io/virtuoso-design-system/
MIT License
5 stars 19 forks source link

INT-389: Dropped `value` and `defaultValue` support and replaced by `editorState` #427

Closed riabokon-virtru closed 1 year ago

riabokon-virtru commented 1 year ago

Proposed Changes

Checklist

riabokon-virtru commented 1 year ago

I'm not sure this is the right way to go. A consumer now needs to know how to use draft-js and give the proper editorState. What is the motivation for this change? If the editorState that is passed in has external changes will it automatically sync?

I agree with you. It was a forced step. When I tried to implement a controlled mode based on a string value I faced with a problem when a caret jumped to the beginning of the text. It is a known issue in DraftJS. Also, because DraftJS is archived we can be sure that this issue will be not fixed.

We already have a small discussion around replacing DraftJS with something new. You can check this discussion starting from this message

Maybe you have some thoughts on how to implement a controlled mode in a better way?

riabokon-virtru commented 1 year ago

As a solution, we can provide util functions to create EditorState

ntrevino-virtru commented 1 year ago

Gotcha. Replacing definitely seems like the long-term path. I like the idea of a util function for now though, I think that makes the most sense until we can swap.