mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
collab_client: Redo server message queueing
Move server message queue processing out of `handleUserChanges()` for the following reasons: * Fix a race condition: Before this change the client would stop processing incoming messages and stop sending changes to the server if a `NEW_CHANGES` message arrived while the user was composing a character and waiting for an `ACCEPT_COMMIT` message. * Improve readability: The `handleUserChanges()` function is for handling changes from the local user, not for handling changes from other users. * Simplify the code.
This commit is contained in:
parent
e99fe88537
commit
63a1f078f4
3 changed files with 75 additions and 115 deletions
|
@ -3504,16 +3504,7 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
|
||||
const teardown = () => _teardownActions.forEach((a) => a());
|
||||
|
||||
let inInternationalComposition = false;
|
||||
const handleCompositionEvent = (evt) => {
|
||||
// international input events, fired in FF3, at least; allow e.g. Japanese input
|
||||
if (evt.type === 'compositionstart') {
|
||||
inInternationalComposition = true;
|
||||
} else if (evt.type === 'compositionend') {
|
||||
inInternationalComposition = false;
|
||||
}
|
||||
};
|
||||
|
||||
let inInternationalComposition = null;
|
||||
editorInfo.ace_getInInternationalComposition = () => inInternationalComposition;
|
||||
|
||||
const bindTheEventHandlers = () => {
|
||||
|
@ -3602,8 +3593,15 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
});
|
||||
});
|
||||
|
||||
$(document.documentElement).on('compositionstart', handleCompositionEvent);
|
||||
$(document.documentElement).on('compositionend', handleCompositionEvent);
|
||||
$(document.documentElement).on('compositionstart', () => {
|
||||
if (inInternationalComposition) return;
|
||||
inInternationalComposition = new Promise((resolve) => {
|
||||
$(document.documentElement).one('compositionend', () => {
|
||||
inInternationalComposition = null;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const topLevel = (n) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue