Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Table visualization does not render \r\n as newline #20258

Closed
lziosi opened this issue Jun 3, 2022 · 9 comments
Closed

Table visualization does not render \r\n as newline #20258

lziosi opened this issue Jun 3, 2022 · 9 comments

Comments

@lziosi
Copy link

lziosi commented Jun 3, 2022

Found using Superset 1.3.2.
I have a text column called description in Postgresql with strings like: "\r\n\r\nTitle".
When I display these strings in a Table chart, the carriage return an line feed are not rendered (all text appears on the same line).
I can workaround this by creating a derived column with the function:

regexp_replace(description, E'[\\n\\r]+', '</br>', 'g' )

I have found an old closed defect that should have fixed this:
e762978#diff-e4cefda577d63cfaafae%5B%E2%80%A6%5D46b45c7fce61e56362e207f915
But the referenced code files (Table.css and Table.js) are not in the latest version of the repository.
This recent change:
66adcc9
shows that: "white-space: nowrap;" was changed to "white-space: normal;"
That would explain why \r\n are no longer honored (it used to be "white-space: pre;" at the time of the earlier fix).

It seems to me that "pre-wrap" might be the most useful option: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
Would it be possible to change this or introduce an option?

@yousoph
Copy link
Member

yousoph commented Jun 10, 2022

@prosdev0107 could you take a look? thanks!

@prosdev0107
Copy link
Contributor

@yousoph I carefully took an enough check and test.
\r\n didn't honor even with "white-space: pre" or "white-space: pre-wrap".
I believe that we can't control them by css whitespace property and can only control them by reg expression.

image

Please let me know your idea.

@yousoph
Copy link
Member

yousoph commented Jun 16, 2022

Hey @lziosi , it looks like this functionality wasn't supported before the most recent change in 66adcc9

Do you have a SHA of if/when this worked?

@Hokwang
Copy link

Hokwang commented Feb 24, 2023

I have a same problem,
I actually use superset for tables.
table should support newline.

For now, web shows newline to just one space, when I download csv file and load it to google sheet,
it shows newline.

So now I always download and use google sheet for seeing newline.

@Hokwang
Copy link

Hokwang commented Feb 24, 2023

@Hokwang
Copy link

Hokwang commented Mar 17, 2023

@yousoph Could you check this issue again? I hope someone updated this issue.

@Hokwang
Copy link

Hokwang commented Apr 26, 2023

@prosdev0107 Could you check this issue once again? Is there any solution?

@gaful
Copy link

gaful commented Oct 24, 2023

I have the same issue, we come up with transforming it into <br>, but <br> appears when exporting data so it is not a really good solution.

@rusackas
Copy link
Member

rusackas commented Apr 5, 2024

Closing this out for now, since:

  1. the thread has gone pretty stale
  2. I think this is a feature request more than a bug.
  3. There are valid workarounds, as posted on the thread.

As always, we'd be more than happy to review a PR. And if anyone else disagrees, and thinks this is truly a bug, I'm more than happy to re-open this.

@rusackas rusackas closed this as completed Apr 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants