1/** 2 * Loading interface for CKEDITOR 3 */ 4 5//var ckPluginsBasePath; 6 7function load_rich_editor(name, params){ 8 // Load CKEditor main javascript if not loaded yet 9 if( (typeof(CKEDITOR) == 'undefined')){ 10 $.getScript('/ckeditor/ckeditor.js', function() { 11 if(typeof(CKEDITOR.instances[name]) == 'undefined'){ 12 create_instance(name, params); 13 } 14 }); 15 } else if(typeof(CKEDITOR.instances[name]) == 'undefined'){ 16 create_instance(name, params); 17 } else { 18 // destroy & create editor again 19 if (CKEDITOR.instances[name] && typeof CKEDITOR.instances[name].destroy == 'function' ) { 20 try { 21 CKEDITOR.instances[name].destroy(true); 22 } catch (error) { 23 console.error(error); 24 } 25 } 26 delete CKEDITOR.instances[name]; 27 create_instance(name, params); 28 } 29} 30 31function create_instance(name, params){ 32 33 let editorDom = document.getElementById(name); 34 let $editor = $(editorDom); 35 36 let newParams = Object.assign({}, params); 37 if (newParams.toolbar === 'Complete') { 38 newParams = Object.assign({}, newParams, { 39 allowedContent: true, 40 disallowedContent: 'script; *[on]*' 41 }); 42 } 43 let ckeditorToken = null; 44 if ($editor.length) { 45 ckeditorToken = editorDom.dataset.ckeditorToken; 46 if (!ckeditorToken && SYM && SYM.data && SYM.data.ckeditor_token) { 47 ckeditorToken = SYM.data.ckeditor_token; 48 } 49 } 50 51 CKEDITOR.replace(name, newParams); 52 // console.log(params); 53 54 // Put a label in the maximize button 55 CKEDITOR.on('instanceReady', function(ev){ 56 $('.cke_button_maximize').find('span.max_me').remove(); 57 $('.cke_button_maximize').append('<span class="max_me"> '+msg.MAXIMIZE+'</span>'); 58 59 // Set the filebrowserBrowseUrl 60 if (ckeditorToken && ev.editor) { 61 ev.editor.config.filebrowserBrowseUrl = '/file_manager/fck_get_browser' + (typeof(ckeditorToken) !== 'undefined' ? '?token='+ckeditorToken : ''); 62 } 63 }); 64 65 CKEDITOR.on('dialogDefinition', function( ev ) { 66 67 var diagName = ev.data.name; 68 var diagDefn = ev.data.definition; 69 70 if(diagName === 'table') { 71 var infoTab = diagDefn.getContents('info'); 72 73 var width = infoTab.get('txtWidth'); 74 width['default'] = "100%"; 75 } 76 }); 77 78 /* [BUG] this disallow the load of several CKEditors in the same page using TABS 79 var loading_interval = setInterval(function(){ 80 if($('#cke_' + name).height() > 0 || $('li.textarea #cke_' + name).length > 0) 81 { 82 clearInterval(loading_interval); 83 } 84 else 85 { 86 $('#' + name).css('display', 'none'); 87 $('#cke_' + name).appendTo($('li.textarea')); 88 } 89 }, 200);*/ 90 $('div.ajax_load_points').fadeOut('quick').remove(); 91}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.