Dotclear

source: plugins/dcCKEditor/js/ckeditor-plugins/media/plugin.js @ 3880:e6d1f6d9d7df

Revision 3880:e6d1f6d9d7df, 975 bytes checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

Use let and const rather than var (ES2015/ES6), use template string where is more efficient

Line 
1/*global CKEDITOR, dotclear, $ */
2'use strict';
3
4(function() {
5  CKEDITOR.plugins.add('media', {
6    icons: 'media',
7    init: function(editor) {
8      const popup_params = {
9        'width': 760,
10        'height': 500
11      };
12
13      editor.addCommand('mediaCommand', {
14        exec: function() {
15          $.toolbarPopup('media.php?popup=1&plugin_id=dcCKEditor', popup_params);
16        }
17      });
18
19      editor.ui.addButton('Media', {
20        label: dotclear.msg.img_select_title,
21        command: 'mediaCommand',
22        toolbar: 'insert'
23      });
24
25      editor.on('doubleclick', function(e) {
26        const element = CKEDITOR.plugins.link.getSelectedLink(editor) || e.data.element;
27        if (!element.isReadOnly()) {
28          if (element.is('img') || (element.is('a') && element.hasClass('media-link'))) {
29            $.toolbarPopup('media.php?popup=1&plugin_id=dcCKEditor', popup_params);
30            return false;
31          }
32        }
33      });
34    }
35  });
36})();
Note: See TracBrowser for help on using the repository browser.

Sites map