Revision 3880:e6d1f6d9d7df,
730 bytes
checked in by franck <carnet.franck.paul@…>, 7 years ago
(diff) |
Use let and const rather than var (ES2015/ES6), use template string where is more efficient
|
Line | |
---|
1 | /*global $ */ |
---|
2 | 'use strict'; |
---|
3 | |
---|
4 | $(function() { |
---|
5 | $('#link-insert-cancel').click(function() { |
---|
6 | window.close(); |
---|
7 | }); |
---|
8 | |
---|
9 | $('#form-entries tr>td.maximal>a').click(function(e) { |
---|
10 | e.preventDefault(); |
---|
11 | const editor_name = window.opener.$.getEditorName(); |
---|
12 | const editor = window.opener.CKEDITOR.instances[editor_name]; |
---|
13 | let link = ''; |
---|
14 | const selected_text = editor.getSelection().getNative().toString(); |
---|
15 | |
---|
16 | if (editor.mode == 'wysiwyg') { |
---|
17 | link = '<a class="ref-post" href="' + window.opener.$.stripBaseURL($(this).attr('title')) + '">' + selected_text + '</a>'; |
---|
18 | const element = window.opener.CKEDITOR.dom.element.createFromHtml(link); |
---|
19 | editor.insertElement(element); |
---|
20 | } |
---|
21 | window.close(); |
---|
22 | }); |
---|
23 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.