1

Using org.omnifaces.resourcehandler.CombinedResourceHandler with,

  • OmniFaces 2.2 final
  • PrimeFaces 5.3 final
  • PrimeFaces Extensions 4.0.0

There is a <pe:ckEditor> being used at one place in an application.

Simply trying to load the editor like the following.

<h:form id="form">
    <pe:ckEditor value="Contents" label="Label" height="200" width="1000"/>
</h:form>

leaves the following JavaScript error on the console.

Uncaught TypeError: Cannot read property 'replace' of undefined

The test case contains nothing other than the basic XHTML structure and a <pe:ckEditor> tag.

The error disappears, when

<resource-handler>org.omnifaces.resourcehandler.CombinedResourceHandler</resource-handler>

is removed from faces-config.xml.

The error is arriving from primefaces-extensions.source.js. Something wonky is likely to be happening in assembling / combining the JavaScript code into a single JavaScript file, when a <pe:ckEditor> is used.

It is also reproducible in OmniFaces 2.1 final

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Tiny
  • 27,221
  • 105
  • 339
  • 599
  • Is this still applicable? http://stackoverflow.com/questions/25003338/peckeditor-doesnt-work-anymore-after-adding-combinedresourcehandler – BalusC Dec 14 '15 at 21:14
  • Done as directed. `` related resources were not loaded. 404 at `javax.faces.resource/ckeditor/skins/moono/&v=null&v=null&v=null`, `javax.faces.resource/ckeditor/styles.js&v=null&v=null&v=null`. – Tiny Dec 14 '15 at 21:30
  • Perhaps things changed in PE 4. Let me check. – BalusC Dec 14 '15 at 21:32
  • They improved their resource handler. Explicitly registering it after the combined resource handler is unnecessary and only causes trouble you were seeing. Removing it from explicit registration worked for me. Only the context param for OmniFaces is sufficient. Does it now work for you too? – BalusC Dec 14 '15 at 21:49
  • Dupe answer has been improved. Thanks! :) For the record, those were the fixes PE guys did making explicitly ordered registration unnecessary: https://github.com/primefaces-extensions/core/commit/28a07ba and https://github.com/primefaces-extensions/core/commit/64dc30d – BalusC Dec 14 '15 at 22:00
  • This question does not deserve an upvote, since it is a duplicate :) – Tiny Dec 14 '15 at 22:03
  • All contributions to improving OmniFaces deserve an upvote. – BalusC Dec 14 '15 at 22:04
  • Excluding `primefaces-extensions.js` from being included in a combined js file has a consequence which I could only see in the real application. I am also using other components from PrimeFaces Extensions like `` which issue errors like `Uncaught ReferenceError: PrimeFacesExt is not defined` `Uncaught TypeError: Cannot read property 'replace' of undefined` `Uncaught TypeError: Cannot read property 'show' of undefined`. It might be because `primefaces-extensions.js` is loaded after the combined js. Hence, no reference from `primefaces-extensions.js` is available to the combined js. – Tiny Dec 14 '15 at 23:59
  • 1
    Try to exclude `primefaces-extensions:*` instead. – BalusC Dec 15 '15 at 08:04
  • I see something unusual. This `primefaces-extensions:*` excludes no JavaScript / CSS files. – Tiny Dec 15 '15 at 13:57
  • Wildcard cupport for CRH was only added in OmniFaces 2.2. – BalusC Dec 15 '15 at 19:45
  • I am using OmniFaces 2.2. – Tiny Dec 15 '15 at 19:50
  • Hm, I tested it right before posting the comment and it worked for me. – BalusC Dec 15 '15 at 20:00
  • Forgive my ignorance. I am currently busy migrating the application from GlassFish to WildFly. Since the IDE behaves weirdly with WildFly in deploying applications, I had been testing this on GlassFish for the sake of convenience to deploy the application where I forgot to upgrade OmniFaces 2.1 to 2.2. Upgrading the library solved the problem entirely. Thanks. – Tiny Dec 15 '15 at 20:07
  • You're welcome. Those things happen :) – BalusC Dec 15 '15 at 20:08

0 Answers0