| Revision 2751:a96ec5640056,
1.3 KB
checked in by Nicolas <nikrou77@…>, 11 years ago
(diff) |
|
Each editor (ckeditor, legacy ones) loads its own context when it is active.
Add plugin_id parameter to transmit that context
Remove call of ckeditorExtraPlugins behavior until a good solution is found.
Closes #1983
|
| Line | |
|---|
| 1 | (function() { |
|---|
| 2 | CKEDITOR.plugins.add('dclink', { |
|---|
| 3 | icons: 'dclink', |
|---|
| 4 | init: function(editor) { |
|---|
| 5 | editor.addCommand('dcLinkCommand', { |
|---|
| 6 | exec: function(editor) { |
|---|
| 7 | if (editor.getSelection().getNative().toString().replace(/\s*/,'')!='') { |
|---|
| 8 | $.toolbarPopup('popup_link.php?plugin_id=dcCKEditor'); |
|---|
| 9 | } |
|---|
| 10 | } |
|---|
| 11 | }); |
|---|
| 12 | |
|---|
| 13 | editor.ui.addButton('dcLink', { |
|---|
| 14 | label: dotclear.msg.link_title, |
|---|
| 15 | command: 'dcLinkCommand', |
|---|
| 16 | toolbar: 'insert' |
|---|
| 17 | }); |
|---|
| 18 | |
|---|
| 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('a') |
|---|
| 23 | && !element.hasClass('media-link') // link to original media @see js/popup_media.js |
|---|
| 24 | && !element.hasClass('post')) { // link to an entry @see js/popup_posts.js |
|---|
| 25 | |
|---|
| 26 | editor.getSelection().selectElement(element); |
|---|
| 27 | |
|---|
| 28 | var popup_url = 'popup_link.php?plugin_id=dcCKEditor'; |
|---|
| 29 | if (element.getAttribute('href')) { |
|---|
| 30 | popup_url += '&href='+element.getAttribute('href'); |
|---|
| 31 | } |
|---|
| 32 | if (element.getAttribute('hreflang')) { |
|---|
| 33 | popup_url += '&hreflang='+element.getAttribute('hreflang'); |
|---|
| 34 | } |
|---|
| 35 | if (element.getAttribute('title')) { |
|---|
| 36 | popup_url += '&title='+element.getAttribute('title'); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | $.toolbarPopup(popup_url); |
|---|
| 40 | return false; |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | }); |
|---|
| 44 | } |
|---|
| 45 | }); |
|---|
| 46 | })(); |
|---|
Note: See
TracBrowser
for help on using the repository browser.