@wordpress/reusable-blocks 3.20.0 → 4.1.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/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js +7 -4
- package/build/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js.map +1 -1
- package/build-module/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js +7 -4
- package/build-module/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js.map +1 -1
- package/build-style/style-rtl.css +17 -3
- package/build-style/style.css +17 -3
- package/package.json +14 -14
- package/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js +7 -3
- package/src/store/test/actions.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 4.1.0 (2023-01-02)
|
|
6
|
+
|
|
7
|
+
## 4.0.0 (2022-12-14)
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies to require React 18 ([45235](https://github.com/WordPress/gutenberg/pull/45235))
|
|
12
|
+
|
|
5
13
|
## 3.20.0 (2022-11-16)
|
|
6
14
|
|
|
7
15
|
## 3.19.0 (2022-11-02)
|
|
@@ -36,11 +36,13 @@ function ReusableBlocksManageButton(_ref) {
|
|
|
36
36
|
} = _ref;
|
|
37
37
|
const {
|
|
38
38
|
canRemove,
|
|
39
|
-
isVisible
|
|
39
|
+
isVisible,
|
|
40
|
+
innerBlockCount
|
|
40
41
|
} = (0, _data.useSelect)(select => {
|
|
41
42
|
const {
|
|
42
43
|
getBlock,
|
|
43
|
-
canRemoveBlock
|
|
44
|
+
canRemoveBlock,
|
|
45
|
+
getBlockCount
|
|
44
46
|
} = select(_blockEditor.store);
|
|
45
47
|
const {
|
|
46
48
|
canUser
|
|
@@ -48,7 +50,8 @@ function ReusableBlocksManageButton(_ref) {
|
|
|
48
50
|
const reusableBlock = getBlock(clientId);
|
|
49
51
|
return {
|
|
50
52
|
canRemove: canRemoveBlock(clientId),
|
|
51
|
-
isVisible: !!reusableBlock && (0, _blocks.isReusableBlock)(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref)
|
|
53
|
+
isVisible: !!reusableBlock && (0, _blocks.isReusableBlock)(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref),
|
|
54
|
+
innerBlockCount: getBlockCount(clientId)
|
|
52
55
|
};
|
|
53
56
|
}, [clientId]);
|
|
54
57
|
const {
|
|
@@ -65,7 +68,7 @@ function ReusableBlocksManageButton(_ref) {
|
|
|
65
68
|
})
|
|
66
69
|
}, (0, _i18n.__)('Manage Reusable blocks')), canRemove && (0, _element.createElement)(_components.MenuItem, {
|
|
67
70
|
onClick: () => convertBlockToStatic(clientId)
|
|
68
|
-
}, (0, _i18n.__)('Convert to regular blocks')));
|
|
71
|
+
}, innerBlockCount > 1 ? (0, _i18n.__)('Convert to regular blocks') : (0, _i18n.__)('Convert to regular block')));
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
var _default = ReusableBlocksManageButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js"],"names":["ReusableBlocksManageButton","clientId","canRemove","isVisible","select","getBlock","canRemoveBlock","blockEditorStore","canUser","coreStore","reusableBlock","attributes","ref","__experimentalConvertBlockToStatic","convertBlockToStatic","reusableBlocksStore","post_type"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAGA,SAASA,0BAAT,OAAoD;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js"],"names":["ReusableBlocksManageButton","clientId","canRemove","isVisible","innerBlockCount","select","getBlock","canRemoveBlock","getBlockCount","blockEditorStore","canUser","coreStore","reusableBlock","attributes","ref","__experimentalConvertBlockToStatic","convertBlockToStatic","reusableBlocksStore","post_type"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAGA,SAASA,0BAAT,OAAoD;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwBC,IAAAA;AAAxB,MAA4C,qBAC/CC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,cAAZ;AAA4BC,MAAAA;AAA5B,QACLH,MAAM,CAAEI,kBAAF,CADP;AAEA,UAAM;AAAEC,MAAAA;AAAF,QAAcL,MAAM,CAAEM,eAAF,CAA1B;AACA,UAAMC,aAAa,GAAGN,QAAQ,CAAEL,QAAF,CAA9B;AAEA,WAAO;AACNC,MAAAA,SAAS,EAAEK,cAAc,CAAEN,QAAF,CADnB;AAENE,MAAAA,SAAS,EACR,CAAC,CAAES,aAAH,IACA,6BAAiBA,aAAjB,CADA,IAEA,CAAC,CAAEF,OAAO,CACT,QADS,EAET,QAFS,EAGTE,aAAa,CAACC,UAAd,CAAyBC,GAHhB,CALL;AAUNV,MAAAA,eAAe,EAAEI,aAAa,CAAEP,QAAF;AAVxB,KAAP;AAYA,GAnBgD,EAoBjD,CAAEA,QAAF,CApBiD,CAAlD;AAuBA,QAAM;AAAEc,IAAAA,kCAAkC,EAAEC;AAAtC,MACL,uBAAaC,YAAb,CADD;;AAGA,MAAK,CAAEd,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,sCAAD,QACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,uBAAc,UAAd,EAA0B;AAAEe,MAAAA,SAAS,EAAE;AAAb,KAA1B;AADR,KAGG,cAAI,wBAAJ,CAHH,CADD,EAMGhB,SAAS,IACV,4BAAC,oBAAD;AAAU,IAAA,OAAO,EAAG,MAAMc,oBAAoB,CAAEf,QAAF;AAA9C,KACGG,eAAe,GAAG,CAAlB,GACC,cAAI,2BAAJ,CADD,GAEC,cAAI,0BAAJ,CAHJ,CAPF,CADD;AAgBA;;eAEcJ,0B","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 {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} 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 reusableBlocksStore } from '../../store';\n\nfunction ReusableBlocksManageButton( { clientId } ) {\n\tconst { canRemove, isVisible, innerBlockCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, canRemoveBlock, getBlockCount } =\n\t\t\t\tselect( 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(\n\t\t\t\t\t\t'update',\n\t\t\t\t\t\t'blocks',\n\t\t\t\t\t\treusableBlock.attributes.ref\n\t\t\t\t\t),\n\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __experimentalConvertBlockToStatic: convertBlockToStatic } =\n\t\tuseDispatch( reusableBlocksStore );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t<MenuItem\n\t\t\t\thref={ addQueryArgs( 'edit.php', { post_type: 'wp_block' } ) }\n\t\t\t>\n\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t</MenuItem>\n\t\t\t{ canRemove && (\n\t\t\t\t<MenuItem onClick={ () => convertBlockToStatic( clientId ) }>\n\t\t\t\t\t{ innerBlockCount > 1\n\t\t\t\t\t\t? __( 'Convert to regular blocks' )\n\t\t\t\t\t\t: __( 'Convert to regular block' ) }\n\t\t\t\t</MenuItem>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nexport default ReusableBlocksManageButton;\n"]}
|
|
@@ -22,11 +22,13 @@ function ReusableBlocksManageButton(_ref) {
|
|
|
22
22
|
} = _ref;
|
|
23
23
|
const {
|
|
24
24
|
canRemove,
|
|
25
|
-
isVisible
|
|
25
|
+
isVisible,
|
|
26
|
+
innerBlockCount
|
|
26
27
|
} = useSelect(select => {
|
|
27
28
|
const {
|
|
28
29
|
getBlock,
|
|
29
|
-
canRemoveBlock
|
|
30
|
+
canRemoveBlock,
|
|
31
|
+
getBlockCount
|
|
30
32
|
} = select(blockEditorStore);
|
|
31
33
|
const {
|
|
32
34
|
canUser
|
|
@@ -34,7 +36,8 @@ function ReusableBlocksManageButton(_ref) {
|
|
|
34
36
|
const reusableBlock = getBlock(clientId);
|
|
35
37
|
return {
|
|
36
38
|
canRemove: canRemoveBlock(clientId),
|
|
37
|
-
isVisible: !!reusableBlock && isReusableBlock(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref)
|
|
39
|
+
isVisible: !!reusableBlock && isReusableBlock(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref),
|
|
40
|
+
innerBlockCount: getBlockCount(clientId)
|
|
38
41
|
};
|
|
39
42
|
}, [clientId]);
|
|
40
43
|
const {
|
|
@@ -51,7 +54,7 @@ function ReusableBlocksManageButton(_ref) {
|
|
|
51
54
|
})
|
|
52
55
|
}, __('Manage Reusable blocks')), canRemove && createElement(MenuItem, {
|
|
53
56
|
onClick: () => convertBlockToStatic(clientId)
|
|
54
|
-
}, __('Convert to regular blocks')));
|
|
57
|
+
}, innerBlockCount > 1 ? __('Convert to regular blocks') : __('Convert to regular block')));
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
export default ReusableBlocksManageButton;
|
package/build-module/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js"],"names":["MenuItem","__","isReusableBlock","useSelect","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","addQueryArgs","coreStore","reusableBlocksStore","ReusableBlocksManageButton","clientId","canRemove","isVisible","select","getBlock","canRemoveBlock","canUser","reusableBlock","attributes","ref","__experimentalConvertBlockToStatic","convertBlockToStatic","post_type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,mBAAlB,QAA6C,aAA7C;;AAEA,SAASC,0BAAT,OAAoD;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js"],"names":["MenuItem","__","isReusableBlock","useSelect","useDispatch","BlockSettingsMenuControls","store","blockEditorStore","addQueryArgs","coreStore","reusableBlocksStore","ReusableBlocksManageButton","clientId","canRemove","isVisible","innerBlockCount","select","getBlock","canRemoveBlock","getBlockCount","canUser","reusableBlock","attributes","ref","__experimentalConvertBlockToStatic","convertBlockToStatic","post_type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,mBAAlB,QAA6C,aAA7C;;AAEA,SAASC,0BAAT,OAAoD;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwBC,IAAAA;AAAxB,MAA4CZ,SAAS,CACxDa,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,cAAZ;AAA4BC,MAAAA;AAA5B,QACLH,MAAM,CAAET,gBAAF,CADP;AAEA,UAAM;AAAEa,MAAAA;AAAF,QAAcJ,MAAM,CAAEP,SAAF,CAA1B;AACA,UAAMY,aAAa,GAAGJ,QAAQ,CAAEL,QAAF,CAA9B;AAEA,WAAO;AACNC,MAAAA,SAAS,EAAEK,cAAc,CAAEN,QAAF,CADnB;AAENE,MAAAA,SAAS,EACR,CAAC,CAAEO,aAAH,IACAnB,eAAe,CAAEmB,aAAF,CADf,IAEA,CAAC,CAAED,OAAO,CACT,QADS,EAET,QAFS,EAGTC,aAAa,CAACC,UAAd,CAAyBC,GAHhB,CALL;AAUNR,MAAAA,eAAe,EAAEI,aAAa,CAAEP,QAAF;AAVxB,KAAP;AAYA,GAnByD,EAoB1D,CAAEA,QAAF,CApB0D,CAA3D;AAuBA,QAAM;AAAEY,IAAAA,kCAAkC,EAAEC;AAAtC,MACLrB,WAAW,CAAEM,mBAAF,CADZ;;AAGA,MAAK,CAAEI,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,yBAAD,QACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAGN,YAAY,CAAE,UAAF,EAAc;AAAEkB,MAAAA,SAAS,EAAE;AAAb,KAAd;AADpB,KAGGzB,EAAE,CAAE,wBAAF,CAHL,CADD,EAMGY,SAAS,IACV,cAAC,QAAD;AAAU,IAAA,OAAO,EAAG,MAAMY,oBAAoB,CAAEb,QAAF;AAA9C,KACGG,eAAe,GAAG,CAAlB,GACCd,EAAE,CAAE,2BAAF,CADH,GAECA,EAAE,CAAE,0BAAF,CAHN,CAPF,CADD;AAgBA;;AAED,eAAeU,0BAAf","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 {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} 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 reusableBlocksStore } from '../../store';\n\nfunction ReusableBlocksManageButton( { clientId } ) {\n\tconst { canRemove, isVisible, innerBlockCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, canRemoveBlock, getBlockCount } =\n\t\t\t\tselect( 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(\n\t\t\t\t\t\t'update',\n\t\t\t\t\t\t'blocks',\n\t\t\t\t\t\treusableBlock.attributes.ref\n\t\t\t\t\t),\n\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __experimentalConvertBlockToStatic: convertBlockToStatic } =\n\t\tuseDispatch( reusableBlocksStore );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t<MenuItem\n\t\t\t\thref={ addQueryArgs( 'edit.php', { post_type: 'wp_block' } ) }\n\t\t\t>\n\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t</MenuItem>\n\t\t\t{ canRemove && (\n\t\t\t\t<MenuItem onClick={ () => convertBlockToStatic( clientId ) }>\n\t\t\t\t\t{ innerBlockCount > 1\n\t\t\t\t\t\t? __( 'Convert to regular blocks' )\n\t\t\t\t\t\t: __( 'Convert to regular block' ) }\n\t\t\t\t</MenuItem>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nexport default ReusableBlocksManageButton;\n"]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a hex value into the rgb equivalent.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
5
|
+
* @return {string} comma separated rgb values
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Colors
|
|
3
9
|
*/
|
|
@@ -11,6 +17,12 @@
|
|
|
11
17
|
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
18
|
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* Converts a hex value into the rgb equivalent.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
24
|
+
* @return {string} comma separated rgb values
|
|
25
|
+
*/
|
|
14
26
|
/**
|
|
15
27
|
* Colors
|
|
16
28
|
*/
|
|
@@ -46,15 +58,15 @@
|
|
|
46
58
|
* @param {string} hex - the hexadecimal value to convert
|
|
47
59
|
* @return {string} comma separated rgb values
|
|
48
60
|
*/
|
|
49
|
-
/**
|
|
50
|
-
* Breakpoint mixins
|
|
51
|
-
*/
|
|
52
61
|
/**
|
|
53
62
|
* Long content fade mixin
|
|
54
63
|
*
|
|
55
64
|
* Creates a fading overlay to signify that the content is longer
|
|
56
65
|
* than the space allows.
|
|
57
66
|
*/
|
|
67
|
+
/**
|
|
68
|
+
* Breakpoint mixins
|
|
69
|
+
*/
|
|
58
70
|
/**
|
|
59
71
|
* Focus styles.
|
|
60
72
|
*/
|
|
@@ -82,6 +94,8 @@
|
|
|
82
94
|
--wp-admin-theme-color-darker-20: #005a87;
|
|
83
95
|
--wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
|
|
84
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
|
+
--wp-block-synced-color: #7a00df;
|
|
98
|
+
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
85
99
|
}
|
|
86
100
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
87
101
|
:root {
|
package/build-style/style.css
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a hex value into the rgb equivalent.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
5
|
+
* @return {string} comma separated rgb values
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Colors
|
|
3
9
|
*/
|
|
@@ -11,6 +17,12 @@
|
|
|
11
17
|
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
18
|
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* Converts a hex value into the rgb equivalent.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
24
|
+
* @return {string} comma separated rgb values
|
|
25
|
+
*/
|
|
14
26
|
/**
|
|
15
27
|
* Colors
|
|
16
28
|
*/
|
|
@@ -46,15 +58,15 @@
|
|
|
46
58
|
* @param {string} hex - the hexadecimal value to convert
|
|
47
59
|
* @return {string} comma separated rgb values
|
|
48
60
|
*/
|
|
49
|
-
/**
|
|
50
|
-
* Breakpoint mixins
|
|
51
|
-
*/
|
|
52
61
|
/**
|
|
53
62
|
* Long content fade mixin
|
|
54
63
|
*
|
|
55
64
|
* Creates a fading overlay to signify that the content is longer
|
|
56
65
|
* than the space allows.
|
|
57
66
|
*/
|
|
67
|
+
/**
|
|
68
|
+
* Breakpoint mixins
|
|
69
|
+
*/
|
|
58
70
|
/**
|
|
59
71
|
* Focus styles.
|
|
60
72
|
*/
|
|
@@ -82,6 +94,8 @@
|
|
|
82
94
|
--wp-admin-theme-color-darker-20: #005a87;
|
|
83
95
|
--wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
|
|
84
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
|
+
--wp-block-synced-color: #7a00df;
|
|
98
|
+
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
85
99
|
}
|
|
86
100
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
87
101
|
:root {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/reusable-blocks",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Reusable blocks utilities.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -28,23 +28,23 @@
|
|
|
28
28
|
"{src,build,build-module}/{index.js,store/index.js}"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@wordpress/block-editor": "^
|
|
32
|
-
"@wordpress/blocks": "^
|
|
33
|
-
"@wordpress/components": "^
|
|
34
|
-
"@wordpress/core-data": "^
|
|
35
|
-
"@wordpress/data": "^
|
|
36
|
-
"@wordpress/element": "^
|
|
37
|
-
"@wordpress/i18n": "^4.
|
|
38
|
-
"@wordpress/icons": "^9.
|
|
39
|
-
"@wordpress/notices": "^3.
|
|
40
|
-
"@wordpress/url": "^3.
|
|
31
|
+
"@wordpress/block-editor": "^11.1.0",
|
|
32
|
+
"@wordpress/blocks": "^12.1.0",
|
|
33
|
+
"@wordpress/components": "^23.1.0",
|
|
34
|
+
"@wordpress/core-data": "^6.1.0",
|
|
35
|
+
"@wordpress/data": "^8.1.0",
|
|
36
|
+
"@wordpress/element": "^5.1.0",
|
|
37
|
+
"@wordpress/i18n": "^4.24.0",
|
|
38
|
+
"@wordpress/icons": "^9.15.0",
|
|
39
|
+
"@wordpress/notices": "^3.24.0",
|
|
40
|
+
"@wordpress/url": "^3.25.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"react": "^
|
|
44
|
-
"react-dom": "^
|
|
43
|
+
"react": "^18.0.0",
|
|
44
|
+
"react-dom": "^18.0.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "200bee7b06b15f6fa655e25b6ab69cbd6b49a357"
|
|
50
50
|
}
|
|
@@ -18,9 +18,10 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
18
18
|
import { store as reusableBlocksStore } from '../../store';
|
|
19
19
|
|
|
20
20
|
function ReusableBlocksManageButton( { clientId } ) {
|
|
21
|
-
const { canRemove, isVisible } = useSelect(
|
|
21
|
+
const { canRemove, isVisible, innerBlockCount } = useSelect(
|
|
22
22
|
( select ) => {
|
|
23
|
-
const { getBlock, canRemoveBlock } =
|
|
23
|
+
const { getBlock, canRemoveBlock, getBlockCount } =
|
|
24
|
+
select( blockEditorStore );
|
|
24
25
|
const { canUser } = select( coreStore );
|
|
25
26
|
const reusableBlock = getBlock( clientId );
|
|
26
27
|
|
|
@@ -34,6 +35,7 @@ function ReusableBlocksManageButton( { clientId } ) {
|
|
|
34
35
|
'blocks',
|
|
35
36
|
reusableBlock.attributes.ref
|
|
36
37
|
),
|
|
38
|
+
innerBlockCount: getBlockCount( clientId ),
|
|
37
39
|
};
|
|
38
40
|
},
|
|
39
41
|
[ clientId ]
|
|
@@ -55,7 +57,9 @@ function ReusableBlocksManageButton( { clientId } ) {
|
|
|
55
57
|
</MenuItem>
|
|
56
58
|
{ canRemove && (
|
|
57
59
|
<MenuItem onClick={ () => convertBlockToStatic( clientId ) }>
|
|
58
|
-
{
|
|
60
|
+
{ innerBlockCount > 1
|
|
61
|
+
? __( 'Convert to regular blocks' )
|
|
62
|
+
: __( 'Convert to regular block' ) }
|
|
59
63
|
</MenuItem>
|
|
60
64
|
) }
|
|
61
65
|
</BlockSettingsMenuControls>
|
|
@@ -178,9 +178,7 @@ describe( 'Actions', () => {
|
|
|
178
178
|
|
|
179
179
|
await registry
|
|
180
180
|
.dispatch( reusableBlocksStore )
|
|
181
|
-
.__experimentalConvertBlockToStatic(
|
|
182
|
-
associatedBlock.clientId,
|
|
183
|
-
] );
|
|
181
|
+
.__experimentalConvertBlockToStatic( associatedBlock.clientId );
|
|
184
182
|
|
|
185
183
|
// Check that blocks were converted to reusable.
|
|
186
184
|
const updatedBlocks = registry
|