[Field Format] Refactor field format to completely remove html format converter #2932
Labels
discuss
needs research
refactor
Tech debt related tasks that need refactoring
technical debt
If not paid, jeapardizes long-term success and maintainability of the repository.
unified visualization UX
visualizations
Issues and PRs related to visualizations
Field format is restored in index pattern. Currently, we support 15+ formats. An index pattern is constructed like the following
From @joshuarrrr comment:
It seems the primary purpose of the field formatters (provided by the data plugin) is plain text formatting, which seems both sensible and necessary. I see no need to get rid of these or fundamentally change them.
We have two types of format converters, text and html. The default is text. Only 3 of the formats also have a htmlConvert method:
These return string-ified HTML from templates is wired and requires another layer of transfer. For example, for url formatter there are 3 types. For these 3 types, here is a compare of text converter vs html converter
We could see that the text format converter is not able to return correct data. Only html format converter is working for the url format. These return string-ified HTML from templates, so using them in React is awkward and requires dangerouslySetInnerHTML, for example
<div dangerouslySetInnerHTML={{ __html: dompurify.sanitize(htmlContent) }} />
, to convert the html content and make it secure.We should consider refactor field format in the future to completely remove html format converter.
The text was updated successfully, but these errors were encountered: