!function(e,t){"use strict";function n(e,t){for(var n,i=[],a=0;a]+src=\"data:image[^>]+>/g,"")),n=i.fire("BeforePastePreProcess",{content:e}),n=i.fire("PastePreProcess",n),e=n.content,!n.isDefaultPrevented()){if(i.hasEventListeners("PastePostProcess")&&!n.isDefaultPrevented()){var o=r.add(i.getBody(),"div",{style:"display:none"},e);n=i.fire("PastePostProcess",{node:o}),r.remove(o),e=n.node.innerHTML}if(!n.isDefaultPrevented()){var s=i.selection.getNode();if("PRE"==s.nodeName){if(!t)try{t=$(e).text()}catch(l){}t=t.replace(//g,">"),i.insertRawContent(t)}else if(f.copyImage){var c=UrlPrefix,d={},p=(new Date).getTime();try{for(var u=$("
"+e+""),a&&/^(PRE|DIV)$/.test(a.nodeName)||!o?e=n.filter(e,[[/\n/g,"
"]]):(e=n.filter(e,[[/\n\n/g,"

"+s],[/^(.*<\/p>)(

)$/,s+"$1"],[/\n/g,"
"]]),-1!=e.indexOf("

")&&(e=s+e)),r(e,t)}function s(){var e=i.dom,t=i.getBody(),n=i.dom.getViewPort(i.getWin()),a=i.inline?t.scrollTop:n.y,r=i.inline?t.clientHeight:n.h;l(),m=e.add(i.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"1",style:"position: absolute; top: "+(a+20)+"px;width: 10px; height: "+(r-40)+"px; overflow: hidden; opacity: 0"},h),e.setStyle(m,"left","rtl"==e.getStyle(t,"direction",!0)?65535:-65535),e.bind(m,"beforedeactivate focusin focusout",function(e){e.stopPropagation()}),g=i.selection.getRng(),m.focus(),i.selection.select(m,!0)}function l(){m&&(i.dom.unbind(m),i.dom.remove(m),g&&i.selection.setRng(g)),y=!1,m=g=null}function c(){return m?m.innerHTML:h}function d(e){var t={},n=e.clipboardData||i.getDoc().dataTransfer;if(n&&n.types){t["text/plain"]=n.getData("Text");for(var a=0;a600&&(e.width=600),r.width=e.width,a.setAttrib(o,"width",r.width)),a.setAttrib(o,"src",n)}),a.setAttrib(o,"id",null)})},a.readAsDataURL(n),!0}return!1}var f=this,m,g,v=0,h="%MCEPASTEBIN%",y;i.on("keydown",function(n){if(!n.isDefaultPrevented()&&(t.metaKeyPressed(n)&&86==n.keyCode||n.shiftKey&&45==n.keyCode)){if(y=n.shiftKey&&86==n.keyCode,n.stopImmediatePropagation(),v=(new Date).getTime(),e.ie&&y)return n.preventDefault(),void i.fire("paste",{ieFake:!0});s()}}),i.on("paste",function(t){var a=d(t),p=(new Date).getTime()-v<100,g="text"==f.pasteFormat||y;p||t.preventDefault(),!e.ie||p&&!t.ieFake||(s(),i.dom.bind(m,"paste",function(e){e.stopPropagation()}),i.getDoc().execCommand("Paste",!1,null),a["text/html"]=c(),l()),setTimeout(function(){var e=c();return m&&m.firstChild&&"mcepastebin"===m.firstChild.id&&(g=!0),l(),e!=h&&p||(e=a["text/html"]||a["text/plain"]||h,e!=h)?void(g?o(a["text/plain"]||n.innerText(e)):r(e,a["text/plain"])):void(p||i.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."))},0);try{if(u(t))return}catch(t){}}),f.pasteHtml=r,f.pasteText=o}}),i(g,[c,d,p,v,h,l],function(e,t,n,i,a,r){function o(e){return/class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(e)}function s(s){var l=s.settings;s.on("BeforePastePreProcess",function(c){function d(e){function t(e,t,o,s){var l=e._listLevel||r;l!=r&&(r>l?n&&(n=n.parent.parent):(i=n,n=null)),n&&n.name==o?n.append(e):(i=i||n,n=new a(o,1),s>1&&n.attr("start",""+s),e.wrap(n)),e.name="li",t.value="";var c=t.next;c&&3==c.type&&(c.value=c.value.replace(/^\u00a0+/,"")),l>r&&i&&i.lastChild.append(n),r=l}for(var n,i,r=1,o=e.getAll("p"),s=0;s/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/([\s\u00a0]*)<\/span>/gi,function(e,t){return t.length>0?t.replace(/./," ").slice(Math.floor(t.length/2)).split("").join("\xa0"):""}]]);var g=l.paste_word_valid_elements;g||(g="@[style],-strong/b,-em/i,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-table,-tr,-td[colspan|rowspan],-th,-thead,-tfoot,-tbody,-a[!href],sub,sup,strike,br");var v=new n({valid_elements:g}),h=new t({},v);h.addAttributeFilter("style",function(e){for(var t=e.length,n;t--;)n=e[t],n.attr("style",p(n,n.attr("style"))),"span"!=n.name||n.attributes.length||n.unwrap()});var y=h.parse(u);d(y),c.content=new i({},v).serialize(y)}})}return s.isWordContent=o,s}),i(y,[f,c,g,l],function(e,t,n,i){return function(a){function r(e){a.on("BeforePastePreProcess",function(t){t.content=e(t.content)})}function o(e){return e=i.filter(e,[/^[\s\S]*|[\s\S]*$/g,[/\u00a0<\/span>/g,"\xa0"],/
$/])}function s(e){if(!n.isWordContent(e))return e;var r=[];t.each(a.schema.getBlockElements(),function(e,t){r.push(t)});var o=new RegExp("(?:
 [\\s\\r\\n]+|
)*(<\\/?("+r.join("|")+")[^>]*>)(?:
 [\\s\\r\\n]+|
)*","g");return e=i.filter(e,[[o,"$1"]]),e=i.filter(e,[[/

/g,"

"],[/
/g," "],[/

/g,"
"]])}function l(e){return(a.settings.paste_remove_styles||a.settings.paste_remove_styles_if_webkit!==!1)&&(e=e.replace(/ style=\"[^\"]+\"/g,"")),e}e.webkit&&(r(l),r(o)),e.ie&&r(s)}}),i(b,[w,u,g,y],function(e,t,n,i){var a,r;e.add("paste",function(e){function o(){"text"==c.pasteFormat?(this.active(!1),c.pasteFormat="html"):(c.pasteFormat="text",this.active(!0),a||(e.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off."),a=!0))}function s(){c.copyImage?(this.active(!1),c.copyImage=!1):(c.copyImage=!0,this.active(!0),r||(e.windowManager.alert("When copy other site's images (not in leanote) into editor, it will copy the image into your album."),r=!0))}var l=this,c,d=e.settings;l.clipboard=c=new t(e),l.quirks=new i(e),l.wordFilter=new n(e),e.settings.paste_as_text&&(l.clipboard.pasteFormat="text"),d.paste_preprocess&&e.on("PastePreProcess",function(e){d.paste_preprocess.call(l,l,e)}),d.paste_postprocess&&e.on("PastePostProcess",function(e){d.paste_postprocess.call(l,l,e)}),e.addCommand("mceInsertClipboardContent",function(e,t){t.content&&l.clipboard.pasteHtml(t.content),t.text&&l.clipboard.pasteText(t.text)}),e.paste_block_drop&&e.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault(),e.stopPropagation()}),e.settings.paste_data_images||e.on("drop",function(e){var t=e.dataTransfer;t&&t.files&&t.files.length>0&&e.preventDefault()}),e.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:o,active:"text"==l.clipboard.pasteFormat}),e.addButton("pasteCopyImage",{icon:"copy",tooltip:"When Paste other site's image, copy it into my album as public image",onclick:s,active:l.clipboard.copyImage===!0}),e.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:c.pasteFormat,onclick:o})})}),o([l,u,g,y,b])}(this);