Allow HTML in Tablefield Cells

Created on 9 May 2023, over 1 year ago
Updated 1 August 2024, 4 months ago

Problem/Motivation

Users sometimes want to use inline HTML in uploaded tables.

Steps to reproduce

Proposed resolution

Allow cell content to be rendered as #markup

Remaining tasks

User interface changes

This could be added as an optional configuration, we have a patch to just turn it on across the board.

API changes

Data model changes

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mciver87

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

Merge Requests

Comments & Activities

  • Issue created by @mciver87
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    I think if we add this, it shouldn't use a #markup render array. That's too permissive. While that is filtered for XSS, it's not filtered for other restricted tags on the site, nor are any filters run to make sure the HTML is valid. You could have unclosed tags, for example, that would break the site formatting.

    I think to add this, we would need two things:

    1. Switch to using #processed_text instead of #markup.

    2. Add a configuration option on the field formatter that allows you to select whether the contents of the CSV file should be rendered as plain text or formatted text. If formatted text is chosen, then you should be required to pick what text format to use from the available text formats on the website. That would then be used as the #format value when we render the results with #processed_text. We can use #plain_text if the plain text option is chosen.

  • πŸ‡¦πŸ‡ΊAustralia geoffreyr

    I've got a case where I have a CSV with a lot of line breaks in the cells that I'd like to convert to HTML <br /> markup (nl2br style). This feature might allow for what I want to achieve, so I'll see if it's possible to render out the cells with a text filter set.

  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • πŸ‡¦πŸ‡ΊAustralia geoffreyr

    MR available for review.

Production build 0.71.5 2024