@wordpress/patterns 2.44.1-next.v.202604201441.0 → 2.45.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/allow-overrides-modal.cjs.map +3 -3
- package/build/components/patterns-manage-button.cjs +3 -3
- package/build/components/patterns-manage-button.cjs.map +2 -2
- package/build-module/components/allow-overrides-modal.mjs +3 -3
- package/build-module/components/allow-overrides-modal.mjs.map +2 -2
- package/build-module/components/patterns-manage-button.mjs +3 -3
- package/build-module/components/patterns-manage-button.mjs.map +2 -2
- package/package.json +17 -17
- package/src/components/allow-overrides-modal.js +5 -5
- package/src/components/patterns-manage-button.js +3 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/allow-overrides-modal.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\t__experimentalText as
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,kBAA4B;AAC5B,qBAAgC;AAChC,kBAAsB;AAkDjB;AAhDE,SAAS,oBAAqB;AAAA,EACpC;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,iBAAiB,kBAAmB,QAAI,yBAAU,WAAY;AACtE,QAAM,oBAAgB,sBAAM;AAE5B,QAAM,cAAc,CAAC,CAAE,gBAAgB,KAAK;AAE5C,QAAM,eAAe,MAAM;AAC1B,QAAK,oBAAoB,aAAc;AACtC,YAAM,cAAU;AAAA;AAAA,YAEf,gBAAI,8BAA+B;AAAA,QACnC;AAAA,MACD;AAGA,6BAAO,SAAS,WAAY;AAAA,IAC7B;AACA,WAAQ,eAAgB;AAGxB,YAAQ;AAAA,EACT;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ,gBAAI,kBAAmB;AAAA,MAC/B,gBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,MAAO,EAAE,aAAa,cAAc;AAAA,MACpC,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AAErB,gBAAK,CAAE,aAAc;AACpB;AAAA,YACD;AAEA,yBAAa;AAAA,UACd;AAAA,UAEA,uDAAC,kBAAAA,sBAAA,EAAO,SAAQ,KACf;AAAA,wDAAC,kBAAAC,oBAAA,
|
|
6
|
-
"names": ["VStack", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\t__experimentalText as WCText,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useId } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nexport function AllowOverridesModal( {\n\tplaceholder,\n\tinitialName = '',\n\tonClose,\n\tonSave,\n} ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( initialName );\n\tconst descriptionId = useId();\n\n\tconst isNameValid = !! editedBlockName.trim();\n\n\tconst handleSubmit = () => {\n\t\tif ( editedBlockName !== initialName ) {\n\t\t\tconst message = sprintf(\n\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\teditedBlockName\n\t\t\t);\n\n\t\t\t// Must be assertive to immediately announce change.\n\t\t\tspeak( message, 'assertive' );\n\t\t}\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Enable overrides' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\taria={ { describedby: descriptionId } }\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"6\">\n\t\t\t\t\t<WCText id={ descriptionId }>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WCText>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'For example, if you are creating a recipe pattern, you use \"Recipe Title\", \"Recipe Description\", etc.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Enable' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nexport function DisallowOverridesModal( { onClose, onSave } ) {\n\tconst descriptionId = useId();\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Disable overrides' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\taria={ { describedby: descriptionId } }\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonSave();\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"6\">\n\t\t\t\t\t<WCText id={ descriptionId }>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WCText>\n\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Disable' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,kBAA4B;AAC5B,qBAAgC;AAChC,kBAAsB;AAkDjB;AAhDE,SAAS,oBAAqB;AA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BACA,uBAAqB;AAAA,kBACrB,iBAAgB,CAAE;AAAA,kBAClB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,8BAAI,QAAS;AAAA;AAAA,cAChB;AAAA,eACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;AAEO,SAAS,uBAAwB,EAAE,SAAS,OAAO,GAAI;AAC7D,QAAM,oBAAgB,sBAAM;AAE5B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ,gBAAI,mBAAoB;AAAA,MAChC,gBAAiB;AAAA,MACjB,MAAO,EAAE,aAAa,cAAc;AAAA,MACpC,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,mBAAO;AACP,oBAAQ;AAAA,UACT;AAAA,UAEA,uDAAC,kBAAAF,sBAAA,EAAO,SAAQ,KACf;AAAA,wDAAC,kBAAAC,oBAAA,EAAO,IAAK,eACV;AAAA,cACD;AAAA,YACD,GACD;AAAA,YAEA,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,SACf;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,SAAU;AAAA,kBAER,8BAAI,QAAS;AAAA;AAAA,cAChB;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,8BAAI,SAAU;AAAA;AAAA,cACjB;AAAA,eACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": ["VStack", "WCText", "HStack"]
|
|
7
7
|
}
|
|
@@ -101,16 +101,16 @@ function PatternsManageButton({ clientId, onClose }) {
|
|
|
101
101
|
};
|
|
102
102
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
103
103
|
canDetach && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
104
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.MenuItem, { onClick: () => setShowConfirmDialog(true), children:
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.MenuItem, { onClick: () => setShowConfirmDialog(true), children: (0, import_i18n.__)("Detach") }),
|
|
105
105
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
106
|
import_components.__experimentalConfirmDialog,
|
|
107
107
|
{
|
|
108
108
|
isOpen: showConfirmDialog,
|
|
109
109
|
onConfirm: handleDetach,
|
|
110
110
|
onCancel: () => setShowConfirmDialog(false),
|
|
111
|
-
confirmButtonText:
|
|
111
|
+
confirmButtonText: (0, import_i18n.__)("Detach"),
|
|
112
112
|
size: "medium",
|
|
113
|
-
title:
|
|
113
|
+
title: (0, import_i18n.__)("Detach pattern?"),
|
|
114
114
|
__experimentalHideHeader: false,
|
|
115
115
|
children: isSyncedPattern ? (0, import_i18n.__)(
|
|
116
116
|
"The blocks will be separated from the original pattern and will be fully editable. Future changes to the pattern will not apply here."
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/patterns-manage-button.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\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, onClose } ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tconst {\n\t\tattributes,\n\t\tcanDetach,\n\t\tisVisible,\n\t\tmanagePatternsUrl,\n\t\tisSyncedPattern,\n\t\tisUnsyncedPattern,\n\t\tcanEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canRemoveBlock, getBlock, canEditBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst block = getBlock( clientId );\n\n\t\t\tconst _isUnsyncedPattern =\n\t\t\t\t!! block?.attributes?.metadata?.patternName;\n\n\t\t\tconst _isSyncedPattern =\n\t\t\t\t!! block &&\n\t\t\t\tisReusableBlock( block ) &&\n\t\t\t\t!! canUser( 'update', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\tid: block.attributes.ref,\n\t\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tattributes: block.attributes,\n\t\t\t\tcanEdit: canEditBlock( clientId ),\n\t\t\t\t// For unsynced patterns, detaching is simply removing the `patternName` attribute.\n\t\t\t\t// For synced patterns, the `core:block` block is replaced with its inner blocks,\n\t\t\t\t// so checking whether `canRemoveBlock` is possible is required.\n\t\t\t\tcanDetach:\n\t\t\t\t\t_isUnsyncedPattern ||\n\t\t\t\t\t( _isSyncedPattern && canRemoveBlock( clientId ) ),\n\t\t\t\tisUnsyncedPattern: _isUnsyncedPattern,\n\t\t\t\tisSyncedPattern: _isSyncedPattern,\n\t\t\t\tisVisible: _isUnsyncedPattern || _isSyncedPattern,\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\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\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 || ! canEdit ) {\n\t\treturn null;\n\t}\n\n\tconst handleDetach = () => {\n\t\tif ( isSyncedPattern ) {\n\t\t\tconvertSyncedPatternToStatic( clientId );\n\t\t}\n\n\t\tif ( isUnsyncedPattern ) {\n\t\t\tconst { patternName, ...attributesWithoutPatternName } =\n\t\t\t\tattributes?.metadata ?? {};\n\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\tmetadata: attributesWithoutPatternName,\n\t\t\t} );\n\t\t}\n\t\tonClose?.();\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ canDetach && (\n\t\t\t\t<>\n\t\t\t\t\t<MenuItem onClick={ () => setShowConfirmDialog( true ) }>\n\t\t\t\t\t\t{
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,kBAAmB;AACnB,oBAAgC;AAChC,kBAAuC;AACvC,qBAAyB;AACzB,0BAA0C;AAC1C,iBAA6B;AAC7B,uBAAmC;AAKnC,mBAAuC;AACvC,yBAAuB;AA6FnB;AA3FJ,SAAS,qBAAsB,EAAE,UAAU,QAAQ,GAAI;AACtD,QAAM,CAAE,mBAAmB,oBAAqB,QAAI,yBAAU,KAAM;AAEpE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI;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AAA,QAChC,UAAU;AAAA,MACX,CAAE;AAAA,IACH;AACA,cAAU;AACV,yBAAsB,KAAM;AAAA,EAC7B;AAEA,SACC,4EACG;AAAA,iBACD,4EACC;AAAA,kDAAC,8BAAS,SAAU,MAAM,qBAAsB,IAAK,GAClD,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\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, onClose } ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tconst {\n\t\tattributes,\n\t\tcanDetach,\n\t\tisVisible,\n\t\tmanagePatternsUrl,\n\t\tisSyncedPattern,\n\t\tisUnsyncedPattern,\n\t\tcanEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canRemoveBlock, getBlock, canEditBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst block = getBlock( clientId );\n\n\t\t\tconst _isUnsyncedPattern =\n\t\t\t\t!! block?.attributes?.metadata?.patternName;\n\n\t\t\tconst _isSyncedPattern =\n\t\t\t\t!! block &&\n\t\t\t\tisReusableBlock( block ) &&\n\t\t\t\t!! canUser( 'update', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\tid: block.attributes.ref,\n\t\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tattributes: block.attributes,\n\t\t\t\tcanEdit: canEditBlock( clientId ),\n\t\t\t\t// For unsynced patterns, detaching is simply removing the `patternName` attribute.\n\t\t\t\t// For synced patterns, the `core:block` block is replaced with its inner blocks,\n\t\t\t\t// so checking whether `canRemoveBlock` is possible is required.\n\t\t\t\tcanDetach:\n\t\t\t\t\t_isUnsyncedPattern ||\n\t\t\t\t\t( _isSyncedPattern && canRemoveBlock( clientId ) ),\n\t\t\t\tisUnsyncedPattern: _isUnsyncedPattern,\n\t\t\t\tisSyncedPattern: _isSyncedPattern,\n\t\t\t\tisVisible: _isUnsyncedPattern || _isSyncedPattern,\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\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\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 || ! canEdit ) {\n\t\treturn null;\n\t}\n\n\tconst handleDetach = () => {\n\t\tif ( isSyncedPattern ) {\n\t\t\tconvertSyncedPatternToStatic( clientId );\n\t\t}\n\n\t\tif ( isUnsyncedPattern ) {\n\t\t\tconst { patternName, ...attributesWithoutPatternName } =\n\t\t\t\tattributes?.metadata ?? {};\n\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\tmetadata: attributesWithoutPatternName,\n\t\t\t} );\n\t\t}\n\t\tonClose?.();\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ canDetach && (\n\t\t\t\t<>\n\t\t\t\t\t<MenuItem onClick={ () => setShowConfirmDialog( true ) }>\n\t\t\t\t\t\t{ __( 'Detach' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t\t<ConfirmDialog\n\t\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\t\tonConfirm={ handleDetach }\n\t\t\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t\t\t\tconfirmButtonText={ __( 'Detach' ) }\n\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\ttitle={ __( 'Detach pattern?' ) }\n\t\t\t\t\t\t__experimentalHideHeader={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSyncedPattern\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'The blocks will be separated from the original pattern and will be fully editable. Future changes to the pattern will not apply here.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Blocks will no longer be associated with this pattern and will be fully editable.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</ConfirmDialog>\n\t\t\t\t</>\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,kBAAmB;AACnB,oBAAgC;AAChC,kBAAuC;AACvC,qBAAyB;AACzB,0BAA0C;AAC1C,iBAA6B;AAC7B,uBAAmC;AAKnC,mBAAuC;AACvC,yBAAuB;AA6FnB;AA3FJ,SAAS,qBAAsB,EAAE,UAAU,QAAQ,GAAI;AACtD,QAAM,CAAE,mBAAmB,oBAAqB,QAAI,yBA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AA,IACxC;AAEA,QAAK,mBAAoB;AACxB,YAAM,EAAE,aAAa,GAAG,6BAA6B,IACpD,YAAY,YAAY,CAAC;AAC1B,4BAAuB,UAAU;AAAA,QAChC,UAAU;AAAA,MACX,CAAE;AAAA,IACH;AACA,cAAU;AACV,yBAAsB,KAAM;AAAA,EAC7B;AAEA,SACC,4EACG;AAAA,iBACD,4EACC;AAAA,kDAAC,8BAAS,SAAU,MAAM,qBAAsB,IAAK,GAClD,8BAAI,QAAS,GAChB;AAAA,MACA;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA,QAAS;AAAA,UACT,WAAY;AAAA,UACZ,UAAW,MAAM,qBAAsB,KAAM;AAAA,UAC7C,uBAAoB,gBAAI,QAAS;AAAA,UACjC,MAAK;AAAA,UACL,WAAQ,gBAAI,iBAAkB;AAAA,UAC9B,0BAA2B;AAAA,UAEzB,gCACC;AAAA,YACA;AAAA,UACA,QACA;AAAA,YACA;AAAA,UACA;AAAA;AAAA,MACJ;AAAA,OACD;AAAA,IAED,4CAAC,8BAAS,MAAO,mBACd,8BAAI,iBAAkB,GACzB;AAAA,KACD;AAEF;AAEA,IAAO,iCAAQ;",
|
|
6
6
|
"names": ["blockEditorStore", "coreStore", "patternsStore", "ConfirmDialog"]
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__experimentalHStack as HStack,
|
|
4
4
|
__experimentalVStack as VStack,
|
|
5
5
|
Button,
|
|
6
|
-
__experimentalText as
|
|
6
|
+
__experimentalText as WCText,
|
|
7
7
|
TextControl,
|
|
8
8
|
Modal
|
|
9
9
|
} from "@wordpress/components";
|
|
@@ -51,7 +51,7 @@ function AllowOverridesModal({
|
|
|
51
51
|
handleSubmit();
|
|
52
52
|
},
|
|
53
53
|
children: /* @__PURE__ */ jsxs(VStack, { spacing: "6", children: [
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
54
|
+
/* @__PURE__ */ jsx(WCText, { id: descriptionId, children: __(
|
|
55
55
|
"Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override."
|
|
56
56
|
) }),
|
|
57
57
|
/* @__PURE__ */ jsx(
|
|
@@ -112,7 +112,7 @@ function DisallowOverridesModal({ onClose, onSave }) {
|
|
|
112
112
|
onClose();
|
|
113
113
|
},
|
|
114
114
|
children: /* @__PURE__ */ jsxs(VStack, { spacing: "6", children: [
|
|
115
|
-
/* @__PURE__ */ jsx(
|
|
115
|
+
/* @__PURE__ */ jsx(WCText, { id: descriptionId, children: __(
|
|
116
116
|
"Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern."
|
|
117
117
|
) }),
|
|
118
118
|
/* @__PURE__ */ jsxs(HStack, { justify: "right", children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/allow-overrides-modal.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\t__experimentalText as
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,OACM;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,aAAa;AAChC,SAAS,aAAa;AAkDjB,cAeA,YAfA;AAhDE,SAAS,oBAAqB;AAAA,EACpC;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,iBAAiB,kBAAmB,IAAI,SAAU,WAAY;AACtE,QAAM,gBAAgB,MAAM;AAE5B,QAAM,cAAc,CAAC,CAAE,gBAAgB,KAAK;AAE5C,QAAM,eAAe,MAAM;AAC1B,QAAK,oBAAoB,aAAc;AACtC,YAAM,UAAU;AAAA;AAAA,QAEf,GAAI,8BAA+B;AAAA,QACnC;AAAA,MACD;AAGA,YAAO,SAAS,WAAY;AAAA,IAC7B;AACA,WAAQ,eAAgB;AAGxB,YAAQ;AAAA,EACT;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,kBAAmB;AAAA,MAC/B,gBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,MAAO,EAAE,aAAa,cAAc;AAAA,MACpC,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AAErB,gBAAK,CAAE,aAAc;AACpB;AAAA,YACD;AAEA,yBAAa;AAAA,UACd;AAAA,UAEA,+BAAC,UAAO,SAAQ,KACf;AAAA,gCAAC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\t__experimentalText as WCText,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useId } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nexport function AllowOverridesModal( {\n\tplaceholder,\n\tinitialName = '',\n\tonClose,\n\tonSave,\n} ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( initialName );\n\tconst descriptionId = useId();\n\n\tconst isNameValid = !! editedBlockName.trim();\n\n\tconst handleSubmit = () => {\n\t\tif ( editedBlockName !== initialName ) {\n\t\t\tconst message = sprintf(\n\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\teditedBlockName\n\t\t\t);\n\n\t\t\t// Must be assertive to immediately announce change.\n\t\t\tspeak( message, 'assertive' );\n\t\t}\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Enable overrides' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\taria={ { describedby: descriptionId } }\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"6\">\n\t\t\t\t\t<WCText id={ descriptionId }>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WCText>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'For example, if you are creating a recipe pattern, you use \"Recipe Title\", \"Recipe Description\", etc.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Enable' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nexport function DisallowOverridesModal( { onClose, onSave } ) {\n\tconst descriptionId = useId();\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Disable overrides' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\taria={ { describedby: descriptionId } }\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonSave();\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"6\">\n\t\t\t\t\t<WCText id={ descriptionId }>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WCText>\n\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Disable' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,OACM;AACP,SAAS,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cAChB;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,iBAAgB,CAAE;AAAA,kBAClB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,aAAI,QAAS;AAAA;AAAA,cAChB;AAAA,eACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;AAEO,SAAS,uBAAwB,EAAE,SAAS,OAAO,GAAI;AAC7D,QAAM,gBAAgB,MAAM;AAE5B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,mBAAoB;AAAA,MAChC,gBAAiB;AAAA,MACjB,MAAO,EAAE,aAAa,cAAc;AAAA,MACpC,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,mBAAO;AACP,oBAAQ;AAAA,UACT;AAAA,UAEA,+BAAC,UAAO,SAAQ,KACf;AAAA,gCAAC,UAAO,IAAK,eACV;AAAA,cACD;AAAA,YACD,GACD;AAAA,YAEA,qBAAC,UAAO,SAAQ,SACf;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,SAAU;AAAA,kBAER,aAAI,QAAS;AAAA;AAAA,cAChB;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,aAAI,SAAU;AAAA;AAAA,cACjB;AAAA,eACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -81,16 +81,16 @@ function PatternsManageButton({ clientId, onClose }) {
|
|
|
81
81
|
};
|
|
82
82
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
83
83
|
canDetach && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
-
/* @__PURE__ */ jsx(MenuItem, { onClick: () => setShowConfirmDialog(true), children:
|
|
84
|
+
/* @__PURE__ */ jsx(MenuItem, { onClick: () => setShowConfirmDialog(true), children: __("Detach") }),
|
|
85
85
|
/* @__PURE__ */ jsx(
|
|
86
86
|
ConfirmDialog,
|
|
87
87
|
{
|
|
88
88
|
isOpen: showConfirmDialog,
|
|
89
89
|
onConfirm: handleDetach,
|
|
90
90
|
onCancel: () => setShowConfirmDialog(false),
|
|
91
|
-
confirmButtonText:
|
|
91
|
+
confirmButtonText: __("Detach"),
|
|
92
92
|
size: "medium",
|
|
93
|
-
title:
|
|
93
|
+
title: __("Detach pattern?"),
|
|
94
94
|
__experimentalHideHeader: false,
|
|
95
95
|
children: isSyncedPattern ? __(
|
|
96
96
|
"The blocks will be separated from the original pattern and will be fully editable. Future changes to the pattern will not apply here."
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/patterns-manage-button.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\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, onClose } ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tconst {\n\t\tattributes,\n\t\tcanDetach,\n\t\tisVisible,\n\t\tmanagePatternsUrl,\n\t\tisSyncedPattern,\n\t\tisUnsyncedPattern,\n\t\tcanEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canRemoveBlock, getBlock, canEditBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst block = getBlock( clientId );\n\n\t\t\tconst _isUnsyncedPattern =\n\t\t\t\t!! block?.attributes?.metadata?.patternName;\n\n\t\t\tconst _isSyncedPattern =\n\t\t\t\t!! block &&\n\t\t\t\tisReusableBlock( block ) &&\n\t\t\t\t!! canUser( 'update', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\tid: block.attributes.ref,\n\t\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tattributes: block.attributes,\n\t\t\t\tcanEdit: canEditBlock( clientId ),\n\t\t\t\t// For unsynced patterns, detaching is simply removing the `patternName` attribute.\n\t\t\t\t// For synced patterns, the `core:block` block is replaced with its inner blocks,\n\t\t\t\t// so checking whether `canRemoveBlock` is possible is required.\n\t\t\t\tcanDetach:\n\t\t\t\t\t_isUnsyncedPattern ||\n\t\t\t\t\t( _isSyncedPattern && canRemoveBlock( clientId ) ),\n\t\t\t\tisUnsyncedPattern: _isUnsyncedPattern,\n\t\t\t\tisSyncedPattern: _isSyncedPattern,\n\t\t\t\tisVisible: _isUnsyncedPattern || _isSyncedPattern,\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\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\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 || ! canEdit ) {\n\t\treturn null;\n\t}\n\n\tconst handleDetach = () => {\n\t\tif ( isSyncedPattern ) {\n\t\t\tconvertSyncedPatternToStatic( clientId );\n\t\t}\n\n\t\tif ( isUnsyncedPattern ) {\n\t\t\tconst { patternName, ...attributesWithoutPatternName } =\n\t\t\t\tattributes?.metadata ?? {};\n\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\tmetadata: attributesWithoutPatternName,\n\t\t\t} );\n\t\t}\n\t\tonClose?.();\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ canDetach && (\n\t\t\t\t<>\n\t\t\t\t\t<MenuItem onClick={ () => setShowConfirmDialog( true ) }>\n\t\t\t\t\t\t{
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,+BAA+B;AAAA,OACzB;AACP,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC,SAAS,WAAW,mBAAmB;AACvC,SAAS,gBAAgB;AACzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,oBAAoB;AAC7B,SAAS,SAAS,iBAAiB;AAKnC,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AA6FnB,mBACC,KADD;AA3FJ,SAAS,qBAAsB,EAAE,UAAU,QAAQ,GAAI;AACtD,QAAM,CAAE,mBAAmB,oBAAqB,IAAI,SAAU,KAAM;AAEpE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM,EAAE,gBAAgB,UAAU,aAAa,IAC9C,OAAQ,gBAAiB;AAC1B,YAAM,EAAE,QAAQ,IAAI,OAAQ,SAAU;AACtC,YA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D,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\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, onClose } ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tconst {\n\t\tattributes,\n\t\tcanDetach,\n\t\tisVisible,\n\t\tmanagePatternsUrl,\n\t\tisSyncedPattern,\n\t\tisUnsyncedPattern,\n\t\tcanEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canRemoveBlock, getBlock, canEditBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst block = getBlock( clientId );\n\n\t\t\tconst _isUnsyncedPattern =\n\t\t\t\t!! block?.attributes?.metadata?.patternName;\n\n\t\t\tconst _isSyncedPattern =\n\t\t\t\t!! block &&\n\t\t\t\tisReusableBlock( block ) &&\n\t\t\t\t!! canUser( 'update', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\tid: block.attributes.ref,\n\t\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tattributes: block.attributes,\n\t\t\t\tcanEdit: canEditBlock( clientId ),\n\t\t\t\t// For unsynced patterns, detaching is simply removing the `patternName` attribute.\n\t\t\t\t// For synced patterns, the `core:block` block is replaced with its inner blocks,\n\t\t\t\t// so checking whether `canRemoveBlock` is possible is required.\n\t\t\t\tcanDetach:\n\t\t\t\t\t_isUnsyncedPattern ||\n\t\t\t\t\t( _isSyncedPattern && canRemoveBlock( clientId ) ),\n\t\t\t\tisUnsyncedPattern: _isUnsyncedPattern,\n\t\t\t\tisSyncedPattern: _isSyncedPattern,\n\t\t\t\tisVisible: _isUnsyncedPattern || _isSyncedPattern,\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\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\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 || ! canEdit ) {\n\t\treturn null;\n\t}\n\n\tconst handleDetach = () => {\n\t\tif ( isSyncedPattern ) {\n\t\t\tconvertSyncedPatternToStatic( clientId );\n\t\t}\n\n\t\tif ( isUnsyncedPattern ) {\n\t\t\tconst { patternName, ...attributesWithoutPatternName } =\n\t\t\t\tattributes?.metadata ?? {};\n\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\tmetadata: attributesWithoutPatternName,\n\t\t\t} );\n\t\t}\n\t\tonClose?.();\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ canDetach && (\n\t\t\t\t<>\n\t\t\t\t\t<MenuItem onClick={ () => setShowConfirmDialog( true ) }>\n\t\t\t\t\t\t{ __( 'Detach' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t\t<ConfirmDialog\n\t\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\t\tonConfirm={ handleDetach }\n\t\t\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t\t\t\tconfirmButtonText={ __( 'Detach' ) }\n\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\ttitle={ __( 'Detach pattern?' ) }\n\t\t\t\t\t\t__experimentalHideHeader={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSyncedPattern\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'The blocks will be separated from the original pattern and will be fully editable. Future changes to the pattern will not apply here.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Blocks will no longer be associated with this pattern and will be fully editable.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</ConfirmDialog>\n\t\t\t\t</>\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"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,+BAA+B;AAAA,OACzB;AACP,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC,SAAS,WAAW,mBAAmB;AACvC,SAAS,gBAAgB;AACzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,oBAAoB;AAC7B,SAAS,SAAS,iBAAiB;AAKnC,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AA6FnB,mBACC,KADD;AA3FJ,SAAS,qBAAsB,EAAE,UAAU,QAAQ,GAAI;AACtD,QAAM,CAAE,mBAAmB,oBAAqB,IAAI,SAAU,KAAM;AAEpE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAC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,CAAE;AAAA,IACH;AACA,cAAU;AACV,yBAAsB,KAAM;AAAA,EAC7B;AAEA,SACC,iCACG;AAAA,iBACD,iCACC;AAAA,0BAAC,YAAS,SAAU,MAAM,qBAAsB,IAAK,GAClD,aAAI,QAAS,GAChB;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,QAAS;AAAA,UACT,WAAY;AAAA,UACZ,UAAW,MAAM,qBAAsB,KAAM;AAAA,UAC7C,mBAAoB,GAAI,QAAS;AAAA,UACjC,MAAK;AAAA,UACL,OAAQ,GAAI,iBAAkB;AAAA,UAC9B,0BAA2B;AAAA,UAEzB,4BACC;AAAA,YACA;AAAA,UACA,IACA;AAAA,YACA;AAAA,UACA;AAAA;AAAA,MACJ;AAAA,OACD;AAAA,IAED,oBAAC,YAAS,MAAO,mBACd,aAAI,iBAAkB,GACzB;AAAA,KACD;AAEF;AAEA,IAAO,iCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/patterns",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.0",
|
|
4
4
|
"description": "Management of user pattern editing.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -52,21 +52,21 @@
|
|
|
52
52
|
"build-module/store/index.mjs"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@wordpress/a11y": "^4.
|
|
56
|
-
"@wordpress/base-styles": "^
|
|
57
|
-
"@wordpress/block-editor": "^15.18.
|
|
58
|
-
"@wordpress/blocks": "^15.
|
|
59
|
-
"@wordpress/components": "^33.0.
|
|
60
|
-
"@wordpress/compose": "^7.
|
|
61
|
-
"@wordpress/core-data": "^7.
|
|
62
|
-
"@wordpress/data": "^10.45.
|
|
63
|
-
"@wordpress/element": "^6.
|
|
64
|
-
"@wordpress/html-entities": "^4.
|
|
65
|
-
"@wordpress/i18n": "^6.
|
|
66
|
-
"@wordpress/icons": "^
|
|
67
|
-
"@wordpress/notices": "^5.
|
|
68
|
-
"@wordpress/private-apis": "^1.
|
|
69
|
-
"@wordpress/url": "^4.
|
|
55
|
+
"@wordpress/a11y": "^4.45.0",
|
|
56
|
+
"@wordpress/base-styles": "^7.0.0",
|
|
57
|
+
"@wordpress/block-editor": "^15.18.0",
|
|
58
|
+
"@wordpress/blocks": "^15.18.0",
|
|
59
|
+
"@wordpress/components": "^33.0.0",
|
|
60
|
+
"@wordpress/compose": "^7.45.0",
|
|
61
|
+
"@wordpress/core-data": "^7.45.0",
|
|
62
|
+
"@wordpress/data": "^10.45.0",
|
|
63
|
+
"@wordpress/element": "^6.45.0",
|
|
64
|
+
"@wordpress/html-entities": "^4.45.0",
|
|
65
|
+
"@wordpress/i18n": "^6.18.0",
|
|
66
|
+
"@wordpress/icons": "^13.0.0",
|
|
67
|
+
"@wordpress/notices": "^5.45.0",
|
|
68
|
+
"@wordpress/private-apis": "^1.45.0",
|
|
69
|
+
"@wordpress/url": "^4.45.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"react": "^18.0.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "8c229eaed0e88c9827e2da3d73a78f9ddd77714b"
|
|
79
79
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__experimentalHStack as HStack,
|
|
6
6
|
__experimentalVStack as VStack,
|
|
7
7
|
Button,
|
|
8
|
-
__experimentalText as
|
|
8
|
+
__experimentalText as WCText,
|
|
9
9
|
TextControl,
|
|
10
10
|
Modal,
|
|
11
11
|
} from '@wordpress/components';
|
|
@@ -61,11 +61,11 @@ export function AllowOverridesModal( {
|
|
|
61
61
|
} }
|
|
62
62
|
>
|
|
63
63
|
<VStack spacing="6">
|
|
64
|
-
<
|
|
64
|
+
<WCText id={ descriptionId }>
|
|
65
65
|
{ __(
|
|
66
66
|
'Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override.'
|
|
67
67
|
) }
|
|
68
|
-
</
|
|
68
|
+
</WCText>
|
|
69
69
|
<TextControl
|
|
70
70
|
__next40pxDefaultSize
|
|
71
71
|
value={ editedBlockName }
|
|
@@ -118,11 +118,11 @@ export function DisallowOverridesModal( { onClose, onSave } ) {
|
|
|
118
118
|
} }
|
|
119
119
|
>
|
|
120
120
|
<VStack spacing="6">
|
|
121
|
-
<
|
|
121
|
+
<WCText id={ descriptionId }>
|
|
122
122
|
{ __(
|
|
123
123
|
'Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern.'
|
|
124
124
|
) }
|
|
125
|
-
</
|
|
125
|
+
</WCText>
|
|
126
126
|
|
|
127
127
|
<HStack justify="right">
|
|
128
128
|
<Button
|
|
@@ -112,25 +112,15 @@ function PatternsManageButton( { clientId, onClose } ) {
|
|
|
112
112
|
{ canDetach && (
|
|
113
113
|
<>
|
|
114
114
|
<MenuItem onClick={ () => setShowConfirmDialog( true ) }>
|
|
115
|
-
{
|
|
116
|
-
? __( 'Disconnect pattern' )
|
|
117
|
-
: __( 'Detach pattern' ) }
|
|
115
|
+
{ __( 'Detach' ) }
|
|
118
116
|
</MenuItem>
|
|
119
117
|
<ConfirmDialog
|
|
120
118
|
isOpen={ showConfirmDialog }
|
|
121
119
|
onConfirm={ handleDetach }
|
|
122
120
|
onCancel={ () => setShowConfirmDialog( false ) }
|
|
123
|
-
confirmButtonText={
|
|
124
|
-
isSyncedPattern
|
|
125
|
-
? __( 'Disconnect' )
|
|
126
|
-
: __( 'Detach' )
|
|
127
|
-
}
|
|
121
|
+
confirmButtonText={ __( 'Detach' ) }
|
|
128
122
|
size="medium"
|
|
129
|
-
title={
|
|
130
|
-
isSyncedPattern
|
|
131
|
-
? __( 'Disconnect pattern?' )
|
|
132
|
-
: __( 'Detach pattern?' )
|
|
133
|
-
}
|
|
123
|
+
title={ __( 'Detach pattern?' ) }
|
|
134
124
|
__experimentalHideHeader={ false }
|
|
135
125
|
>
|
|
136
126
|
{ isSyncedPattern
|