3 * IMCE integration for Linkit.
6 (function ($, Drupal, drupalSettings) {
13 * Need to be in the global namespace, otherwise the IMCE window will not show
14 * the 'select' button in the toolbar.
16 var linkitImce = window.linkitImce = {};
19 * Drupal behavior to handle imce linkit integration.
21 Drupal.behaviors.linkitImce = {
22 attach: function (context, settings) {
23 var $link = $(context).find('.linkit-imce-open').once('linkit-imce-open');
25 $link.bind('click', function (event) {
26 event.preventDefault();
27 window.open($(this).attr('href'), '', 'width=760,height=560,resizable=1');
34 * Handler for imce sendto operation.
36 linkitImce.sendto = function (file, win) {
38 var items = imce.getSelection();
40 if (imce.countSelection() > 1) {
41 imce.setMessage(Drupal.t('You can only select one file.'));
44 var path = imce.getConf('root_url') + '/' + imce.getItemPath(items[0]);
45 $('[data-drupal-selector="edit-attributes-href"]').val(path);
50 })(jQuery, Drupal, drupalSettings);