Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.77k stars 722 forks source link

Numeric keyboard issue? #814

Open luncan987 opened 2 years ago

luncan987 commented 2 years ago

First thank you for the awesome keyboard project, and it still being maintained!

Iam not sure about this "issue" but I really would like to hear your opinion @Mottie

I created a layout is based of custom numbers. as it can be seen on the following code: const kb = { caretToEnd: true, layout: 'custom_float', restrictInput: true, preventPaste: true, stayOpen: true, display: { cancel, accept, clear: ${trashIcon}, }, customLayout: { default: [ '7 {sp:25px} 8 {sp:25px} 9 {sp:100px} {b}', '4 {sp:25px} 5 {sp:25px} 6 {sp:135px} {clear}', '1 {sp:25px} 2 {sp:25px} 3 {sp:100px} {c}', '- {sp:25px} 0 {sp:170px} {a}', ], }, };

when the keyboard shown, the "dash" key, can be entered multiple times. Shouldnt be blocked, "somehow" ? Because when I see the demo on https://mottie.github.io/Keyboard/ it have the same issue on numeric keyboard.

Mottie commented 2 years ago

Hi @luncan987!

You can control what is added into the input using the beforeInsert function

luncan987 commented 2 years ago

Yes, I already tried to use the function, beforeInsert, but I guess I have to write somekind of regex to "enable" only single dash. Is there any other way to solve it?