@private
()
| 236 | class OpenPGPEmailWrite extends HTMLElement { |
| 237 | /** @private */ |
| 238 | connectedCallback() { |
| 239 | const id = this.getAttribute('id'); |
| 240 | if (!id) { |
| 241 | return this.onError(new Error('Missing id attribute on openpgp-email-write tag. Please add a unique identifier.')); |
| 242 | } |
| 243 | const [armoredDraftElement] = this.getElementsByClassName('armored-draft'); |
| 244 | const armoredDraft = armoredDraftElement ? armoredDraftElement.textContent : undefined; |
| 245 | const [quotedMailElement] = this.getElementsByClassName('quoted-mail'); |
| 246 | const quotedMail = quotedMailElement ? quotedMailElement.textContent : undefined; |
| 247 | let {quota, signMsg, keepAttachments} = this.dataset; |
| 248 | quota = quota ? Number(quota) : undefined; |
| 249 | signMsg = signMsg || signMsg === '' ? true : false; |
| 250 | keepAttachments = keepAttachments || keepAttachments === '' ? true : false; |
| 251 | const options = {armoredDraft, quotedMail, ...this.dataset, quota, signMsg, keepAttachments}; |
| 252 | if (window.mailvelope) { |
| 253 | this.createEditor(id, options); |
| 254 | } else { |
| 255 | window.addEventListener('mailvelope', () => this.createEditor(id, options), {once: true}); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | /** @private */ |
| 260 | async createEditor(id, options) { |
nothing calls this directly
no test coverage detected