pe:ckEditor issues when in prime:tabView - 5.1.5 and above

Community Driven Extensions Project
Post Reply
joelconv
Posts: 11
Joined: 26 Mar 2013, 19:18
Location: Newcastle, UK

03 Mar 2015, 16:54

I'm in the process of upgrading from primefaces 4.0.X to 5.1.X so have been going through my app making sure everything is standing up ok. I'm using the latest 3.0.0 version of primefaces extensions.

I came across an issue on one of my pages where I was using pe:cKEditor within a prime:tabView where I could effectively screw up the initialisation of the editor depending on the order in which I clicked buttons.

I've condensed my larger example down to the following snippet to eliminate a lot of other issues:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:prime="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <h:head>
    </h:head>

    <h:body>
        <h:form id="contentForm">
            <prime:tabView>
                <prime:tab  title="Tab 1">
                    <prime:outputLabel value="FLD PAGE 1"></prime:outputLabel>
                    <prime:inputText value="#{testBean.field1}" size="50"/>
                </prime:tab>

                <prime:tab title="Tab 2">
                    <prime:outputLabel value="FLD PAGE 2"></prime:outputLabel>
                    <pe:ckEditor value="#{testBean.field2}"/>
                </prime:tab>
            </prime:tabView>

            <h:panelGroup style="float:right">
                <prime:commandButton value="An Action" action="#{testBean.doAction}" update=":contentForm"/>
            </h:panelGroup>
        </h:form>
    </h:body>
</html>
When you go into the page, switch to tab 2, the ckEditor initialises fine. If you go into the page, click the action button, then switch to the second tab, the ckEditor doesn't initialise properly and you get the following javascript error:

Uncaught TypeError: Cannot read property 'hasAttribute' of undefined

I initially assumed it would be an issue with the primefaces extensions / ckEditor resources as there seems to be some historical errors reported with the editor when it tries to destroy / initialise itself. See http://dev.ckeditor.com/ticket/11924 and http://stackoverflow.com/questions/1932 ... -in-emberj but by chance I jumped back to version 5.1.2 of primefaces and found I didn't have the same issue. I went up versions one by one until it started breaking and the issues start in version 5.1.5

Whilst I am sure I can do some working around, restructuring the page in question (which is obviously far more complicated than the example above), I wonder if anyone else is experiencing this, and why it might have just started occurring since version 5.1.5

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

03 Mar 2015, 17:11

3.0.0 was tested with 5.1 and i'm sure 3.0.0 is not fully compatible with elite releases as small stuff like hidden container logic was changed during elite releases.

If not sponsored, we will not release elite versions of primefaces extensions as its much effort for us to maintain such an project for bi-weekly releases.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

joelconv
Posts: 11
Joined: 26 Mar 2013, 19:18
Location: Newcastle, UK

03 Mar 2015, 17:18

Thanks for the quick reply tandraschko. Totally understand that each project is on a different path and can't always be in synch with elite releases.

Just want to be clear what you are saying there though. Basically, I should wait until the next marked release / sync of primefaces and extensions and hope that it's fixed?
PrimeFaces 7.0.15
Spring Boot 2.3.1 (Embedded Tomcat)
JSF 2.2 (Mojarra)
Hibernate + MySQL

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

03 Mar 2015, 17:26

Yep, exactly but the upcoming release will be in sync with PF 5.2.
hope that it's fixed?
It would be better to test it with source builds BEFORE the release, so you can be sure that it will be fixed :P

It MAY be possible that you copy the current ckeditor script in your project via the last facade of h:head:
https://github.com/primefaces-extension ... /widget.js
this script should work with the hidden container logic of PF 5.1 elite releases.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

joelconv
Posts: 11
Joined: 26 Mar 2013, 19:18
Location: Newcastle, UK

03 Mar 2015, 17:55

Thanks again for the quick response, really is appreciated, you guys do amazing work.

I've just went ahead and grabbed the latest ckEditor resources from github and created my own jar from it (I don't use maven) as I noticed that you'd updated that on 31st December (what, no new year celebrations :D ).

So far, it looks like promising to solve my issue. I just assumed that latest showcase had that in, but noticed it was a November on the timestamp (and the cloudbees link wasn't working)
PrimeFaces 7.0.15
Spring Boot 2.3.1 (Embedded Tomcat)
JSF 2.2 (Mojarra)
Hibernate + MySQL

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

03 Mar 2015, 17:58

thanks!

the widget.js is not in the resources jar, therefore it should NOT fix your problem :)
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

joelconv
Posts: 11
Joined: 26 Mar 2013, 19:18
Location: Newcastle, UK

03 Mar 2015, 18:25

Definitely seems to have fixed the issue I am having as the JS error is no longer a hard blocking error about hasAttribute (which prevents it from initialising) to what seems like a console logged error stating:

CKEditor throwed a error while destroying the old instance: TypeError: Cannot read property 'destroy' of undefined

Totally understand what you are saying regards the widget js and the new container logic in the elite releases, but it seems (for my example) this gets me over the hurdle I need. Seems like the upgraded CK Editor scripts have more defensive coding inside them, I had read a few bug reports about a similar (outside of Primefaces) issue that other users had whilst using various javascript frameworks.
PrimeFaces 7.0.15
Spring Boot 2.3.1 (Embedded Tomcat)
JSF 2.2 (Mojarra)
Hibernate + MySQL

juttt45
Posts: 2
Joined: 31 Mar 2015, 07:07

31 Mar 2015, 07:19

Just want to be clear what you are saying there though. Basically, I should wait until the next marked release / sync of primefaces and extensions and hope that it's fixed??? :?:

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests