@wordpress/list-reusable-blocks 5.53.0 → 5.54.2-next.v.202608281122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/utils/export.cjs +2 -1
- package/build/utils/export.cjs.map +3 -3
- package/build-module/utils/export.mjs +2 -1
- package/build-module/utils/export.mjs.map +2 -2
- package/build-types/utils/export.d.ts.map +1 -1
- package/package.json +12 -11
- package/src/utils/export.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 5.54.1-next.0 (2026-08-28)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- Normalize special characters in exported reusable block filenames to prevent broken or unreadable files. ([#77033](https://github.com/WordPress/gutenberg/pull/77033))
|
|
10
|
+
|
|
11
|
+
## 5.54.0 (2026-08-26)
|
|
12
|
+
|
|
5
13
|
## 5.53.0 (2026-08-12)
|
|
6
14
|
|
|
7
15
|
|
package/build/utils/export.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(export_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(export_exports);
|
|
36
36
|
var import_change_case = require("change-case");
|
|
37
|
+
var import_remove_accents = __toESM(require("remove-accents"));
|
|
37
38
|
var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
|
|
38
39
|
var import_blob = require("@wordpress/blob");
|
|
39
40
|
async function exportReusableBlock(id) {
|
|
@@ -56,7 +57,7 @@ async function exportReusableBlock(id) {
|
|
|
56
57
|
null,
|
|
57
58
|
2
|
|
58
59
|
);
|
|
59
|
-
const fileName = (0, import_change_case.paramCase)(title) + ".json";
|
|
60
|
+
const fileName = (0, import_change_case.paramCase)((0, import_remove_accents.default)(title)) + ".json";
|
|
60
61
|
(0, import_blob.downloadBlob)(fileName, fileContent, "application/json");
|
|
61
62
|
}
|
|
62
63
|
var export_default = exportReusableBlock;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/export.ts"],
|
|
4
|
-
"sourcesContent": ["import { paramCase as kebabCase } from 'change-case';\nimport apiFetch from '@wordpress/api-fetch';\nimport { downloadBlob } from '@wordpress/blob';\nimport type { Post, PostType } from './types';\n\n/**\n * Export a reusable block as a JSON file.\n *\n * @param id - The ID of the reusable block to export\n */\nasync function exportReusableBlock( id: number ): Promise< void > {\n\tconst postType = await apiFetch< PostType >( {\n\t\tpath: `/wp/v2/types/wp_block`,\n\t} );\n\n\tconst post = await apiFetch< Post >( {\n\t\tpath: `/wp/v2/${ postType.rest_base }/${ id }?context=edit`,\n\t} );\n\n\tconst title = post.title.raw;\n\tconst content = post.content.raw;\n\tconst syncStatus = post.wp_pattern_sync_status;\n\n\tconst fileContent = JSON.stringify(\n\t\t{\n\t\t\t__file: 'wp_block',\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\tsyncStatus,\n\t\t},\n\t\tnull,\n\t\t2\n\t);\n\n\tconst fileName = kebabCase( title ) + '.json';\n\n\tdownloadBlob( fileName, fileContent, 'application/json' );\n}\n\nexport default exportReusableBlock;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAuC;AACvC,uBAAqB;AACrB,kBAA6B;AAQ7B,eAAe,oBAAqB,IAA8B;AACjE,QAAM,WAAW,UAAM,iBAAAA,SAAsB;AAAA,IAC5C,MAAM;AAAA,EACP,CAAE;AAEF,QAAM,OAAO,UAAM,iBAAAA,SAAkB;AAAA,IACpC,MAAM,UAAW,SAAS,SAAU,IAAK,EAAG;AAAA,EAC7C,CAAE;AAEF,QAAM,QAAQ,KAAK,MAAM;AACzB,QAAM,UAAU,KAAK,QAAQ;AAC7B,QAAM,aAAa,KAAK;AAExB,QAAM,cAAc,KAAK;AAAA,IACxB;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,eAAW,mBAAAC,
|
|
6
|
-
"names": ["apiFetch", "kebabCase"]
|
|
4
|
+
"sourcesContent": ["import { paramCase as kebabCase } from 'change-case';\nimport removeAccents from 'remove-accents';\nimport apiFetch from '@wordpress/api-fetch';\nimport { downloadBlob } from '@wordpress/blob';\nimport type { Post, PostType } from './types';\n\n/**\n * Export a reusable block as a JSON file.\n *\n * @param id - The ID of the reusable block to export\n */\nasync function exportReusableBlock( id: number ): Promise< void > {\n\tconst postType = await apiFetch< PostType >( {\n\t\tpath: `/wp/v2/types/wp_block`,\n\t} );\n\n\tconst post = await apiFetch< Post >( {\n\t\tpath: `/wp/v2/${ postType.rest_base }/${ id }?context=edit`,\n\t} );\n\n\tconst title = post.title.raw;\n\tconst content = post.content.raw;\n\tconst syncStatus = post.wp_pattern_sync_status;\n\n\tconst fileContent = JSON.stringify(\n\t\t{\n\t\t\t__file: 'wp_block',\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\tsyncStatus,\n\t\t},\n\t\tnull,\n\t\t2\n\t);\n\n\tconst fileName = kebabCase( removeAccents( title ) ) + '.json';\n\n\tdownloadBlob( fileName, fileContent, 'application/json' );\n}\n\nexport default exportReusableBlock;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAuC;AACvC,4BAA0B;AAC1B,uBAAqB;AACrB,kBAA6B;AAQ7B,eAAe,oBAAqB,IAA8B;AACjE,QAAM,WAAW,UAAM,iBAAAA,SAAsB;AAAA,IAC5C,MAAM;AAAA,EACP,CAAE;AAEF,QAAM,OAAO,UAAM,iBAAAA,SAAkB;AAAA,IACpC,MAAM,UAAW,SAAS,SAAU,IAAK,EAAG;AAAA,EAC7C,CAAE;AAEF,QAAM,QAAQ,KAAK,MAAM;AACzB,QAAM,UAAU,KAAK,QAAQ;AAC7B,QAAM,aAAa,KAAK;AAExB,QAAM,cAAc,KAAK;AAAA,IACxB;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,eAAW,mBAAAC,eAAW,sBAAAC,SAAe,KAAM,CAAE,IAAI;AAEvD,gCAAc,UAAU,aAAa,kBAAmB;AACzD;AAEA,IAAO,iBAAQ;",
|
|
6
|
+
"names": ["apiFetch", "kebabCase", "removeAccents"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// packages/list-reusable-blocks/src/utils/export.ts
|
|
2
2
|
import { paramCase as kebabCase } from "change-case";
|
|
3
|
+
import removeAccents from "remove-accents";
|
|
3
4
|
import apiFetch from "@wordpress/api-fetch";
|
|
4
5
|
import { downloadBlob } from "@wordpress/blob";
|
|
5
6
|
async function exportReusableBlock(id) {
|
|
@@ -22,7 +23,7 @@ async function exportReusableBlock(id) {
|
|
|
22
23
|
null,
|
|
23
24
|
2
|
|
24
25
|
);
|
|
25
|
-
const fileName = kebabCase(title) + ".json";
|
|
26
|
+
const fileName = kebabCase(removeAccents(title)) + ".json";
|
|
26
27
|
downloadBlob(fileName, fileContent, "application/json");
|
|
27
28
|
}
|
|
28
29
|
var export_default = exportReusableBlock;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/export.ts"],
|
|
4
|
-
"sourcesContent": ["import { paramCase as kebabCase } from 'change-case';\nimport apiFetch from '@wordpress/api-fetch';\nimport { downloadBlob } from '@wordpress/blob';\nimport type { Post, PostType } from './types';\n\n/**\n * Export a reusable block as a JSON file.\n *\n * @param id - The ID of the reusable block to export\n */\nasync function exportReusableBlock( id: number ): Promise< void > {\n\tconst postType = await apiFetch< PostType >( {\n\t\tpath: `/wp/v2/types/wp_block`,\n\t} );\n\n\tconst post = await apiFetch< Post >( {\n\t\tpath: `/wp/v2/${ postType.rest_base }/${ id }?context=edit`,\n\t} );\n\n\tconst title = post.title.raw;\n\tconst content = post.content.raw;\n\tconst syncStatus = post.wp_pattern_sync_status;\n\n\tconst fileContent = JSON.stringify(\n\t\t{\n\t\t\t__file: 'wp_block',\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\tsyncStatus,\n\t\t},\n\t\tnull,\n\t\t2\n\t);\n\n\tconst fileName = kebabCase( title ) + '.json';\n\n\tdownloadBlob( fileName, fileContent, 'application/json' );\n}\n\nexport default exportReusableBlock;\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,aAAa,iBAAiB;AACvC,OAAO,cAAc;AACrB,SAAS,oBAAoB;AAQ7B,eAAe,oBAAqB,IAA8B;AACjE,QAAM,WAAW,MAAM,SAAsB;AAAA,IAC5C,MAAM;AAAA,EACP,CAAE;AAEF,QAAM,OAAO,MAAM,SAAkB;AAAA,IACpC,MAAM,UAAW,SAAS,SAAU,IAAK,EAAG;AAAA,EAC7C,CAAE;AAEF,QAAM,QAAQ,KAAK,MAAM;AACzB,QAAM,UAAU,KAAK,QAAQ;AAC7B,QAAM,aAAa,KAAK;AAExB,QAAM,cAAc,KAAK;AAAA,IACxB;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,WAAW,UAAW,KAAM,IAAI;
|
|
4
|
+
"sourcesContent": ["import { paramCase as kebabCase } from 'change-case';\nimport removeAccents from 'remove-accents';\nimport apiFetch from '@wordpress/api-fetch';\nimport { downloadBlob } from '@wordpress/blob';\nimport type { Post, PostType } from './types';\n\n/**\n * Export a reusable block as a JSON file.\n *\n * @param id - The ID of the reusable block to export\n */\nasync function exportReusableBlock( id: number ): Promise< void > {\n\tconst postType = await apiFetch< PostType >( {\n\t\tpath: `/wp/v2/types/wp_block`,\n\t} );\n\n\tconst post = await apiFetch< Post >( {\n\t\tpath: `/wp/v2/${ postType.rest_base }/${ id }?context=edit`,\n\t} );\n\n\tconst title = post.title.raw;\n\tconst content = post.content.raw;\n\tconst syncStatus = post.wp_pattern_sync_status;\n\n\tconst fileContent = JSON.stringify(\n\t\t{\n\t\t\t__file: 'wp_block',\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\tsyncStatus,\n\t\t},\n\t\tnull,\n\t\t2\n\t);\n\n\tconst fileName = kebabCase( removeAccents( title ) ) + '.json';\n\n\tdownloadBlob( fileName, fileContent, 'application/json' );\n}\n\nexport default exportReusableBlock;\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,aAAa,iBAAiB;AACvC,OAAO,mBAAmB;AAC1B,OAAO,cAAc;AACrB,SAAS,oBAAoB;AAQ7B,eAAe,oBAAqB,IAA8B;AACjE,QAAM,WAAW,MAAM,SAAsB;AAAA,IAC5C,MAAM;AAAA,EACP,CAAE;AAEF,QAAM,OAAO,MAAM,SAAkB;AAAA,IACpC,MAAM,UAAW,SAAS,SAAU,IAAK,EAAG;AAAA,EAC7C,CAAE;AAEF,QAAM,QAAQ,KAAK,MAAM;AACzB,QAAM,UAAU,KAAK,QAAQ;AAC7B,QAAM,aAAa,KAAK;AAExB,QAAM,cAAc,KAAK;AAAA,IACxB;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,WAAW,UAAW,cAAe,KAAM,CAAE,IAAI;AAEvD,eAAc,UAAU,aAAa,kBAAmB;AACzD;AAEA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/utils/export.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/utils/export.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,iBAAe,mBAAmB,CAAE,EAAE,EAAE,MAAM,GAAI,OAAO,CAAE,IAAI,CAAE,CA2BhE;eAEc,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/list-reusable-blocks",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.54.2-next.v.202608281122.0",
|
|
4
4
|
"description": "Adding Export/Import support to the reusable blocks listing.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -45,15 +45,16 @@
|
|
|
45
45
|
"wpScript": true,
|
|
46
46
|
"types": "build-types",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@wordpress/api-fetch": "^7.
|
|
49
|
-
"@wordpress/base-styles": "^
|
|
50
|
-
"@wordpress/blob": "^4.
|
|
51
|
-
"@wordpress/components": "^
|
|
52
|
-
"@wordpress/compose": "^8.
|
|
53
|
-
"@wordpress/core-data": "^7.
|
|
54
|
-
"@wordpress/element": "^8.
|
|
55
|
-
"@wordpress/i18n": "^6.
|
|
56
|
-
"change-case": "^4.1.2"
|
|
48
|
+
"@wordpress/api-fetch": "^7.54.1-next.v.202608281122.0",
|
|
49
|
+
"@wordpress/base-styles": "^13.0.1-next.v.202608281122.0",
|
|
50
|
+
"@wordpress/blob": "^4.54.1-next.v.202608281122.0",
|
|
51
|
+
"@wordpress/components": "^40.1.1-next.v.202608281122.0",
|
|
52
|
+
"@wordpress/compose": "^8.7.2-next.v.202608281122.0",
|
|
53
|
+
"@wordpress/core-data": "^7.54.2-next.v.202608281122.0",
|
|
54
|
+
"@wordpress/element": "^8.6.2-next.v.202608281122.0",
|
|
55
|
+
"@wordpress/i18n": "^6.27.1-next.v.202608281122.0",
|
|
56
|
+
"change-case": "^4.1.2",
|
|
57
|
+
"remove-accents": "^0.5.0"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"@types/react": "^18 || ^19",
|
|
@@ -68,5 +69,5 @@
|
|
|
68
69
|
"publishConfig": {
|
|
69
70
|
"access": "public"
|
|
70
71
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "de479d415171765f7b573c81aeec5334ff506a12"
|
|
72
73
|
}
|
package/src/utils/export.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { paramCase as kebabCase } from 'change-case';
|
|
2
|
+
import removeAccents from 'remove-accents';
|
|
2
3
|
import apiFetch from '@wordpress/api-fetch';
|
|
3
4
|
import { downloadBlob } from '@wordpress/blob';
|
|
4
5
|
import type { Post, PostType } from './types';
|
|
@@ -32,7 +33,7 @@ async function exportReusableBlock( id: number ): Promise< void > {
|
|
|
32
33
|
2
|
|
33
34
|
);
|
|
34
35
|
|
|
35
|
-
const fileName = kebabCase( title ) + '.json';
|
|
36
|
+
const fileName = kebabCase( removeAccents( title ) ) + '.json';
|
|
36
37
|
|
|
37
38
|
downloadBlob( fileName, fileContent, 'application/json' );
|
|
38
39
|
}
|