Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Converting a table in a classic block to a table block removes all inline styles #6096

Closed
2 tasks
samfull opened this issue Apr 10, 2018 · 3 comments
Closed
2 tasks
Labels
[Feature] Block Transforms Block transforms from one block to another [Feature] Blocks Overall functionality of blocks [Feature] Paste [Type] Bug An existing feature does not function as intended
Milestone

Comments

@samfull
Copy link

samfull commented Apr 10, 2018

Issue Overview

In the latest version of Gutenburg (Version 2.5.0 ). If you have a table set-up with in-line styles, Gutenburg will remove the styles when you convert it to a block.

Steps to Reproduce (for bugs)

  1. Make a table with in-line styles without gutenburg
  2. Enable gutenburg and edit the page
  3. Now you will see the table is now a classic block
  4. Convert this to blocks and all in-line styles are lost

Expected Behavior

In-line CSS is kept, however you can change the values visually. You should also be able to delete rows and columns.

It would be great if the visual editor displayed the colors and other CSS too. Also it would be nice to be able to change the colors. But for now, just being able to edit the values and not remove all the in-line CSS would be good for users who don't know how to code.

Current Behavior

All of the in-line CSS for the table is removed when you convert a table from the classic block to the table block.

Possible Solution

Don't remove the in-line CSS when converting to a table block. The data is kept, so why remove the CSS?

Screenshots / Video

How the Gutenberg classic block looks like:

before

How the Gutenberg table block looks like after converting:

after

The HTML after converting (it has removed the in-line styles)

after_html

Related Issues and/or PRs

Todos

  • Tests
  • Documentation
@samfull samfull changed the title Converting a classic block to a table block removes all inline styles Converting a table in a classic block to a table block removes all inline styles Apr 10, 2018
@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended [Feature] Blocks Overall functionality of blocks labels Apr 10, 2018
@danielbachhuber danielbachhuber added this to the Merge Proposal milestone Apr 10, 2018
@danielbachhuber
Copy link
Member

Thanks for the detailed report, @samfull.

It's intentional behavior to strip accessory inline HTML attributes at the moment. There's some room for discussion on:

  1. Whether we leave more inline HTML attributes in-place.
  2. Whether we need to have UX alerting the user to the fact their data is being stripped out.

See conversation in #4522 (comment)

Related #4498

@mtias
Copy link
Member

mtias commented Jul 12, 2018

I don't think this one should be a concern for the "try" milestone, since the Table block is completely new and doesn't have a corresponding feature set in core there's not many expectations of conversion capabilities.

It's also not clear if from a design point of view this is something that wants to be supported at all in the table block in general, so we should look at it as arbitrary HTML that upon converting to blocks might lose style attributes, with the option to undo.

@karmatosed
Copy link
Member

Closing so we can focus on #6923 for fixing tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Transforms Block transforms from one block to another [Feature] Blocks Overall functionality of blocks [Feature] Paste [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants