Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-1833

Facelet version of liferay-ui:input-editor is unable to destroy CKEditor with Liferay 6.2

    Details

      Description

      The FACES-1444 feature was implemented in order to prevent JavaScript memory leaks with the CKEditor when the liferay-ui:input-editor goes from rendered="false" to rendered="true". This worked fine for Liferay 6.1, but it is not working with Liferay 6.2 because the CKEditor was upgraded and has different cleanup behavior. Specifically, the JavaScript rendered by the encodeCleanup() method is executing after the CKEditor has been removed from the DOM by JSF, and the CKEditor destroy(true) function is failing.

      The only solution to this problem is if the developer puts a script in the Facelet view that destroys the CKEditor before JSF submits the XMLHttpRequest. For example:

      <script>
      	function cleanupCKEditor(clientId) {
      		var ckEditor = CKEDITOR.instances[clientId];
      		if (ckEditor) {
      			ckEditor.destroy(true);
      			delete window[clientId];
      			console.log('Cleaned up ckEditor with clientId=' + clientId);
      		}
      		else {
      			console.log('Cannot find ckEditor with clientId=' + clientId);
      		}
      	}
      </script>
      
      <c:set var="inputEditor1ClientId" value="#{aui:findClientId('inputEditor1')}" />
      <h:commandButton actionListener="#{backingBean.toggleEditor1}"
      	immediate="true" onclick="cleanupCKEditor('#{inputEditor1ClientId}'); return true;" value="Show/Hide Editor 1">
      	<f:ajax render="editorPanel" />
      </h:commandButton>
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              neil.griffin Neil Griffin
              Reporter:
              neil.griffin Neil Griffin
              Participants of an Issue:
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Packages

                  Version Package
                  liferay-faces-3.2.4-ga5