0
votes

I have a custom button in CKeditor, which is responsible to open a modal showing picture the user has in order to insert one of them into the CKeditor.

This is a textarea:

<textarea name="editor1" id="editor1" rows="10" cols="80"></textarea>

Here is the init code of the editor:

CKEDITOR.replace( 'editor1');

I refereed to the documentation to know how to insert HTML to the editor when an event fires and it looks like below:

CKEDITOR.instances.editor1.insertHtml( '<img src="Media/smiley.gif>' );

But nothing is shoiwing on the editor even in the source

What i have tired so far :

I tried to insert <p>test</p> ==> with no luck

CKeditor version : latest

1

1 Answers

0
votes

this is because of calling the insert code before Creditor is initialized, you should tie your insert element code with an event that fires after the CKeditor is %100 ready.