I need those code to get innerText and manipulate them for make it better.. if anyone know about this please help me.....
Hi @Maijied - can you give an example of what you want to do? I need more info to help you.
Some helpful methods:
ContentState.getPlainText() -> https://draftjs.org/docs/api-reference-content-state.html#getplaintext
ContentState.createFromText() -> https://draftjs.org/docs/api-reference-content-state.html#createfromtext
You could read the "innerText" of the editor using getPlainText, change the text, and then create a new updated contentState using createFromText and then pass the updated contentState to your Draft.js editor.
@flarnie how i'll copy editor innerText by a button. Like Copy To Clipboard method. Thanks in advance.
And basically i work in draft.js for making a editor where editor automatically check #Bangla spell by calling API and suggest 2 gram data(Text).
I think this should demonstrate how you can do it:
https://jsfiddle.net/m6z0xn4r/452/
This demonstrates -
I hope you can use the example to do what you need, let me know if there is more to your question.
After press the enter button ,text line get a new div .That's why i cant implement my spell checker api for underline the false words . How i get all text or by which div?
and push those words back to the same div?
@flarnie
Most helpful comment
Some helpful methods:
ContentState.getPlainText()-> https://draftjs.org/docs/api-reference-content-state.html#getplaintextContentState.createFromText()-> https://draftjs.org/docs/api-reference-content-state.html#createfromtextYou could read the "innerText" of the editor using
getPlainText, change the text, and then create a new updatedcontentStateusingcreateFromTextand then pass the updated contentState to your Draft.js editor.