[LON-CAPA-cvs] cvs: loncom /html/adm/dragmath/applet FCKEditMathPopup.html

foxr lon-capa-cvs-allow@mail.lon-capa.org
Tue, 07 Oct 2008 10:14:48 -0000


foxr		Tue Oct  7 06:14:48 2008 EDT

  Added files:                 
    /loncom/html/adm/dragmath/applet	FCKEditMathPopup.html 
  Log:
  First try at geting the dragmath editor to work from visual editor
  (failure) but is a place holder in which further development can take
  place that may make this all work.
  
  

Index: loncom/html/adm/dragmath/applet/FCKEditMathPopup.html
+++ loncom/html/adm/dragmath/applet/FCKEditMathPopup.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>DragMath Equation Editor -- for FCKeditor</title>

<script>
function insertAtCursor(doc, myField, myValue) {
		//IE support
		if (doc.selection) {
			myField.focus();
			sel = doc.selection.createRange();
			sel.text = myValue;
		}
		//MOZILLA/NETSCAPE support
		else if (myField.selectionStart || myField.selectionStart == '0') {
			var startPos = myField.selectionStart;
			var endPos = myField.selectionEnd;
			myField.value = myField.value.substring(0, startPos)
			+ myValue + '\n\n'
			+ myField.value.substring(endPos, myField.value.length);
		} else {
			myField.value += myValue;
		}
	}

function renderLatex() {
  var ans = document.DragMath.getMathExpression();  
  var source = '$'
         + ans
         + '$';

  var Api    = window.opener.FCKEditorAPI;
  var FCK    = Api.GetInstance(opener.targetEntry);
  var doc    = FCK.EditorDocument;
  var target = FCK.EditorWindow;

  insertAtCursor(doc, target, source);

  window.close();

 
}
</script>

</head>
<body>

<div id="mainContent">


<DIV align=left><FONT face=Arial color=#000080 
size=6><STRONG>DragMath Latex Equation Editor</STRONG></FONT></DIV>
<br><br>

<applet name="DragMath" codebase="classes" code="Display.MainApplet.class" archive="Project.jar,AbsoluteLayout.jar,swing-layout-1.0.jar,jdom.jar,jep.jar" width=540 height=333>
<param name=language value="en">
<param name=showOutputToolBar value="false">
<param name=outputFormat value="Latex">
To use this page you need a Java-enabled browser. Download the latest Java plug-in from <a href="http://www.java.com">Java.com</a>
</applet >
<br>

<form>
<input type='button' value='Render Latex' onclick='renderLatex(); return true;' />
</form>

</body>
</html>