简体   繁体   中英

jQuery Keypad / Primefaces keyboard re-map spacebar

I face issue with jQuery Keypad / Primefaces keyboard - I try to re-map default spacebar button to input hex value '32' instead of '160'. Because when I type "space" from my phisical keyboard then it gives different value (32) then from virtual one (160)

Any solutions? Because I try to avoid writting my own component.

Big thanks in advance.

If someone struggle with same problem.

I have fix it by override _generateHTML function inside keyboard.js from Primefaces 6.1 . For next version it will be configurable, but for this I will change (line 717):

(keys[j] == this.SPACE_BAR ? ' ' :
(keys[j] == ' ' ? '&nbsp;' : keys[j]))))))) + '</button>'));

To:

(keys[j] == this.SPACE_BAR ? ' ' : keys[j])))))) + '</button>'));

And for me works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM