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/entrylink/plugin.js

    r2901 r3880  
     1/*global CKEDITOR, dotclear, $ */ 
     2'use strict'; 
     3 
    14(function() { 
    2      CKEDITOR.plugins.add('entrylink', { 
    3           icons: 'entrylink', 
    4           init: function(editor) { 
    5                popup_params = { 'width': 760, 'height': 500}; 
     5  CKEDITOR.plugins.add('entrylink', { 
     6    icons: 'entrylink', 
     7    init: function(editor) { 
     8      const popup_params = { 
     9        'width': 760, 
     10        'height': 500 
     11      }; 
    612 
    7                editor.addCommand('entryLinkCommand', { 
    8                     exec: function(editor) { 
    9                          if (editor.getSelection().getNative().toString().replace(/\s*/,'')!='') { 
    10                               $.toolbarPopup('popup_posts.php?popup=1&plugin_id=dcCKEditor', popup_params); 
    11                          } 
    12                     } 
    13                }); 
     13      editor.addCommand('entryLinkCommand', { 
     14        exec: function(editor) { 
     15          if (editor.getSelection().getNative().toString().replace(/\s*/, '') != '') { 
     16            $.toolbarPopup('popup_posts.php?popup=1&plugin_id=dcCKEditor', popup_params); 
     17          } 
     18        } 
     19      }); 
    1420 
    15                editor.ui.addButton('EntryLink', { 
    16                     label: dotclear.msg.post_link_title, 
    17                     command: 'entryLinkCommand', 
    18                     toolbar: 'insert' 
    19                }); 
     21      editor.ui.addButton('EntryLink', { 
     22        label: dotclear.msg.post_link_title, 
     23        command: 'entryLinkCommand', 
     24        toolbar: 'insert' 
     25      }); 
    2026 
    21                editor.on('doubleclick',function(e) { 
    22                     var element = CKEDITOR.plugins.link.getSelectedLink(editor) || e.data.element; 
    23                     if (!element.isReadOnly()) { 
    24                          if (element.is('a') 
    25                              && !element.hasClass('media-link') 
    26                              && element.hasClass('ref-post')) { // link to original media @see js/popup_media.js 
    27                               editor.getSelection().selectElement(element); 
     27      editor.on('doubleclick', function(e) { 
     28        const element = CKEDITOR.plugins.link.getSelectedLink(editor) || e.data.element; 
     29        if (!element.isReadOnly()) { 
     30          if (element.is('a') && !element.hasClass('media-link') && element.hasClass('ref-post')) { 
     31            // link to original media @see js/popup_media.js 
     32            editor.getSelection().selectElement(element); 
    2833 
    29                               $.toolbarPopup('popup_posts.php?popup=1&plugin_id=dcCKEditor', popup_params); 
    30                               return false; 
    31                          } 
    32                     } 
    33                }); 
    34           } 
    35      }); 
     34            $.toolbarPopup('popup_posts.php?popup=1&plugin_id=dcCKEditor', popup_params); 
     35            return false; 
     36          } 
     37        } 
     38      }); 
     39    } 
     40  }); 
    3641})(); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map