src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/WordFilter.min.js
changeset 557 bca7a7e058a3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/resources/js/ext/tinymce/dev/plugins/paste/classes/WordFilter.min.js	Thu Feb 13 11:43:31 2020 +0100
@@ -0,0 +1,1 @@
+define("tinymce/pasteplugin/WordFilter",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema","tinymce/html/Serializer","tinymce/html/Node","tinymce/pasteplugin/Utils"],function(a,j,d,f,e,c){function i(k){return((/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i).test(k)||(/class="OutlineElement/).test(k)||(/id="?docs\-internal\-guid\-/.test(k)))}function b(m){var l,k;k=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/];m=m.replace(/^[\u00a0 ]+/,"");a.each(k,function(n){if(n.test(m)){l=true;return false}});return l}function g(k){return/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(k)}function h(l){var k=l.settings;l.on("BeforePastePreProcess",function(s){var u=s.content,t,p;u=u.replace(/<b[^>]+id="?docs-internal-[^>]*>/gi,"");u=u.replace(/<br class="?Apple-interchange-newline"?>/gi,"");t=k.paste_retain_style_properties;if(t){p=a.makeMap(t.split(/[, ]/))}function r(C){var z,I,x=1;function H(L){var K="";if(L.type===3){return L.value}if((L=L.firstChild)){do{K+=H(L)}while((L=L.next))}return K}function F(L,K){if(L.type===3){if(K.test(L.value)){L.value=L.value.replace(K,"");return false}}if((L=L.firstChild)){do{if(!F(L,K)){return false}}while((L=L.next))}return true}function B(K){if(K._listIgnore){K.remove();return}if((K=K.firstChild)){do{B(K)}while((K=K.next))}}function J(K,L,N){var M=K._listLevel||x;if(M!=x){if(M<x){if(z){z=z.parent.parent}}else{I=z;z=null}}if(!z||z.name!=L){I=I||z;z=new e(L,1);if(N>1){z.attr("start",""+N)}K.wrap(z)}else{z.append(K)}K.name="li";if(M>x&&I){I.lastChild.append(z)}x=M;B(K);F(K,/^\u00a0+/);F(K,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);F(K,/^\u00a0+/)}var w=[],A=C.firstChild;while(typeof A!=="undefined"&&A!==null){w.push(A);A=A.walk();if(A!==null){while(typeof A!=="undefined"&&A.parent!==C){A=A.walk()}}}for(var D=0;D<w.length;D++){C=w[D];if(C.name=="p"&&C.firstChild){var G=H(C);if(g(G)){J(C,"ul");continue}if(b(G)){var E=/([0-9]+)\./.exec(G);var y=1;if(E){y=parseInt(E[1],10)}J(C,"ol",y);continue}if(C._listLevel){J(C,"ul",1);continue}z=null}else{I=z;z=null}}}function m(y,w){var A={},z,x=l.dom.parseStyle(w);a.each(x,function(C,B){switch(B){case"mso-list":z=/\w+ \w+([0-9]+)/i.exec(w);if(z){y._listLevel=parseInt(z[1],10)}if(/Ignore/i.test(C)&&y.firstChild){y._listIgnore=true;y.firstChild._listIgnore=true}break;case"horiz-align":B="text-align";break;case"vert-align":B="vertical-align";break;case"font-color":case"mso-foreground":B="color";break;case"mso-background":case"mso-highlight":B="background";break;case"font-weight":case"font-style":if(C!="normal"){A[B]=C}return;case"mso-element":if(/^(comment|comment-list)$/i.test(C)){y.remove();return}break}if(B.indexOf("mso-comment")===0){y.remove();return}if(B.indexOf("mso-")===0){return}if(t=="all"||(p&&p[B])){A[B]=C}});if(/(bold)/i.test(A["font-weight"])){delete A["font-weight"];y.wrap(new e("b",1))}if(/(italic)/i.test(A["font-style"])){delete A["font-style"];y.wrap(new e("i",1))}A=l.dom.serializeStyle(A,y.name);if(A){return A}return null}if(k.paste_enable_default_filters===false){return}if(i(s.content)){s.wordContent=true;u=c.filter(u,[/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(x,w){return(w.length>0)?w.replace(/./," ").slice(Math.floor(w.length/2)).split("").join("\u00a0"):""}]]);var n=k.paste_word_valid_elements;if(!n){n=("-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")}var q=new d({valid_elements:n,valid_children:"-li[p]"});a.each(q.elements,function(w){if(!w.attributes["class"]){w.attributes["class"]={};w.attributesOrder.push("class")}if(!w.attributes.style){w.attributes.style={};w.attributesOrder.push("style")}});var v=new j({},q);v.addAttributeFilter("style",function(w){var x=w.length,y;while(x--){y=w[x];y.attr("style",m(y,y.attr("style")));if(y.name=="span"&&y.parent&&!y.attributes.length){y.unwrap()}}});v.addAttributeFilter("class",function(w){var x=w.length,z,y;while(x--){z=w[x];y=z.attr("class");if(/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(y)){z.remove()}z.attr("class",null)}});v.addNodeFilter("del",function(w){var x=w.length;while(x--){w[x].remove()}});v.addNodeFilter("a",function(x){var z=x.length,A,w,y;while(z--){A=x[z];w=A.attr("href");y=A.attr("name");if(w&&w.indexOf("#_msocom_")!=-1){A.remove();continue}if(w&&w.indexOf("file://")===0){w=w.split("#")[1];if(w){w="#"+w}}if(!w&&!y){A.unwrap()}else{if(y&&!/^_?(?:toc|edn|ftn)/i.test(y)){A.unwrap();continue}A.attr({href:w,name:y})}}});var o=v.parse(u);if(k.paste_convert_word_fake_lists!==false){r(o)}s.content=new f({},q).serialize(o)}})}h.isWordContent=i;return h});
\ No newline at end of file