Changeset 5962 for trunk/expressoMail1_2/js/rich_text_editor.js
- Timestamp:
- 04/18/12 11:28:26 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/rich_text_editor.js
r5924 r5962 241 241 } 242 242 cRichTextEditor.prototype.setInitData = function (id,data,reply,recursion){ 243 244 if(recursion === undefined) recursion = 1; 245 else recursion++; 246 247 if(this.plain[id] === true) 248 { 249 data = data.replace( new RegExp('<pre>((.\n*)*)</pre>'),'$1'); 250 251 243 var content = $("#content_id_"+id); 244 if(recursion === undefined){ 245 recursion = 1; 246 }else{ 247 recursion++; 248 } 249 if(this.plain[id] === true){ 250 data = data.replace( new RegExp('<pre>((.\n*)*)</pre>'),'$1'); 251 if($('#'+id) !== undefined){ 252 252 $('#'+id).val(data); 253 if (reply === undefined) 254 $('#to_'+id).focus(); 255 } 256 else 257 setTimeout(function() {RichTextEditor.setInitData(id,data,reply,recursion); }, 500); 258 } 259 else 260 { 261 if( RichTextEditor.editorReady === true && CKEDITOR.instances['body_'+id] !== undefined ) 262 { 263 var editor = CKEDITOR.instances['body_'+id]; 264 editor.insertHtml(''); 265 var selection = editor.getSelection(); 266 if(selection !== undefined && selection !== null) var selectionRanges = selection.getRanges(); 267 268 var fontSize = ''; 269 var fontFamily = ''; 270 271 if(typeof(preferences.font_size_editor) !== 'undefined') 272 fontSize = 'font-size:' + preferences.font_size_editor; 273 274 if(fontSize != '') 275 fontFamily = ';' 276 277 if(typeof(preferences.font_family_editor) !== 'undefined') 278 fontFamily += 'font-family:' + preferences.font_family_editor + ';'; 279 280 var divBr = '<div style="'+fontSize+fontFamily+'"><br type="_moz"></div>'; 281 282 if(reply === undefined){ 283 editor.on('insertHtml',function setFocus(e){ 284 setTimeout("$('#to_"+id+"').focus()",100); 285 editor.removeListener('insertHtml', setFocus); 286 } 287 ); 288 editor.insertHtml(divBr+divBr+data); 253 if (reply === undefined){ 254 $('#to_'+id).focus(); 289 255 } 290 else if(reply == 'edit') 291 editor.insertHtml(data); 292 else 293 editor.insertHtml(divBr+data); 294 295 if(selection !== null) selection.selectRanges(selectionRanges); 296 297 //Coloca o scroll do editor no inicio 298 if (is_webkit){ 256 } 257 else{ 258 setTimeout(function() {RichTextEditor.setInitData(id,data,reply,recursion); }, 500); 259 } 260 } 261 else{ 262 if( RichTextEditor.editorReady === true && CKEDITOR.instances['body_'+id] !== undefined ){ 263 var editor = CKEDITOR.instances['body_'+id]; 264 var selection = editor.getSelection(); 265 var fontSize = ''; 266 var fontFamily = ''; 267 if(typeof(preferences.font_size_editor) !== 'undefined') 268 fontSize = 'font-size:' + preferences.font_size_editor; 269 if(fontSize != '') 270 fontFamily = ';' 271 if(typeof(preferences.font_family_editor) !== 'undefined') 272 fontFamily += 'font-family:' + preferences.font_family_editor + ';'; 273 var divBr = '<div style="'+fontSize+fontFamily+'"><br type="_moz"></div>'; 274 275 if(selection !== undefined && selection !== null){ 276 var selectionRanges = selection.getRanges(); 277 } 278 if(reply !== undefined){ 279 if(reply == 'edit') 280 editor.insertHtml(data); 281 else 282 editor.insertHtml(divBr+data); 283 editor.focus(); 284 } 285 286 if(selection !== null){ 287 selection.selectRanges(selectionRanges); 288 } 289 if (is_webkit){ 299 290 $('#cke_contents_body_'+id+'>iframe').scrollTo(':first'); 300 } 301 //Caso não for uma resposta votla o foco para o input to 302 //if(reply === undefined) 303 // setTimeout("$('#to_"+id+"').focus()",100); 304 305 } 306 else if(recursion < 20) 307 setTimeout(function() {RichTextEditor.setInitData(id,data,reply,recursion); }, 500); 308 } 291 } 292 293 } 294 else if(recursion < 20){ 295 setTimeout(function() {RichTextEditor.setInitData(id,data,reply,recursion); }, 500); 296 } 297 } 309 298 } 310 299
Note: See TracChangeset
for help on using the changeset viewer.