12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- (function ($, Drupal, drupalSettings) {
- 'use strict';
-
- var linkitImce = window.linkitImce = {};
-
- Drupal.behaviors.linkitImce = {
- attach: function (context, settings) {
- var $link = $(context).find('.linkit-imce-open').once('linkit-imce-open');
- if ($link.length) {
- $link.bind('click', function (event) {
- event.preventDefault();
- window.open($(this).attr('href'), '', 'width=760,height=560,resizable=1');
- });
- }
- }
- };
-
- linkitImce.sendto = function (file, win) {
- var imce = win.imce;
- var items = imce.getSelection();
- if (imce.countSelection() > 1) {
- imce.setMessage(Drupal.t('You can only select one file.'));
- return;
- }
- var path = imce.getConf('root_url') + '/' + imce.getItemPath(items[0]);
- $('[data-drupal-selector="edit-attributes-href"]').val(path);
- win.close();
- };
- })(jQuery, Drupal, drupalSettings);
|