Skip to content
Snippets Groups Projects
Commit 601f62a3 authored by srosse's avatar srosse
Browse files

OO-742: repair compress after merge issue

parent aa17ec54
No related branches found
No related tags found
No related merge requests found
......@@ -15,18 +15,9 @@
* @param {string} url Absolute URL to where the plugin is located.
*/
init : function(ed, url) {
MathJax.Hub.Config({
extensions: ["jsMath2jax.js"],
jsMath2jax: {
preview: "none"
},
tex2jax: {
ignoreClass: "math"
}
});
var cachedTrans;
var MathJax = window.MathJax;
// Load the OLAT translator.
function translator() {
if(cachedTrans) return cachedTrans;
......@@ -56,16 +47,23 @@
}
function updatePreview() {
var tex = win.find('#latex')[0].value();
var math = MathJax.Hub.getAllJax("mathpreviewFormula")[0];
if(typeof math === "undefined") {
MathJax.Hub.Queue(function() {
jQuery("#mathpreviewFormula .math").text(tex);
MathJax.Hub.Typeset("#mathpreviewFormula");
});
} else {
MathJax.Hub.Queue(["Text", math, tex]);
}
if(typeof MathJax === "undefined") {
o_mathjax(function() {
MathJax = window.MathJax;
updatePreview();
});
} else {
var tex = win.find('#latex')[0].value();
var math = MathJax.Hub.getAllJax("mathpreviewFormula")[0];
if(typeof math === "undefined") {
MathJax.Hub.Queue(function() {
jQuery("#mathpreviewFormula .math").text(tex);
MathJax.Hub.Typeset("#mathpreviewFormula");
});
} else {
MathJax.Hub.Queue(["Text", math, tex]);
}
}
}
function showDialog() {
......
(function(){tinymce.create("org.olat.core.gui.components.form.flexible.impl.elements.richText.plugins.olatmatheditor",{init:function(b,d){MathJax.Hub.Config({extensions:["jsMath2jax.js"],jsMath2jax:{preview:"none"},tex2jax:{ignoreClass:"math"}});var f;function c(){if(f){return f}var h=o_getMainWin();if(h){f=jQuery(document).ooTranslator().getTranslator(h.o_info.locale,"org.olat.core.gui.components.form.flexible.impl.elements.richText.plugins.olatmatheditor")}else{f={translate:function(i){return i}}}return f}function e(){var i=win.find("#latex")[0].value();var h=b.selection.getNode();if((h!=null)&&(/mceItemJSMath/.test(b.dom.getAttrib(h,"class")))){b.dom.setAttrib(h,"data-mathtex",i);b.dom.setAttrib(h,"title",escape(i));b.execCommand("mceRepaint")}else{var j='<img src="'+tinymce.Env.transparentSrc+'" class="mce-shim mceItemJSMath" data-mathtex="'+i+'" title="'+escape(i)+'" width="32" height="32"/>';b.execCommand("mceInsertContent",false,j)}}function g(){var h=win.find("#latex")[0].value();var i=MathJax.Hub.getAllJax("mathpreviewFormula")[0];if(typeof i==="undefined"){MathJax.Hub.Queue(function(){jQuery("#mathpreviewFormula .math").text(h);MathJax.Hub.Typeset("#mathpreviewFormula")})}else{MathJax.Hub.Queue(["Text",i,h])}}function a(){win=b.windowManager.open({title:c().translate("olatmatheditor.formulaTabTitle"),minWidth:540,body:[{type:"container",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,items:[{type:"label",text:c().translate("olatmatheditor.latexGroupTitle")},{name:"latex",type:"textbox",multiline:true,flex:1,minHeight:120,onkeyup:g},{name:"preview",type:"panel",label:"",flex:1,minHeight:120,html:'<div id="mathpreviewFormula" style="width:100%; height=100%;"><div class="math"></div></div><div id="mathpreviewErrorMessage"></div>'}]}],onSubmit:e});var i=b.selection.getNode();if((i.nodeName.toLowerCase()=="img")&&(i.className.indexOf("mceItemJSMath")>=0)){var h=jQuery(i).attr("data-mathtex");win.find("#latex")[0].value(h);g()}}b.addButton("olatmatheditor",{title:c().translate("olatmatheditor.desc"),icon:"math",stateSelector:["img[data-mathtex]","span[data-mathtex]"],onclick:a,onPostRender:function(){var h=this;b.on("NodeChange",function(i){var j=(i.element.nodeName=="IMG")&&(/mceItemJSMath/.test(b.dom.getAttrib(i.element,"class")));h.active(j);if(j){i.preventDefault(true);i.stopImmediatePropagation()}})}});b.addMenuItem("olatmatheditor",{text:c().translate("olatmatheditor.desc"),icon:"math",stateSelector:["img[data-mathtex]","span[data-mathtex]"],onclick:a,context:"insert",});b.on("init",function(){if(b.settings.content_css!==false){b.dom.loadCSS(d+"/css/content.css")}});b.on("LoadContent",function(h){tinymce.each(b.dom.select("span.math"),function(j){var k=j.innerHTML;var i=b.dom.create("img",{"class":"mce-shim mceItemJSMath",width:"32",height:"32",src:tinymce.Env.transparentSrc,"data-mathtex":k,title:j.title});b.dom.replace(i,j)})});b.on("PreProcess",function(h){tinymce.each(b.dom.select("img.mceItemJSMath"),function(j){var i=b.dom.create("span",{"class":"math",title:j.title},jQuery(j).attr("data-mathtex"));b.dom.replace(i,j)})})},createControl:function(b,a){return null},getInfo:function(){return{longname:"OpenOLAT Math Editor",author:"frentix GmbH",authorurl:"http://www.frentix.com",infourl:"http://www.frentix.com",version:"1.2"}}});tinymce.PluginManager.add("olatmatheditor",org.olat.core.gui.components.form.flexible.impl.elements.richText.plugins.olatmatheditor)})();
\ No newline at end of file
(function(){tinymce.create("org.olat.core.gui.components.form.flexible.impl.elements.richText.plugins.olatmatheditor",{init:function(b,d){var f;var g=window.MathJax;function c(){if(f){return f}var i=o_getMainWin();if(i){f=jQuery(document).ooTranslator().getTranslator(i.o_info.locale,"org.olat.core.gui.components.form.flexible.impl.elements.richText.plugins.olatmatheditor")}else{f={translate:function(j){return j}}}return f}function e(){var j=win.find("#latex")[0].value();var i=b.selection.getNode();if((i!=null)&&(/mceItemJSMath/.test(b.dom.getAttrib(i,"class")))){b.dom.setAttrib(i,"data-mathtex",j);b.dom.setAttrib(i,"title",escape(j));b.execCommand("mceRepaint")}else{var k='<img src="'+tinymce.Env.transparentSrc+'" class="mce-shim mceItemJSMath" data-mathtex="'+j+'" title="'+escape(j)+'" width="32" height="32"/>';b.execCommand("mceInsertContent",false,k)}}function h(){if(typeof g==="undefined"){o_mathjax(function(){g=window.MathJax;h()})}else{var i=win.find("#latex")[0].value();var j=g.Hub.getAllJax("mathpreviewFormula")[0];if(typeof j==="undefined"){g.Hub.Queue(function(){jQuery("#mathpreviewFormula .math").text(i);g.Hub.Typeset("#mathpreviewFormula")})}else{g.Hub.Queue(["Text",j,i])}}}function a(){win=b.windowManager.open({title:c().translate("olatmatheditor.formulaTabTitle"),minWidth:540,body:[{type:"container",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,items:[{type:"label",text:c().translate("olatmatheditor.latexGroupTitle")},{name:"latex",type:"textbox",multiline:true,flex:1,minHeight:120,onkeyup:h},{name:"preview",type:"panel",label:"",flex:1,minHeight:120,html:'<div id="mathpreviewFormula" style="width:100%; height=100%;"><div class="math"></div></div><div id="mathpreviewErrorMessage"></div>'}]}],onSubmit:e});var j=b.selection.getNode();if((j.nodeName.toLowerCase()=="img")&&(j.className.indexOf("mceItemJSMath")>=0)){var i=jQuery(j).attr("data-mathtex");win.find("#latex")[0].value(i);h()}}b.addButton("olatmatheditor",{title:c().translate("olatmatheditor.desc"),icon:"math",stateSelector:["img[data-mathtex]","span[data-mathtex]"],onclick:a,onPostRender:function(){var i=this;b.on("NodeChange",function(j){var k=(j.element.nodeName=="IMG")&&(/mceItemJSMath/.test(b.dom.getAttrib(j.element,"class")));i.active(k);if(k){j.preventDefault(true);j.stopImmediatePropagation()}})}});b.addMenuItem("olatmatheditor",{text:c().translate("olatmatheditor.desc"),icon:"math",stateSelector:["img[data-mathtex]","span[data-mathtex]"],onclick:a,context:"insert",});b.on("init",function(){if(b.settings.content_css!==false){b.dom.loadCSS(d+"/css/content.css")}});b.on("LoadContent",function(i){tinymce.each(b.dom.select("span.math"),function(k){var l=k.innerHTML;var j=b.dom.create("img",{"class":"mce-shim mceItemJSMath",width:"32",height:"32",src:tinymce.Env.transparentSrc,"data-mathtex":l,title:k.title});b.dom.replace(j,k)})});b.on("PreProcess",function(i){tinymce.each(b.dom.select("img.mceItemJSMath"),function(k){var j=b.dom.create("span",{"class":"math",title:k.title},jQuery(k).attr("data-mathtex"));b.dom.replace(j,k)})})},createControl:function(b,a){return null},getInfo:function(){return{longname:"OpenOLAT Math Editor",author:"frentix GmbH",authorurl:"http://www.frentix.com",infourl:"http://www.frentix.com",version:"1.2"}}});tinymce.PluginManager.add("olatmatheditor",org.olat.core.gui.components.form.flexible.impl.elements.richText.plugins.olatmatheditor)})();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment