push browser workaround to the end of the method
This commit is contained in:
parent
090f3bcb23
commit
e496cf84bc
@ -62,14 +62,6 @@ function onSelectionChange() {
|
|||||||
function onInput(event) {
|
function onInput(event) {
|
||||||
if (!validEvents.includes(event.inputType)) return;
|
if (!validEvents.includes(event.inputType)) return;
|
||||||
|
|
||||||
// workaround for differences between firefox and chrome
|
|
||||||
// chrome does not fire selectionchange events on backspace/delete events,
|
|
||||||
// while firefox does
|
|
||||||
if (event.inputType === "deleteContentBackward") {
|
|
||||||
selectionStart = area.selectionStart;
|
|
||||||
selectionEnd = area.selectionEnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
client: uuid,
|
client: uuid,
|
||||||
action: event.inputType,
|
action: event.inputType,
|
||||||
@ -81,6 +73,14 @@ function onInput(event) {
|
|||||||
ws.send(JSON.stringify(payload));
|
ws.send(JSON.stringify(payload));
|
||||||
|
|
||||||
console.log(selectionStart, selectionEnd);
|
console.log(selectionStart, selectionEnd);
|
||||||
|
|
||||||
|
// workaround for differences between firefox and chrome
|
||||||
|
// chrome does not fire selectionchange events on backspace/delete events,
|
||||||
|
// while firefox does
|
||||||
|
if (event.inputType === "deleteContentBackward") {
|
||||||
|
selectionStart = area.selectionStart - 1;
|
||||||
|
selectionEnd = area.selectionEnd - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
Loading…
Reference in New Issue
Block a user