Repository navigation
Add wrapper in Query block and align support
#30804
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
Changes from all 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 |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { InnerBlocks } from '@wordpress/block-editor'; | ||
|
|
||
| const deprecated = [ | ||
| // Version with NO wrapper `div` element. | ||
| { | ||
| attributes: { | ||
| queryId: { | ||
| type: 'number', | ||
| }, | ||
| query: { | ||
| type: 'object', | ||
| default: { | ||
| perPage: null, | ||
| pages: 0, | ||
| offset: 0, | ||
| postType: 'post', | ||
| categoryIds: [], | ||
| tagIds: [], | ||
| order: 'desc', | ||
| orderBy: 'date', | ||
| author: '', | ||
| search: '', | ||
| exclude: [], | ||
| sticky: '', | ||
| inherit: true, | ||
| }, | ||
| }, | ||
| layout: { | ||
| type: 'object', | ||
| default: { | ||
| type: 'list', | ||
| }, | ||
| }, | ||
| }, | ||
| supports: { | ||
| html: false, | ||
| }, | ||
| save() { | ||
| return <InnerBlocks.Content />; | ||
| }, | ||
| }, | ||
| ]; | ||
|
|
||
| export default deprecated; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { InnerBlocks } from '@wordpress/block-editor'; | ||
| import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; | ||
|
|
||
| export default function QuerySave() { | ||
| return <InnerBlocks.Content />; | ||
| return ( | ||
| <div { ...useBlockProps.save() }> | ||
| <InnerBlocks.Content /> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| <!-- wp:query /--> | ||
| <!-- wp:query --> | ||
| <div class="wp-block-query"></div> | ||
| <!-- /wp:query --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,6 @@ | |
| } | ||
| }, | ||
| "innerBlocks": [], | ||
| "originalContent": "" | ||
| "originalContent": "<div class=\"wp-block-query\"></div>" | ||
| } | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| <!-- wp:query /--> | ||
| <!-- wp:query --> | ||
| <div class="wp-block-query"></div> | ||
| <!-- /wp:query --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <!-- wp:query /--> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| [ | ||
| { | ||
| "clientId": "_clientId_0", | ||
| "name": "core/query", | ||
| "isValid": true, | ||
| "attributes": { | ||
| "query": { | ||
| "perPage": null, | ||
| "pages": 0, | ||
| "offset": 0, | ||
| "postType": "post", | ||
| "categoryIds": [], | ||
| "tagIds": [], | ||
| "order": "desc", | ||
| "orderBy": "date", | ||
| "author": "", | ||
| "search": "", | ||
| "exclude": [], | ||
| "sticky": "", | ||
| "inherit": true | ||
| }, | ||
| "layout": { | ||
| "type": "list" | ||
| } | ||
| }, | ||
| "innerBlocks": [], | ||
| "originalContent": "" | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [ | ||
| { | ||
| "blockName": "core/query", | ||
| "attrs": {}, | ||
| "innerBlocks": [], | ||
| "innerHTML": "", | ||
| "innerContent": [] | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <!-- wp:query {"query":{"perPage":null,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true},"layout":{"type":"list"}} --> | ||
|
Member
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. As long as default value for attributes is used, it should look rather like: <!-- wp:query -->
<div class="wp-block-query"></div>
<!-- /wp:query -->
Contributor
Author
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'll investigate. I'm wondering if it has to do with these properties being
Member
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 wouldn't be surprised. I think you know already my opinion about using complex key/value-based objects as attributes. I would avoid them in the first place, so if that creates an issue, we could use the opportunity that deprecation is inevitable to refactor that as well. Anyway, I hope that is something else and you don't have to end up with a nuclear option 🤣
Contributor
Author
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 some cases (Query being the main case that comes in my mind) it makes sense to use How do you feel about this:494aa75 We could always use |
||
| <div class="wp-block-query"></div> | ||
| <!-- /wp:query --> | ||
Uh oh!
There was an error while loading. Please reload this page.