Fix signature not being updated when composer first opened without one
The ComposerPageState JS object assumed that if no signature was present when first loaded, that none ever would be. This broke changing the signature when the composer was opened for an account without one, and the from account was changed to an account with a sig. Instead of including the signature as part of the loaded body, always include just a skeleton signature DIV and ensure the signature is loaded dynamically after the body has been loaded. Update code and tests to match this assumption, and add a unit test for updating the sig. Fixes #309
This commit is contained in:
parent
791c321a00
commit
12c6bbca56
6 changed files with 81 additions and 49 deletions
|
|
@ -133,6 +133,7 @@ ComposerPageState.prototype = {
|
|||
if (!enabled) {
|
||||
this.stopBodyObserver();
|
||||
}
|
||||
|
||||
this.bodyPart.contentEditable = true;
|
||||
if (this.signaturePart != null) {
|
||||
this.signaturePart.contentEditable = true;
|
||||
|
|
@ -140,6 +141,7 @@ ComposerPageState.prototype = {
|
|||
if (this.quotePart != null) {
|
||||
this.quotePart.contentEditable = true;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
// Enable modification observation only after the document
|
||||
// has been set editable as WebKit will alter some attrs
|
||||
|
|
@ -208,8 +210,13 @@ ComposerPageState.prototype = {
|
|||
},
|
||||
updateSignature: function(signature) {
|
||||
if (this.signaturePart != null) {
|
||||
console.log(signature);
|
||||
this.signaturePart.innerHTML = signature;
|
||||
if (signature.trim()) {
|
||||
this.signaturePart.innerHTML = signature;
|
||||
this.signaturePart.classList.remove("geary-no-display");
|
||||
} else {
|
||||
this.signaturePart.innerHTML = "";
|
||||
this.signaturePart.classList.add("geary-no-display");
|
||||
}
|
||||
}
|
||||
},
|
||||
deleteQuotedMessage: function() {
|
||||
|
|
@ -315,13 +322,17 @@ ComposerPageState.prototype = {
|
|||
|
||||
if (this.signaturePart != null) {
|
||||
parent.appendChild(
|
||||
ComposerPageState.cleanPart(this.signaturePart.cloneNode(true), false)
|
||||
ComposerPageState.cleanPart(
|
||||
this.signaturePart.cloneNode(true), false
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (this.quotePart != null) {
|
||||
parent.appendChild(
|
||||
ComposerPageState.cleanPart(this.quotePart.cloneNode(true), false)
|
||||
ComposerPageState.cleanPart(
|
||||
this.quotePart.cloneNode(true), false
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue