Pass attributes to Paragraph with Block content
jjavierdguezas opened this issue · comments
Hi, first thanks for this awesome tool
--
This is my issue:
I have made changes to the Paragraph
template so that it can accept fontSize
and color
attributes, similar to the example provided in the README.md file):
template.Paragraph(m => $"<p style='font-family: sans-serif; font-size: {(m.IsProperty(() => m.Attributes.fontSize) ? m.Attributes.fontSize : "14px")}; font-weight: normal; margin: 0; Margin-bottom: 15px;{(m.IsProperty(() => m.Attributes.color) ? $" color: {m.Attributes.color};" : string.Empty)}'>{m.Content}</p>");
Then I have a paragraph with a Block inside
var body = MailBody
.CreateBody()
....
.Paragraph(MailBody.CreateBlock().Text("Text...").LineBreak().Link(url), new { color = "#7F88A1", fontSize = "12px" });
but Attributes
is null
in Paragraph
func
Reviewing MailBody
codebase I found this:
MailBody/src/MailBody/MailBlockFluent.cs
Lines 86 to 100 in 730abf4
should MailBody
pass the attributes
argument to the ContentElement
?
PS: I can submit the PR if needed
Hi, thank you! :)
--
Yes, you are totally right and I fixed it.
I pushed a new version on Nuget (1.1.5)