Ckeditor5-react: How to get the editor value?

Created on 31 Jul 2018  路  6Comments  路  Source: ckeditor/ckeditor5-react

I implemented the ckeditor-react module described in your documentation.
But there i only get en eventInfo and the editor instance.

How do i get the value the user entered?

solved question

All 6 comments

You have got two ways to do that:

  1. Use onInit callback in order to save a reference to the editor. Then if the data is needed, call the editor.getData(),
  2. Listen to data changes in the editor using onChange callback. It receives two parameters. The second one is an editor instance. Calling editor.getData() returns what you want.

Ok, i read the docu but i didn't find the getData() method -.-

Sorry and thank you very much.

@pomek Perhaps it is worth adding it to readme? This is the first thing one will be looking for. We can use the answer also to encourage user to look at the documentation for more API methods.

vv

How do you get the editor value outside the CK editor component , like say after subitting form i need to clear the editor, for this i need editor outside any thoughts anyone ?

@shamseerahammedm did you happen to solve the clearing value issue?

Was this page helpful?
0 / 5 - 0 ratings