Email in table field not rendered due to missing javascript

Created on 21 July 2023, 11 months ago
Updated 10 August 2023, 11 months ago

Problem/Motivation

When email addresses are added to a table field β†’ , the html is converted, but as far as I can tell, the javascript that would actually render the email to the user correctly isn't even loaded on the page. I set the site to not compress javascript and could not find the spamspan.js file listed among the scripts.

Steps to reproduce

Add the tablefield β†’ module. Add a field of type tablefield to a content type and add an email in such as

<a href="mailto:user@mail.com">user@mail.com</a>

See that the email is displayed as user [at] mail.com.

I did confirm that this was in the previous beta as well, so it's not a new bug.

πŸ› Bug report
Status

Needs work

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States shelane

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @shelane
  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    I just took a quick look at the code and it looks like the JS is loaded if the spamspan filter is being used. Does tablefield let you specify which filters to use for a column?

  • πŸ‡ΊπŸ‡ΈUnited States shelane

    The "rich text" field formatter is set for the table. I looked a body field that is using the filter and that isn't looking quite right either. I entered the email address myemail@mail.com, but it is being displayed as myemailatmaildotcom.

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    I set this up and I think the module is telling Drupal to load its JS. I'll look into what Drupal doesn't like about the module's JS tomorrow (unless someone else wants to look at it in the meantime).

  • Status changed to Needs work 11 months ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    I guess this might indeed be an issue / conflict with table field. Could someone, who has it installed, take a closer look and prepare a MR?

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    I created a text format with spamspan and used it with both a regular body field and a tablefield field. I copied AttachmentsTrait into FilterProcessResult and added logging to getAttachments(). For the body field, the value returned from getAttachments() contains this module's JS library. For the tablefield, it doesn't.

    This seems like such an obscure case that it doesn't warrant more research but others might disagree. A workaround I found is to give a text field on the same page as tablefield the spamspan text filter and put an email address in it. That results in this module's JS being loaded. That field could be hidden using custom JS. Even better, the page could be altered by custom code to attach this module's JS.

  • πŸ‡ΊπŸ‡ΈUnited States shelane

    I have a twig template that is used for the paragraph that displays the table field. I have added {{ attach_library('spamspan/obfuscate') }} to the template and it is working. I'm not sure why the library isn't being called in on its own, but at least there is a work around. Thanks for verifying. I'm not sure that this issue should be closed though if someone is able to figure out why the filters aren't being applied correctly.

    It may be an issue that needs to be moved to the TableField module or just another issue added on their queue and mark this as related?

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thanks for your feedback. So I think we should set this minor, but it would be nice if someone could find out, why the library isn't loaded in this case. Perhaps using Xdebug?

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    I created this issue: https://www.drupal.org/project/tablefield/issues/3380355 πŸ› Tablefield causes spamspan module's Javascript not to be loaded Active

    "Throw it over the fence, let Arby's worry about it."

Production build 0.69.0 2024