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

[WIP] Table Block v1 #3

Closed
wants to merge 11 commits into from
Closed

[WIP] Table Block v1 #3

wants to merge 11 commits into from

Conversation

i-am-chitti
Copy link
Member

Description

This PR is under WIP for table block.

Features

[ ] Toggle Options to add a THEAD and TFOOT on the Table block
[ ] Toggle Options to make THEAD sticky
[x] Ability to select text and background colors on a row
[x] Ability to select text and background colors on a column
[x] Ability to transform a cell into a Paragraph, Image, Heading, List
[ ] Ability to move an entire column left or right
[ ] Ability to move an entire row up or down
[ ] Ability to add text alignment in the cell block

Note

  • The current markup is throwing invalid HTML structure due to absence of tbody. So, tbody is added.

@i-am-chitti i-am-chitti self-assigned this Apr 23, 2024
return (
<RichText.Content value={ attributes.content } />
<RichText.Content tagName="span" { ...blockProps } value={ attributes.content } />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@i-am-chitti We don't want to save any markup in here other than the value. That's why we are creating this block in the first place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@junaidbhura I've added the color attribute to the cell block - https://github.com/Travelopia/wordpress-blocks/blob/WP-70/table-block-v1/src/blocks/table-cell/index.tsx#L39-L42

Now, if I don't include the tagName, then, colors are not reflected on frontend, though present on editor side. Without tagName, if I just add the {...blockProps}, there is no tag where these color classes can be applied.

Taking a step back, I've added color on table-row, table-column and table-cell. I have started thinking again that table-cell doesn't need the color since table column has it and a cell will be only present in the column.

colSpan={ attributes.colSpan }
rowSpan={ attributes.rowSpan }
/>
{ attributes.isHead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@i-am-chitti Can I request you to remove this header code out of this PR?

background: true,
text: true,
},
align: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@i-am-chitti Does this also add align wide? If so, we should only allow left right and center

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@junaidbhura It's not working currently. Will remove this and tackle in separate PR.

import { name as cellBlockName } from '../table-cell';
import { PanelBody, ToggleControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@i-am-chitti lets remove this empty line

@i-am-chitti
Copy link
Member Author

Closing this as it's changes are broken down into multiple PRs. Re-raising new ones.

@junaidbhura junaidbhura deleted the WP-70/table-block-v1 branch April 29, 2024 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants