File:  [LON-CAPA] / loncom / html / adm / dragmath / applet / FCKEditMathPopup.html
Revision 1.1: download - view: text, annotated - select for diffs
Tue Oct 7 10:14:48 2008 UTC (15 years, 10 months ago) by foxr
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_99_1, version_2_7_99_0, version_2_11_0_RC1, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, bz6209-base, bz6209, bz5969, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox, BZ4492-merge, BZ4492-feature_horizontal_radioresponse
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.

    1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    2: <html>
    3: <head>
    4: 
    5: <title>DragMath Equation Editor -- for FCKeditor</title>
    6: 
    7: <script>
    8: function insertAtCursor(doc, myField, myValue) {
    9: 		//IE support
   10: 		if (doc.selection) {
   11: 			myField.focus();
   12: 			sel = doc.selection.createRange();
   13: 			sel.text = myValue;
   14: 		}
   15: 		//MOZILLA/NETSCAPE support
   16: 		else if (myField.selectionStart || myField.selectionStart == '0') {
   17: 			var startPos = myField.selectionStart;
   18: 			var endPos = myField.selectionEnd;
   19: 			myField.value = myField.value.substring(0, startPos)
   20: 			+ myValue + '\n\n'
   21: 			+ myField.value.substring(endPos, myField.value.length);
   22: 		} else {
   23: 			myField.value += myValue;
   24: 		}
   25: 	}
   26: 
   27: function renderLatex() {
   28:   var ans = document.DragMath.getMathExpression();  
   29:   var source = '$'
   30:          + ans
   31:          + '$';
   32: 
   33:   var Api    = window.opener.FCKEditorAPI;
   34:   var FCK    = Api.GetInstance(opener.targetEntry);
   35:   var doc    = FCK.EditorDocument;
   36:   var target = FCK.EditorWindow;
   37: 
   38:   insertAtCursor(doc, target, source);
   39: 
   40:   window.close();
   41: 
   42:  
   43: }
   44: </script>
   45: 
   46: </head>
   47: <body>
   48: 
   49: <div id="mainContent">
   50: 
   51: 
   52: <DIV align=left><FONT face=Arial color=#000080 
   53: size=6><STRONG>DragMath Latex Equation Editor</STRONG></FONT></DIV>
   54: <br><br>
   55: 
   56: <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>
   57: <param name=language value="en">
   58: <param name=showOutputToolBar value="false">
   59: <param name=outputFormat value="Latex">
   60: 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>
   61: </applet >
   62: <br>
   63: 
   64: <form>
   65: <input type='button' value='Render Latex' onclick='renderLatex(); return true;' />
   66: </form>
   67: 
   68: </body>
   69: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>