diff --git a/src/components/NewMessageModal.vue b/src/components/NewMessageModal.vue index d7fade8b4c..dfc8d573e5 100644 --- a/src/components/NewMessageModal.vue +++ b/src/components/NewMessageModal.vue @@ -316,11 +316,10 @@ export default { return this.draftsPromise }, getDataForServer(data) { - return { + const dataForServer = { ...data, id: data.id, accountId: data.accountId, - body: data.isHtml ? data.body.value : toPlain(data.body).value, editorBody: data.body.value, to: data.to, cc: data.cc, @@ -331,6 +330,12 @@ export default { sendAt: data.sendAt, draftId: this.composerData?.draftId, } + if (data.isHtml) { + dataForServer.bodyHtml = data.body.value + } else { + dataForServer.bodyPlain = toPlain(data.body).value + } + return dataForServer }, onAttachmentUploading(done, data) { this.attachmentsPromise = this.attachmentsPromise diff --git a/src/components/OutboxMessageListItem.vue b/src/components/OutboxMessageListItem.vue index e58c39eee0..f6ed059415 100644 --- a/src/components/OutboxMessageListItem.vue +++ b/src/components/OutboxMessageListItem.vue @@ -173,11 +173,17 @@ export default { if (this.message.editorBody === null) { return } + const bodyData = {} + if (this.message.isHtml) { + bodyData.bodyHtml = html(this.message.body) + } else { + bodyData.bodyPlain = plain(this.message.body) + } await this.$store.dispatch('startComposerSession', { type: 'outbox', data: { ...this.message, - body: this.message.isHtml ? html(this.message.body) : plain(this.message.body), + ...bodyData, }, }) }, diff --git a/src/store/actions.js b/src/store/actions.js index a6324b58cf..7d411ef564 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -474,9 +474,11 @@ export default { let originalSendAt if (type === 'outbox' && data.id && data.sendAt) { originalSendAt = data.sendAt - const message = { - ...data, - body: data.isHtml ? data.body.value : toPlain(data.body).value, + const message = { ...data } + if (data.isHtml) { + message.bodyHtml = data.body.value + } else { + message.bodyPlain = toPlain(data.body).value } const outboxStore = useOutboxStore() await outboxStore.stopMessage({ message }) @@ -503,7 +505,11 @@ export default { const message = getters.composerMessage if (restoreOriginalSendAt && message.type === 'outbox' && message.options?.originalSendAt) { const body = message.data.body - message.body = message.data.isHtml ? body.value : toPlain(body).value + if (message.data.isHtml) { + message.bodyHtml = body.value + } else { + message.bodyPlain = toPlain(body).value + } message.sendAt = message.options.originalSendAt updateDraft(message) } diff --git a/src/store/outboxStore.js b/src/store/outboxStore.js index 432ac55291..6669d4b679 100644 --- a/src/store/outboxStore.js +++ b/src/store/outboxStore.js @@ -183,12 +183,18 @@ export default defineStore('outbox', { logger.info('Attempting to stop sending message ' + message.id) const stopped = await this.stopMessage({ message }) logger.info('Message ' + message.id + ' stopped', { message: stopped }) + // The composer expects rich body data and not just a string + const bodyData = {} + if (message.isHtml) { + bodyData.bodyHtml = html(message.body) + } else { + bodyData.bodyPlain = plain(message.body) + } await store.dispatch('startComposerSession', { type: 'outbox', data: { ...message, - // The composer expects rich body data and not just a string - body: message.isHtml ? html(message.body) : plain(message.body), + ...bodyData, }, }, { root: true }) }, {