juek / CustomSections

Developer plugin for rapid prototyping of custom section types in Typesetter CMS
GNU General Public License v2.0
3 stars 7 forks source link

CK editor field (image) #17

Closed a2exfr closed 7 years ago

a2exfr commented 7 years ago

When have image field and ckeditor field in one custom editor, when you want insert image in ckeditor field this image goes to editor image field) Can we divide this callback? On first look I do not know where to dig...

juek commented 7 years ago

Hmm, this could become tricky....

juek commented 7 years ago

We need to destroy the gp_editor.FinderSelect once used... I'll try it

a2exfr commented 7 years ago

Once you wrote it, I just remember that I have done it before in otherr plug in!!! I have to look my folders)) I have two image select and editor there

juek commented 7 years ago

please try this:

  gp_editor.selectUsingFinder = function(callback_fn, input_selector){
    gp_editor.FinderSelect = function(fileUrl){ 
      if (fileUrl != "") {
        callback_fn(fileUrl, input_selector);
      }
      setTimeout(function(){
        gp_editor.FinderSelect = null;
      }, 150);
      return true;
    };
    var finderPopUp = window.open(gpFinderUrl, 'gpFinder', 'menubar=no,width=960,height=450');
    if( window.focus ){ 
      finderPopUp.focus(); 
    }
  }; // gp_editor.selectUsingFinder --end

my current codebase i not ready to commit.

juek commented 7 years ago

or better

delete gp_editor.FinderSelect;

instead of

gp_editor.FinderSelect = null;

juek commented 7 years ago

but even ...

gp_editor.FinderSelect = false;

should work. Anything that doesn't return a 'function' type will prevent the execution.

a2exfr commented 7 years ago

I was doing this like this in but in callback function

gp_editor.FinderSelect="";

shame that I forgot about this

juek commented 7 years ago

LOL, yes, ="" will also work.

juek commented 7 years ago

I was doing this like this in but in callback function

Since the callback_fn can be anything, doing it in FinderSelect with setTimeout will be easier and more safe.

a2exfr commented 7 years ago

mega lol that I made new issue about this, despite solve it in the past)

I agree about timeot, let me test it.

juek commented 7 years ago

I made new issue about this, despite solve it in the past

Haha, yes, now I recall that we talked about this one earlier. Repetition improves memory :)

a2exfr commented 7 years ago

Just test it work good. Made [ pull request] (https://github.com/juek/CustomSections/pull/18)

juek commented 7 years ago

Thx. I'm currently working on module/component loader. Hope to commit soon.