Uploaded image for project: 'ZK CKeditor'
  1. ZK CKeditor
  2. ZKCK-41

Iframe destroyed warning when removing ckeditor parent DOM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Normal Normal
    • None
    • 4.7.0.0
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      http://zkfiddle.org/sample/2rvbcep/1-ckeditor-modal-close-iframe-destroy

      Click the close button on the modal window.

      Current Result

      Warning in console

      Expected Result

      no warning in console

      Debug Info

      The editor DOM is detroyed before the editor JS object is destroyed during widget.unbind_
      This causes a warning in the client console:
      [CKEDITOR] Error code: editor-destroy-iframe.
      (anonymous)
      [CKEDITOR] For more information about this error go to http://docs.ckeditor.com/#!/guide/dev_errors-section-editor-destroy-iframe

      Root Cause

      https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/wnd/Window.js#L1166
      https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/wnd/Window.js#L1203

      Also in panel:
      https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/wnd/Panel.js#L868

      Workaround

      <script><![CDATA[
      		zk.afterLoad('zul.wnd', function() {
      			var xWindow = {};
      			zk.override(zul.wnd.Window.prototype, xWindow ,{
      				onClose : function() {
      					this.$n().querySelectorAll(".z-ckeditor").forEach(function(elem){
      						zk.$(elem)._editor.destroy(true);
      						delete zk.$(elem)._editor;
      					});
      					var result = xWindow.onClose.apply(this, arguments);
      					return result;
      				}
      			});//zk.override
      		});//zk.afterLoad
      	]]></script>
      

            Unassigned Unassigned
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: