I've been playing with the Decorators in Draft.js but when I could not build a custom one I am sending the text to an API which I will get a response with an array of incorrect words that typed in the editor So I am trying to build a Strategory function that applies a style to all the items in that array
function highlightWorngWords(contentBlock, callback) {
let text = contentBlock.getText();
let worngWords = ['word', 'word1' , 'word2'];
while ( worngWords !== null ) {
start = worngWords.index;
callback(start, start + worngWords[0].length);
}
}
What did I miss it won't work?
Are you wanting to do something like this?