Open vaclav-zeman opened 6 years ago
Up
Did You get the answer?
Yeah... would be nice to have an answer to this one... There seems to be no clear way documented anywhere on how to properly navigate these decorators.
ffs choosing draft-js was the worst choice of my programming career...
Do you want to request a feature or report a bug? Question / Bug?
What is the current behavior? Scenario: When user writes a reserved word (in this case it's
%promo%
) into the editor, the word should became an entity (viaModifier.applyEntity
) so I can later create validations if the reserved word is inputted more than once etc.Simplified code is here - https://jsfiddle.net/m6z0xn4r/958/ (based on draft 0.10.5)
Basically decorator is just checking if the word is already an entity and if not, it tries to apply an entity to it. The problem is that it's throwing an error -
Draft.min.js:11 Uncaught TypeError: Cannot read property 'getEntity' of undefined
I'm super lost right now as I spent way too much time trying to make it work so any help will be appreciated.
What is the expected behavior? No error thrown
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.5