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
From 09:00 To 17:00 Europe/London (BST)

Please post your question in the Forum and we will get back to you as soon as we can.

  Friday, 09 July 2021
  10 Replies
  1.1K Visits
Hello,

Is it possible to trigger and use the link/media/file manager popups away from using JCE as an editor? I have created a page builder editor and would like to implement the use of JCE's insert link popup, as well as the image uploading capabilities provided by JCE. Using joomla by the way.

It's fine to require the editor somewhere on the page, but to programmatically open the popup and collect the HTML it generates would save me a lot of trouble

Thanks in advance
more than a month ago
·
#108537
Accepted Answer
Good point, thanks Ryan.

To anyone trying to do this too, I have included my process and final solution in the below pastebin.

https://pastebin.com/7LLKT5Mc
more than a month ago
·
#108268
I have created a page builder editor and would like to implement the use of JCE's insert link popup, as well as the image uploading capabilities provided by JCE. Using joomla by the way.


It is available in a field, which you can add to your extension, as you would other Joomla fields, eg:


<field
name="my_media"
type="mediajce"
label="My Media Field"
description=""
mediatype="images"
/>


Alternatively, if you use the Joomla Media field, it will be converted into a JCE Media Field, eg:


<field
name="my_media"
type="media"
label="My Media Field"
description=""
/>

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

more than a month ago
·
#108283
Hey Ryan,

Thanks for the reply. It's not being rendered in this way, so essentially I've created a custom field type that renders a page builder (built in JS). The page builder has an interface that is self contained and simply dumps its HTML into the article/category field in the admin screen.

Ideally I'd like to trigger the link/media popups myself. I don't know there's an API to expose its features?

As it works as a standalone field type, I'm hopeful it can be used this way too.

Thanks again


edit: ps it took me ages to submit this post. Something in my reply was setting off admin tools and blocking me from replying. There were no code examples or profanities so maybe this needs adjusting?
more than a month ago
·
#108292
I don't know there's an API to expose its features?


Not really, as it's designed to run off the Joomla Fields API, either as a Joomla Media Field, or as a MediaJCE field.

edit: ps it took me ages to submit this post. Something in my reply was setting off admin tools and blocking me from replying. There were no code examples or profanities so maybe this needs adjusting?


It looks like something triggered the SQLi Shield.

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

more than a month ago
·
#108294
Thanks Ryan. So there isn't a way for me to utilise these features outside of the editor? Even if it were hidden on the page for example?

If it works as a standalone joomla field I'd have thought I can potentially initialise the field in a similar way just without the joomla interface (hidden field/call the JS/php directly)
more than a month ago
·
#108295
See this - https://github.com/widgetfactory/jce/blob/master/plugins/system/jce/fields/mediajce.php#L57-L67

So for example if you supplied a $config array with the following:


$config = array(
'element' => 'my_custom_input',
'mediatype' => 'images',
'converted' => false
);

$options = WFBrowserHelper::getMediaFieldOptions($config);


then an $options array can be returned with the url value to use for the modal iframe, assuming you are going to handle opening of the modal yourself.

If no url value is returned, then the user does not have access to the File Browser.

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

more than a month ago
·
#108503
Hey Ryan

Thanks for your input so far. I've been working on this and unfortunately PHP implementations aren't going to work as my page builder is created entirely via JS.

I've changed the requirement slightly and now instead of hijacking the link/media popups, I want to use the editor directly within my page builder.

I note that a WFEditor.init(); function is called and passed parameters. Is it possible to effectively recall this after including the correct JS files?

Simply put I would like to, within a javascript app, initialise JCE and have it return the inputted data (getContent()) to a DIV. This way I can create and destroy the editor at will whenever I need to use it.

Is it possible to call WFEditor.init() myself and create and destroy JCE editors as I see fit? I noticed some of the data is kept in a JSON string in the <head> (like tokens and the element to turn into an editor)

Look forward to hearing back

Thank you
more than a month ago
·
#108504
Hi Ryan,

In my digging I have found this thread

https://www.joomlacontenteditor.net/support/forum/98135-error-in-creating-editor-via-javascript-uncaught-typeerror-cannot-read-property-css-of-undefined-in-editor_template-js

Which seems to answer the query. I've implemented your suggestion but get the error

"Uncaught TypeError: can't convert undefined to object"

I feel like I'm very nearly there so any help you can offer is appreciated

Kind regards
more than a month ago
·
#108510
Hi Ryan

I have figured this out, but I am really struggling to make a reply that answers the query for others. Something in my post gets blocked every time. Please can you PM or email me so that I can give you my answer, so that you may post it?
more than a month ago
·
#108534
Either include more complex scripts as a zipped attachement to your post, or ideally, linked to a github gist (if you have a github account), or a jsfiddle - https://jsfiddle.net/

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

more than a month ago
·
#108537
Accepted Answer
Good point, thanks Ryan.

To anyone trying to do this too, I have included my process and final solution in the below pastebin.

https://pastebin.com/7LLKT5Mc
qlue selected the reply #108537 as the answer for this post — 1 month ago
  • Page :
  • 1
There are no replies made for this post yet.
Be one of the first to reply to this post!