Rev | Line | |
---|
[2738] | 1 | (function() { |
---|
| 2 | CKEDITOR.plugins.add('dclink', { |
---|
| 3 | icons: 'dclink', |
---|
| 4 | init: function(editor) { |
---|
| 5 | editor.addCommand('dcLinkCommand', { |
---|
| 6 | exec: function(editor) { |
---|
[2868] | 7 | if (editor.getSelection().getSelectedElement()!=null |
---|
| 8 | || editor.getSelection().getNative().toString().replace(/\s*/,'')!='') { |
---|
[2751] | 9 | $.toolbarPopup('popup_link.php?plugin_id=dcCKEditor'); |
---|
[2738] | 10 | } |
---|
| 11 | } |
---|
| 12 | }); |
---|
| 13 | |
---|
| 14 | editor.ui.addButton('dcLink', { |
---|
[2743] | 15 | label: dotclear.msg.link_title, |
---|
[2738] | 16 | command: 'dcLinkCommand', |
---|
| 17 | toolbar: 'insert' |
---|
| 18 | }); |
---|
[2743] | 19 | |
---|
[2738] | 20 | editor.on('doubleclick',function(e) { |
---|
| 21 | var element = CKEDITOR.plugins.link.getSelectedLink(editor) || e.data.element; |
---|
| 22 | if (!element.isReadOnly()) { |
---|
[2743] | 23 | if (element.is('a') |
---|
[2738] | 24 | && !element.hasClass('media-link') // link to original media @see js/popup_media.js |
---|
[2962] | 25 | && !element.hasClass('ref-post')) { // link to an entry @see js/popup_posts.js |
---|
[2738] | 26 | |
---|
| 27 | editor.getSelection().selectElement(element); |
---|
| 28 | |
---|
[2751] | 29 | var popup_url = 'popup_link.php?plugin_id=dcCKEditor'; |
---|
[2738] | 30 | if (element.getAttribute('href')) { |
---|
| 31 | popup_url += '&href='+element.getAttribute('href'); |
---|
| 32 | } |
---|
| 33 | if (element.getAttribute('hreflang')) { |
---|
| 34 | popup_url += '&hreflang='+element.getAttribute('hreflang'); |
---|
| 35 | } |
---|
| 36 | if (element.getAttribute('title')) { |
---|
| 37 | popup_url += '&title='+element.getAttribute('title'); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | $.toolbarPopup(popup_url); |
---|
| 41 | return false; |
---|
[2743] | 42 | } |
---|
[2738] | 43 | } |
---|
| 44 | }); |
---|
| 45 | } |
---|
| 46 | }); |
---|
| 47 | })(); |
---|
Note: See
TracBrowser
for help on using the repository browser.