HOME


Mini Shell 1.0
DIR:/usr/local/cwpsrv/var/services/roundcubemail-1.4.11/program/js/
Upload File :
Current File : //usr/local/cwpsrv/var/services/roundcubemail-1.4.11/program/js/editor.min.js
/**
 * Roundcube editor js library
 *
 * This file is part of the Roundcube Webmail client
 *
 * @licstart  The following is the entire license notice for the
 * JavaScript code in this file.
 *
 * Copyright (c) The Roundcube Dev Team
 *
 * The JavaScript code in this page is free software: you can
 * redistribute it and/or modify it under the terms of the GNU
 * General Public License (GNU GPL) as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version.  The code is distributed WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
 *
 * As additional permission under GNU GPL version 3 section 7, you
 * may distribute non-source (e.g., minimized or compacted) forms of
 * that code without the copy of the GNU GPL normally required by
 * section 4, provided you include this license notice and a URL
 * through which recipients can access the Corresponding Source.
 *
 * @licend  The above is the entire license notice
 * for the JavaScript code in this file.
 *
 * @author Eric Stadtherr <estadtherr@gmail.com>
 * @author Aleksander Machniak <alec@alec.pl>
 */
function rcube_text_editor(m,p){var g=this,q=location.href.replace(/[?#].*$/,"").replace(/\/$/,""),h={selector:"#"+($("#"+p).is(".mce_editor")?p:"fake-editor-id"),cache_suffix:"s=40091100",theme:"modern",language:m.lang,content_css:rcmail.assets_path(m.content_css),menubar:!1,statusbar:!1,toolbar_items_size:"small",extended_valid_elements:"font[face|size|color|style],span[id|class|align|style]",fontsize_formats:"8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 36pt",valid_children:"+body[style],+blockquote[style],+div[style]",
relative_urls:!1,remove_script_host:!1,convert_urls:!1,image_description:!1,paste_webkit_style:"color font-size font-family",paste_data_images:!0,browser_spellcheck:!0,anchor_bottom:!1,anchor_top:!1};this.spellcheck_observer=function(){};m.spellchecker&&(this.spellchecker=m.spellchecker,m.spellcheck_observer&&(this.spellchecker.spelling_state_observer=this.spellcheck_observer=m.spellcheck_observer));tinymce.registered_request_token||(tinymce.registered_request_token=!0,tinymce.util.XHR.on("beforeSend",
function(a){a.xhr.setRequestHeader("X-Roundcube-Request",rcmail.env.request_token);a.settings&&a.settings.data&&(a.settings.data=a.settings.data.replace(/^(method=[a-zA-Z]+&lang=)([^&]+)/,"$1"+rcmail.env.spell_lang))}));"identity"==m.mode?$.extend(h,{plugins:"autolink charmap code colorpicker hr image link paste tabfocus textcolor",toolbar:"bold italic underline alignleft aligncenter alignright alignjustify | outdent indent charmap hr link unlink image code forecolor | fontselect fontsizeselect",
file_browser_callback:function(a,b,c,d){g.file_browser_callback(a,b,c)},file_browser_callback_types:"image",invalid_elements:"embed"}):$.extend(h,{plugins:"autolink charmap code colorpicker directionality link lists image media nonbreaking paste table tabfocus textcolor searchreplace spellchecker",toolbar:"bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent ltr rtl blockquote | forecolor backcolor | fontselect fontsizeselect | link unlink table | $extra charmap image media | code searchreplace undo redo",
spellchecker_rpc_url:q+"/?_task=utils&_action=spell_html&_remote=1",spellchecker_language:rcmail.env.spell_lang,accessibility_focus:!1,file_browser_callback:function(a,b,c,d){g.file_browser_callback(a,b,c)},file_browser_callback_types:"image media"});$.each(m.extra_plugins||[],function(){0>h.plugins.indexOf(this)&&(h.plugins=h.plugins+" "+this)});$.each(m.extra_buttons||[],function(){0>h.toolbar.indexOf(this)&&(h.toolbar=h.toolbar.replace("$extra","$extra "+this))});$.each(m.disabled_plugins||[],
function(){h.plugins=h.plugins.replace(this,"")});$.each(m.disabled_buttons||[],function(){h.toolbar=h.toolbar.replace(this,"")});h.toolbar=h.toolbar.replace("$extra","").replace(/\|\s+\|/g,"|");window.rcmail_editor_settings&&$.extend(h,window.rcmail_editor_settings);h.setup=function(a){a.on("init",function(){g.init_callback(a)});a.on("SpellcheckStart SpellcheckEnd",function(b){g.spellcheck_active="spellcheckstart"==b.type;g.spellcheck_observer()});a.on("keypress",function(){rcmail.compose_type_activity++});
a.on("click",function(b){var c=$(b.target).closest("a");if(c.length&&b.shiftKey)return window.open(c.get(0).href,"_blank"),!1});a.on("focus blur",function(b){$(a.getContainer()).toggleClass("focused")});h.setup_callback&&h.setup_callback(a)};rcmail.triggerEvent("editor-init",{config:h,ref:g,id:p});this.id=p;this.editor=null;tinymce.init(h);this.init_callback=function(a){this.editor=a;if("compose"==rcmail.env.action){var b=$("#"+this.id),c=$("div.mce-toolbar-grp",b.parent()).first().height();if(200<
c||c>b.height())return setTimeout(function(){g.init_callback(a)},300);b={};c=rcube_find_object("_from");var d=rcmail.env.compose_focus_elem;rcmail.env.default_font&&(b["font-family"]=rcmail.env.default_font);rcmail.env.default_font_size&&(b["font-size"]=rcmail.env.default_font_size);(b["font-family"]||b["font-size"])&&$(this.editor.getBody()).css(b);c&&"select-one"==c.type&&(rcmail.env.identities_initialized||rcmail.change_identity(c),d&&d.id!=this.id&&"BODY"!=d.nodeName&&(window.focus(),d.focus(),
rcmail.env.compose_focus_elem=null))}rcmail.triggerEvent("editor-load",{config:h,ref:g});g.tabindex(g.force_focus||d&&d.id==g.id);$(window).resize()};this.tabindex=function(a){if("mail"==rcmail.env.task&&this.editor){var b=this.editor.getElement(),c=this.editor.getContentAreaContainer().childNodes[0];b&&c&&(c.tabIndex=b.tabIndex);if(0<b.tabIndex){var d=null;c=[":prev",":next"];b=tinymce.DOM.select("*[tabindex="+b.tabIndex+"]:not(iframe)");tinymce.each(b,function(e,f){if(e.id==g.id)return d=f,!1});
null!==d&&(b[d-1]&&b[d-1].id&&(c[0]=b[d-1].id),b[d+1]&&b[d+1].id&&(c[1]=b[d+1].id),this.editor.settings.tabfocus_elements=c.join(","))}bw.mz&&25>bw.vendver&&$(this.editor.getBody()).prop("contenteditable",!1).prop("contenteditable",!0)}a&&this.focus()};this.focus=function(){$(this.editor||"#"+this.id).focus();this.force_focus=!1};this.toggle=function(a,b){var c=$("#"+this.id),d=rcmail.env.identity?rcmail.env.signatures[rcmail.env.identity]:null,e=d&&d.text&&1<d.text.length;this.spellcheck_stop();
if(a){a=c.val();e&&(a=a.replace(/\r\n/,"\n"),a=a.replace(d.text.replace(/\r\n/,"\n"),"\u0002\u0003"));var f=function(n){e&&(n=n.replace("\u0002\u0003",'<div id="_rc_sig">'+d.html+"</div>"));g.force_focus=!0;c.val(n);tinymce.execCommand("mceAddEditor",!1,g.id)};if(b){f(a);var l=!0}else l=rcmail.plain2html(a,f)}else if(this.editor){if(e){if(f=this.editor.dom.get("_rc_sig"))f=f.innerHTML;this.editor.dom.setHTML("_rc_sig","\u0002\u0003")}a=this.editor.getContent();l=function(n){tinymce.execCommand("mceRemoveEditor",
!1,g.id);g.editor=null;e&&(n=n.replace("\u0002\u0003","\n"+d.text));c.val(n).focus().trigger("input");rcmail.set_caret_pos(c.get(0),0)};b?(l(c.val()),l=!0):l=rcmail.html2plain(a,l);!l&&f&&this.editor.dom.setHTML("_rc_sig",f)}return l};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 a=this.editor;a?a.plugins&&a.plugins.spellchecker&&
this.spellcheck_active&&(a.execCommand("mceSpellCheck",!1),this.spellcheck_observer()):(a=this.spellchecker)&&a.state&&"ready"!=a.state&&"no_error_found"!=a.state&&$(a.spell_span).trigger("click")};this.spellcheck_state=function(){var a;if(this.editor)return this.spellcheck_active;if((a=this.spellchecker)&&a.state)return"ready"!=a.state&&"no_error_found"!=a.state};this.spellcheck_resume=function(a){var b=this.editor;if(b)b.plugins.spellchecker.markErrors(a);else if(b=this.spellchecker)b.prepare(!1,
!0),b.processData(a)};this.get_language=function(){return rcmail.env.spell_lang};this.set_language=function(a){var b=this.editor;b&&(b.settings.spellchecker_language=a);(b=this.spellchecker)&&b.setCurrentLanguage(a);rcmail.env.spell_lang=a};this.replace=function(a){var b=this.editor;if(!a)return!1;if(b){b.getWin().focus();if("object"==$.type(a)&&"html"in a){a=a.html;var c="html"}else"object"==$.type(a)&&(a=a.text||""),a=rcmail.quote_html(a).replace(/\r?\n/g,"<br/>"),c="text";b.selection.setContent(a,
{format:c})}else if(b=rcube_find_object(this.id)){c=rcmail.get_input_selection(b);var d=b.value,e=d.substring(0,c.start);d=d.substring(c.end,d.length);"object"==$.type(a)&&(a=a.text||"");b.value=e+a+d;rcmail.set_caret_pos(b,c.start+a.length);b.focus()}};this.set_content=function(a){this.editor?(this.editor.setContent(a),this.editor.getWin().focus()):(ed=rcube_find_object(this.id))&&$(ed).val(a).focus()};this.get_content=function(a){var b=this.editor,c="",d=!1,e={refresh:!0,selection:!1,nosig:!1,format:"html"};
a=a?$.extend(e,a):e;a.refresh&&this.spellcheck_stop();if(b)a.selection&&(c=b.selection.getContent({format:a.format})),c||(c=b.getContent({format:a.format}),d="text"==a.format);else if(b=rcube_find_object(this.id))a.selection&&(c=rcmail.get_input_selection(b).text),c||(c=b.value,d=!0);d&&a.nosig&&(a=c.indexOf("-- \n"),0<a&&(c=c.substring(0,a)));return c};this.change_signature=function(a,b){var c=-1,d=$("#"+this.id),e=d.val(),f=rcmail.env.identity;if(this.editor)if(b&&rcmail.env.signatures){d=this.editor.dom.get("_rc_sig");
if(!d)if(e=this.editor.getBody(),d=$('<div id="_rc_sig"></div>').get(0),rcmail.env.top_posting&&!rcmail.env.sig_below&&rcmail.env.compose_mode&&(1<e.childNodes.length||$(e).text()))this.editor.getWin().focus(),f=this.editor.selection.getNode(),$(d).insertBefore("BODY"==f.nodeName?e.firstChild:f.nextSibling),$("<p>").append($("<br>")).insertBefore(d);else{e.appendChild(d);var l=rcmail.env.top_posting&&rcmail.env.compose_mode?e.firstChild:$(d).prev()}d.innerHTML=rcmail.env.signatures[a]?rcmail.env.signatures[a].html:
""}else rcmail.env.top_posting||(l=$(this.editor.getBody()).children().last());else b&&f&&rcmail.env.signatures&&rcmail.env.signatures[f]&&(f=rcmail.env.signatures[f].text,f=f.replace(/\r\n/g,"\n"),c=rcmail.env.top_posting?e.indexOf(f):e.lastIndexOf(f),0<=c&&(e=e.substring(0,c)+e.substring(c+f.length,e.length))),b&&rcmail.env.signatures&&rcmail.env.signatures[a]?(f=rcmail.env.signatures[a].text,f=f.replace(/\r\n/g,"\n"),0<=c?(e=e.substring(0,c)+f+e.substring(c,e.length),a=c-1):e&&rcmail.env.compose_mode?
rcmail.env.top_posting&&!rcmail.env.sig_below?(pos=rcmail.get_caret_pos(d.get(0)))?(e=e.substring(0,pos)+"\n"+f+"\n\n"+e.substring(pos,e.length),a=pos):(e="\n\n"+f+"\n\n"+e.replace(/^[\r\n]+/,""),a=0):(e=e.replace(/[\r\n]+$/,""),a=!rcmail.env.top_posting&&e.length?e.length+1:0,e+="\n\n"+f):(a=e.length,e+="\n\n"+f)):a=rcmail.env.top_posting?0:e.length,d.val(e),rcmail.set_caret_pos(d.get(0),a);this.editor&&l&&l.length&&(this.editor.selection.setCursorLocation(l.get(0)),this.editor.getWin().scroll(0,
l.offset().top))};this.save=function(){this.editor&&this.editor.save()};this.focus=function(){(this.editor||rcube_find_object(this.id)).focus()};this.file_browser_callback=function(a,b,c){var d,e,f=[];b=$(".upload-form").clone();this.editor.windowManager.open({title:rcmail.get_label("select"+c),width:500,html:'<div id="image-selector" class="image-selector file-upload"><ul id="image-selector-list" class="attachmentslist"></ul></div>',buttons:[{text:rcmail.get_label("close"),onclick:function(){g.file_browser_close()}}]});
rcmail.env.file_browser_field=a;rcmail.env.file_browser_type=c;a=$("#image-selector");b.length?b.find("button,a.button").slice(1).remove():b=this.file_upload_form(rcmail.gui_objects.uploadform);var l=a.prepend(b).find("button,a.button").text(rcmail.get_label("add"+c)).focus();for(d in rcmail.env.attachments)(e=g.file_browser_entry(d,rcmail.env.attachments[d]))&&f.push(e);var n=a.parent().parent().find("button").last().parent();f=$("#image-selector-list").append(f).on("keydown","li",function(k){if(9==
k.which)return rcube_event.get_modifier(k)==SHIFT_KEY?$(this).prev().focus().length||l.focus():$(this).next().focus().length||n.focus(),!1});l.keydown(function(k){if(9==k.which)return rcube_event.get_modifier(k)!=SHIFT_KEY&&f.find("li").first().focus().length||n.focus(),!1;13==k.which&&this.click()});n.keydown(function(k){if(9==k.which)return rcube_event.get_modifier(k)==SHIFT_KEY&&f.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(k){k.preventDefault();k.stopPropagation();$(this)["dragover"==k.type?"addClass":"removeClass"]("hover")}).get(0).addEventListener("drop",function(k){return rcmail.file_dropped(k)},!1));rcmail.env["file_dialog_event_"+c]||(rcmail.env["file_dialog_event+"+c]=!0,rcmail.addEventListener("fileuploaded",function(k){if(k=
g.file_browser_entry(k.name,k.attachment))f.prepend(k),k.focus()}))};this.file_browser_close=function(a){var b=$("#"+rcmail.env.file_browser_field);a&&b.val(a);this.editor.windowManager.close();b.focus();rcmail.env.old_file_drop&&(rcmail.gui_objects.filedrop=rcmail.env.old_file_drop)};this.file_browser_entry=function(a,b){if(b.complete&&b.mimetype){rcmail.file_upload_id&&rcmail.set_busy(!1,null,rcmail.file_upload_id);switch(rcmail.env.file_browser_type){case "image":var c=/^image\//i;break;case "media":c=
/^video\//i;var d=rcmail.assets_path("program/resources/tinymce/video.png");break;default:return}if(c.test(b.mimetype))return a=rcmail.env.comm_path+"&_from="+rcmail.env.action+(rcmail.env.compose_id?"&_id="+rcmail.env.compose_id+"&_action=display-attachment":"&_action=upload-display")+"&_file="+a,d=$("<img>").attr({title:b.name,src:d?d:a+"&_thumbnail=1"}),$("<li>").attr({tabindex:0}).data("url",a).append($('<span class="img">').append(d)).append($('<span class="name">').text(b.name)).click(function(){g.file_browser_close($(this).data("url"))}).keydown(function(e){13==
e.which&&g.file_browser_close($(this).data("url"))})}};this.file_upload_form=function(a){var b=a?$(a).find(".hint").text():"",c=$('<form id="imageuploadform">').attr({method:"post",enctype:"multipart/form-data"});file=$("<input>").attr({name:"_file[]",type:"file",multiple:!0,style:"opacity:0;height:1px;width:1px"}).change(function(){rcmail.upload_file(c,"upload")});wrapper=$('<div class="upload-form">').append($("<button>").attr({"class":"btn btn-secondary attach",href:"#",onclick:"rcmail.upload_input('imageuploadform')"}));
b&&wrapper.prepend($('<div class="hint">').text(b));a&&(file.attr("name",$('input[type="file"]',a).attr("name")),c.attr("action",$(a).attr("action")));c.append(file).append($("<input>").attr({type:"hidden",name:"_token",value:rcmail.env.request_token}));return wrapper.append(c)}};