mirror of
https://github.com/ProtonMail/ios-mail.git
synced 2026-06-14 09:54:45 +00:00
ET-3654: Fix composer blocking ui while typing
This commit is contained in:
+11
-2
@@ -324,11 +324,11 @@ private extension BodyHtmlDocument {
|
||||
|
||||
// wait until next render to ensure all layout changes are done
|
||||
requestAnimationFrame(() => {
|
||||
updateCursorPosition();
|
||||
debouncedUpdateCursorPosition();
|
||||
isProcessingNewLine = false;
|
||||
});
|
||||
} else if (!isProcessingNewLine) {
|
||||
updateCursorPosition();
|
||||
debouncedUpdateCursorPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,6 +434,15 @@ private extension BodyHtmlDocument {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
|
||||
function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function(...args) {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => func.apply(this, args), wait);
|
||||
};
|
||||
}
|
||||
|
||||
const debouncedUpdateCursorPosition = debounce(updateCursorPosition, 100);
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user