summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/dist/reusable-blocks.js
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/js/dist/reusable-blocks.js')
-rw-r--r--wp-includes/js/dist/reusable-blocks.js174
1 files changed, 98 insertions, 76 deletions
diff --git a/wp-includes/js/dist/reusable-blocks.js b/wp-includes/js/dist/reusable-blocks.js
index c804230..5f23bc3 100644
--- a/wp-includes/js/dist/reusable-blocks.js
+++ b/wp-includes/js/dist/reusable-blocks.js
@@ -221,26 +221,27 @@ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME,
});
(0,external_wp_data_namespaceObject.register)(store);
-;// CONCATENATED MODULE: external "React"
-const external_React_namespaceObject = window["React"];
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
+;// CONCATENATED MODULE: external "ReactJSXRuntime"
+const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
-
/**
* WordPress dependencies
*/
-const symbol = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
+ })
+});
/* harmony default export */ const library_symbol = (symbol);
;// CONCATENATED MODULE: external ["wp","notices"]
@@ -256,10 +257,9 @@ const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
const {
unlock
-} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/reusable-blocks');
+} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/reusable-blocks');
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-block-convert-button.js
-
/**
* WordPress dependencies
*/
@@ -278,6 +278,9 @@ const {
*/
+
+
+
const {
useReusableBlocksRenameHint,
ReusableBlocksRenameHint
@@ -357,57 +360,65 @@ function ReusableBlockConvertButton({
if (!canConvert) {
return null;
}
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- icon: library_symbol,
- onClick: () => setIsModalOpen(true)
- }, showRenameHint ? (0,external_wp_i18n_namespaceObject.__)('Create pattern/reusable block') : (0,external_wp_i18n_namespaceObject.__)('Create pattern')), isModalOpen && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
- title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'),
- onRequestClose: () => {
- setIsModalOpen(false);
- setTitle('');
- },
- overlayClassName: "reusable-blocks-menu-items__convert-modal"
- }, (0,external_React_namespaceObject.createElement)("form", {
- onSubmit: event => {
- event.preventDefault();
- onConvert(title);
- setIsModalOpen(false);
- setTitle('');
- onClose();
- }
- }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
- spacing: "5"
- }, (0,external_React_namespaceObject.createElement)(ReusableBlocksRenameHint, null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
- __nextHasNoMarginBottom: true,
- label: (0,external_wp_i18n_namespaceObject.__)('Name'),
- value: title,
- onChange: setTitle,
- placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern')
- }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
- label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'Option that makes an individual pattern synchronized'),
- help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'),
- checked: !syncType,
- onChange: () => {
- setSyncType(!syncType ? 'unsynced' : undefined);
- }
- }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
- justify: "right"
- }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "tertiary",
- onClick: () => {
- setIsModalOpen(false);
- setTitle('');
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
- variant: "primary",
- type: "submit"
- }, (0,external_wp_i18n_namespaceObject.__)('Create')))))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ icon: library_symbol,
+ onClick: () => setIsModalOpen(true),
+ children: showRenameHint ? (0,external_wp_i18n_namespaceObject.__)('Create pattern/reusable block') : (0,external_wp_i18n_namespaceObject.__)('Create pattern')
+ }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
+ title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'),
+ onRequestClose: () => {
+ setIsModalOpen(false);
+ setTitle('');
+ },
+ overlayClassName: "reusable-blocks-menu-items__convert-modal",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
+ onSubmit: event => {
+ event.preventDefault();
+ onConvert(title);
+ setIsModalOpen(false);
+ setTitle('');
+ onClose();
+ },
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
+ spacing: "5",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ReusableBlocksRenameHint, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
+ __nextHasNoMarginBottom: true,
+ label: (0,external_wp_i18n_namespaceObject.__)('Name'),
+ value: title,
+ onChange: setTitle,
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
+ label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'),
+ help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'),
+ checked: !syncType,
+ onChange: () => {
+ setSyncType(!syncType ? 'unsynced' : undefined);
+ }
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
+ justify: "right",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "tertiary",
+ onClick: () => {
+ setIsModalOpen(false);
+ setTitle('');
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
+ variant: "primary",
+ type: "submit",
+ children: (0,external_wp_i18n_namespaceObject.__)('Create')
+ })]
+ })]
+ })
+ })
+ })]
+ });
}
;// CONCATENATED MODULE: external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js
-
/**
* WordPress dependencies
*/
@@ -423,6 +434,9 @@ const external_wp_url_namespaceObject = window["wp"]["url"];
* Internal dependencies
*/
+
+
+
function ReusableBlocksManageButton({
clientId
}) {
@@ -434,14 +448,12 @@ function ReusableBlocksManageButton({
const {
getBlock,
canRemoveBlock,
- getBlockCount,
- getSettings
+ getBlockCount
} = select(external_wp_blockEditor_namespaceObject.store);
const {
canUser
} = select(external_wp_coreData_namespaceObject.store);
const reusableBlock = getBlock(clientId);
- const isBlockTheme = getSettings().__unstableIsBlockBasedTheme;
return {
canRemove: canRemoveBlock(clientId),
isVisible: !!reusableBlock && (0,external_wp_blocks_namespaceObject.isReusableBlock)(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref),
@@ -449,7 +461,7 @@ function ReusableBlocksManageButton({
// The site editor and templates both check whether the user
// has edit_theme_options capabilities. We can leverage that here
// and omit the manage patterns link if the user can't access it.
- managePatternsUrl: isBlockTheme && canUser('read', 'templates') ? (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', {
+ managePatternsUrl: canUser('create', 'templates') ? (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', {
path: '/patterns'
}) : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
post_type: 'wp_block'
@@ -462,16 +474,19 @@ function ReusableBlocksManageButton({
if (!isVisible) {
return null;
}
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- href: managePatternsUrl
- }, (0,external_wp_i18n_namespaceObject.__)('Manage patterns')), canRemove && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
- onClick: () => convertBlockToStatic(clientId)
- }, (0,external_wp_i18n_namespaceObject.__)('Detach')));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ href: managePatternsUrl,
+ children: (0,external_wp_i18n_namespaceObject.__)('Manage patterns')
+ }), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
+ onClick: () => convertBlockToStatic(clientId),
+ children: (0,external_wp_i18n_namespaceObject.__)('Detach')
+ })]
+ });
}
/* harmony default export */ const reusable_blocks_manage_button = (ReusableBlocksManageButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/index.js
-
/**
* WordPress dependencies
*/
@@ -482,19 +497,26 @@ function ReusableBlocksManageButton({
*/
+
+
+
function ReusableBlocksMenuItems({
rootClientId
}) {
- return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({
- onClose,
- selectedClientIds
- }) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(ReusableBlockConvertButton, {
- clientIds: selectedClientIds,
- rootClientId: rootClientId,
- onClose: onClose
- }), selectedClientIds.length === 1 && (0,external_React_namespaceObject.createElement)(reusable_blocks_manage_button, {
- clientId: selectedClientIds[0]
- })));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, {
+ children: ({
+ onClose,
+ selectedClientIds
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ReusableBlockConvertButton, {
+ clientIds: selectedClientIds,
+ rootClientId: rootClientId,
+ onClose: onClose
+ }), selectedClientIds.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(reusable_blocks_manage_button, {
+ clientId: selectedClientIds[0]
+ })]
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/index.js