Legend:
- Unmodified
- Added
- Removed
-
plugins/dcCKEditor/js/ckeditor-plugins/dclink/plugin.js
r2962 r3880 1 /*global CKEDITOR, dotclear, $ */ 2 'use strict'; 3 1 4 (function() { 2 3 4 5 6 7 if (editor.getSelection().getSelectedElement()!=null 8 || editor.getSelection().getNative().toString().replace(/\s*/,'')!='') {9 10 11 12 5 CKEDITOR.plugins.add('dclink', { 6 icons: 'dclink', 7 init: function(editor) { 8 editor.addCommand('dcLinkCommand', { 9 exec: function(editor) { 10 if (editor.getSelection().getSelectedElement() != null || 11 editor.getSelection().getNative().toString().replace(/\s*/, '') != '') { 12 $.toolbarPopup('popup_link.php?plugin_id=dcCKEditor'); 13 } 14 } 15 }); 13 16 14 15 16 17 18 17 editor.ui.addButton('dcLink', { 18 label: dotclear.msg.link_title, 19 command: 'dcLinkCommand', 20 toolbar: 'insert' 21 }); 19 22 20 editor.on('doubleclick',function(e) {21 varelement = CKEDITOR.plugins.link.getSelectedLink(editor) || e.data.element;22 23 if (element.is('a') 24 && !element.hasClass('media-link')// link to original media @see js/popup_media.js25 && !element.hasClass('ref-post')) {// link to an entry @see js/popup_posts.js23 editor.on('doubleclick', function(e) { 24 const element = CKEDITOR.plugins.link.getSelectedLink(editor) || e.data.element; 25 if (!element.isReadOnly()) { 26 if (element.is('a') && 27 !element.hasClass('media-link') && // link to original media @see js/popup_media.js 28 !element.hasClass('ref-post')) { // link to an entry @see js/popup_posts.js 26 29 27 30 editor.getSelection().selectElement(element); 28 31 29 varpopup_url = 'popup_link.php?plugin_id=dcCKEditor';30 31 popup_url += '&href='+element.getAttribute('href');32 33 34 popup_url += '&hreflang='+element.getAttribute('hreflang');35 36 37 popup_url += '&title='+element.getAttribute('title');38 32 let popup_url = 'popup_link.php?plugin_id=dcCKEditor'; 33 if (element.getAttribute('href')) { 34 popup_url += '&href=' + element.getAttribute('href'); 35 } 36 if (element.getAttribute('hreflang')) { 37 popup_url += '&hreflang=' + element.getAttribute('hreflang'); 38 } 39 if (element.getAttribute('title')) { 40 popup_url += '&title=' + element.getAttribute('title'); 41 } 39 42 40 41 42 43 44 45 46 43 $.toolbarPopup(popup_url); 44 return false; 45 } 46 } 47 }); 48 } 49 }); 47 50 })();
Note: See TracChangeset
for help on using the changeset viewer.