--- loncom/homework/response.pm 2014/08/28 14:41:18 1.236 +++ loncom/homework/response.pm 2014/09/24 18:14:27 1.237 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.236 2014/08/28 14:41:18 raeburn Exp $ +# $Id: response.pm,v 1.237 2014/09/24 18:14:27 damieng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -578,10 +578,15 @@ sub start_mathresponse { sub edit_mathresponse_button { my ($id,$field)=@_; - my $button=&mt('Edit Answer'); -# my $helplink=&Apache::loncommon::help_open_topic('Formula_Editor'); - my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'}; - return(< function edit_${id}_${field} (textarea) { thenumber = textarea; @@ -591,6 +596,27 @@ function edit_${id}_${field} (textarea) $button ENDFORMULABUTTON + + } else { + # LON-CAPA math equation editor + return(< + var field = document.getElementById('${field}'); + field.className += ' math'; // note the space + var LCMATH_started; + if (typeof LCMATH_started === 'undefined') { + LCMATH_started = true; + var script = document.createElement("script"); + script.type = "text/javascript"; + script.src = "/adm/LC_math_editor/LC_math_editor.min.js"; + document.body.appendChild(script); + window.addEventListener('load', function(e) { + LCMATH.initEditors(); + }, false); + } + +EQ_EDITOR_SCRIPT + } } sub end_mathresponse {