This commit is contained in:
Craig 2020-04-05 03:31:23 +00:00
parent 9d484a49d0
commit 19466b5625

View File

@ -327,7 +327,7 @@
this.$accessor.video.setPlayable(false) this.$accessor.video.setPlayable(false)
}) })
this._video.addEventListener('error', (event) => { this._video.addEventListener('error', event => {
this.$log.error(event.error) this.$log.error(event.error)
this.$accessor.video.setPlayable(false) this.$accessor.video.setPlayable(false)
}) })
@ -352,7 +352,7 @@
.then(() => { .then(() => {
this.onResise() this.onResise()
}) })
.catch((err) => this.$log.error) .catch(err => this.$log.error)
} catch (err) { } catch (err) {
this.$log.error(err) this.$log.error(err)
} }
@ -391,7 +391,7 @@
if (this.hosting && navigator.clipboard && typeof navigator.clipboard.readText === 'function') { if (this.hosting && navigator.clipboard && typeof navigator.clipboard.readText === 'function') {
navigator.clipboard navigator.clipboard
.readText() .readText()
.then((text) => { .then(text => {
if (this.clipboard !== text) { if (this.clipboard !== text) {
this.$accessor.remote.setClipboard(text) this.$accessor.remote.setClipboard(text)
this.$accessor.remote.sendClipboard(text) this.$accessor.remote.sendClipboard(text)
@ -463,18 +463,38 @@
this.focused = false this.focused = false
} }
// frick you firefox
getCode(e: KeyboardEvent): number {
let key = e.keyCode
if (key === 59 && e.key === ';') {
key = 186
}
if (key === 61 && e.key === '=') {
key = 187
}
if (key === 173 && e.key === '-') {
key = 189
}
return key
}
onKeyDown(e: KeyboardEvent) { onKeyDown(e: KeyboardEvent) {
if (!this.focused || !this.hosting || this.locked) { if (!this.focused || !this.hosting || this.locked) {
return return
} }
this.$client.sendData('keydown', { key: e.keyCode })
this.$client.sendData('keydown', { key: this.getCode(e) })
} }
onKeyUp(e: KeyboardEvent) { onKeyUp(e: KeyboardEvent) {
if (!this.focused || !this.hosting || this.locked) { if (!this.focused || !this.hosting || this.locked) {
return return
} }
this.$client.sendData('keyup', { key: e.keyCode })
this.$client.sendData('keyup', { key: this.getCode(e) })
} }
onResise() { onResise() {