CoreFiles by mySites.guru
plugin.min.js1 lines, 6,050 bytes, from Joomla_6.3.0-alpha1-Alpha-Full_Package.zip
Raw History Compare with 6.2.0-alpha3
md5
89d00f4ec06e46cb995b0b6888a98d10
sha1
2edf50d06a6a1a8d2ad0df34de37cc9a01f35522
sha256
54dff55315f8df52868368ae803c4e8670852a5fcff2b7e9538f271adf9bc8e0
const getRetainStyleProps=t=>t.getParam("paste_retain_style_properties"),getWordValidElements=t=>t.getParam("paste_word_valid_elements","-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"),shouldConvertWordFakeLists=t=>t.getParam("paste_convert_word_fake_lists",!0),shouldUseDefaultFilters=t=>t.getParam("paste_enable_default_filters",!0),getValidate=t=>{var e;return(e=t.getParam("validate"))!=null?e:!0},{Tools:Tools$1}=tinymce.util,isRegExp=t=>t.constructor===RegExp,filter=(t,e)=>(Tools$1.each(e,i=>{isRegExp(i)?t=t.replace(i,""):t=t.replace(i[0],i[1])}),t),nbsp="\xA0",AstNode=tinymce.html.Node,{Tools}=tinymce.util,{DomParser}=tinymce.html,{Schema}=tinymce.html,HtmlSerializer=tinymce.html.Serializer,isWordContent=t=>/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument/i.test(t)||/class="OutlineElement/.test(t)||/id="?docs-internal-guid-/.test(t),isNumericList=t=>{let e=!1;const i=[/^[IVXLMCD]+\.[ \u00a0]/,/^[ivxlmcd]+\.[ \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]/];return t=t.replace(/^[\u00a0 ]+/,""),Tools.each(i,u=>u.test(t)?(e=!0,!1):!0),e},isBulletList=t=>/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(t),convertFakeListsToProperLists=t=>{let e=null,i,u=1;const o=s=>{let f="";if(s.type===3)return s.value||"";if(s=s.firstChild)do f+=o(s);while(s=s.next);return f},c=(s,f)=>{if(s.type===3&&f.test(s.value||""))return s.value=(s.value||"").replace(f,""),!1;if(s=s.firstChild)do if(!c(s,f))return!1;while(s=s.next);return!0},p=s=>{if(s._listIgnore){s.remove();return}if(s=s.firstChild)do p(s);while(s=s.next)},m=(s,f,g)=>{const h=s._listLevel||u;if(h!==u&&(h<u?e&&e.parent&&e.parent.parent&&(e=e.parent.parent):(i=e,e=null)),!e||e.name!==f?(i=i||e,e=new AstNode(f,1),g&&g>1&&e.attr("start",`${g}`),s.wrap(e)):e.append(s),s.name="li",h>u&&i){var w;(w=i.lastChild)==null||w.append(e)}u=h,p(s),c(s,/^\u00a0+/),c(s,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),c(s,/^\u00a0+/)},l=[];let r=t.firstChild;for(;typeof r<"u"&&r!==null;)if(l.push(r),r=r.walk(),r!==null)for(;typeof r<"u"&&((a=r)==null?void 0:a.parent)!==t;){var a,n;r=(n=r)==null?void 0:n.walk()}for(let s=0;s<l.length;s++)if(t=l[s],t.name==="p"&&t.firstChild){const f=o(t);if(isBulletList(f)){m(t,"ul");continue}if(isNumericList(f)){const g=/([0-9]+)\./.exec(f);let h=1;g&&(h=parseInt(g[1],10)),m(t,"ol",h);continue}if(t._listLevel){m(t,"ul",1);continue}e=null}else i=e,e=null},filterStyles=(t,e,i,u)=>{const o={},c=t.dom.parseStyle(u);Tools.each(c,(m,l)=>{switch(l){case"mso-list":const r=/\w+ \w+([0-9]+)/i.exec(u);r&&(i._listLevel=parseInt(r[1],10)),/Ignore/i.test(m)&&i.firstChild&&(i._listIgnore=!0,i.firstChild._listIgnore=!0);break;case"horiz-align":l="text-align";break;case"vert-align":l="vertical-align";break;case"font-color":case"mso-foreground":l="color";break;case"mso-background":case"mso-highlight":l="background";break;case"font-weight":case"font-style":m!=="normal"&&(o[l]=m);return;case"mso-element":if(/^(comment|comment-list)$/i.test(m)){i.remove();return}break}if(l.indexOf("mso-comment")===0){i.remove();return}l.indexOf("mso-")!==0&&(getRetainStyleProps(t)==="all"||e&&e[l])&&(o[l]=m)}),/(bold)/i.test(o["font-weight"])&&(delete o["font-weight"],i.wrap(new AstNode("b",1))),/(italic)/i.test(o["font-style"])&&(delete o["font-style"],i.wrap(new AstNode("i",1)));const p=t.dom.serializeStyle(o,i.name);return p||null},filterWordContent=(t,e)=>{let i;const u=getRetainStyleProps(t);u&&(i=Tools.makeMap(u.split(/[, ]/))),e=filter(e,[/<br class="?Apple-interchange-newline"?>/gi,/<b[^>]+id="?docs-internal-[^>]*>/gi,/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,nbsp],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,(l,r)=>r.length>0?r.replace(/./," ").slice(Math.floor(r.length/2)).split("").join(nbsp):""]]);const o=getWordValidElements(t),c=Schema({valid_elements:o,valid_children:"-li[p]"});Tools.each(c.elements,l=>{l.attributes.class||(l.attributes.class={},l.attributesOrder.push("class")),l.attributes.style||(l.attributes.style={},l.attributesOrder.push("style"))});const p=DomParser({},c);p.addAttributeFilter("style",l=>{let r=l.length,a;for(;r--;){var n;a=l[r],a.attr("style",filterStyles(t,i,a,a.attr("style")||"")),a.name==="span"&&a.parent&&!((n=a.attributes)!=null&&n.length)&&a.unwrap()}}),p.addAttributeFilter("class",l=>{let r=l.length,a,n;for(;r--;)a=l[r],n=a.attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(n||"")&&a.remove(),a.attr("class",null)}),p.addNodeFilter("del",l=>{let r=l.length;for(;r--;)l[r].remove()}),p.addNodeFilter("a",l=>{let r=l.length,a,n,s;for(;r--;){if(a=l[r],n=a.attr("href"),s=a.attr("name"),n&&n.indexOf("#_msocom_")!==-1){a.remove();continue}if(n&&n.indexOf("file://")===0&&(n=n.split("#")[1],n&&(n=`#${n}`)),!n&&!s)a.unwrap();else{if(s&&!/^_?(?:toc|edn|ftn)/i.test(s)){a.unwrap();continue}a.attr({href:n,name:s})}}});const m=p.parse(e);return shouldConvertWordFakeLists(t)&&convertFakeListsToProperLists(m),e=HtmlSerializer({validate:getValidate(t)},c).serialize(m),e},preProcess=(t,e)=>shouldUseDefaultFilters(t)?filterWordContent(t,e):e;var Plugin=()=>{tinymce.PluginManager.add("pasteword",t=>{let e;return t.on("PastePreProcess",i=>{var u;const{content:o}=i,{options:c}=t;e=(u=c.get("paste_remove_styles_if_webkit"))!=null?u:!0,isWordContent(o)&&(i.content=preProcess(t,o),e&&c.set("paste_remove_styles_if_webkit",!1))}),t.on("PastePostProcess",()=>{const{options:i}=t;i.get("paste_remove_styles_if_webkit")!==e&&i.set("paste_remove_styles_if_webkit",e)}),{getMetadata:()=>({name:"Paste from Word",url:"https://www.openregion.info/"})}})};Plugin();

No other release has this exact content. See every version of this file.