iflrandevu/assets/ext/trumbowyg/plugins/mathml/trumbowyg.mathml.min.js

1 line
1.3 KiB
JavaScript
Raw Normal View History

!function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{mathml:"Insert Formulas",formulas:"Formulas",inline:"Inline"},fr:{mathml:"Inserer une formule",formulas:"Formule",inline:"En ligne"},tr:{mathml:"Formül Ekle",formulas:"Formüller",inline:"Satır içi"}},plugins:{mathml:{init:function(n){var t={fn:function(){n.saveRange();var t={formulas:{label:n.lang.formulas,required:!0,value:""},inline:{label:n.lang.inline,attributes:{checked:!0},type:"checkbox",required:!1}},a=function(l){var r=l.inline?"$":"$$";if(n.currentMathNode)e(n.currentMathNode).html(r+" "+l.formulas+" "+r).attr("formulas",l.formulas).attr("inline",l.inline?"true":"false");else{var i='<span class="mathMlContainer" contenteditable="false" formulas="'+l.formulas+'" inline="'+(l.inline?"true":"false")+'" >'+r+" "+l.formulas+" "+r+"</span>",u=e(i)[0];u.onclick=function(l){n.currentMathNode=this,t.formulas.value=e(this).attr("formulas"),"true"===e(this).attr("inline")?t.inline.attributes.checked=!0:delete t.inline.attributes.checked,n.openModalInsert(n.lang.mathml,t,a)},n.range.deleteContents(),n.range.insertNode(u)}return n.currentMathNode=!1,MathJax.Hub.Queue(["Typeset",MathJax.Hub]),!0};t.formulas.value=n.getRangeText(),t.inline.attributes.checked=!0,n.openModalInsert(n.lang.mathml,t,a)}};n.addBtnDef("mathml",t)}}}})}(jQuery);