Dotclear


Ignore:
Timestamp:
09/18/18 20:22:10 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/dcCKEditor/js/ckeditor-plugins/media/plugin.js

    r2835 r3880  
     1/*global CKEDITOR, dotclear, $ */ 
     2'use strict'; 
     3 
    14(function() { 
    2      CKEDITOR.plugins.add('media', { 
    3           icons: 'media', 
    4           init: function(editor) { 
    5                popup_params = { 'width': 760, 'height': 500}; 
     5  CKEDITOR.plugins.add('media', { 
     6    icons: 'media', 
     7    init: function(editor) { 
     8      const popup_params = { 
     9        'width': 760, 
     10        'height': 500 
     11      }; 
    612 
    7                editor.addCommand('mediaCommand', { 
    8                     exec: function(editor) { 
    9                          $.toolbarPopup('media.php?popup=1&plugin_id=dcCKEditor', popup_params); 
    10                     } 
    11                }); 
     13      editor.addCommand('mediaCommand', { 
     14        exec: function() { 
     15          $.toolbarPopup('media.php?popup=1&plugin_id=dcCKEditor', popup_params); 
     16        } 
     17      }); 
    1218 
    13                editor.ui.addButton('Media', { 
    14                     label: dotclear.msg.img_select_title, 
    15                     command: 'mediaCommand', 
    16                     toolbar: 'insert' 
    17                }); 
     19      editor.ui.addButton('Media', { 
     20        label: dotclear.msg.img_select_title, 
     21        command: 'mediaCommand', 
     22        toolbar: 'insert' 
     23      }); 
    1824 
    19                editor.on('doubleclick',function(e) { 
    20                     var element = CKEDITOR.plugins.link.getSelectedLink(editor) || e.data.element; 
    21                     if (!element.isReadOnly()) { 
    22                          if (element.is('img') || (element.is('a') && element.hasClass('media-link'))) { 
    23                               $.toolbarPopup('media.php?popup=1&plugin_id=dcCKEditor', popup_params); 
    24                               return false; 
    25                          } 
    26                     } 
    27                }); 
    28           } 
    29      }); 
     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  }); 
    3036})(); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map