diff --git a/modules/compose.mjs b/modules/compose.mjs index e1188cf..b88cff3 100644 --- a/modules/compose.mjs +++ b/modules/compose.mjs @@ -19,6 +19,7 @@ const positionBeforeBegin = 'beforebegin'; const positionAfterBegin = 'afterbegin'; const fwdHdrLookupString = '-------- '; const plainTextFirstChars = '> '; +const cleanBlockQuoteStyle = 'border:none !important; padding-left:0px !important; margin-left:0px !important;'; export async function process(tab) { rwhLogger.debug(`tab.id=${tab.id}, tab.type=${tab.type}, tab.mailTab=${tab.mailTab}`); @@ -176,6 +177,17 @@ class ReplyWithHeader { // put back the cleaned up
tags as-is if (this.isReply) { div.insertAdjacentElement(positionAfterBegin, this._createElement('br')); + + // blockquote + if (await rwhSettings.isCleanAllBlockQuoteColor()) { // all + let bqs = this._getAllByTagName('blockquote'); + for (let b of bqs) { + b.setAttribute('style', cleanBlockQuoteStyle); + } + } else if (await rwhSettings.isCleanBlockQuoteColor()) { // first level + let bq = this._getByTagName('blockquote'); + bq.setAttribute('style', cleanBlockQuoteStyle); + } } if (this.isForward) { let mozForwardContainer = this._getByClassName('moz-forward-container'); @@ -183,12 +195,6 @@ class ReplyWithHeader { mozForwardContainer.insertAdjacentElement(positionAfterBegin, this._createElement('br')); } - // blockquote - if (await rwhSettings.isCleanBlockQuoteColor() && this.isReply) { - let bq = this._getByTagName('blockquote'); - bq.setAttribute('style', 'border:none !important;padding-left:0 !important;'); - } - return { body: new XMLSerializer().serializeToString(this.#document), } @@ -410,7 +416,11 @@ class ReplyWithHeader { } _getByTagName(tagName) { - return this.#document?.getElementsByTagName(tagName)?.[0]; + return this._getAllByTagName(tagName)?.[0]; + } + + _getAllByTagName(tagName) { + return this.#document?.getElementsByTagName(tagName); } _createElement(tagName) { diff --git a/modules/settings.mjs b/modules/settings.mjs index e96ab5b..0e7c5aa 100755 --- a/modules/settings.mjs +++ b/modules/settings.mjs @@ -37,6 +37,7 @@ let keyHeaderHtmlPrefixLine = 'header.html.prefix.line'; let keyHeaderHtmlPrefixLineColor = 'header.html.prefix.line.color'; let keyTransSubjectPrefix = 'trans.subject.prefix'; let keyCleanBlockQuoteColor = 'clean.blockquote.color'; +let keyCleanAllBlockQuoteColor = 'clean.blockquote.all.color'; let keyCleanQuoteCharGreaterThan = 'clean.quote.char.greaterthan'; let rwhDefaultSettings = { @@ -63,6 +64,7 @@ let rwhDefaultSettings = { [keyHeaderTimeZone]: true, [keyCleanBlockQuoteColor]: true, + [keyCleanAllBlockQuoteColor]: false, [keyCleanQuoteCharGreaterThan]: true, } @@ -157,6 +159,10 @@ export async function isCleanBlockQuoteColor() { return await get(keyCleanBlockQuoteColor, rwhDefaultSettings[keyCleanBlockQuoteColor]); } +export async function isCleanAllBlockQuoteColor() { + return await get(keyCleanAllBlockQuoteColor, rwhDefaultSettings[keyCleanAllBlockQuoteColor]); +} + export async function isCleanQuoteCharGreaterThan() { return await get(keyCleanQuoteCharGreaterThan, rwhDefaultSettings[keyCleanQuoteCharGreaterThan]); } diff --git a/options/options.html b/options/options.html index 2913c1e..46294fa 100644 --- a/options/options.html +++ b/options/options.html @@ -104,7 +104,13 @@
+
+
+