Reputation: 1925
I'm using CKEditor to create an WYSIWYG for some textarea i'm my site.
The thing is, in the comment section of the site, i move the DOM of the form where the CKEditor is loaded, to another <div>
in my site to show below of the comments which will be edited by the user.
So, when the CKEditor appears in the other div, nothing works. I cannot edit the content and the buttons don't work too.
For contextualize, i do this:
<div class='ckeditor-hidden'>
<form action="/" class="form-edit-content">
<textarea id="someid"></textarea>
</form>
</div>
<div class="div-where-ckeditor-will-be-placed">
</div>
In jQuery, i do this:
$(".form-edit-content").appendTo(".div-where-ckeditor-will-be-placed");
Now, why i'm doing this? Because i use the same form in different places on my site, so that's why i move them.
So, when i move, the CKEditor now work anymore.
Just to know, i'm using Drupal 7 on my site, and i install the Module CKEditor for Drupal (https://www.drupal.org/project/ckeditor).
Someone know why this happend?
Upvotes: 3
Views: 1354
Reputation: 22013
This happens because by default CKEditor uses iframes and iframes are unloaded when you detached them from the DOM or move somewhere else. There are couple of ways handle that.
div
instead of an iframe
. You lose a useful features of the classic editor, but no more problems with iframes.Upvotes: 5