-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call insertText but cursor is at begining #506
Comments
Hi @yangyili! Setting the |
Thank you @Mottie very much |
Hmm, maybe you can do this instead: keyboard = $("#keyboard").data("keyboard");
keyboard.reveal().insertText('hello');
keyboard.$el.trigger('change'); I don't want to trigger a change inside the What if I make the keyboard = $("#keyboard").data("keyboard");
keyboard.reveal().insertText('hello').$el.trigger("change"); |
ok thank you very much |
Oops, I had to make a change in the code above. The Anyway, I just released v1.26.8... the following functions are now chainable: |
Hi:
when I call keyboard.reveal().insertText('hello'), keyboard openen with cursir at the beging
I saw the source code find a timer was excuted after insert text。the timer change the cursor position
I found the timer is:
base.timer2 = setTimeout(function () {
var undef;
base.opening = false;
// Number inputs don't support selectionStart and selectionEnd
// Number/email inputs don't support selectionStart and selectionEnd
if (!/(number|email)/i.test(base.el.type) && !o.caretToEnd) {
// caret position is always 0,0 in webkit; and nothing is focused at this point... odd
// save caret position in the input to transfer it to the preview
// inside delay to get correct caret position
base.saveCaret(undef, undef, base.$el);
}
if (o.initialFocus) {
$keyboard.caret(base.$preview, base.last);
}
// save event time for keyboards with stayOpen: true
base.last.eventTime = new Date().getTime();
base.$el.trigger($keyboard.events.kbVisible, [base, base.el]);
base.timer = setTimeout(function () {
// get updated caret information after visible event - fixes #331
if (base) { // Check if base exists, this is a case when destroy is called, before timers fire
base.saveCaret();
}
}, 200);
}, 10);
The text was updated successfully, but these errors were encountered: