Open terencechow opened 7 years ago
Rather than send the entire content, can you detect the specific change that occurred and send that?
How could I do that?
On 21 Sep 2017 5:58 am, "Colin Jeanne" notifications@github.com wrote:
Rather than send the entire content, can you detect the specific change that occurred and send that?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/facebook/draft-js/issues/1397#issuecomment-331051180, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2PfBzByIibk27Y23-J-eHndaFnqgnOks5skezkgaJpZM4PedpU .
Do you want to request a feature or report a bug? feature?
What is the current behavior?
convertToRaw
takes about 30ms when text gets to ~3k words. I want to something a la google docs but that means I need websockets.Hence I need to
convertToRaw
in anonChange
handler that then sends the data to the websockets server. The problem is thatconvertToRaw
takes 35ms+ when at 3k words and it degrades fast as the words increase. 35ms+ is equivalent to having 20-30 fps in an onchange handler which is not good enough...(I can certainly debounce this, but the more I debounce, the less realtime it becomes...)In addition to that,
convertFromRaw
takes significantly longer thanconvertToRaw
but that's a problem for a later time...Basically, if
contentState
was already serializable, I wouldn't have any of these issues. AgetHtmlText()
likegetPlainText()
would be a really nice feature. How hard would that be to implement? What causesconvertToRaw
orconvertFromRaw
to take so much time? My 3000 word example didn't have any entities and had only 2 blocks and that still took 35ms.Other things that benefit from a serializable
contentState
is the ability to throw it into a webworker for intensive computations, i.e. if you're checking a 3000 word essay that no 'banned words' are present.What is the expected behavior? contentState can be serialized quickly.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? 0.10.1 using chrome on Mac el capitan