Make input 𝘬𝘪𝘯𝘥𝘢 work with Firefox mobile

box-drawing
cpsdqs 7 years ago
parent ddd55c1ae0
commit 09d3fff59d
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 6
      js/soft_keyboard.js

@ -82,8 +82,12 @@ module.exports = function (screen, input) {
keyInput.addEventListener('input', e => { keyInput.addEventListener('input', e => {
e.stopPropagation() e.stopPropagation()
if (e.isComposing) { if (e.isComposing && 'data' in e) {
sendInputDelta(e.data) sendInputDelta(e.data)
} else if (e.isComposing) {
// Firefox Mobile doesn't support InputEvent#data, so here's a hack
// that just takes the input value and uses that
sendInputDelta(keyInput.value)
} else { } else {
if (e.inputType === 'insertCompositionText') input.sendString(e.data) if (e.inputType === 'insertCompositionText') input.sendString(e.data)
else if (e.inputType === 'deleteContentBackward') { else if (e.inputType === 'deleteContentBackward') {

Loading…
Cancel
Save