-
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
Auto upper/lower case #428
Comments
Hi @ZLoG83! It isn't build-in but you can add a little extra code to customize how the keyboard behaves. If you look on the home wiki page under "Manipulating text" you'll find this demo which switches the keyboard to the shifted keyset at the beginning and after the user enters period + a space. $('#keyboard').keyboard({
visible: function(e, kb, el) {
if (kb.$preview.caret().start === 0) {
kb.shiftActive = true;
kb.showKeySet(el);
}
},
change: function(e, kb, el) {
var caret = kb.$preview.caret(),
end = caret.end - 2 >= 0 ? caret.end - 2 : caret.end,
str = kb.$preview.val().substring(end, caret.end);
kb.shiftActive = (caret.start === 0 || str.indexOf('. ') >= 0);
kb.showKeySet(el);
}
}); If you want it to type in title case, then tweak the code to only look for spaces. |
That's just wonderful! I will try this ASAP, thanks! :) |
This works like a charm with spaces... Simply changed the shiftactive criteria to str.indexOf(' ') == 1 |
actually it seems that activating this keyboard renders the shift key useless :( |
Oops, sorry about that! I guess I never thoroughly tested that demo 😞 Anyway, try this updated demo. $(function(){
$('#keyboard').keyboard({
visible: function(e, kb) {
if ($.keyboard.caret(kb.$preview).start === 0) {
kb.showKeySet('shift');
}
},
change: function(e, kb) {
var caret = $.keyboard.caret(kb.$preview),
end = caret.end - 2 >= 0 ? caret.end - 2 : caret.end;
str = kb.$preview.val().substring(end, caret.end);
if (!/shift|lock/i.test(kb.last.key)) {
kb.shiftActive = (caret.start === 0 || str.indexOf('. ') >= 0);
kb.showKeySet();
}
}
})
// activate the typing extension
.addTyping();
}); |
My god that is sexy.. it works 100% as I intended and dreamt of now.. Thank you so much! :D |
😺 |
I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread. |
I have used this keyboard in a webapp now. The absolutely topping issue from people is about the keyboard.
It lacks a really nice feature which I hope you will consider to implement.
It would be really nice for a parameter which would enable auto upper-case of the first letter of a word/name.
Just like on iPhone og Android devices. It seems super intuitive.
It should uppercase the first letter - and switch keyboard from from SHIFT to normal state - just like on previously mentioned devices.
If it uppercases a word/name which you manually want to have small - like "Ulrich von Doom" - then you should have the option to manually overwrite and go to "normal".
I am sure that multiple users of this nice keyboard would appreciate this update! :) I know I would.
Thanks for all the time you guys have out in to making this, It's a really nice piece of code :D
The text was updated successfully, but these errors were encountered: