Inconsistent Html email display

Hi all,

When I send an email from interface. The resulting HTML is not coherent with the interface (in thunderbird at last).

For instance if I send this:

This would be the resulting email. I’ve lost all the spaces between chapters and unfortunatly, these are often required for a good readability.

Here is the resulting email source:

--===============2090774107435372536==
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
<head><title>Vente: (2) TEST</title></head>
<body><div align=3D"left"><font face=3D"normal">=C3=87a sounds good, m=C3=
=AAme si on frime comme on appelle =C3=A7a en France... </font></div><div a=
lign=3D"left"><font face=3D"normal">Il faut toute la splendeur du aware et =
c'est tr=C3=A8s, tr=C3=A8s beau d'avoir son propre moi-m=C3=AAme ! </font><=
/div><div align=3D"left"><font face=3D"normal">Donc on n'est jamais seul sp=
irituellement !</font></div><div align=3D"left"><font face=3D"normal"></fon=
t></div><div align=3D"left"><font face=3D"normal">Oui alors =C3=A9coute moi=
, je ne suis pas un simple danseur car on vit dans une r=C3=A9alit=C3=A9 qu=
'on a cr=C3=A9=C3=A9e et que j'appelle illusion car l'aboutissement de l'in=
stinct, c'est l'amour ! </font></div><div align=3D"left"><font face=3D"norm=
al">=C3=87a respire le meuble de Provence, hein ?</font></div><div align=3D=
"left"><font face=3D"normal"></font></div><div align=3D"left"><font face=3D=
"normal">Si je t'emmerde, tu me le dis, l=C3=A0 on voit qu'on a beaucoup =
=C3=A0 travailler sur nous-m=C3=AAmes car le cycle du cosmos dans la vie...=
 </font></div><div align=3D"left"><font face=3D"normal">c'est une grande ro=
ue car l'aboutissement de l'instinct, c'est l'amour ! </font></div><div ali=
gn=3D"left"><font face=3D"normal">Tu vas te dire : J'aurais jamais cru que =
le karat=C3=A9 guy pouvait parler comme =C3=A7a !</font></div><div align=3D=
"left"><font face=3D"normal"></font></div><div align=3D"left"><font face=3D=
"normal">Tu comprends, j'ai vraiment une grande mission car on vit dans une=
 r=C3=A9alit=C3=A9 qu'on a cr=C3=A9=C3=A9e et que j'appelle illusion et =C3=
=A7a, c'est tr=C3=A8s dur, et, et, et... </font></div><div align=3D"left"><=
font face=3D"normal">c'est tr=C3=A8s facile en m=C3=AAme temps. Il y a un a=
n, je t'aurais parl=C3=A9 de mes muscles.</font></div><div align=3D"left"><=
font face=3D"normal"></font></div><div align=3D"left"><font face=3D"normal"=
>Si je t'emmerde, tu me le dis, je sais que, gr=C3=A2ce =C3=A0 ma propre v=
=C3=A9rit=C3=A9 le cycle du cosmos dans la vie... </font></div><div align=
=3D"left"><font face=3D"normal">c'est une grande roue car l'aboutissement d=
e l'instinct, c'est l'amour ! </font></div><div align=3D"left"><font face=
=3D"normal">Il y a un an, je t'aurais parl=C3=A9 de mes muscles.</font></di=
v><div align=3D"left"><font face=3D"normal"></font></div><div align=3D"left=
"><font face=3D"normal">Merci</font></div><div align=3D"left"><font face=3D=
"normal"></font></div><div align=3D"left"><font face=3D"normal">Simon</font=
></div><div align=3D"left"><font face=3D"normal"></font></div><br/>
<hr style=3D"width: 2em; text-align: start; display: inline-block"/><br/>
<div align=3D"left"><font face=3D"normal">Artisans Nomades ASBL</font></div=
><div align=3D"left"><font face=3D"normal">5, Bruy=C3=A8re Cacou - 1460 Vir=
ginal-Samme</font></div><div align=3D"left"><font face=3D"normal">+32.497.9=
7.62.84</font></div><div align=3D"left"><font face=3D"normal">IBAN: BE30 00=
19 3728 3390</font></div><div align=3D"left"><font face=3D"normal">BCE: BE =
0786.423.144</font></div></body>
</html>
--===============2090774107435372536==--

An access to a source mode editor would be great, but also, using <p> instead of <div> could be displayed in a more consistent way through mail clients, with the default HTML mode.

Is there a way to enhance this behavior?

thanks

Simon

It seems that the editor is not adding the <br/> for empty line as it seems it should according to normalize_markup from htmltextbuffer.py.
I guess this is because there are nested empty tags for the empty <div/> tags so it is not considered as empty. Probably the loop before does not clean all the empty tags.

<div/> has been used because it does not carry any semantic instead of <p/>.
Also we must ensure to generate the same code for both editors.

I detected that how to show html in a widget richtext (html editor), are different that html show in a report (weasyprint)

Same result that Simon explain (<div> and <br/>).

What about moving RichText editor to a WebKit based base WebView which basically renders a HTML page. In the past I found an example but it took some time to find it: PyGTK HTML WYSIWYG Editor · GitHub. The example runs on Fedora 36 which is very recent.

The advantage is also that images can be added or tables.

Maybe eventually a full blown javascript HTML editor can be implemented.

WebKitGTK does not seem to be packages by MSYS2 nor Homebrew.

I think the limited features of RichText is the feature. If you want to edit HTML you can use the HTML widget based on TinyMCE.

I would like to avoid blow the system with JavaScript nor supporting rendering random HTML/CSS/JavaScript as it will be an open door for security.

I do not think having a bug in the RichText editor should be a reason to drop it. The bug reason seems to be identified and it should not be difficult to fix it.

I didn’t look that far but isn’t it integrated into the gi package?

I agree, I talked about moving, not dropping.

Totally off-topic, some thoughts / ideas mostly unworkable

I see 3 things I think more people like in the editor.

  1. Add tables so you can add more details of the record in your email templates
  2. Add images, no need to do resizing etc, just place it
  3. Ability to switch between HTML and plain text so you are able to make some changes to the HTML tags

Basically the things you also have in an email editor. The idea was to move from a TextBox to a WebKit View to support that, but also be a bit more inline with the other editors.

I also think it would make it possible to have TinyMCE displayed inside the client instead of opening a tab in the webbrowser. No idea if WebKit supports sandboxing etc like browsers do.

But as WebKit is not available in MSYS2 this is not going to work.

gobject-introspection is just a general tool to bind with libraries with language like Python.
So you still need to have the library to use it with for example Python.

Ah, I see. Did search a bit and it seems it needs a lot of work to get WebKit build on Windows. That’s why there is no package anymore.

Actually, imho here we expect a semantic content to be carried with a paragraph, because this is what it is…
But <br> would to the trick.

Can we as a system administrator adding option the the default RichText editor included? The source edition would be usefull to me.
Any clue to do this would be appreciated.

I do not think we will allow that because the richtext is based on HTML but it is not HTML (only a restricted subset) so allowing user to type anything will break the rendering of the widget.

Once again it is better to fix the bug than overcome it with a new feature.