Creat Link with Mailto and add CSS for Button
Button in Frontend
CSS removed, no Button
Joomla 4.0.4
deactivate Content - Email Cloaking the Button shows up
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
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.
I can confirm the bug. It would appear that the joomla-hidden-mail javascript is ignoring any class attributes.
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");
I already have a first part of the troubleshooting. But I am not really satisfied with it yet.
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?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-12-08 21:18:31 |
Closed_By | ⇒ | richard67 |
could you please share the exact code you used for the button, how you created it and where.