Your software
My Mautic version is: 4.4.7
My PHP version is: 7.4.29
My Database type and version is: 10.3.38-MariaDB-0ubuntu0.20.04.1
I am using the classic editor (not the new mjml-one)
Your problem
Mautic changes my email code in a wrong way.
All <br>
tags are being replaced with
<div data-empty="true">
<br>
</div>
Further more, I have some unusual replacements, that lead to the fact that {contactfield=firstname}
is not being replaced in the emails.
Visually I see the correct text {contactfield=firstname}
, but inside the code I see the following:
<span data-fr-verified="true">{</span>contactfield=firstname}
with a strange red bullet after the text, that apparently is not visible (see on the picture below).
I did not entered any of the div tags, nor the red bullet:
I would like to stop this replacement. Is it possible? Where should I look for?
These errors are showing in the log:
There are some errors in the log, but not relevant to the subject.
Steps I have tried to fix the problem:
I searched on the forums, on google, everywhere for a solution or at least someone else that describes the same.
I found what the red bullet means: in UTF-8 (hex) is like this represented: “e2 80 8d” and it is a “ZERO WIDTH JOINER”. (the character is here described) . I do not know why this char is added in my email content.
Found also this Issue from Froala: Data-empty = “true” causes problems. #1950. They mention the files js/froala_editor.min.js
and js/froala_editor.pkgd.min.js
Also searched inside the Mautic files and found the text data-empty="true"
only in these two files: app\bundles\CoreBundle\Assets\js\libraries\froala\plugins\paragraph_format.js
and paragraph_format.min.js
=> So I edited the app\bundles\CoreBundle\Assets\js\libraries\froala\froala_editor.js
and commented out these lines:
// Current node is BR.
else if (node.tagName == 'BR') {
// There is no anchor.
if (anchor == null) {
anchor = editor.doc.createElement(default_tag);
if (temp) anchor.setAttribute('data-empty', true);
anchor.appendChild(node);
main_doc.appendChild(anchor);
}
// There is anchor. Just remove BR.
else {
// There is nothing else except markers and BR inside the new formed tag.
if (found === false) {
anchor.appendChild(editor.doc.createElement('br'));
anchor.setAttribute('data-empty', true);
}
}
anchor = null;
}
=> can this action have secondary effects? (besides that I must redo the editing after the next update)
LATER EDIT:
yes, one side effect is: Froala did not recognized paragraphs and I could not format as Heading 1/2/3/…
Solved by updating to 4.4.8 , so the changes were reset.