View File Name : editor.min.js
")),o.force_focus=!0,s.val(e),tinymce.execCommand("mceAddEditor",!1,o.id)},n=t?(e(l),!0):rcmail.plain2html(l,e)):!this.editor||(a&&(i=(i=this.editor.dom.get("_rc_sig"))&&i.innerHTML,this.editor.dom.setHTML("_rc_sig",r)),l=this.editor.getContent(),e=function(e){tinymce.execCommand("mceRemoveEditor",!1,o.id),o.editor=null,a&&(e=e.replace(r,"\n"+c.text)),s.val(e).focus().trigger("input"),rcmail.set_caret_pos(s.get(0),0)},n=t?(e(s.val()),!0):rcmail.html2plain(l,e))||!i||this.editor.dom.setHTML("_rc_sig",i),n},this.spellcheck_start=function(){this.editor?(tinymce.execCommand("mceSpellCheck",!0),this.spellcheck_observer()):this.spellchecker&&this.spellchecker.spellCheck&&this.spellchecker.spellCheck()},this.spellcheck_stop=function(){var e=this.editor;e?e.plugins&&e.plugins.spellchecker&&this.spellcheck_active&&(e.execCommand("mceSpellCheck",!1),this.spellcheck_observer()):(e=this.spellchecker)&&e.state&&"ready"!=e.state&&"no_error_found"!=e.state&&$(e.spell_span).trigger("click")},this.spellcheck_state=function(){var e;return this.editor?this.spellcheck_active:(e=this.spellchecker)&&e.state?"ready"!=e.state&&"no_error_found"!=e.state:void 0},this.spellcheck_resume=function(e){var t=this.editor;t?t.plugins.spellchecker.markErrors(e):(t=this.spellchecker)&&(t.prepare(!1,!0),t.processData(e))},this.get_language=function(){return rcmail.env.spell_lang},this.set_language=function(e){var t=this.editor;t&&(t.settings.spellchecker_language=e),(t=this.spellchecker)&&t.setCurrentLanguage(e),rcmail.env.spell_lang=e},this.replace=function(e){var t,i,n,l=this.editor;if(!e)return!1;l?(l.getWin().focus(),t="object"==$.type(e)&&"html"in e?(e=e.html,"html"):("object"==$.type(e)&&(e=e.text||""),e=rcmail.quote_html(e).replace(/\r?\n/g,"
"),"text"),l.selection.setContent(e,{format:t})):(l=rcube_find_object(this.id))&&(t=rcmail.get_input_selection(l),i=(n=l.value).substring(0,t.start),n=n.substring(t.end,n.length),"object"==$.type(e)&&(e=e.text||""),l.value=i+e+n,rcmail.set_caret_pos(l,t.start+e.length),l.focus())},this.set_content=function(e){this.editor?(this.editor.setContent(e),this.editor.getWin().focus()):(ed=rcube_find_object(this.id))&&$(ed).val(e).focus()},this.get_content=function(e){var t=this.editor,i="",n=!1,l={refresh:!0,selection:!1,nosig:!1,format:"html"};return(e=e?$.extend(l,e):l).refresh&&this.spellcheck_stop(),t?(i=e.selection?t.selection.getContent({format:e.format}):i)||(i=t.getContent({format:e.format}),n="text"==e.format):(t=rcube_find_object(this.id))&&!(i=e.selection?rcmail.get_input_selection(t).text:i)&&(i=t.value,n=!0),i=n&&e.nosig&&0<(l=i.indexOf("-- \n"))?i.substring(0,l):i},this.change_signature=function(e,t){var i,n,l,r,s,c=-1,a=$("#"+this.id),o=a.val(),d=rcmail.env.identity;this.editor?t&&rcmail.env.signatures?((s=this.editor.dom.get("_rc_sig"))||(l=this.editor.getBody(),s=$('
').get(0),rcmail.env.top_posting&&!rcmail.env.sig_below&&rcmail.env.compose_mode&&(1
").append($("
")).insertBefore(s)):(l.appendChild(s),i=rcmail.env.top_posting&&rcmail.env.compose_mode?l.firstChild:$(s).prev())),s.innerHTML=rcmail.env.signatures[e]?rcmail.env.signatures[e].html:""):rcmail.env.top_posting||(i=$(this.editor.getBody()).children().last()):(t&&d&&rcmail.env.signatures&&rcmail.env.signatures[d]&&(d=(d=rcmail.env.signatures[d].text).replace(/\r\n/g,"\n"),0<=(c=rcmail.env.top_posting?o.indexOf(d):o.lastIndexOf(d)))&&(o=o.substring(0,c)+o.substring(c+d.length,o.length)),t&&rcmail.env.signatures&&rcmail.env.signatures[e]?(d=(d=rcmail.env.signatures[e].text).replace(/\r\n/g,"\n"),0<=c?(o=o.substring(0,c)+d+o.substring(c,o.length),n=c-1):o&&rcmail.env.compose_mode?rcmail.env.top_posting&&!rcmail.env.sig_below?n=(pos=rcmail.get_caret_pos(a.get(0)))?(o=o.substring(0,pos)+"\n"+d+"\n\n"+o.substring(pos,o.length),pos):(o="\n\n"+d+"\n\n"+o.replace(/^[\r\n]+/,""),0):(o=o.replace(/[\r\n]+$/,""),n=!rcmail.env.top_posting&&o.length?o.length+1:0,o+="\n\n"+d):(n=o.length,o+="\n\n"+d)):n=rcmail.env.top_posting?0:o.length,a.val(o),rcmail.set_caret_pos(a.get(0),n)),this.editor&&i&&i.length&&(this.editor.selection.setCursorLocation(i.get(0)),this.editor.getWin().scroll(0,i.offset().top))},this.save=function(){this.editor&&this.editor.save()},this.focus=function(){(this.editor||rcube_find_object(this.id)).focus()},this.file_picker_callback=function(e,t,i){var n,l,r,s,c=[],i=i.filetype,a=$(".upload-form").clone();for(n in this.editor.windowManager.open({title:rcmail.get_label("select"+i),body:{type:"panel",items:[{type:"htmlpanel",html:''}]},buttons:[{type:"cancel",text:rcmail.get_label("close"),onclick:function(){o.file_picker_close()}}]}),rcmail.env.file_picker_callback=e,rcmail.env.file_picker_type=i,e=$("#image-selector"),a.length?a.find("button,a.button").slice(1).remove():a=this.file_upload_form(rcmail.gui_objects.uploadform),(l=e.prepend(a).find("button,a.button").text(rcmail.get_label("add"+i)).focus()).is(".btn")||l.addClass("tox-button"),rcmail.env.attachments)(r=o.file_picker_entry(n,rcmail.env.attachments[n]))&&c.push(r);s=e.parents(".tox-dialog").find("button").last(),c=$("#image-selector-list").append(c).on("keydown","li",function(e){if(9==e.which)return rcube_event.get_modifier(e)==SHIFT_KEY?$(this).prev().focus().length||l.focus():$(this).next().focus().length||s.focus(),!1}),l.keydown(function(e){if(9==e.which)return rcube_event.get_modifier(e)!=SHIFT_KEY&&c.find("li").first().focus().length||s.focus(),!1;13==e.which&&this.click()}),s.keydown(function(e){if(9==e.which)return rcube_event.get_modifier(e)==SHIFT_KEY&&c.find("li").last().focus().length||l.focus(),!1}),window.FormData&&(rcmail.env.filedrop||(rcmail.env.filedrop={}),rcmail.gui_objects.filedrop&&(rcmail.env.old_file_drop=rcmail.gui_objects.filedrop),rcmail.gui_objects.filedrop=$("#image-selector"),rcmail.gui_objects.filedrop.addClass("droptarget").on("dragover dragleave",function(e){e.preventDefault(),e.stopPropagation(),$(this)["dragover"==e.type?"addClass":"removeClass"]("hover")}).get(0).addEventListener("drop",function(e){return rcmail.file_dropped(e)},!1)),rcmail.env["file_dialog_event_"+i]||(rcmail.env["file_dialog_event+"+i]=!0,rcmail.addEventListener("fileuploaded",function(e){(e=o.file_picker_entry(e.name,e.attachment))&&(c.prepend(e),e.focus())}))},this.file_picker_close=function(e){this.editor.windowManager.close(),e&&rcmail.env.file_picker_callback(e),rcmail.env.old_file_drop&&(rcmail.gui_objects.filedrop=rcmail.env.old_file_drop)},this.file_picker_entry=function(e,t){if(t.complete&&t.mimetype){var i,n,l;switch(rcmail.file_upload_id&&rcmail.set_busy(!1,null,rcmail.file_upload_id),rcmail.env.file_picker_type){case"image":i=/^image\//i;break;case"media":i=/^video\//i,n=rcmail.assets_path("program/resources/tinymce/video.png");break;default:return}return i.test(t.mimetype)?(e=rcmail.env.comm_path+"&_from="+rcmail.env.action+(rcmail.env.compose_id?"&_id="+rcmail.env.compose_id+"&_action=display-attachment":"&_action=upload-display")+"&_file="+e,l=$("
").attr({title:t.name,src:n||e+"&_thumbnail=1"}),$("").attr({tabindex:0}).data("url",e).append($('').append(l)).append($('').text(t.name)).click(function(){o.file_picker_close($(this).data("url"))}).keydown(function(e){13==e.which&&o.file_picker_close($(this).data("url"))})):void 0}},this.file_upload_form=function(e){var t=e?$(e).find(".hint").text():"",i=$('