You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#115024 Implementation of JCE into custom component

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Thursday, 09 November 2023 11:51 GMT

erycweb
I am developing a Joomla 4 component which uses editors in a couple of different contexts.

The first is in a standard editor form field type and that is now using JCE without a problem after I installed the Pro version. It's also using a custom JCE profile that I set up.

The second manually assigns an editor to textarea inputs. Currently the view file has a line to import Joomla's native tinymce script and then calls tinymce.init with the selector of the input I want it to appear on, plus a few other parameters to say which buttons it wants on which toolbar etc.

I would like to be able to replace the editor in this context with JCE, and be able to programmatically specify which JCE profile it uses as well, but I'm not sure if it's possible or how to go about it.

I tried copying the CSS and script dependencies that I could see in the HTML for the view for the standard JCE implementation, but it's failing when it tries to access language files. I can also see the WfEditor.init function call in the HTML, but I assume this is generated by the JCE component somehow, so I'm hoping there is a straightforward way I can call JCE that will set up the dependencies for me as well as the init function. Can you help point me in the right direction please?

erycweb
I've made some progress with this.

I have a standard form element on my form view that was originally a textarea that I'd assigned a custom implementation of tinymce to, but I've now changed it to an editor form field type, so that field is now importing JCE into the page properly.

I've also worked out that I'm able to assign JCE to other textareas on the page by giving them the classes mce_editable and wf-editor. That should be enough to get me moving, but if there is a nice way of importing JCE without having an editor form field on the page somewhere, that would be very useful to know.

Ryan
I've also worked out that I'm able to assign JCE to other textareas on the page by giving them the classes mce_editable and wf-editor. That should be enough to get me moving, but if there is a nice way of importing JCE without having an editor form field on the page somewhere, that would be very useful to know.


This is always the best way because it is essentially future-proof. Any other method I suggest may be subject to change in a future update as it is not an official API based method for loading an editor in Joomla.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.