]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19516 dragmath embedding improvements by Mauno Korpelainen
authorskodak <skodak>
Fri, 19 Jun 2009 14:35:46 +0000 (14:35 +0000)
committerskodak <skodak>
Fri, 19 Jun 2009 14:35:46 +0000 (14:35 +0000)
lib/editor/tinymce/plugins/dragmath/dragmath.php
lib/editor/tinymce/plugins/dragmath/js/dragmath.js

index 9a1b2cf27e6e112475a2dc021371aba180e01994..017f7d17c1120ecf58eb407728147c9d7a19d71c 100644 (file)
@@ -46,7 +46,7 @@ if (!file_exists("$CFG->dirroot/lib/dragmath/applet/lang/$lang.xml")) {
        width="540" height="300"
 >
        <param name="language" value="<?php echo $lang; ?>" />
-       <param name="outputFormat" value="Latex" />
+       <param name="outputFormat" value="MoodleTex" />
        <param name="showOutputToolBar" value="false" />
     <?php print_string('dragmath:dragmath_javaneeded', 'editor_tinymce', '<a href="http://www.java.com">Java.com</a>')?>
 </applet>
index c9c24f601c7ab32a7930244f81996d794a35cc7d..53760b826fd2b6323b1f01fb04475e8fae34b3b9 100644 (file)
@@ -1,34 +1,21 @@
 tinyMCEPopup.requireLangPack();
 
 var DragMathDialog = {
-               init : function(ed) {
-               
-               },
-               
-       
+    init : function(ed) {
+    },
 
-       insert : function(file, title) {
-               
-           var ed = tinyMCEPopup.editor;
-               var mathExpression = document.dragmath.getMathExpression();
-           //
-           // TBD any massaging needed here?
-           //
-           var text = mathExpression;
-           // convert < and > to entities
-           text = text.replace('<', '&lt;');
-           text = text.replace('>', '&gt;');
-           //
-           // Escape the expression
-           //
-           text = '$$' + text + '$$';
-           ed.execCommand('mceInsertContent', false, text);
+    insert : function(file, title) {
+        var ed = tinyMCEPopup.editor;
+        var tex = document.dragmath.getMathExpression();
 
-               tinyMCEPopup.close();
-       }
+        // convert < and > to entities
+        tex = tex.replace('<', '&lt;');
+        tex = tex.replace('>', '&gt;');
 
-       
-       
+        ed.execCommand('mceInsertContent', false, tex);
+
+        tinyMCEPopup.close();
+    }
 };
 
 tinyMCEPopup.onInit.add(DragMathDialog.init, DragMathDialog);