diff --git a/packages/block-library/src/query-pagination/block.json b/packages/block-library/src/query-pagination/block.json index edab3acc951d65..44ccb0f9ee3822 100644 --- a/packages/block-library/src/query-pagination/block.json +++ b/packages/block-library/src/query-pagination/block.json @@ -4,6 +4,7 @@ "category": "design", "usesContext": [ "queryId", "query" ], "supports": { + "align": true, "reusable": false, "html": false }, diff --git a/packages/block-library/src/query/block.json b/packages/block-library/src/query/block.json index fc557abee646e3..e64e3350b22d11 100644 --- a/packages/block-library/src/query/block.json +++ b/packages/block-library/src/query/block.json @@ -37,6 +37,7 @@ "layout": "layout" }, "supports": { + "align": [ "wide", "full" ], "html": false }, "editorStyle": "wp-block-query-editor" diff --git a/packages/block-library/src/query/deprecated.js b/packages/block-library/src/query/deprecated.js new file mode 100644 index 00000000000000..e39ad4cf372496 --- /dev/null +++ b/packages/block-library/src/query/deprecated.js @@ -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 ; + }, + }, +]; + +export default deprecated; diff --git a/packages/block-library/src/query/index.js b/packages/block-library/src/query/index.js index 317fd1b0445739..b5cd3ec4041fbc 100644 --- a/packages/block-library/src/query/index.js +++ b/packages/block-library/src/query/index.js @@ -11,6 +11,7 @@ import metadata from './block.json'; import edit from './edit'; import save from './save'; import variations from './variations'; +import deprecated from './deprecated'; const { name } = metadata; export { metadata, name }; @@ -22,4 +23,5 @@ export const settings = { edit, save, variations, + deprecated, }; diff --git a/packages/block-library/src/query/save.js b/packages/block-library/src/query/save.js index d9b9bec9c7bc26..4705f671580c5a 100644 --- a/packages/block-library/src/query/save.js +++ b/packages/block-library/src/query/save.js @@ -1,8 +1,12 @@ /** * WordPress dependencies */ -import { InnerBlocks } from '@wordpress/block-editor'; +import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; export default function QuerySave() { - return ; + return ( +
+ +
+ ); } diff --git a/packages/e2e-tests/fixtures/blocks/core__query.html b/packages/e2e-tests/fixtures/blocks/core__query.html index b15b17b5bd4197..3bc4085f4f090d 100644 --- a/packages/e2e-tests/fixtures/blocks/core__query.html +++ b/packages/e2e-tests/fixtures/blocks/core__query.html @@ -1 +1,3 @@ - + +
+ diff --git a/packages/e2e-tests/fixtures/blocks/core__query.json b/packages/e2e-tests/fixtures/blocks/core__query.json index 19ef71fdf3bcb8..91150a3fdba46b 100644 --- a/packages/e2e-tests/fixtures/blocks/core__query.json +++ b/packages/e2e-tests/fixtures/blocks/core__query.json @@ -24,6 +24,6 @@ } }, "innerBlocks": [], - "originalContent": "" + "originalContent": "
" } ] diff --git a/packages/e2e-tests/fixtures/blocks/core__query.parsed.json b/packages/e2e-tests/fixtures/blocks/core__query.parsed.json index bbdd465acf5118..c26f382360fbb1 100644 --- a/packages/e2e-tests/fixtures/blocks/core__query.parsed.json +++ b/packages/e2e-tests/fixtures/blocks/core__query.parsed.json @@ -3,7 +3,18 @@ "blockName": "core/query", "attrs": {}, "innerBlocks": [], - "innerHTML": "", - "innerContent": [] + "innerHTML": "\n
\n", + "innerContent": [ + "\n
\n" + ] + }, + { + "blockName": null, + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/packages/e2e-tests/fixtures/blocks/core__query.serialized.html b/packages/e2e-tests/fixtures/blocks/core__query.serialized.html index b15b17b5bd4197..3bc4085f4f090d 100644 --- a/packages/e2e-tests/fixtures/blocks/core__query.serialized.html +++ b/packages/e2e-tests/fixtures/blocks/core__query.serialized.html @@ -1 +1,3 @@ - + +
+ diff --git a/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.html b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.html new file mode 100644 index 00000000000000..b15b17b5bd4197 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.html @@ -0,0 +1 @@ + diff --git a/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.json b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.json new file mode 100644 index 00000000000000..19ef71fdf3bcb8 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.json @@ -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": "" + } +] diff --git a/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.parsed.json b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.parsed.json new file mode 100644 index 00000000000000..3354da9130a84e --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.parsed.json @@ -0,0 +1,18 @@ +[ + { + "blockName": "core/query", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "", + "innerContent": [] + }, + { + "blockName": null, + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n", + "innerContent": [ + "\n" + ] + } +] diff --git a/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.serialized.html b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.serialized.html new file mode 100644 index 00000000000000..366975244609ab --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__query__deprecated-1.serialized.html @@ -0,0 +1,3 @@ + +
+