简体   繁体   English

mathquill latex-如何通过代码移动光标(选择)?

[英]mathquill latex- how can I move cursor (selection) by code?

I am using mathquill lib ( mathquill git ) and I am trying to make a keypad and a backspace using html buttons but I can't figure out how to move the cursor throw the formula. 我正在使用mathquill lib( mathquill git ),我正在尝试使用html按钮制作键盘和退格键,但我无法弄清楚如何移动光标抛出公式。

Thanks, 谢谢,

You can trigger custom keydown event on textarea within mathquill to move cursor through formula. 您可以在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);

Use charCode / keyCode / which are: 使用charCode / keyCode /,它们是:

  1. 37 for left arrow key 左箭头键为37
  2. 39 for right arrow key 39为右箭头键

Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Mathquill Matheditor 输出为 LaTeX? - How to output as LaTeX from Mathquill Matheditor? 如何将光标置于 MathQuill (0.10) 字段以便可以立即输入进行编辑? - How to put cursor to the MathQuill (0.10) field so that one can type to edit right away? 如何重新提交mathquill.js? - How do I rerender mathquill.js? 如何通过光标拖动阻止文本/元素选择 - How can I prevent text/element selection with cursor drag 如何使输入占位符随光标动态移动? - How can I make an input placeholder dynamically move with cursor? CKEDITOR将光标移至选择的结尾 - CKEDITOR move cursor to end of selection 当我单击画布并拖动鼠标时,光标将变为文本选择光标。 我怎么能阻止这个? - When I click on a canvas and drag my mouse, the cursor changes to a text-selection cursor. How can I prevent this? 使Mathquill字段始终使用光标滚动 - Make mathquill field scroll always with the cursor 一旦光标离开目标元素,如何在javascript中跟踪鼠标移动事件? - How can I track mouse move events in javascript once the cursor is off of the target element? 我如何将鼠标悬停时的鼠标光标更改为“默认”,但使用jQuery可排序为“移动” - how i can change mouse cursor on mouseover to “default” but in sortable be “move” using jquery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM