'How to set initial data for CKEditor5?

I can't find a simple example on how to set initial data in CKEditor 5.

In some SO questions, it's said that we should use setData API. But those examples are AJAX based.

In CKEditor 4, I would simply set the value of the textarea and that was it.

In CKEditor 5, the HTML is not textarea but a simple <div>.

I tried to put the content inside the <div> and it did not work.

I also can't find an example in the docs.

So, how can I set initial data in CKEditor 5?



Solution 1:[1]

You can provide the initialData field in your config object during initialization. Doc reference

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chetyoubet