No Code Attached Yet
avatar nikzolahr
nikzolahr
30 Nov 2021

Steps to reproduce the issue

Creat Link with Mailto and add CSS for Button

Expected result

Button in Frontend

Actual result

CSS removed, no Button

System information (as much as possible)

Joomla 4.0.4

Additional comments

deactivate Content - Email Cloaking the Button shows up

avatar nikzolahr nikzolahr - open - 30 Nov 2021
avatar nikzolahr nikzolahr - change - 30 Nov 2021
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 30 Nov 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Nov 2021
avatar nikzolahr nikzolahr - change - 30 Nov 2021
The description was changed
avatar nikzolahr nikzolahr - edited - 30 Nov 2021
avatar brianteeman
brianteeman - comment - 30 Nov 2021

could you please share the exact code you used for the button, how you created it and where.

avatar nikzolahr
nikzolahr - comment - 30 Nov 2021

i created an articel and added a Link with JCE added classes btn btn-primary btn-lg

the code from JCE
<p style="text-align: left;"><a href="mailto:k…@….at?subject=Sonderproduktion" class="btn btn-primary btn-lg">Senden Sie uns Ihre Anfrage</a></p>

source code at the frontend
<p style="text-align: left;"><joomla-hidden-mail is-link="1" is-email="0" first="a2FsZW5kZXI=" last="azEyLmF0P3N1YmplY3Q9U29uZGVycHJvZHVrdGlvbg==" text="U2VuZGVuIFNpZSB1bnMgSWhyZSBBbmZyYWdl" base="/www.k12.at" >Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein.</joomla-hidden-mail></p><hr />This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36166.

avatar brianteeman
brianteeman - comment - 30 Nov 2021

I can confirm the bug. It would appear that the joomla-hidden-mail javascript is ignoring any class attributes.

avatar LukasHH
LukasHH - comment - 30 Nov 2021

can confirm the bug. i think, this is in the plugin emailcloack.php
In line 324 the pattern results are passed to the helper. Here the $attribsBefore and $attribsAfter are missing.

instead of:

$replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0);

should:

$replacement = HTMLHelper::_('email.cloak', $mail, $mode, $mailText, 0, $regs[1][0], $regs[4][0]);

The same can be true for the other calls. I have not tested this. But then the class and style attribute is duplicated.But then is the class and style attributes in the link an:
<joomla-hidden-mail is-link="1" is-email="0" first="VGVzdA==" last="ZXhhbXBsZS5vcmc/c3ViamVjdD1UZXN0bWFpbA==" text="IERhcyBpc3QgZWluIExpbms=" base="/www/j4test" class="btn btn-primary" style="border: 2px solid #f00;"><a href="mailto:Test@example.org?subject=Testmail" base="/www/j4test" class="btn btn-primary" style="border: 2px solid #f00;">Das ist ein Link</a></joomla-hidden-mail>

For this, the attributes in the JS file must be removed once. For example, insert in line 58 from /media/system/js/joomla-hidden-mail.js

//remove style an class
this.removeAttribute("class");
this.removeAttribute("style");
avatar LukasHH
LukasHH - comment - 2 Dec 2021

I already have a first part of the troubleshooting. But I am not really satisfied with it yet.

avatar LukasHH
LukasHH - comment - 3 Dec 2021

There is still a problem in the file: media/system/js/joomla-hidden-mail.js

If I link an image, assign a class to it and provide style attributes, then the class is applied but the sytle attributes are deleted.
Example in html:
<a href="mailto:email@amail.com?subject=Text"><img src="path2img" class="myclass" style="border: 1px solid blue;">any text</a>

The call in the JS-file is as follows:
this.newElement.innerHTML = Joomla.sanitizeHtml(innerStr);

If I take that out, then the class and style attributes are taken over correctly.
this.newElement.innerHTML = innerStr;

I'm not sure what this sanitizeHtml does exactly and why it deletes the style specifications. So I'm not sure if you can leave it out?

avatar richard67 richard67 - close - 8 Dec 2021
avatar richard67
richard67 - comment - 8 Dec 2021

Closing as having a pull request. Please test #36269 . Thanks in advance.

avatar richard67 richard67 - change - 8 Dec 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-12-08 21:18:31
Closed_By richard67

Add a Comment

Login with GitHub to post a comment