-
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
Question: possible to use with codemirror, ace, etc? #306
Comments
Hi @jsbain! Intriguing question! As you stated the editors that I have looked at all use a unique method of cursor & caret placement. Because this keyboard is tightly bound to caret positioning, it makes it difficult to integrate it with other software; this includes plugins that mask the input and other editors. Also, this keyboard does not currently support contenteditable elements. I would really need to spend some time digging into the editor code and API to see if integration were possible, but I don't really have the time to do this kind of work. |
Ok, turns out to be very straightforward in codemirror, as it exposes the hidden textarea used for input using Backspace doesn't seem to work except for recently entered text, which seems to be a documented issue with code mirror on android for example. |
Oh wow that's awesome! Nice work! |
I figured out how to make the backspace work, but sadly it only works on the same line as you are inputting. If you move the cursor to a different line it stops working (demo): $.keyboard.keyaction.delete = function(){
CodeMirror.commands.delLineLeft(CodeMirror);
}; |
I haven't forgotten about this request! I got the caret/cursor keys to work in this demo: http://jsfiddle.net/Mottie/MK947/4021/ But there are still issues with the backspace. So, I'll see if I can get some help: http://discuss.codemirror.net/t/codemirror-virtual-keyboard/440 |
I'm really interested in this as well and I found that it's not that hard with Ace editor. It might help that I skip the whole 'accept' process that just seems to be getting in the way of interacting at the moment. This is a simplification of what I did:
I hide the keyboard input field with height: 0 in my css and ignore it completely (disabling the preview shows the textarea, which is hard to hide properly). Honestly I'm not sure what the ultimate consequences of my hacks will be, but this works for now. Also, it deletes new lines just fine and works even if the cursor has been moved. I'm having problems getting the value I need, but that's for another issue (or maybe more research). |
Hi @knod! Thanks for sharing! That's awesome that you got it to interact more smoothly. Would you be willing to update this demo to get it to work? Also, instead of using css to hide the input, set the |
Hi @Mottie, I'll check out the demo and play around with it! (Edit: I'll probably make a new fiddle using Ace instead, since that's what I got working) As for the |
@Mottie - here's the demo I've set up with the Ace editor: http://jsfiddle.net/MK947/4104/ Let me know if it's what you're looking for. |
Wow, that's awesome, thanks for sharing! As for why the |
Is it possible to use this keyboard with editors like codemirror or ace?
I believe both use hidden textareas for input. I tried, without success... Just loading codemirror seems to kill the keyboard, even if loaded into another textarea...
With the ability to use custom keyboards, this would be the ideal coding environment for mobile!
The text was updated successfully, but these errors were encountered: