簡體   English   中英

如何將光標置於 MathQuill (0.10) 字段以便可以立即輸入進行編輯?

[英]How to put cursor to the MathQuill (0.10) field so that one can type to edit right away?

我正在為 Etherpad 開發一個簡單的插件,以使用 MathQuill 編輯公式。 當工具欄打開時,我希望光標進入編輯字段。 該字段是 mathquillified 像這樣:

var MQ = MathQuill.getInterface(2);
var mathQuillEditor = MQ.MathField(mathQuillField, {
    spaceBehavesLikeTab: true,
    handlers: {
        edit: function() {
            latexEditor.value = mathQuillEditor.latex(); // update LaTeX field
            jQuery(latexEditor).change(); // fire updating of CodeCogs
        }
    }
});

為了在編輯字段中獲取光標,我嘗試過:

mathQuillEditor.moveToRightEnd();

它在視覺上將光標放在那里,但沒有出現藍色邊距(表示編輯器處於活動狀態)並且打字沒有任何效果;

mathQuillEditor.el().focus();

這不會產生任何視覺差異。 我也嘗試將它們結合起來,但仍然沒有成功。 任何想法如何做到這一點?

好的,這沒有記錄,答案很簡單

mathQuillEditor.focus();

在我提出問題后,對此進行了解釋,並且文檔現在包含此方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM