-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Adds fixed table layout to table block #18870
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
height: auto; | ||
|
||
table { | ||
table-layout: fixed; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this unnecessary since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In testing it was for me, feel free to iterate on PR if you don't find it is in testing @ZebulanStanphill There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @ZebulanStanphill is right, it shouldn't be required. |
||
// Ensure the table element is not full-width when aligned. | ||
width: auto; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ import { RichText, getColorClassName } from '@wordpress/block-editor'; | |
|
||
export default function save( { attributes } ) { | ||
const { | ||
hasFixedLayout, | ||
head, | ||
body, | ||
foot, | ||
|
@@ -26,7 +25,6 @@ export default function save( { attributes } ) { | |
const backgroundClass = getColorClassName( 'background-color', backgroundColor ); | ||
|
||
const classes = classnames( backgroundClass, { | ||
'has-fixed-layout': hasFixedLayout, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will have to test whether this change to the save output requires a further block deprecation to be added. Often if it's only a class name change it doesn't seem to require a deprecation. |
||
'has-background': !! backgroundClass, | ||
} ); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,13 +119,8 @@ | |
background-size: 100px 100%; | ||
// Disable reason: This function call looks nicer when each argument is on its own line. | ||
/* stylelint-disable */ | ||
background-image: linear-gradient( | ||
-45deg, | ||
theme(button) 28%, | ||
color(theme(button) shade(20%)) 28%, | ||
color(theme(button) shade(20%)) 72%, | ||
theme(button) 72% | ||
); | ||
background-image: | ||
linear-gradient(-45deg, theme(button) 28%, color(theme(button) shade(20%)) 28%, color(theme(button) shade(20%)) 72%, theme(button) 72%); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this shouldn't have been updated given the comment above. |
||
/* stylelint-enable */ | ||
border-color: color(theme(button)); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
"name": "core/table", | ||
"isValid": true, | ||
"attributes": { | ||
"hasFixedLayout": false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should remain so that the deprecation is tested correctly. |
||
"head": [ | ||
{ | ||
"cells": [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,6 @@ exports[`Table allows adding and deleting columns across the table header, body | |
<!-- /wp:table -->" | ||
`; | ||
|
||
exports[`Table allows cells to be selected when the cell area outside of the RichText is clicked 1`] = ` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The snapshot shouldn't have been removed as the test is still present. Instead it needs to be updated. |
||
"<!-- wp:table {\\"hasFixedLayout\\":true} --> | ||
<figure class=\\"wp-block-table\\"><table class=\\"has-fixed-layout\\"><tbody><tr><td><br><br><br><br></td><td>Second cell.</td></tr><tr><td></td><td></td></tr></tbody></table></figure> | ||
<!-- /wp:table -->" | ||
`; | ||
|
||
exports[`Table allows columns to be aligned 1`] = ` | ||
"<!-- wp:table --> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixed layout option shouldn't be removed from the block deprecation, it's important it remains so that old versions of the block don't receive a validation error.