Skip to content
Snippets Groups Projects
Commit 59c7285f authored by srosse's avatar srosse
Browse files

OO-3879: set Tiny editor as dirty after closing LaTeX modal dialog

parent 8b6ae25d
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@
ed.dom.setAttrib(contentNode, "data-mce-placeholder", "")
ed.dom.setAttrib(contentNode, "title", escape(tex));
ed.execCommand("mceRepaint");
ed.setDirty(true);
} else {
var htmlCode = '<img src="' + tinymce.Env.transparentSrc + '" class="mce-shim mceItemJSMath" data-mce-placeholder="latex" data-mathtex="' + tex + '" title="' + escape(tex) + '" width="32" height="32"/>';
ed.execCommand("mceInsertContent", false, htmlCode);
......@@ -197,7 +198,7 @@
author : 'frentix GmbH',
authorurl : 'http://www.frentix.com',
infourl : 'http://www.frentix.com',
version : "1.2.1"
version : "1.2.2"
};
}
});
......
(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,"data-mce-placeholder","");b.dom.setAttrib(i,"title",escape(j));b.execCommand("mceRepaint")}else{var k='<img src="'+tinymce.Env.transparentSrc+'" class="mce-shim mceItemJSMath" data-mce-placeholder="latex" 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,"data-mce-placeholder":"latex",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.1"}}});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,"data-mce-placeholder","");b.dom.setAttrib(i,"title",escape(j));b.execCommand("mceRepaint");b.setDirty(true)}else{var k='<img src="'+tinymce.Env.transparentSrc+'" class="mce-shim mceItemJSMath" data-mce-placeholder="latex" 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,"data-mce-placeholder":"latex",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.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