Redactor callback on link creation

Permalink
Hi,

is there a chance to hook into the event when a file link was created with redactor?
I need this to add custom attributes to the anchor so a javascript can grab these donwload links.

Does anyone know a way to achieve that?

Best,
Marcus

elpado
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi elpado,

Here is the code from redactor.js that is involved in launching the file manager. Maybe you can use this to point you in the right direction.
if (this.opts.concrete5.filemanager) {
   $('a[data-action=choose-file-from-file-manager]').on('click', function(e) {
      e.preventDefault();
      ConcreteFileManager.launchDialog(function(data) {
         jQuery.fn.dialog.showLoader();
         ConcreteFileManager.getFileDetails(data.fID, function(r) {
            jQuery.fn.dialog.hideLoader();
            var file = r.files[0];
            $('#redactor-image-link').val(file.urlInline);
         });
      });
   });
} else {
   $('a[data-action=choose-file-from-file-manager]').remove();
}