Topic Closed
juergen
1.4K Posts
50.2K Downloads
16 Plugins
design, web development & visual effects

Josh, may I ask you for a favor?

The new live editing in ver 5 is great. I really love it, it makes the whole editing process pretty straight-forward.
Unfortunately my dirty hack, getting a finder by creating a faux CKEDITOR JS object in several of my plugins will not work anymore.

Although we already discussed finder related things several times, I still didn't manage to get a working alternative to my dirty hack.

Now I wonder if the Typesetter system itself could provide a JS function for file selection.

2 of my already released plugins are affected (Responsive Image and Simple Button) and 3 more to I'd like to release shortly (Slider Factory, Parallax Image, Background Assistant).

Could you please assist me here or - even better - provide sth. like a $gp.selectFile() function in the CMS?

TIA

 

3 years ago#8648

juergen
1.4K Posts
50.2K Downloads
16 Plugins
design, web development & visual effects

update: Now I managed to get a working finder popoup, not interfering with CKEDITOR for my plugins' editor components by adding custom frontend and backend special links.
Since both links only make sense in the editing context, I have hidden them from Admin Menu using CSS.
So this works basically and I will be able to make my addons TS5 compatible.

Anyway, a built-in function would still be after my fancy ;-)

3 years ago#8649

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins

I've added a call to window.top.opener.gp_editor.FinderSelect() for the finder. So in the Responsive Image plugin, instead of the the faux CKEDITOR, we can do this:

    gp_editor.FinderSelect = function(file){
        if( fileUrl != "" ){
            gp_editor.imageData.src = fileUrl;
            gp_editor.imageData.focusX = 0;
            gp_editor.imageData.focusY = 0;
            gp_editor.imageToContent();
            gp_editor.updateEditor();
            gp_editor.optionsChanged = true;
        }
    }

Is that better? It's not $gp.SelectFile() but hopefully helpful

Sorry I didn't get to this sooner

3 years ago#8687

juergen
1.4K Posts
50.2K Downloads
16 Plugins
design, web development & visual effects

Is that better?

Excellent, so we can even use it this way:

gp_editor.MyCustomFinderTriggerFn = function(MyCustomCallbackFn) {
    gp_editor.FinderSelect = function(fileUrl) {
      if (fileUrl != "") {
        MyCustomCallbackFn(fileUrl);
      }
      return true;
    };
    var finderPopUp = window.open(gpFinderUrl, 'gpFinder', 'menubar=no,width=960,height=450');
    if (window.focus) { finderPopUp.focus(); }
  }

Maybe this could also be done more elegant (scope, context, closures... that's not exactly my experise) but this will work.

It would also be great if the JS variable gpFinderUrl was already defined.
This would spare us to set it in InlineEdit_Scripts or GetHead for every plugin...

  function GetHead() {
    global $page;
    [...]
    $page->head_script .= "\nvar gpFinderUrl = '" . common::GetUrl('Admin_Browser') . "';\n";
    [...]
  }
Edited: 3 years ago#8692

Josh S.
2K Posts
263K Downloads
16 Themes
18 Plugins

It would also be great if the JS variable gpFinderUrl was already defined.

Sure thing

3 years ago#8696

Topic Closed

 

News

Typesetter 5.1
8/12/2017

Typesetter 5.0.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

Over 8 Times Faster Than Wordpress
5/3/2016

We've known for a long time that Typesetter is fast. It's something we take pride ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register