sstur / react-rte

Pure React rich text WYSIWYG editor based on draft-js.
https://react-rte.org
ISC License
2.86k stars 430 forks source link

toString('markdown') on a state copy modifies the original state #400

Open tonnoVolante opened 3 years ago

tonnoVolante commented 3 years ago
const rteStateCopy = rteState
const postValue = rteStateCopy.toString('markdown')

Everytime the .toString('markdown') method is called upon a variable holding a copy of the original state, both the original state and the copy are being mutated to markdown. I need to have both the original react-rte untouched state (the big object holding the whole editor state) and the markdown converted state in a string variable to send through a POST request.