@wordpress/reusable-blocks 5.37.0 → 5.37.1-next.06ee73755.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 +0 -2
- package/LICENSE.md +1 -1
- package/build/components/{index.js → index.cjs} +2 -2
- package/build/components/reusable-blocks-menu-items/{index.js → index.cjs} +3 -3
- package/build/components/reusable-blocks-menu-items/{reusable-block-convert-button.js → reusable-block-convert-button.cjs} +2 -4
- package/build/components/reusable-blocks-menu-items/{reusable-block-convert-button.js.map → reusable-block-convert-button.cjs.map} +2 -2
- package/build/components/reusable-blocks-menu-items/{reusable-blocks-manage-button.js → reusable-blocks-manage-button.cjs} +2 -2
- package/build/{index.js → index.cjs} +4 -4
- package/build/{index.js.map → index.cjs.map} +1 -1
- package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
- package/build/store/{actions.js → actions.cjs} +1 -1
- package/build/store/{index.js → index.cjs} +4 -4
- package/build/store/{reducer.js → reducer.cjs} +1 -1
- package/build/store/{selectors.js → selectors.cjs} +1 -1
- package/build-module/components/{index.js → index.mjs} +2 -2
- package/build-module/components/reusable-blocks-menu-items/{index.js → index.mjs} +3 -3
- package/build-module/components/reusable-blocks-menu-items/{reusable-block-convert-button.js → reusable-block-convert-button.mjs} +2 -4
- package/build-module/components/reusable-blocks-menu-items/{reusable-block-convert-button.js.map → reusable-block-convert-button.mjs.map} +2 -2
- package/build-module/components/reusable-blocks-menu-items/{reusable-blocks-manage-button.js → reusable-blocks-manage-button.mjs} +2 -2
- package/build-module/index.mjs +7 -0
- package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
- package/build-module/store/{actions.js → actions.mjs} +1 -1
- package/build-module/store/{index.js → index.mjs} +4 -4
- package/build-module/store/{reducer.js → reducer.mjs} +1 -1
- package/build-module/store/{selectors.js → selectors.mjs} +1 -1
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +4 -0
- package/package.json +30 -22
- package/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js +0 -2
- package/build-module/index.js +0 -7
- /package/build/components/{index.js.map → index.cjs.map} +0 -0
- /package/build/components/reusable-blocks-menu-items/{index.js.map → index.cjs.map} +0 -0
- /package/build/components/reusable-blocks-menu-items/{reusable-blocks-manage-button.js.map → reusable-blocks-manage-button.cjs.map} +0 -0
- /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
- /package/build/store/{actions.js.map → actions.cjs.map} +0 -0
- /package/build/store/{index.js.map → index.cjs.map} +0 -0
- /package/build/store/{reducer.js.map → reducer.cjs.map} +0 -0
- /package/build/store/{selectors.js.map → selectors.cjs.map} +0 -0
- /package/build-module/components/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/reusable-blocks-menu-items/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/reusable-blocks-menu-items/{reusable-blocks-manage-button.js.map → reusable-blocks-manage-button.mjs.map} +0 -0
- /package/build-module/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
- /package/build-module/store/{actions.js.map → actions.mjs.map} +0 -0
- /package/build-module/store/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/store/{reducer.js.map → reducer.mjs.map} +0 -0
- /package/build-module/store/{selectors.js.map → selectors.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
package/LICENSE.md
CHANGED
|
@@ -32,9 +32,9 @@ __export(components_exports, {
|
|
|
32
32
|
ReusableBlocksMenuItems: () => import_reusable_blocks_menu_items.default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(components_exports);
|
|
35
|
-
var import_reusable_blocks_menu_items = __toESM(require("./reusable-blocks-menu-items"));
|
|
35
|
+
var import_reusable_blocks_menu_items = __toESM(require("./reusable-blocks-menu-items/index.cjs"));
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
38
38
|
ReusableBlocksMenuItems
|
|
39
39
|
});
|
|
40
|
-
//# sourceMappingURL=index.
|
|
40
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -33,8 +33,8 @@ __export(reusable_blocks_menu_items_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(reusable_blocks_menu_items_exports);
|
|
35
35
|
var import_block_editor = require("@wordpress/block-editor");
|
|
36
|
-
var import_reusable_block_convert_button = __toESM(require("./reusable-block-convert-button"));
|
|
37
|
-
var import_reusable_blocks_manage_button = __toESM(require("./reusable-blocks-manage-button"));
|
|
36
|
+
var import_reusable_block_convert_button = __toESM(require("./reusable-block-convert-button.cjs"));
|
|
37
|
+
var import_reusable_blocks_manage_button = __toESM(require("./reusable-blocks-manage-button.cjs"));
|
|
38
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
39
|
function ReusableBlocksMenuItems({ rootClientId }) {
|
|
40
40
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockSettingsMenuControls, { children: ({ onClose, selectedClientIds }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -54,4 +54,4 @@ function ReusableBlocksMenuItems({ rootClientId }) {
|
|
|
54
54
|
)
|
|
55
55
|
] }) });
|
|
56
56
|
}
|
|
57
|
-
//# sourceMappingURL=index.
|
|
57
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -31,7 +31,7 @@ var import_data = require("@wordpress/data");
|
|
|
31
31
|
var import_i18n = require("@wordpress/i18n");
|
|
32
32
|
var import_notices = require("@wordpress/notices");
|
|
33
33
|
var import_core_data = require("@wordpress/core-data");
|
|
34
|
-
var import_store = require("../../store");
|
|
34
|
+
var import_store = require("../../store/index.cjs");
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
function ReusableBlockConvertButton({
|
|
37
37
|
clientIds,
|
|
@@ -146,7 +146,6 @@ function ReusableBlockConvertButton({
|
|
|
146
146
|
import_components.TextControl,
|
|
147
147
|
{
|
|
148
148
|
__next40pxDefaultSize: true,
|
|
149
|
-
__nextHasNoMarginBottom: true,
|
|
150
149
|
label: (0, import_i18n.__)("Name"),
|
|
151
150
|
value: title,
|
|
152
151
|
onChange: setTitle,
|
|
@@ -156,7 +155,6 @@ function ReusableBlockConvertButton({
|
|
|
156
155
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
156
|
import_components.ToggleControl,
|
|
158
157
|
{
|
|
159
|
-
__nextHasNoMarginBottom: true,
|
|
160
158
|
label: (0, import_i18n._x)("Synced", "pattern (singular)"),
|
|
161
159
|
help: (0, import_i18n.__)(
|
|
162
160
|
"Sync this pattern across multiple locations."
|
|
@@ -199,4 +197,4 @@ function ReusableBlockConvertButton({
|
|
|
199
197
|
)
|
|
200
198
|
] });
|
|
201
199
|
}
|
|
202
|
-
//# sourceMappingURL=reusable-block-convert-button.
|
|
200
|
+
//# sourceMappingURL=reusable-block-convert-button.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/reusable-blocks-menu-items/reusable-block-convert-button.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, isReusableBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tMenuItem,\n\tModal,\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { symbol } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store } from '../../store';\n\n/**\n * Menu control to convert block(s) to reusable block.\n *\n * @param {Object} props Component props.\n * @param {string[]} props.clientIds Client ids of selected blocks.\n * @param {string} props.rootClientId ID of the currently selected top-level block.\n * @param {()=>void} props.onClose Callback to close the menu.\n * @return {import('react').ComponentType} The menu control or null.\n */\nexport default function ReusableBlockConvertButton( {\n\tclientIds,\n\trootClientId,\n\tonClose,\n} ) {\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst canConvert = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootId =\n\t\t\t\trootClientId ||\n\t\t\t\t( clientIds.length > 0\n\t\t\t\t\t? getBlockRootClientId( clientIds[ 0 ] )\n\t\t\t\t\t: undefined );\n\n\t\t\tconst blocks = getBlocksByClientId( clientIds ) ?? [];\n\n\t\t\tconst isReusable =\n\t\t\t\tblocks.length === 1 &&\n\t\t\t\tblocks[ 0 ] &&\n\t\t\t\tisReusableBlock( blocks[ 0 ] ) &&\n\t\t\t\t!! select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tblocks[ 0 ].attributes.ref\n\t\t\t\t);\n\n\t\t\tconst _canConvert =\n\t\t\t\t// Hide when this is already a reusable block.\n\t\t\t\t! isReusable &&\n\t\t\t\t// Hide when reusable blocks are disabled.\n\t\t\t\tcanInsertBlockType( 'core/block', rootId ) &&\n\t\t\t\tblocks.every(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\t// Guard against the case where a regular block has *just* been converted.\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\t// Hide on invalid blocks.\n\t\t\t\t\t\tblock.isValid &&\n\t\t\t\t\t\t// Hide when block doesn't support being made reusable.\n\t\t\t\t\t\thasBlockSupport( block.name, 'reusable', true )\n\t\t\t\t) &&\n\t\t\t\t// Hide when current doesn't have permission to do that.\n\t\t\t\t// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.\n\t\t\t\t!! canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t} );\n\n\t\t\treturn _canConvert;\n\t\t},\n\t\t[ clientIds, rootClientId ]\n\t);\n\n\tconst { __experimentalConvertBlocksToReusable: convertBlocksToReusable } =\n\t\tuseDispatch( store );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst onConvert = useCallback(\n\t\tasync function ( reusableBlockTitle ) {\n\t\t\ttry {\n\t\t\t\tawait convertBlocksToReusable(\n\t\t\t\t\tclientIds,\n\t\t\t\t\treusableBlockTitle,\n\t\t\t\t\tsyncType\n\t\t\t\t);\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t! syncType\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Synced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Unsynced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'convert-to-reusable-block-success',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'convert-to-reusable-block-error',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tconvertBlocksToReusable,\n\t\t\tclientIds,\n\t\t\tsyncType,\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t]\n\t);\n\n\tif ( ! canConvert ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem icon={ symbol } onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Create pattern' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonConvert( title );\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAiD;AACjD,0BAA0C;AAC1C,qBAAsC;AACtC,wBAQO;AACP,mBAAuB;AACvB,kBAAuC;AACvC,kBAAgC;AAChC,qBAAsC;AACtC,uBAAmC;AAKnC,mBAAsB;AA2HpB;AAhHa,SAAR,2BAA6C;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,UAAU,WAAY,QAAI,yBAAU,MAAU;AACtD,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,KAAM;AACxD,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAU,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B;AAAA,YACnC;AAAA,UACA;AAAA,UACH;AAAA,YACC,MAAM;AAAA,YACN,IAAI;AAAA,UACL;AAAA,QACD;AAAA,MACD,SAAU,OAAQ;AACjB,0BAAmB,MAAM,SAAS;AAAA,UACjC,MAAM;AAAA,UACN,IAAI;AAAA,QACL,CAAE;AAAA,MACH;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,MAAK,CAAE,YAAa;AACnB,WAAO;AAAA,EACR;AAEA,SACC,4EACC;AAAA,gDAAC,8BAAS,MAAO,qBAAS,SAAU,MAAM,eAAgB,IAAK,GAC5D,8BAAI,gBAAiB,GACxB;AAAA,IACE,eACD;AAAA,MAAC;AAAA;AAAA,QACA,WAAQ,gBAAI,gBAAiB;AAAA,QAC7B,gBAAiB,MAAM;AACtB,yBAAgB,KAAM;AACtB,mBAAU,EAAG;AAAA,QACd;AAAA,QACA,kBAAiB;AAAA,QAEjB;AAAA,UAAC;AAAA;AAAA,YACA,UAAW,CAAE,UAAW;AACvB,oBAAM,eAAe;AACrB,wBAAW,KAAM;AACjB,6BAAgB,KAAM;AACtB,uBAAU,EAAG;AACb,sBAAQ;AAAA,YACT;AAAA,YAEA,uDAAC,kBAAAC,sBAAA,EAAO,SAAQ,KACf;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, isReusableBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tMenuItem,\n\tModal,\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { symbol } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store } from '../../store';\n\n/**\n * Menu control to convert block(s) to reusable block.\n *\n * @param {Object} props Component props.\n * @param {string[]} props.clientIds Client ids of selected blocks.\n * @param {string} props.rootClientId ID of the currently selected top-level block.\n * @param {()=>void} props.onClose Callback to close the menu.\n * @return {import('react').ComponentType} The menu control or null.\n */\nexport default function ReusableBlockConvertButton( {\n\tclientIds,\n\trootClientId,\n\tonClose,\n} ) {\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst canConvert = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootId =\n\t\t\t\trootClientId ||\n\t\t\t\t( clientIds.length > 0\n\t\t\t\t\t? getBlockRootClientId( clientIds[ 0 ] )\n\t\t\t\t\t: undefined );\n\n\t\t\tconst blocks = getBlocksByClientId( clientIds ) ?? [];\n\n\t\t\tconst isReusable =\n\t\t\t\tblocks.length === 1 &&\n\t\t\t\tblocks[ 0 ] &&\n\t\t\t\tisReusableBlock( blocks[ 0 ] ) &&\n\t\t\t\t!! select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tblocks[ 0 ].attributes.ref\n\t\t\t\t);\n\n\t\t\tconst _canConvert =\n\t\t\t\t// Hide when this is already a reusable block.\n\t\t\t\t! isReusable &&\n\t\t\t\t// Hide when reusable blocks are disabled.\n\t\t\t\tcanInsertBlockType( 'core/block', rootId ) &&\n\t\t\t\tblocks.every(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\t// Guard against the case where a regular block has *just* been converted.\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\t// Hide on invalid blocks.\n\t\t\t\t\t\tblock.isValid &&\n\t\t\t\t\t\t// Hide when block doesn't support being made reusable.\n\t\t\t\t\t\thasBlockSupport( block.name, 'reusable', true )\n\t\t\t\t) &&\n\t\t\t\t// Hide when current doesn't have permission to do that.\n\t\t\t\t// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.\n\t\t\t\t!! canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t} );\n\n\t\t\treturn _canConvert;\n\t\t},\n\t\t[ clientIds, rootClientId ]\n\t);\n\n\tconst { __experimentalConvertBlocksToReusable: convertBlocksToReusable } =\n\t\tuseDispatch( store );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst onConvert = useCallback(\n\t\tasync function ( reusableBlockTitle ) {\n\t\t\ttry {\n\t\t\t\tawait convertBlocksToReusable(\n\t\t\t\t\tclientIds,\n\t\t\t\t\treusableBlockTitle,\n\t\t\t\t\tsyncType\n\t\t\t\t);\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t! syncType\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Synced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Unsynced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'convert-to-reusable-block-success',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'convert-to-reusable-block-error',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tconvertBlocksToReusable,\n\t\t\tclientIds,\n\t\t\tsyncType,\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t]\n\t);\n\n\tif ( ! canConvert ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem icon={ symbol } onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Create pattern' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonConvert( title );\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAiD;AACjD,0BAA0C;AAC1C,qBAAsC;AACtC,wBAQO;AACP,mBAAuB;AACvB,kBAAuC;AACvC,kBAAgC;AAChC,qBAAsC;AACtC,uBAAmC;AAKnC,mBAAsB;AA2HpB;AAhHa,SAAR,2BAA6C;AAA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,gBAAI,UAAU,oBAAqB;AAAA,kBAC3C,UAAO;AAAA,oBACN;AAAA,kBACD;AAAA,kBACA,SAAU,CAAE;AAAA,kBACZ,UAAW,MAAM;AAChB;AAAA,sBACC,CAAE,WAAW,aAAa;AAAA,oBAC3B;AAAA,kBACD;AAAA;AAAA,cACD;AAAA,cACA,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,SACf;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,uBAAqB;AAAA,oBACrB,SAAQ;AAAA,oBACR,SAAU,MAAM;AACf,qCAAgB,KAAM;AACtB,+BAAU,EAAG;AAAA,oBACd;AAAA,oBAEE,8BAAI,QAAS;AAAA;AAAA,gBAChB;AAAA,gBAEA;AAAA,kBAAC;AAAA;AAAA,oBACA,uBAAqB;AAAA,oBACrB,SAAQ;AAAA,oBACR,MAAK;AAAA,oBAEH,8BAAI,QAAS;AAAA;AAAA,gBAChB;AAAA,iBACD;AAAA,eACD;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": ["coreStore", "blockEditorStore", "noticesStore", "VStack", "HStack"]
|
|
7
7
|
}
|
|
@@ -29,7 +29,7 @@ var import_data = require("@wordpress/data");
|
|
|
29
29
|
var import_block_editor = require("@wordpress/block-editor");
|
|
30
30
|
var import_url = require("@wordpress/url");
|
|
31
31
|
var import_core_data = require("@wordpress/core-data");
|
|
32
|
-
var import_store = require("../../store");
|
|
32
|
+
var import_store = require("../../store/index.cjs");
|
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
34
|
function ReusableBlocksManageButton({ clientId }) {
|
|
35
35
|
const { canRemove, isVisible, managePatternsUrl } = (0, import_data.useSelect)(
|
|
@@ -69,4 +69,4 @@ function ReusableBlocksManageButton({ clientId }) {
|
|
|
69
69
|
] });
|
|
70
70
|
}
|
|
71
71
|
var reusable_blocks_manage_button_default = ReusableBlocksManageButton;
|
|
72
|
-
//# sourceMappingURL=reusable-blocks-manage-button.
|
|
72
|
+
//# sourceMappingURL=reusable-blocks-manage-button.cjs.map
|
|
@@ -23,11 +23,11 @@ __export(index_exports, {
|
|
|
23
23
|
store: () => import_store.store
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
var import_store = require("./store");
|
|
27
|
-
__reExport(index_exports, require("./components"), module.exports);
|
|
26
|
+
var import_store = require("./store/index.cjs");
|
|
27
|
+
__reExport(index_exports, require("./components/index.cjs"), module.exports);
|
|
28
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
29
|
0 && (module.exports = {
|
|
30
30
|
store,
|
|
31
|
-
...require("./components")
|
|
31
|
+
...require("./components/index.cjs")
|
|
32
32
|
});
|
|
33
|
-
//# sourceMappingURL=index.
|
|
33
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["export { store } from './store';\nexport * from './components';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,0BAAc,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,0BAAc,mCADd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,9 +33,9 @@ __export(store_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(store_exports);
|
|
35
35
|
var import_data = require("@wordpress/data");
|
|
36
|
-
var actions = __toESM(require("./actions"));
|
|
37
|
-
var import_reducer = __toESM(require("./reducer"));
|
|
38
|
-
var selectors = __toESM(require("./selectors"));
|
|
36
|
+
var actions = __toESM(require("./actions.cjs"));
|
|
37
|
+
var import_reducer = __toESM(require("./reducer.cjs"));
|
|
38
|
+
var selectors = __toESM(require("./selectors.cjs"));
|
|
39
39
|
var STORE_NAME = "core/reusable-blocks";
|
|
40
40
|
var store = (0, import_data.createReduxStore)(STORE_NAME, {
|
|
41
41
|
actions,
|
|
@@ -47,4 +47,4 @@ var store = (0, import_data.createReduxStore)(STORE_NAME, {
|
|
|
47
47
|
0 && (module.exports = {
|
|
48
48
|
store
|
|
49
49
|
});
|
|
50
|
-
//# sourceMappingURL=index.
|
|
50
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/reusable-blocks/src/components/index.js
|
|
2
|
-
import { default as default2 } from "./reusable-blocks-menu-items";
|
|
2
|
+
import { default as default2 } from "./reusable-blocks-menu-items/index.mjs";
|
|
3
3
|
export {
|
|
4
4
|
default2 as ReusableBlocksMenuItems
|
|
5
5
|
};
|
|
6
|
-
//# sourceMappingURL=index.
|
|
6
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/reusable-blocks/src/components/reusable-blocks-menu-items/index.js
|
|
2
2
|
import { BlockSettingsMenuControls } from "@wordpress/block-editor";
|
|
3
|
-
import ReusableBlockConvertButton from "./reusable-block-convert-button";
|
|
4
|
-
import ReusableBlocksManageButton from "./reusable-blocks-manage-button";
|
|
3
|
+
import ReusableBlockConvertButton from "./reusable-block-convert-button.mjs";
|
|
4
|
+
import ReusableBlocksManageButton from "./reusable-blocks-manage-button.mjs";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
function ReusableBlocksMenuItems({ rootClientId }) {
|
|
7
7
|
return /* @__PURE__ */ jsx(BlockSettingsMenuControls, { children: ({ onClose, selectedClientIds }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -24,4 +24,4 @@ function ReusableBlocksMenuItems({ rootClientId }) {
|
|
|
24
24
|
export {
|
|
25
25
|
ReusableBlocksMenuItems as default
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=index.
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -16,7 +16,7 @@ import { useDispatch, useSelect } from "@wordpress/data";
|
|
|
16
16
|
import { __, _x, sprintf } from "@wordpress/i18n";
|
|
17
17
|
import { store as noticesStore } from "@wordpress/notices";
|
|
18
18
|
import { store as coreStore } from "@wordpress/core-data";
|
|
19
|
-
import { store } from "../../store";
|
|
19
|
+
import { store } from "../../store/index.mjs";
|
|
20
20
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
21
|
function ReusableBlockConvertButton({
|
|
22
22
|
clientIds,
|
|
@@ -131,7 +131,6 @@ function ReusableBlockConvertButton({
|
|
|
131
131
|
TextControl,
|
|
132
132
|
{
|
|
133
133
|
__next40pxDefaultSize: true,
|
|
134
|
-
__nextHasNoMarginBottom: true,
|
|
135
134
|
label: __("Name"),
|
|
136
135
|
value: title,
|
|
137
136
|
onChange: setTitle,
|
|
@@ -141,7 +140,6 @@ function ReusableBlockConvertButton({
|
|
|
141
140
|
/* @__PURE__ */ jsx(
|
|
142
141
|
ToggleControl,
|
|
143
142
|
{
|
|
144
|
-
__nextHasNoMarginBottom: true,
|
|
145
143
|
label: _x("Synced", "pattern (singular)"),
|
|
146
144
|
help: __(
|
|
147
145
|
"Sync this pattern across multiple locations."
|
|
@@ -187,4 +185,4 @@ function ReusableBlockConvertButton({
|
|
|
187
185
|
export {
|
|
188
186
|
ReusableBlockConvertButton as default
|
|
189
187
|
};
|
|
190
|
-
//# sourceMappingURL=reusable-block-convert-button.
|
|
188
|
+
//# sourceMappingURL=reusable-block-convert-button.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/reusable-blocks-menu-items/reusable-block-convert-button.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, isReusableBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tMenuItem,\n\tModal,\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { symbol } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store } from '../../store';\n\n/**\n * Menu control to convert block(s) to reusable block.\n *\n * @param {Object} props Component props.\n * @param {string[]} props.clientIds Client ids of selected blocks.\n * @param {string} props.rootClientId ID of the currently selected top-level block.\n * @param {()=>void} props.onClose Callback to close the menu.\n * @return {import('react').ComponentType} The menu control or null.\n */\nexport default function ReusableBlockConvertButton( {\n\tclientIds,\n\trootClientId,\n\tonClose,\n} ) {\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst canConvert = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootId =\n\t\t\t\trootClientId ||\n\t\t\t\t( clientIds.length > 0\n\t\t\t\t\t? getBlockRootClientId( clientIds[ 0 ] )\n\t\t\t\t\t: undefined );\n\n\t\t\tconst blocks = getBlocksByClientId( clientIds ) ?? [];\n\n\t\t\tconst isReusable =\n\t\t\t\tblocks.length === 1 &&\n\t\t\t\tblocks[ 0 ] &&\n\t\t\t\tisReusableBlock( blocks[ 0 ] ) &&\n\t\t\t\t!! select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tblocks[ 0 ].attributes.ref\n\t\t\t\t);\n\n\t\t\tconst _canConvert =\n\t\t\t\t// Hide when this is already a reusable block.\n\t\t\t\t! isReusable &&\n\t\t\t\t// Hide when reusable blocks are disabled.\n\t\t\t\tcanInsertBlockType( 'core/block', rootId ) &&\n\t\t\t\tblocks.every(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\t// Guard against the case where a regular block has *just* been converted.\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\t// Hide on invalid blocks.\n\t\t\t\t\t\tblock.isValid &&\n\t\t\t\t\t\t// Hide when block doesn't support being made reusable.\n\t\t\t\t\t\thasBlockSupport( block.name, 'reusable', true )\n\t\t\t\t) &&\n\t\t\t\t// Hide when current doesn't have permission to do that.\n\t\t\t\t// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.\n\t\t\t\t!! canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t} );\n\n\t\t\treturn _canConvert;\n\t\t},\n\t\t[ clientIds, rootClientId ]\n\t);\n\n\tconst { __experimentalConvertBlocksToReusable: convertBlocksToReusable } =\n\t\tuseDispatch( store );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst onConvert = useCallback(\n\t\tasync function ( reusableBlockTitle ) {\n\t\t\ttry {\n\t\t\t\tawait convertBlocksToReusable(\n\t\t\t\t\tclientIds,\n\t\t\t\t\treusableBlockTitle,\n\t\t\t\t\tsyncType\n\t\t\t\t);\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t! syncType\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Synced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Unsynced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'convert-to-reusable-block-success',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'convert-to-reusable-block-error',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tconvertBlocksToReusable,\n\t\t\tclientIds,\n\t\t\tsyncType,\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t]\n\t);\n\n\tif ( ! canConvert ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem icon={ symbol } onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Create pattern' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonConvert( title );\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,aAAa,gBAAgB;AACtC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,cAAc;AACvB,SAAS,aAAa,iBAAiB;AACvC,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,SAAS,oBAAoB;AACtC,SAAS,SAAS,iBAAiB;AAKnC,SAAS,aAAa;AA2HpB,mBACC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, isReusableBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tMenuItem,\n\tModal,\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { symbol } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store } from '../../store';\n\n/**\n * Menu control to convert block(s) to reusable block.\n *\n * @param {Object} props Component props.\n * @param {string[]} props.clientIds Client ids of selected blocks.\n * @param {string} props.rootClientId ID of the currently selected top-level block.\n * @param {()=>void} props.onClose Callback to close the menu.\n * @return {import('react').ComponentType} The menu control or null.\n */\nexport default function ReusableBlockConvertButton( {\n\tclientIds,\n\trootClientId,\n\tonClose,\n} ) {\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst canConvert = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootId =\n\t\t\t\trootClientId ||\n\t\t\t\t( clientIds.length > 0\n\t\t\t\t\t? getBlockRootClientId( clientIds[ 0 ] )\n\t\t\t\t\t: undefined );\n\n\t\t\tconst blocks = getBlocksByClientId( clientIds ) ?? [];\n\n\t\t\tconst isReusable =\n\t\t\t\tblocks.length === 1 &&\n\t\t\t\tblocks[ 0 ] &&\n\t\t\t\tisReusableBlock( blocks[ 0 ] ) &&\n\t\t\t\t!! select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tblocks[ 0 ].attributes.ref\n\t\t\t\t);\n\n\t\t\tconst _canConvert =\n\t\t\t\t// Hide when this is already a reusable block.\n\t\t\t\t! isReusable &&\n\t\t\t\t// Hide when reusable blocks are disabled.\n\t\t\t\tcanInsertBlockType( 'core/block', rootId ) &&\n\t\t\t\tblocks.every(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\t// Guard against the case where a regular block has *just* been converted.\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\t// Hide on invalid blocks.\n\t\t\t\t\t\tblock.isValid &&\n\t\t\t\t\t\t// Hide when block doesn't support being made reusable.\n\t\t\t\t\t\thasBlockSupport( block.name, 'reusable', true )\n\t\t\t\t) &&\n\t\t\t\t// Hide when current doesn't have permission to do that.\n\t\t\t\t// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.\n\t\t\t\t!! canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t} );\n\n\t\t\treturn _canConvert;\n\t\t},\n\t\t[ clientIds, rootClientId ]\n\t);\n\n\tconst { __experimentalConvertBlocksToReusable: convertBlocksToReusable } =\n\t\tuseDispatch( store );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst onConvert = useCallback(\n\t\tasync function ( reusableBlockTitle ) {\n\t\t\ttry {\n\t\t\t\tawait convertBlocksToReusable(\n\t\t\t\t\tclientIds,\n\t\t\t\t\treusableBlockTitle,\n\t\t\t\t\tsyncType\n\t\t\t\t);\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t! syncType\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Synced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Unsynced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'convert-to-reusable-block-success',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'convert-to-reusable-block-error',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tconvertBlocksToReusable,\n\t\t\tclientIds,\n\t\t\tsyncType,\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t]\n\t);\n\n\tif ( ! canConvert ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem icon={ symbol } onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Create pattern' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonConvert( title );\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,aAAa,gBAAgB;AACtC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,cAAc;AACvB,SAAS,aAAa,iBAAiB;AACvC,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,SAAS,oBAAoB;AACtC,SAAS,SAAS,iBAAiB;AAKnC,SAAS,aAAa;AA2HpB,mBACC,KAyCI,YA1CL;AAhHa,SAAR,2BAA6C;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,UAAU,WAAY,IAAI,SAAU,MAAU;AACtD,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,KAAM;AACxD,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,EAAG;AACzC,QAAM,aAAa;AAAA,IAClB,CAAE,WAAY;AACb,YAAM,EAAE,QAAQ,IAAI,OAAQ,SAAU;AACtC,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,gBAAiB;AAE7B,YAAM,SACL,iBACE,UAAU,SAAS,IAClB,qBAAsB,UAAW,CAAE,CAAE,IAC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;AAAA,oBACR,MAAK;AAAA,oBAEH,aAAI,QAAS;AAAA;AAAA,gBAChB;AAAA,iBACD;AAAA,eACD;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ import { useSelect, useDispatch } from "@wordpress/data";
|
|
|
6
6
|
import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
7
7
|
import { addQueryArgs } from "@wordpress/url";
|
|
8
8
|
import { store as coreStore } from "@wordpress/core-data";
|
|
9
|
-
import { store as reusableBlocksStore } from "../../store";
|
|
9
|
+
import { store as reusableBlocksStore } from "../../store/index.mjs";
|
|
10
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
function ReusableBlocksManageButton({ clientId }) {
|
|
12
12
|
const { canRemove, isVisible, managePatternsUrl } = useSelect(
|
|
@@ -49,4 +49,4 @@ var reusable_blocks_manage_button_default = ReusableBlocksManageButton;
|
|
|
49
49
|
export {
|
|
50
50
|
reusable_blocks_manage_button_default as default
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=reusable-blocks-manage-button.
|
|
52
|
+
//# sourceMappingURL=reusable-blocks-manage-button.mjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// packages/reusable-blocks/src/store/index.js
|
|
2
2
|
import { createReduxStore, register } from "@wordpress/data";
|
|
3
|
-
import * as actions from "./actions";
|
|
4
|
-
import reducer from "./reducer";
|
|
5
|
-
import * as selectors from "./selectors";
|
|
3
|
+
import * as actions from "./actions.mjs";
|
|
4
|
+
import reducer from "./reducer.mjs";
|
|
5
|
+
import * as selectors from "./selectors.mjs";
|
|
6
6
|
var STORE_NAME = "core/reusable-blocks";
|
|
7
7
|
var store = createReduxStore(STORE_NAME, {
|
|
8
8
|
actions,
|
|
@@ -13,4 +13,4 @@ register(store);
|
|
|
13
13
|
export {
|
|
14
14
|
store
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=index.
|
|
16
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
/**
|
|
84
84
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
85
85
|
*/
|
|
86
|
+
/**
|
|
87
|
+
* Creates a checkerboard pattern background to indicate transparency.
|
|
88
|
+
* @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
|
|
89
|
+
*/
|
|
86
90
|
:root {
|
|
87
91
|
--wp-block-synced-color: #7a00df;
|
|
88
92
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
package/build-style/style.css
CHANGED
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
/**
|
|
84
84
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
85
85
|
*/
|
|
86
|
+
/**
|
|
87
|
+
* Creates a checkerboard pattern background to indicate transparency.
|
|
88
|
+
* @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
|
|
89
|
+
*/
|
|
86
90
|
:root {
|
|
87
91
|
--wp-block-synced-color: #7a00df;
|
|
88
92
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/reusable-blocks",
|
|
3
|
-
"version": "5.37.0",
|
|
3
|
+
"version": "5.37.1-next.06ee73755.0",
|
|
4
4
|
"description": "Reusable blocks utilities.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -22,12 +22,20 @@
|
|
|
22
22
|
"node": ">=18.12.0",
|
|
23
23
|
"npm": ">=8.19.2"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
26
|
-
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"build",
|
|
28
|
+
"build-module",
|
|
29
|
+
"build-style",
|
|
30
|
+
"build-types",
|
|
31
|
+
"*.md"
|
|
32
|
+
],
|
|
33
|
+
"main": "build/index.cjs",
|
|
34
|
+
"module": "build-module/index.mjs",
|
|
27
35
|
"exports": {
|
|
28
36
|
".": {
|
|
29
|
-
"import": "./build-module/index.
|
|
30
|
-
"require": "./build/index.
|
|
37
|
+
"import": "./build-module/index.mjs",
|
|
38
|
+
"require": "./build/index.cjs"
|
|
31
39
|
},
|
|
32
40
|
"./package.json": "./package.json"
|
|
33
41
|
},
|
|
@@ -36,24 +44,24 @@
|
|
|
36
44
|
"sideEffects": [
|
|
37
45
|
"src/index.js",
|
|
38
46
|
"src/store/index.js",
|
|
39
|
-
"build/index.
|
|
40
|
-
"build/store/index.
|
|
41
|
-
"build-module/index.
|
|
42
|
-
"build-module/store/index.
|
|
47
|
+
"build/index.cjs",
|
|
48
|
+
"build/store/index.cjs",
|
|
49
|
+
"build-module/index.mjs",
|
|
50
|
+
"build-module/store/index.mjs"
|
|
43
51
|
],
|
|
44
52
|
"dependencies": {
|
|
45
|
-
"@wordpress/base-styles": "^6.13.0",
|
|
46
|
-
"@wordpress/block-editor": "^15.10.0",
|
|
47
|
-
"@wordpress/blocks": "^15.10.0",
|
|
48
|
-
"@wordpress/components": "^
|
|
49
|
-
"@wordpress/core-data": "^7.37.0",
|
|
50
|
-
"@wordpress/data": "^10.37.0",
|
|
51
|
-
"@wordpress/element": "^6.37.0",
|
|
52
|
-
"@wordpress/i18n": "^6.10.0",
|
|
53
|
-
"@wordpress/icons": "^11.4.0",
|
|
54
|
-
"@wordpress/notices": "^5.37.0",
|
|
55
|
-
"@wordpress/private-apis": "^1.37.0",
|
|
56
|
-
"@wordpress/url": "^4.37.0"
|
|
53
|
+
"@wordpress/base-styles": "^6.13.2-next.06ee73755.0",
|
|
54
|
+
"@wordpress/block-editor": "^15.10.1-next.06ee73755.0",
|
|
55
|
+
"@wordpress/blocks": "^15.10.1-next.06ee73755.0",
|
|
56
|
+
"@wordpress/components": "^32.0.1-next.06ee73755.0",
|
|
57
|
+
"@wordpress/core-data": "^7.37.1-next.06ee73755.0",
|
|
58
|
+
"@wordpress/data": "^10.37.1-next.06ee73755.0",
|
|
59
|
+
"@wordpress/element": "^6.37.1-next.06ee73755.0",
|
|
60
|
+
"@wordpress/i18n": "^6.10.1-next.06ee73755.0",
|
|
61
|
+
"@wordpress/icons": "^11.4.1-next.06ee73755.0",
|
|
62
|
+
"@wordpress/notices": "^5.37.1-next.06ee73755.0",
|
|
63
|
+
"@wordpress/private-apis": "^1.37.1-next.06ee73755.0",
|
|
64
|
+
"@wordpress/url": "^4.37.1-next.06ee73755.0"
|
|
57
65
|
},
|
|
58
66
|
"peerDependencies": {
|
|
59
67
|
"react": "^18.0.0",
|
|
@@ -62,5 +70,5 @@
|
|
|
62
70
|
"publishConfig": {
|
|
63
71
|
"access": "public"
|
|
64
72
|
},
|
|
65
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "fd315436f44683a993d5f053789b5279d95b2872"
|
|
66
74
|
}
|
|
@@ -170,14 +170,12 @@ export default function ReusableBlockConvertButton( {
|
|
|
170
170
|
<VStack spacing="5">
|
|
171
171
|
<TextControl
|
|
172
172
|
__next40pxDefaultSize
|
|
173
|
-
__nextHasNoMarginBottom
|
|
174
173
|
label={ __( 'Name' ) }
|
|
175
174
|
value={ title }
|
|
176
175
|
onChange={ setTitle }
|
|
177
176
|
placeholder={ __( 'My pattern' ) }
|
|
178
177
|
/>
|
|
179
178
|
<ToggleControl
|
|
180
|
-
__nextHasNoMarginBottom
|
|
181
179
|
label={ _x( 'Synced', 'pattern (singular)' ) }
|
|
182
180
|
help={ __(
|
|
183
181
|
'Sync this pattern across multiple locations.'
|
package/build-module/index.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|