首页 > 解决方案 > Mathquill - 使用 latex() 解析器后删除了 \MathQuillMathField 命令

问题描述

\MathQuillMathField通过 MathField 上的用户操作动态使用该命令

例子

mathFieldSpan = document.getElementById('math-field');
fillInTheBlank = document.getElementById('fill-in-the-blank')
mathField = MQ.MathField(mathFieldSpan);
fillInTheBlank = MQ.StaticMath(document.getElementById('fill-in-the-blank'));

//add new input field with ```\MathQuillMathField``` command to the mathField object.
function mathFieldBtn() {
  mathField.write('\\MathQuillMathField{}');
}

//display the received math input in static mathQuill element - fillInTheBlank
function save() {
  fillInTheBlank.latex(mathField.latex());
}

但是\MathQuillMathField运行后删除的mathField.latex()方法

如何\MathQuillMathField动态保存空字段 ( ) 并将其显示在 staticMath 对象中?

我的目标是允许在静态数学表达式中进行部分输入(例如让学生填写答案)

标签: javascriptmathquill

解决方案


推荐阅读