Opened 9 years ago

Closed 9 years ago

#12258 closed Bug (wontfix)

Moving form with CKEditor through DOM

Reported by: Rike Owned by:
Priority: Normal Milestone:
Component: General Version: 4.4.3
Keywords: Cc:


Hi, I found a problem. I have one form instance on page and I move this via jQuery, where is needed. But after first move, CKEditor goes failed with error:

TypeError: this.document.getWindow(...).$ is undefined

Minimal code:

<!doctype html>
   <meta charset="utf-8" />
   <script src="//"></script>
   <script src="ckeditor/ckeditor.js"></script>
   <script src="ckeditor/adapters/jquery.js"></script>
   <p><a href="#" id="move">Move CKEditor</a></p>

     $('#move').on('click', function(e) {
       if($('#first>#form').size()>0) $('#form').appendTo('#second');
       else $('#form').appendTo('#first');

   <div id="first" style="min-height:200px;border:2px solid blue">
     <form id="form">
       <textarea name="form_text" id="form_text"></textarea><br />
   <div id="second" style="min-height:200px;border:2px solid red;margin-top:1em"></div>

Tested: Gecko, WebKit.

Attachments (1)

index.html (949 bytes) - added by Rike 9 years ago.
Working example - press "Move CKEditor" and try to click bold-button for example…

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by Rike

Attachment: index.html added

Working example - press "Move CKEditor" and try to click bold-button for example...

comment:1 Changed 9 years ago by Piotrek Koszuliński

Resolution: wontfix
Status: newclosed

The classic editor uses iframe to sandbox content and iframes have a nasty behaviour - they unload their content when moved/detached from DOM. It would be very hard to workaround such issue - basically we would need to listen to unload and reinitialise part of editor. Pretty complex to make it right in all cases.

Therefore, this issue is "won't fix", but there are two solutions:

  1. Destroy editor before moving it and initialise again after that.
  2. Use divarea plugin or inline editor which don't have this problem.
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy