@zklogic/draw.io
Version:
Draw.IO - Graph Editor integration in Angular-cli
1 lines • 1.67 kB
JavaScript
MathJax.Extension.jsMath2jax={version:"2.7.9",config:{preview:"TeX"},PreProcess:function(e){this.configured||(this.config=MathJax.Hub.CombineConfig("jsMath2jax",this.config),this.config.Augment&&MathJax.Hub.Insert(this,this.config.Augment),void 0===this.config.previewTeX||this.config.previewTeX||(this.config.preview="none"),this.previewClass=MathJax.Hub.config.preRemoveClass,this.configured=!0),"string"==typeof e&&(e=document.getElementById(e)),e||(e=document.body);var t,a=e.getElementsByTagName("span");for(t=a.length-1;t>=0;t--)String(a[t].className).match(/(^| )math( |$)/)&&this.ConvertMath(a[t],"");var i=e.getElementsByTagName("div");for(t=i.length-1;t>=0;t--)String(i[t].className).match(/(^| )math( |$)/)&&this.ConvertMath(i[t],"; mode=display")},ConvertMath:function(e,t){if(0===e.getElementsByTagName("script").length){var a=e.parentNode,i=this.createMathTag(t,e.innerHTML);e.nextSibling?a.insertBefore(i,e.nextSibling):a.appendChild(i),"none"!==this.config.preview&&this.createPreview(e),a.removeChild(e)}},createPreview:function(e){var t=MathJax.Hub.config.preRemoveClass,a=this.config.preview;"none"!==a&&(e.previousSibling||{}).className!==t&&("TeX"===a&&(a=[this.filterPreview(e.innerHTML)]),a&&(a=MathJax.HTML.Element("span",{className:t},a),e.parentNode.insertBefore(a,e)))},createMathTag:function(e,t){t=t.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");var a=document.createElement("script");return a.type="math/tex"+e,MathJax.HTML.setScript(a,t),a},filterPreview:function(e){return e}},MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax],8),MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js");