handle sender/body changes in-place
Sending a new message updates sender string (for custom froms
and such) and the body (for elided text), after the message is
sent and synced. Avoid conversation view flashing (re-render)
in those cases by applying the changes in-place.
Sender string changes will update all dependent adapter items,
and a dataset change on the adapter re-renders all overlay
views.
Body changes are handled by sending affected IDs to JS so it can
request individual message bodies. Quoted text collapsing is
then re-applied on each new body.
Bug: 7183109
Change-Id: I630187c276ffc63448e6b457c9cd02afd452c438
diff --git a/assets/script.js b/assets/script.js
index b6b87a6..0015b14 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -49,9 +49,13 @@
measurePositions();
}
-function collapseQuotedText() {
+function collapseAllQuotedText() {
+ collapseQuotedText(document.documentElement);
+}
+
+function collapseQuotedText(elt) {
var i;
- var elements = document.getElementsByClassName("elided-text");
+ var elements = elt.getElementsByClassName("elided-text");
var elidedElement, toggleElement;
for (i = 0; i < elements.length; i++) {
elidedElement = elements[i];
@@ -227,6 +231,19 @@
window.mail.onContentReady();
}
+function replaceMessageBodies(messageIds) {
+ var i;
+ var id;
+ var msgContentDiv;
+
+ for (i = 0, len = messageIds.length; i < len; i++) {
+ id = messageIds[i];
+ msgContentDiv = document.querySelector("#" + id + " > .mail-message-content");
+ msgContentDiv.innerHTML = window.mail.getMessageBody(id);
+ collapseQuotedText(msgContentDiv);
+ }
+}
+
// END Java->JavaScript handlers
window.onload = function() {
@@ -243,7 +260,7 @@
document.getElementById("initial-load-signal").style.webkitAnimationName = 'initial-load';
};
-collapseQuotedText();
+collapseAllQuotedText();
hideUnsafeImages();
normalizeMessageWidths();
//setWideViewport();