Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove CKEdit Instance

Tags:

I can't seem to destroy instances of CKEdit per the documentation.

Consider the following:

<input name="txt1" type="text" id="txt1" /><br /> <a href="javascript:void(0);" onclick="create()">Create</a><br /> <a href="javascript:void(0);" onclick="destroy()">Destroy</a> <script type= "text/javascript" > <!-- function create() {     var hEd = CKEDITOR.instances['txt1'];     if (hEd) {         CKEDITOR.remove(hEd);     }     hEd = CKEDITOR.replace('txt1'); } function destroy(){     var hEd = CKEDITOR.instances['txt1'];     if (hEd) {         CKEDITOR.remove(hEd);     } } --> </script> 

When destroy() runs, CKEDITOR.remove(hEd); is being called. Multiple clicks to create() produce multiple instances of CKEditor on screen, but their instances no longer appear in CKEDITOR.instances.

Am I missing something?

like image 798
Laramie Avatar asked Jun 06 '10 18:06

Laramie


People also ask

How do I get rid of CKEditor?

When destroy() runs, CKEDITOR. remove(hEd); is being called. Multiple clicks to create() produce multiple instances of CKEditor on screen, but their instances no longer appear in CKEDITOR.

What is CKEditor replace?

The CKEditor 4 Find and Replace feature allows for finding and replacing any text in the editor easily. It helps the user find words, word parts or phrases matching the case of the searched text, which is especially helpful in lengthy documents and one that may utilize certain words in different contexts.

How do I get CKEditor data?

If you need to get the actual data from CKEditor at any moment using JavaScript, use the editor. getData() method as described in the next section. When you print the data from the database to a <textarea> element in an HTML page, you need to encode it correctly.


1 Answers

You must use hEd.destroy (editor.destroy()).

CKEDITOR.remove() is for internal use as stated in the API.

like image 78
AlfonsoML Avatar answered Sep 18 '22 12:09

AlfonsoML