ICEfaces
  1. ICEfaces
  2. ICE-9184

showcase - ice:inputRichText JS errors and failures

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: EE-3.3.0.GA, 4.0.BETA, 4.0
    • Component/s: ICE-Components, Sample Apps
    • Labels:
      None
    • Environment:
      ICEfaces-3.3.0 Build11
      Server: Tomcat7
      Browsers: IE10/ Firefox20/ Chrome26 (some demos tested also in IE8/IE9)
    • Assignee Priority:
      P2

      Description

      ice:inputRichText
      > Save on Submit
      IE10: Clicking on Disable and then trying to save a value causes a JS error and the inputRichText to become unresponsive.

      Message: Unable to get property 'getFrameDocument' of undefined or null reference
      Line: 96
      Char: 70
      Code: 0
      URI: http://localhost:8081/showcase/javax.faces.resource/ckeditor/ckeditor.js.jsf?ln=inputrichtext&v=3_3_0_130416

      Firefox: > There is also a JS error, and saving text doesn't seem to work properly afterwards:
      TypeError: N is null
      http://localhost:8080/showcase/javax.faces.resource/coalesced.js.jsf?ln=ice.core&dgst=xx5enu
      Line 555


      > Language:
      Firefox, Chrome: the same JS error occurs; steps to reproduce:
      - select a Language (Bosnian).
      - type characters and save;
      - select another language (English Canadian);
      - click inside the rich text entry to update the text (JS error occurs).

      Firefox error message:
      TypeError: N is null
      http://localhost:8080/showcase/javax.faces.resource/ckeditor/ckeditor.js.jsf?ln=inputrichtext&v=3_3_0_130416
      Line 96

      Chrome error message:
      Uncaught TypeError: Cannot call method 'getFrameDocument' of null ckeditor.js.jsf:96

        Activity

        Hide
        Carmen Cristurean added a comment -

        This is also an issue with release ICEfaces 3.2.0.

        Show
        Carmen Cristurean added a comment - This is also an issue with release ICEfaces 3.2.0.
        Hide
        Arturo Zambrano added a comment -

        Commited fix at revision 34506.

        The issue was indeed present in 3.2 and even before that. It was also present in ace:richTextEntry. It actually only happened when using saveOnSubmit=true. The saveOnSubmit feature updates the underlying text area whenever the user blurs the editor or mouse out of it, so that if the form is submitted by any external means, then the current value of the textarea will be submitted in the form, instead of only being able to submit when pressing the save button. The way this is done is by calling the editor's getData() function at these events and to set the contents to the textarea. However, under certain circumstances a JS error occurs when calling getData() because the iframe object is not present yet. This usually happens after clicking the save button twice or after a combination of certain events like blurring and saving. This only happened once, and then the iframe was always present after the first error happened. So, the fix consists in adding a check in the ckeditor's code to see if the iframe exists, otherwise exit the function. This won't affect the saveOnSubmit functionality because the iframe is always found when saving by clicking a button outside of editor, as in the save on submit example in the showcase.

        Additionally, the onmouseout event was removed because it doesn't really accomplish it's goal. One could mouse out of the editor and still be able to type in the editor, so there's no way to mouseout again to activate the event handler and save the content to the textarea. So, the only event we need to save the editor's contents to the textarea is the blur event. Ideally, we would do this whenever the contents of the editor change, but unfortunately, there's no onchange event in the CKEDITOR, due to its complexity. However, there's a third party plug-in that simulates this (in the link below, and it would be worth considering for a future enhancement for this component.

        http://alfonsoml.blogspot.ca/2011/03/onchange-event-for-ckeditor.html

        Show
        Arturo Zambrano added a comment - Commited fix at revision 34506. The issue was indeed present in 3.2 and even before that. It was also present in ace:richTextEntry. It actually only happened when using saveOnSubmit=true. The saveOnSubmit feature updates the underlying text area whenever the user blurs the editor or mouse out of it, so that if the form is submitted by any external means, then the current value of the textarea will be submitted in the form, instead of only being able to submit when pressing the save button. The way this is done is by calling the editor's getData() function at these events and to set the contents to the textarea. However, under certain circumstances a JS error occurs when calling getData() because the iframe object is not present yet. This usually happens after clicking the save button twice or after a combination of certain events like blurring and saving. This only happened once, and then the iframe was always present after the first error happened. So, the fix consists in adding a check in the ckeditor's code to see if the iframe exists, otherwise exit the function. This won't affect the saveOnSubmit functionality because the iframe is always found when saving by clicking a button outside of editor, as in the save on submit example in the showcase. Additionally, the onmouseout event was removed because it doesn't really accomplish it's goal. One could mouse out of the editor and still be able to type in the editor, so there's no way to mouseout again to activate the event handler and save the content to the textarea. So, the only event we need to save the editor's contents to the textarea is the blur event. Ideally, we would do this whenever the contents of the editor change, but unfortunately, there's no onchange event in the CKEDITOR, due to its complexity. However, there's a third party plug-in that simulates this (in the link below, and it would be worth considering for a future enhancement for this component. http://alfonsoml.blogspot.ca/2011/03/onchange-event-for-ckeditor.html

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Carmen Cristurean
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: