CKEditor JavaScript Exc. if the browser is not compatible

Community Driven Extensions Project
Post Reply
obr
Posts: 6
Joined: 07 Dec 2012, 15:42

28 Oct 2014, 16:56

The CKEditor checks if it is compatible with the used browser. It stores this information in CKEDITOR.env.isCompatible.
Is it not compatible (on Androids Chrome for instance) only the textarea is shown. In this case the _render-Function in 'primefaces-extensions.js' causes an exception which breaks the execution of JavaScript on this page. To prevent breaking the page, I added a try/catch. Maybe this or a better solution can be put in the next release?
Thank you.
Oliver

Code: Select all

_render:function(){
    if(!this.instance){
        this.overwriteSaveButton();
        var a=CKEDITOR.instances[this.id];
        if(a)try{a.destroy(!0)}catch(b){window.console&&console.log&&
                 console.log("CKEditor throwed a error while destroying the old instance: "+b)}
       try {
            // added try catch
            this.jq.ckeditor($.proxy(function(){this.initialized()}, this), this.options)
       } catch (b) {window.console&&console.log&&
                    console.log("Browser is not compatible for CKEditor. Fallback to textarea.")
       }
    }
}
Wildfly 8.1
PF 5.1;
PFE 2.1;
Mojarra 2.2.8

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

28 Oct 2014, 18:02

it's not 100% sure that a error is thrown because of compatibility.
Feel free to develop a better check and provide a pull request via github.
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

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests