【发布时间】:2014-12-07 11:44:45
【问题描述】:
我正在使用 mathquill lib (mathquill git),我正在尝试使用 html 按钮制作键盘和退格键,但我不知道如何移动光标并抛出公式。
谢谢,
【问题讨论】:
标签: javascript html latex mathquill
我正在使用 mathquill lib (mathquill git),我正在尝试使用 html 按钮制作键盘和退格键,但我不知道如何移动光标并抛出公式。
谢谢,
【问题讨论】:
标签: javascript html latex mathquill
您可以在 mathquill 中的 textarea 上触发自定义 keydown 事件以在公式中移动光标。
var customKeyDownEvent = $.Event('keydown');
customKeyDownEvent.bubbles = true;
customKeyDownEvent.cancelable =true;
customKeyDownEvent.charCode = 37; // 37 for left arrow key
customKeyDownEvent.keyCode = 37;
customKeyDownEvent.which = 37;
$('.mathquill-editable textarea').trigger(customKeyDownEvent);
使用 charCode/keyCode/ 分别是:
谢谢。
【讨论】: