Changeset 3705:a37d1b34550a for plugins/dcCKEditor/js/popup_link.js
- Timestamp:
- 02/16/18 13:50:27 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcCKEditor/js/popup_link.js
r3000 r3705 1 /*global $ */ 2 'use strict'; 1 3 $(function() { 2 3 4 4 $('#link-insert-cancel').click(function() { 5 window.close(); 6 }); 5 7 6 7 8 9 10 8 $('#link-insert-ok').click(function() { 9 var insert_form = $('#link-insert-form').get(0); 10 if (insert_form == undefined) { 11 return; 12 } 11 13 12 13 14 15 16 if (editor.getSelection().getSelectedElement()!=null) {17 18 19 20 14 var editor_name = window.opener.$.getEditorName(), 15 editor = window.opener.CKEDITOR.instances[editor_name], 16 link = '', 17 selected_element; 18 if (editor.getSelection().getSelectedElement() != null) { 19 selected_element = editor.getSelection().getSelectedElement(); 20 } else { 21 selected_element = editor.getSelection().getNative().toString(); 22 } 21 23 22 if (editor.mode=='wysiwyg') {23 varlink = editor.document.createElement('a');24 25 if (insert_form.elements.title.value!='') {26 27 28 29 30 31 if (insert_form.elements.hreflang.value!='') {32 33 34 35 36 37 if (editor.getSelection().getSelectedElement()!=null) {38 39 40 41 42 43 44 45 24 if (editor.mode == 'wysiwyg') { 25 link = editor.document.createElement('a'); 26 link.setAttribute('href', insert_form.elements.href.value); 27 if (insert_form.elements.title.value != '') { 28 link.setAttribute( 29 'title', 30 window.opener.CKEDITOR.tools.htmlEncodeAttr(insert_form.elements.title.value) 31 ); 32 } 33 if (insert_form.elements.hreflang.value != '') { 34 link.setAttribute( 35 'hreflang', 36 window.opener.CKEDITOR.tools.htmlEncodeAttr(insert_form.elements.hreflang.value) 37 ); 38 } 39 if (editor.getSelection().getSelectedElement() != null) { 40 selected_element.appendTo(link); 41 } else { 42 link.appendText(selected_element); 43 } 44 editor.insertElement(link); 45 } 46 window.close(); 47 }); 46 48 });
Note: See TracChangeset
for help on using the changeset viewer.