Skip to content

Commit

Permalink
Sets <p> margin to 0 for sent emails
Browse files Browse the repository at this point in the history
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
  • Loading branch information
StCyr committed Feb 3, 2020
1 parent d7c1cdf commit 01b0788
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Composer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ export default {
bcc: this.selectBcc.map(this.recipientToRfc822).join(', '),
draftUID: uid,
subject: this.subjectVal,
body: this.editorPlainText ? htmlToText(this.bodyVal) : this.bodyVal,
body: this.editorPlainText
? htmlToText(this.bodyVal)
: '<style>.null-margin{margin:0;}</style>' + this.bodyVal,
attachments: this.attachments,
folderId: this.replyTo ? this.replyTo.folderId : undefined,
messageId: this.replyTo ? this.replyTo.messageId : undefined,
Expand Down
14 changes: 14 additions & 0 deletions src/components/TextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ export default {
onEditorReady(editor) {
const schema = editor.model.schema

// Assign 'null-margin' class to all <p> elements
editor.conversion.for('downcast').add(dispatcher => {
dispatcher.on(
'insert:paragraph',
(evt, data, conversionApi) => {
const viewWriter = conversionApi.writer
viewWriter.addClass('null-margin', conversionApi.mapper.toViewElement(data.item))
},
{
priority: 'low',
}
)
})

schema.on(
'checkChild',
(evt, args) => {
Expand Down

0 comments on commit 01b0788

Please sign in to comment.