@wordpress/patterns 2.25.0 → 2.26.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 +2 -0
- package/build/components/patterns-manage-button.js +1 -3
- package/build/components/patterns-manage-button.js.map +1 -1
- package/build-module/components/patterns-manage-button.js +1 -3
- package/build-module/components/patterns-manage-button.js.map +1 -1
- package/package.json +16 -16
- package/src/components/patterns-manage-button.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -32,8 +32,7 @@ function PatternsManageButton({
|
|
|
32
32
|
} = (0, _data.useSelect)(select => {
|
|
33
33
|
const {
|
|
34
34
|
getBlock,
|
|
35
|
-
canRemoveBlock
|
|
36
|
-
getBlockCount
|
|
35
|
+
canRemoveBlock
|
|
37
36
|
} = select(_blockEditor.store);
|
|
38
37
|
const {
|
|
39
38
|
canUser
|
|
@@ -46,7 +45,6 @@ function PatternsManageButton({
|
|
|
46
45
|
name: 'wp_block',
|
|
47
46
|
id: reusableBlock.attributes.ref
|
|
48
47
|
}),
|
|
49
|
-
innerBlockCount: getBlockCount(clientId),
|
|
50
48
|
// The site editor and templates both check whether the user
|
|
51
49
|
// has edit_theme_options capabilities. We can leverage that here
|
|
52
50
|
// and omit the manage patterns link if the user can't access it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_blocks","_data","_blockEditor","_url","_coreData","_store","_lockUnlock","_jsxRuntime","PatternsManageButton","clientId","canRemove","isVisible","managePatternsUrl","useSelect","select","getBlock","canRemoveBlock","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_blocks","_data","_blockEditor","_url","_coreData","_store","_lockUnlock","_jsxRuntime","PatternsManageButton","clientId","canRemove","isVisible","managePatternsUrl","useSelect","select","getBlock","canRemoveBlock","blockEditorStore","canUser","coreStore","reusableBlock","isReusableBlock","kind","name","id","attributes","ref","addQueryArgs","p","post_type","convertSyncedPatternToStatic","unlock","useDispatch","patternsStore","jsxs","Fragment","children","jsx","MenuItem","onClick","__","href","_default","exports","default"],"sources":["@wordpress/patterns/src/components/patterns-manage-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as patternsStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nfunction PatternsManageButton( { clientId } ) {\n\tconst { canRemove, isVisible, managePatternsUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, canRemoveBlock } = select( blockEditorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst reusableBlock = getBlock( clientId );\n\n\t\t\treturn {\n\t\t\t\tcanRemove: canRemoveBlock( clientId ),\n\t\t\t\tisVisible:\n\t\t\t\t\t!! reusableBlock &&\n\t\t\t\t\tisReusableBlock( reusableBlock ) &&\n\t\t\t\t\t!! canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\t\tid: reusableBlock.attributes.ref,\n\t\t\t\t\t} ),\n\t\t\t\t// The site editor and templates both check whether the user\n\t\t\t\t// has edit_theme_options capabilities. We can leverage that here\n\t\t\t\t// and omit the manage patterns link if the user can't access it.\n\t\t\t\tmanagePatternsUrl: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_template',\n\t\t\t\t} )\n\t\t\t\t\t? addQueryArgs( 'site-editor.php', {\n\t\t\t\t\t\t\tp: '/pattern',\n\t\t\t\t\t } )\n\t\t\t\t\t: addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t } ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Ignore reason: false positive of the lint rule.\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { convertSyncedPatternToStatic } = unlock(\n\t\tuseDispatch( patternsStore )\n\t);\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ canRemove && (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => convertSyncedPatternToStatic( clientId ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Detach' ) }\n\t\t\t\t</MenuItem>\n\t\t\t) }\n\t\t\t<MenuItem href={ managePatternsUrl }>\n\t\t\t\t{ __( 'Manage patterns' ) }\n\t\t\t</MenuItem>\n\t\t</>\n\t);\n}\n\nexport default PatternsManageButton;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAAwC,IAAAS,WAAA,GAAAT,OAAA;AAfxC;AACA;AACA;;AASA;AACA;AACA;;AAIA,SAASU,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC7C,MAAM;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAkB,CAAC,GAAG,IAAAC,eAAS,EAC1DC,MAAM,IAAM;IACb,MAAM;MAAEC,QAAQ;MAAEC;IAAe,CAAC,GAAGF,MAAM,CAAEG,kBAAiB,CAAC;IAC/D,MAAM;MAAEC;IAAQ,CAAC,GAAGJ,MAAM,CAAEK,eAAU,CAAC;IACvC,MAAMC,aAAa,GAAGL,QAAQ,CAAEN,QAAS,CAAC;IAE1C,OAAO;MACNC,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AE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcpC,oBAAoB","ignoreList":[]}
|
|
@@ -25,8 +25,7 @@ function PatternsManageButton({
|
|
|
25
25
|
} = useSelect(select => {
|
|
26
26
|
const {
|
|
27
27
|
getBlock,
|
|
28
|
-
canRemoveBlock
|
|
29
|
-
getBlockCount
|
|
28
|
+
canRemoveBlock
|
|
30
29
|
} = select(blockEditorStore);
|
|
31
30
|
const {
|
|
32
31
|
canUser
|
|
@@ -39,7 +38,6 @@ function PatternsManageButton({
|
|
|
39
38
|
name: 'wp_block',
|
|
40
39
|
id: reusableBlock.attributes.ref
|
|
41
40
|
}),
|
|
42
|
-
innerBlockCount: getBlockCount(clientId),
|
|
43
41
|
// The site editor and templates both check whether the user
|
|
44
42
|
// has edit_theme_options capabilities. We can leverage that here
|
|
45
43
|
// and omit the manage patterns link if the user can't access it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MenuItem","__","isReusableBlock","useSelect","useDispatch","store","blockEditorStore","addQueryArgs","coreStore","patternsStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PatternsManageButton","clientId","canRemove","isVisible","managePatternsUrl","select","getBlock","canRemoveBlock","
|
|
1
|
+
{"version":3,"names":["MenuItem","__","isReusableBlock","useSelect","useDispatch","store","blockEditorStore","addQueryArgs","coreStore","patternsStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PatternsManageButton","clientId","canRemove","isVisible","managePatternsUrl","select","getBlock","canRemoveBlock","canUser","reusableBlock","kind","name","id","attributes","ref","p","post_type","convertSyncedPatternToStatic","children","onClick","href"],"sources":["@wordpress/patterns/src/components/patterns-manage-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as patternsStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nfunction PatternsManageButton( { clientId } ) {\n\tconst { canRemove, isVisible, managePatternsUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, canRemoveBlock } = select( blockEditorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst reusableBlock = getBlock( clientId );\n\n\t\t\treturn {\n\t\t\t\tcanRemove: canRemoveBlock( clientId ),\n\t\t\t\tisVisible:\n\t\t\t\t\t!! reusableBlock &&\n\t\t\t\t\tisReusableBlock( reusableBlock ) &&\n\t\t\t\t\t!! canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\t\tid: reusableBlock.attributes.ref,\n\t\t\t\t\t} ),\n\t\t\t\t// The site editor and templates both check whether the user\n\t\t\t\t// has edit_theme_options capabilities. We can leverage that here\n\t\t\t\t// and omit the manage patterns link if the user can't access it.\n\t\t\t\tmanagePatternsUrl: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_template',\n\t\t\t\t} )\n\t\t\t\t\t? addQueryArgs( 'site-editor.php', {\n\t\t\t\t\t\t\tp: '/pattern',\n\t\t\t\t\t } )\n\t\t\t\t\t: addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t } ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Ignore reason: false positive of the lint rule.\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { convertSyncedPatternToStatic } = unlock(\n\t\tuseDispatch( patternsStore )\n\t);\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ canRemove && (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => convertSyncedPatternToStatic( clientId ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Detach' ) }\n\t\t\t\t</MenuItem>\n\t\t\t) }\n\t\t\t<MenuItem href={ managePatternsUrl }>\n\t\t\t\t{ __( 'Manage patterns' ) }\n\t\t\t</MenuItem>\n\t\t</>\n\t);\n}\n\nexport default PatternsManageButton;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASF,KAAK,IAAIG,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,UAAU;AACjD,SAASC,MAAM,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExC,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC7C,MAAM;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAkB,CAAC,GAAGlB,SAAS,CAC1DmB,MAAM,IAAM;IACb,MAAM;MAAEC,QAAQ;MAAEC;IAAe,CAAC,GAAGF,MAAM,CAAEhB,gBAAiB,CAAC;IAC/D,MAAM;MAAEmB;IAAQ,CAAC,GAAGH,MAAM,CAAEd,SAAU,CAAC;IACvC,MAAMkB,aAAa,GAAGH,QAAQ,CAAEL,QAAS,CAAC;IAE1C,OAAO;MACNC,SAAS,EAAEK,cAAc,CAAEN,QAAS,CAAC;MACrCE,SAAS,EACR,CAAC,CAAEM,aAAa,IAChBxB,eAAe,CAAEwB,aAAc,CAAC,IAChC,CAAC,CAAED,OAAO,CAAE,QAAQ,EAAE;QACrBE,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE,UAAU;QAChBC,EAAE,EAAEH,aAAa,CAACI,UAAU,CAACC;MAC9B,CAAE,CAAC;MACJ;MACA;MACA;MACAV,iBAAiB,EAAEI,OAAO,CAAE,QAAQ,EAAE;QACrCE,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE;MACP,CAAE,CAAC,GACArB,YAAY,CAAE,iBAAiB,EAAE;QACjCyB,CAAC,EAAE;MACH,CAAE,CAAC,GACHzB,YAAY,CAAE,UAAU,EAAE;QAC1B0B,SAAS,EAAE;MACX,CAAE;IACN,CAAC;EACF,CAAC,EACD,CAAEf,QAAQ,CACX,CAAC;;EAED;EACA;EACA,MAAM;IAAEgB;EAA6B,CAAC,GAAGxB,MAAM,CAC9CN,WAAW,CAAEK,aAAc,CAC5B,CAAC;EAED,IAAK,CAAEW,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,oBACCJ,KAAA,CAAAF,SAAA;IAAAqB,QAAA,GACGhB,SAAS,iBACVP,IAAA,CAACZ,QAAQ;MACRoC,OAAO,EAAGA,CAAA,KAAMF,4BAA4B,CAAEhB,QAAS,CAAG;MAAAiB,QAAA,EAExDlC,EAAE,CAAE,QAAS;IAAC,CACP,CACV,eACDW,IAAA,CAACZ,QAAQ;MAACqC,IAAI,EAAGhB,iBAAmB;MAAAc,QAAA,EACjClC,EAAE,CAAE,iBAAkB;IAAC,CAChB,CAAC;EAAA,CACV,CAAC;AAEL;AAEA,eAAegB,oBAAoB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/patterns",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0",
|
|
4
4
|
"description": "Management of user pattern editing.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "7.25.7",
|
|
36
|
-
"@wordpress/a11y": "^4.
|
|
37
|
-
"@wordpress/block-editor": "^14.
|
|
38
|
-
"@wordpress/blocks": "^14.
|
|
39
|
-
"@wordpress/components": "^29.
|
|
40
|
-
"@wordpress/compose": "^7.
|
|
41
|
-
"@wordpress/core-data": "^7.
|
|
42
|
-
"@wordpress/data": "^10.
|
|
43
|
-
"@wordpress/element": "^6.
|
|
44
|
-
"@wordpress/html-entities": "^4.
|
|
45
|
-
"@wordpress/i18n": "^5.
|
|
46
|
-
"@wordpress/icons": "^10.
|
|
47
|
-
"@wordpress/notices": "^5.
|
|
48
|
-
"@wordpress/private-apis": "^1.
|
|
49
|
-
"@wordpress/url": "^4.
|
|
36
|
+
"@wordpress/a11y": "^4.26.0",
|
|
37
|
+
"@wordpress/block-editor": "^14.21.0",
|
|
38
|
+
"@wordpress/blocks": "^14.15.0",
|
|
39
|
+
"@wordpress/components": "^29.12.0",
|
|
40
|
+
"@wordpress/compose": "^7.26.0",
|
|
41
|
+
"@wordpress/core-data": "^7.26.0",
|
|
42
|
+
"@wordpress/data": "^10.26.0",
|
|
43
|
+
"@wordpress/element": "^6.26.0",
|
|
44
|
+
"@wordpress/html-entities": "^4.26.0",
|
|
45
|
+
"@wordpress/i18n": "^5.26.0",
|
|
46
|
+
"@wordpress/icons": "^10.26.0",
|
|
47
|
+
"@wordpress/notices": "^5.26.0",
|
|
48
|
+
"@wordpress/private-apis": "^1.26.0",
|
|
49
|
+
"@wordpress/url": "^4.26.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^18.0.0",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "35e26942820d8237771af0c58e45b4303f0497f1"
|
|
59
59
|
}
|
|
@@ -18,8 +18,7 @@ import { unlock } from '../lock-unlock';
|
|
|
18
18
|
function PatternsManageButton( { clientId } ) {
|
|
19
19
|
const { canRemove, isVisible, managePatternsUrl } = useSelect(
|
|
20
20
|
( select ) => {
|
|
21
|
-
const { getBlock, canRemoveBlock
|
|
22
|
-
select( blockEditorStore );
|
|
21
|
+
const { getBlock, canRemoveBlock } = select( blockEditorStore );
|
|
23
22
|
const { canUser } = select( coreStore );
|
|
24
23
|
const reusableBlock = getBlock( clientId );
|
|
25
24
|
|
|
@@ -33,7 +32,6 @@ function PatternsManageButton( { clientId } ) {
|
|
|
33
32
|
name: 'wp_block',
|
|
34
33
|
id: reusableBlock.attributes.ref,
|
|
35
34
|
} ),
|
|
36
|
-
innerBlockCount: getBlockCount( clientId ),
|
|
37
35
|
// The site editor and templates both check whether the user
|
|
38
36
|
// has edit_theme_options capabilities. We can leverage that here
|
|
39
37
|
// and omit the manage patterns link if the user can't access it.
|