1function getCkFormInstance(editor_sequence) 2{ 3 var form = $('#ckeditor_instance_' + editor_sequence).closest('form'); 4 return form.length ? form[0] : null; 5} 6 7function getAutoSavedSrl(ret_obj) { 8 var editor_sequence = ret_obj.editor_sequence; 9 var primary_key = ret_obj.key; 10 var fo_obj = getCkFormInstance(editor_sequence); 11 12 if(ret_obj.document_srl !== 0) 13 { 14 fo_obj[primary_key].value = ret_obj.document_srl; 15 reloadUploader(editor_sequence); 16 } 17} 18 19(function($){ 20 "use strict"; 21 var default_ckeconfig = { 22 bodyClass: 'rhymix_content xe_content editable', 23 toolbarCanCollapse: true, 24 toolbarGroups: [ 25 { name: 'clipboard', groups: [ 'undo', 'clipboard' ] }, 26 { name: 'editing', groups: [ 'find', 'selection' ] }, 27 { name: 'links' }, 28 { name: 'insert' }, 29 { name: 'tools' }, 30 { name: 'document', groups: [ 'mode' ] }, 31 '/', 32 { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, 33 { name: 'paragraph', groups: [ 'align', 'list', 'indent', 'blocks', 'bidi' ] }, 34 '/', 35 { name: 'styles' }, 36 { name: 'colors' }, 37 { name: 'xecomponent' }, 38 { name: 'others' } 39 ], 40 allowedContent: true, 41 removePlugins: 'stylescombo,language,bidi,flash,pagebreak,exportpdf', 42 removeButtons: 'Save,Preview,Print,Cut,Copy,Paste,Flash,NewPage,ExportPdf,Language', 43 uiColor: '#EFF0F0' 44 }; 45 46 function arrayUnique(data) { 47 return $.grep(data, function(v, k){ 48 return (v.length && $.inArray(v, data) === k); 49 }); 50 } 51 52 var XeCkEditor = xe.createApp('XeCkEditor', { 53 ckeconfig: {}, 54 editor_sequence: null, 55 init : function() { 56 var self = this; 57 58 CKEDITOR.on('instanceCreated', function(evt){ 59 self.cast('CKEDITOR_CREATED'); 60 }); 61 62 CKEDITOR.on('ready', function(evt){ 63 self.cast('CKEDITOR_READY'); 64 }); 65 66 CKEDITOR.on('instanceReady', function(evt){ 67 self.cast('CKEDITOR_INSTANCE_READY'); 68 }); 69 70 CKEDITOR.on('instanceLoaded', function(evt){ 71 self.cast('CKEDITOR_LOADED'); 72 }); 73 }, 74 editorInit : function(containerEl, opts) { 75 var self = this; 76 var $containerEl = containerEl; 77 var form = $containerEl.closest('form'); 78 var data = $containerEl.data(); 79 var editor_sequence = data.editorSequence; 80 var primary_key = data.editorPrimaryKeyName; 81 var primary_input = form.find("[name='" + primary_key + "']"); 82 var content_key = data.editorContentKeyName; 83 var content_input = form.find("[name='" + content_key + "']"); 84 var fo_obj = getCkFormInstance(editor_sequence); 85 86 this.ckeconfig = $.extend({}, default_ckeconfig, opts.ckeconfig || {}); 87 this.ckeconfig.bodyClass = this.ckeconfig.bodyClass + ' color_scheme_' + getColorScheme() + 88 ($('body').hasClass('cke_auto_dark_mode') ? ' cke_auto_dark_mode' : ''); 89 90 this.editor_sequence = editor_sequence; 91 form.attr('editor_sequence', editor_sequence); 92 93 if(CKEDITOR.env.mobile) CKEDITOR.env.isCompatible = true; 94 95 // saved document(ìëì ì¥ ë¬¸ì)ì ëí íì¸ 96 if(typeof(fo_obj._saved_doc_title)!= "undefined") { ///<< _saved_doc_title fieldê° ìì¼ë©´ ìëì ì¥ íì§ ìì 97 var saved_title = fo_obj._saved_doc_title.value; 98 var saved_content = fo_obj._saved_doc_content.value; 99 100 if(saved_title || saved_content) { 101 // ìëì ì¥ë 문ì íì©ì¬ë¶ë¥¼ 물ì í ì¬ì©íì§ ìëë¤ë©´ ìëì ì¥ë 문ì ìì 102 if (confirm(fo_obj._saved_doc_message.value)) { 103 if(typeof(fo_obj.title) !== 'undefined') { 104 fo_obj.title.value = saved_title; 105 } 106 content_input.val(saved_content); 107 exec_json('editor.procEditorLoadSavedDocument', { 108 editor_sequence: editor_sequence, 109 primary_key: primary_key, 110 mid: current_mid 111 }, getAutoSavedSrl); 112 } else { 113 editorRemoveSavedDoc(); 114 } 115 } 116 } 117 118 var instance = CKEDITOR.appendTo($containerEl[0], {}, content_input.val()); 119 120 instance.on('customConfigLoaded', function(e) { 121 instance.config = $.extend({}, e.editor.config, self.ckeconfig); 122 123 if($.isFunction(CKEDITOR.editorConfig)) { 124 var customConfig = {}; 125 CKEDITOR.editorConfig(customConfig); 126 127 $.each(customConfig, function(key, val) { 128 instance.config[key] = val; 129 }); 130 } 131 132 var bodyClass = e.editor.config.bodyClass.split(' '); 133 bodyClass.push(default_ckeconfig.bodyClass); 134 bodyClass = arrayUnique(bodyClass); 135 instance.config.bodyClass = bodyClass.join(' '); 136 137 if(opts.loadXeComponent) { 138 var extraPlugins = e.editor.config.extraPlugins.split(','); 139 140 extraPlugins.push('xe_component'); 141 extraPlugins = arrayUnique(extraPlugins); 142 instance.config.extraPlugins = extraPlugins.join(','); 143 } 144 145 if(!opts.enableToolbar) instance.config.toolbar = []; 146 }); 147 148 instance.on('instanceReady', function(e) { 149 $containerEl.css("min-height", 0); 150 if(window.editor_resize_iframe && window.editor_copy_input) 151 { 152 e.editor.setData(editor_copy_input.val()); 153 e.editor.on("resize", function(e){ 154 var height = e.data.outerHeight; 155 editor_resize_iframe.height(height); 156 }); 157 e.editor.on("change", function() { 158 var content = e.editor.getData(); 159 editor_copy_input.val(content); 160 }); 161 editor_resize_iframe.height($(".cke_chrome").parent().height()); 162 } 163 }); 164 165 $containerEl.data('cke_instance', instance); 166 167 window.editorRelKeys[data.editorSequence] = {}; 168 window.editorRelKeys[data.editorSequence].primary = primary_input[0]; 169 window.editorRelKeys[data.editorSequence].content = content_input[0]; 170 window.editorRelKeys[data.editorSequence].func = function(seq) { 171 return self.getContent.call(self, seq); 172 }; 173 window.editorRelKeys[data.editorSequence].pasteHTML = function(text){ 174 instance.insertHtml(text, 'html'); 175 }; 176 177 // Automatically update content input value #445 178 instance.on('change', function(e) { 179 if (window.editorRelKeys[data.editorSequence].content) { 180 window.editorRelKeys[data.editorSequence].content.value = e.editor.getData(); 181 } 182 }); 183 184 // Enable autosave 185 if (typeof(fo_obj._saved_doc_title) !== 'undefined') { 186 editorEnableAutoSave(fo_obj, editor_sequence); 187 } 188 }, 189 getContent : function(seq) { 190 var self = this; 191 var content = _getCkeInstance(seq).getData(); 192 self.cast('GET_CONTENT', [content]); 193 194 return content; 195 }, 196 getInstance : function(name) { 197 return CKEDITOR.instances[name]; 198 }, 199 API_EDITOR_CREATED : function(){ 200 }, 201 }); 202 203 // Shortcut function in jQuery 204 $.fn.XeCkEditor = function(opts) { 205 var u = new XeCkEditor(this.eq(0), opts); 206 207 if(u) { 208 xe.registerApp(u); 209 u.editorInit(this.eq(0), opts); 210 } 211 212 return u; 213 }; 214 215 // Shortcut function in XE 216 window.xe.XeCkEditor = function() { 217 var u = new XeCkEditor(); 218 219 return u; 220 }; 221 222})(jQuery);
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.