Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sets <p> margin to 0 for sent emails #2538

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

StCyr
Copy link
Collaborator

@StCyr StCyr commented Jan 24, 2020

fixes #2481 and #2513 I guess )

Signed-off-by: Cyrille Bollu cyrpub@bollu.be

@StCyr StCyr force-pushed the fix-2481-null_margin_for_paragraphs branch from c07b222 to 8ced49c Compare January 30, 2020 15:49
@StCyr
Copy link
Collaborator Author

StCyr commented Jan 30, 2020

I've tried to create a ckeditor plugin to implement this functionality.

Without success till now.

If someone @nextcloud/mail with knowledge about ckeditor's internals could review my PR to try and understand what should be done ,that would be great.

ping @ChristophWurst

@StCyr StCyr force-pushed the fix-2481-null_margin_for_paragraphs branch 3 times, most recently from 8bb5bec to 01b0788 Compare February 3, 2020 07:35
@StCyr
Copy link
Collaborator Author

StCyr commented Feb 3, 2020

Hi @ChristophWurst

This should be working properly now

Cyrille

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very clean 👍 Thanks a lot!

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works, but from a logical PoV the composer shouldn't have to care about this. This should be moved to the TextEditor.vue

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense but I can't figure out how to implement this there.

What could probably easily be done would be to add a "style" attribute to all <p> elements rather than assign them a class:

viewWriter.addClass('null-margin', conversionApi.mapper.toViewElement(data.item))

might be changed to add an attribute rather than adding a class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense but I can't figure out how to implement this there.

Possibly at

this.text = this.value
but CKEditor might remove the style tag. I also just realized that when we only add the style element when the message is sent, the previewed message looks different than what is actually sent.

What could probably easily be done would be to add a "style" attribute to all <p> elements rather than assign them a class:

If that is easy to do I'm fine with that as well :) This will also show a correct preview of what will be sent (independent of Nextcloud's paragraph styling)

@ChristophWurst
Copy link
Member

Can't test right now as I have my local setup migrated to #2064 but will give it a test once that PR is merged :)

@StCyr StCyr force-pushed the fix-2481-null_margin_for_paragraphs branch 3 times, most recently from bb24284 to 78ed1cc Compare February 3, 2020 10:55
@ChristophWurst
Copy link
Member

This works fine with the rich text editing mode. But the plain text one still has line breaks for paragraphs, no?

@StCyr
Copy link
Collaborator Author

StCyr commented Feb 5, 2020

This works fine with the rich text editing mode. But the plain text one still has line breaks for paragraphs, no?

I think it's fixed now

Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
function so that they get converted to a single newline only.

Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
Copy link
Contributor

@GretaD GretaD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and it works

@ChristophWurst ChristophWurst force-pushed the fix-2481-null_margin_for_paragraphs branch from ddcd33e to bb88284 Compare March 4, 2020 13:24
@GretaD GretaD merged commit 55ed29d into master Mar 4, 2020
@GretaD GretaD deleted the fix-2481-null_margin_for_paragraphs branch March 4, 2020 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sending mail inserts newlines
3 participants