Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3910

ZK destroys all iframes elements on some containers when changing DOM location

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.5.1.1
    • Fix Version/s: 8.5.2
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None
    • gh.sprint.customfield.default.name:
      ZK 8.5.2 S1, ZK 8.5.2 S2

      Description

      Steps to Reproduce

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

      Click the close button on the modal window.

      Current Result

      the iframe DOM element (not ZK iframe component) included in the Editor DOM tree is removed by the window modal onClose workflow.
      This cause a warning in the console.

      Expected Result

      ZK should only remove ZK based iframes from the DOM

      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

      This behavior prevents ZK iframes components from being reloaded when moved around the DOM tree. However, it also affects non-ZK iframes.

      Root Cause

      Affect window and panel:
      Window:
      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>
      

        Issue Links

          Activity

          Hide
          JamesChu JamesChu added a comment -

          Fixed since 2018/05/18

          Show
          JamesChu JamesChu added a comment - Fixed since 2018/05/18
          Hide
          JamesChu JamesChu added a comment -

          Fixed since 2018/06/22

          Show
          JamesChu JamesChu added a comment - Fixed since 2018/06/22

            People

            • Assignee:
              klyvechen klyvechen
              Reporter:
              MDuchemin MDuchemin
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Agile