@wordpress/block-editor 12.10.0 → 12.10.1

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.
Files changed (71) hide show
  1. package/build/components/block-patterns-list/index.js +9 -4
  2. package/build/components/block-patterns-list/index.js.map +1 -1
  3. package/build/components/block-patterns-paging/index.js +3 -1
  4. package/build/components/block-patterns-paging/index.js.map +1 -1
  5. package/build/components/inserter/block-patterns-explorer/patterns-list.js +19 -30
  6. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  7. package/build/components/inserter/block-patterns-explorer/sidebar.js +0 -15
  8. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  9. package/build/components/inserter/block-patterns-filter.js +137 -0
  10. package/build/components/inserter/block-patterns-filter.js.map +1 -0
  11. package/build/components/inserter/block-patterns-tab.js +77 -37
  12. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  13. package/build/components/inserter/hooks/use-patterns-paging.js +4 -0
  14. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  15. package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
  16. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  17. package/build/hooks/background.js +28 -23
  18. package/build/hooks/background.js.map +1 -1
  19. package/build/hooks/block-rename-ui.js +2 -1
  20. package/build/hooks/block-rename-ui.js.map +1 -1
  21. package/build/store/private-selectors.js +2 -3
  22. package/build/store/private-selectors.js.map +1 -1
  23. package/build-module/components/block-patterns-list/index.js +10 -5
  24. package/build-module/components/block-patterns-list/index.js.map +1 -1
  25. package/build-module/components/block-patterns-paging/index.js +3 -1
  26. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  27. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +20 -31
  28. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  29. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +0 -14
  30. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  31. package/build-module/components/inserter/block-patterns-filter.js +128 -0
  32. package/build-module/components/inserter/block-patterns-filter.js.map +1 -0
  33. package/build-module/components/inserter/block-patterns-tab.js +75 -35
  34. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  35. package/build-module/components/inserter/hooks/use-patterns-paging.js +5 -1
  36. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  37. package/build-module/components/inspector-controls-tabs/styles-tab.js +1 -1
  38. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  39. package/build-module/hooks/background.js +30 -25
  40. package/build-module/hooks/background.js.map +1 -1
  41. package/build-module/hooks/block-rename-ui.js +2 -1
  42. package/build-module/hooks/block-rename-ui.js.map +1 -1
  43. package/build-module/store/private-selectors.js +2 -3
  44. package/build-module/store/private-selectors.js.map +1 -1
  45. package/build-style/style-rtl.css +53 -26
  46. package/build-style/style.css +53 -26
  47. package/package.json +32 -32
  48. package/src/components/block-patterns-list/index.js +21 -12
  49. package/src/components/block-patterns-paging/index.js +1 -1
  50. package/src/components/block-patterns-paging/style.scss +16 -13
  51. package/src/components/inserter/block-patterns-explorer/patterns-list.js +23 -67
  52. package/src/components/inserter/block-patterns-explorer/sidebar.js +0 -15
  53. package/src/components/inserter/block-patterns-filter.js +183 -0
  54. package/src/components/inserter/block-patterns-tab.js +106 -58
  55. package/src/components/inserter/hooks/use-patterns-paging.js +12 -1
  56. package/src/components/inserter/style.scss +13 -5
  57. package/src/components/inspector-controls-tabs/styles-tab.js +1 -1
  58. package/src/hooks/background.js +57 -46
  59. package/src/hooks/background.scss +36 -18
  60. package/src/hooks/block-rename-ui.js +1 -0
  61. package/src/store/private-selectors.js +7 -3
  62. package/build/components/inserter/block-patterns-source-filter.js +0 -54
  63. package/build/components/inserter/block-patterns-source-filter.js.map +0 -1
  64. package/build/components/inserter/block-patterns-sync-filter.js +0 -46
  65. package/build/components/inserter/block-patterns-sync-filter.js.map +0 -1
  66. package/build-module/components/inserter/block-patterns-source-filter.js +0 -44
  67. package/build-module/components/inserter/block-patterns-source-filter.js.map +0 -1
  68. package/build-module/components/inserter/block-patterns-sync-filter.js +0 -38
  69. package/build-module/components/inserter/block-patterns-sync-filter.js.map +0 -1
  70. package/src/components/inserter/block-patterns-source-filter.js +0 -40
  71. package/src/components/inserter/block-patterns-sync-filter.js +0 -35
@@ -43,7 +43,8 @@ function RenameModal({
43
43
  overlayClassName: "block-editor-block-rename-modal",
44
44
  aria: {
45
45
  describedby: dialogDescription
46
- }
46
+ },
47
+ focusOnMount: "firstContentElement"
47
48
  }, createElement("p", {
48
49
  id: dialogDescription
49
50
  }, __('Enter a custom name for this block.')), createElement("form", {
@@ -1 +1 @@
1
- {"version":3,"names":["createHigherOrderComponent","useInstanceId","addFilter","__","sprintf","getBlockSupport","MenuItem","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useState","speak","BlockSettingsMenuControls","useBlockDisplayInformation","InspectorControls","emptyString","testString","trim","length","RenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","createElement","title","onRequestClose","overlayClassName","aria","describedby","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type","BlockRenameControl","props","renamingBlock","setRenamingBlock","clientId","customName","blockInformation","Fragment","group","selectedClientIds","canRename","newName","undefined","withBlockRenameControl","BlockEdit","name","attributes","setAttributes","metaDataSupport","supportsBlockNaming","metadata","key"],"sources":["@wordpress/block-editor/src/hooks/block-rename-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockDisplayInformation,\n\tInspectorControls,\n} from '../components';\n\nconst emptyString = ( testString ) => testString?.trim()?.length === 0;\n\nfunction RenameModal( { blockName, originalBlockName, onClose, onSave } ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = emptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %1$s: type of update (either reset of changed). %2$s: new name/label for the block */\n\t\t\t\t__( 'Block name %1$s to: \"%2$s\".' ),\n\t\t\t\tnameIsOriginal || nameIsEmpty ? __( 'reset' ) : __( 'changed' ),\n\t\t\t\teditedBlockName\n\t\t\t),\n\t\t\t'assertive'\n\t\t);\n\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={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.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=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\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\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{ __( 'Save' ) }\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\nfunction BlockRenameControl( props ) {\n\tconst [ renamingBlock, setRenamingBlock ] = useState( false );\n\n\tconst { clientId, customName, onChange } = props;\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\tvalue={ customName || '' }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t// Only enabled for single selections.\n\t\t\t\t\tconst canRename =\n\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\tclientId === selectedClientIds[ 0 ];\n\n\t\t\t\t\t// This check ensures the `BlockSettingsMenuControls` fill\n\t\t\t\t\t// doesn't render multiple times and also that it renders for\n\t\t\t\t\t// the block from which the menu was triggered.\n\t\t\t\t\tif ( ! canRename ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenamingBlock( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-expanded={ renamingBlock }\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t{ renamingBlock && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tblockName={ customName || '' }\n\t\t\t\t\toriginalBlockName={ blockInformation?.title }\n\t\t\t\t\tonClose={ () => setRenamingBlock( false ) }\n\t\t\t\t\tonSave={ ( newName ) => {\n\t\t\t\t\t\t// If the new value is the block's original name (e.g. `Group`)\n\t\t\t\t\t\t// or it is an empty string then assume the intent is to reset\n\t\t\t\t\t\t// the value. Therefore reset the metadata.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnewName === blockInformation?.title ||\n\t\t\t\t\t\t\temptyString( newName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewName = undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( newName );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const withBlockRenameControl = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name, attributes, setAttributes } = props;\n\n\t\tconst metaDataSupport = getBlockSupport(\n\t\t\tname,\n\t\t\t'__experimentalMetadata',\n\t\t\tfalse\n\t\t);\n\n\t\tconst supportsBlockNaming = !! (\n\t\t\ttrue === metaDataSupport || metaDataSupport?.name\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ supportsBlockNaming && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockRenameControl\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tcustomName={ attributes?.metadata?.name }\n\t\t\t\t\t\t\tonChange={ ( newName ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t...( attributes?.metadata &&\n\t\t\t\t\t\t\t\t\t\t\tattributes?.metadata ),\n\t\t\t\t\t\t\t\t\t\tname: newName,\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/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/block-rename-ui/with-block-rename-control',\n\twithBlockRenameControl\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,0BAA0B,EAAEC,aAAa,QAAQ,oBAAoB;AAC9E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,QAAQ,EACRC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,EACNC,WAAW,EACXC,KAAK,QACC,uBAAuB;AAC9B,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,QAAQ,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KAAK;EAE3D,MAAMiB,eAAe,GAAG3E,eAAe,CACtCwE,IAAI,EACJ,wBAAwB,EACxB,KACD,CAAC;EAED,MAAMI,mBAAmB,GAAG,CAAC,EAC5B,IAAI,KAAKD,eAAe,IAAIA,eAAe,EAAEH,IAAI,CACjD;EAED,OACCrC,aAAA,CAAA6B,QAAA,QACGY,mBAAmB,IACpBzC,aAAA,CAAA6B,QAAA,QACC7B,aAAA,CAACsB,kBAAkB;IAClBI,QAAQ,EAAGA,QAAU;IACrBC,UAAU,EAAGW,UAAU,EAAEI,QAAQ,EAAEL,IAAM;IACzCrB,QAAQ,EAAKiB,OAAO,IAAM;MACzBM,aAAa,CAAE;QACdG,QAAQ,EAAE;UACT,IAAKJ,UAAU,EAAEI,QAAQ,IACxBJ,UAAU,EAAEI,QAAQ,CAAE;UACvBL,IAAI,EAAEJ;QACP;MACD,CAAE,CAAC;IACJ;EAAG,CACH,CACA,CACF,EAEDjC,aAAA,CAACoC,SAAS;IAACO,GAAG,EAAC,MAAM;IAAA,GAAMpB;EAAK,CAAI,CACnC,CAAC;AAEL,CAAC,EACD,qBACD,CAAC;AAED7D,SAAS,CACR,kBAAkB,EAClB,gDAAgD,EAChDyE,sBACD,CAAC"}
1
+ {"version":3,"names":["createHigherOrderComponent","useInstanceId","addFilter","__","sprintf","getBlockSupport","MenuItem","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useState","speak","BlockSettingsMenuControls","useBlockDisplayInformation","InspectorControls","emptyString","testString","trim","length","RenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","createElement","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type","BlockRenameControl","props","renamingBlock","setRenamingBlock","clientId","customName","blockInformation","Fragment","group","selectedClientIds","canRename","newName","undefined","withBlockRenameControl","BlockEdit","name","attributes","setAttributes","metaDataSupport","supportsBlockNaming","metadata","key"],"sources":["@wordpress/block-editor/src/hooks/block-rename-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockDisplayInformation,\n\tInspectorControls,\n} from '../components';\n\nconst emptyString = ( testString ) => testString?.trim()?.length === 0;\n\nfunction RenameModal( { blockName, originalBlockName, onClose, onSave } ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = emptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %1$s: type of update (either reset of changed). %2$s: new name/label for the block */\n\t\t\t\t__( 'Block name %1$s to: \"%2$s\".' ),\n\t\t\t\tnameIsOriginal || nameIsEmpty ? __( 'reset' ) : __( 'changed' ),\n\t\t\t\teditedBlockName\n\t\t\t),\n\t\t\t'assertive'\n\t\t);\n\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={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.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=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\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\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{ __( 'Save' ) }\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\nfunction BlockRenameControl( props ) {\n\tconst [ renamingBlock, setRenamingBlock ] = useState( false );\n\n\tconst { clientId, customName, onChange } = props;\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\tvalue={ customName || '' }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t// Only enabled for single selections.\n\t\t\t\t\tconst canRename =\n\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\tclientId === selectedClientIds[ 0 ];\n\n\t\t\t\t\t// This check ensures the `BlockSettingsMenuControls` fill\n\t\t\t\t\t// doesn't render multiple times and also that it renders for\n\t\t\t\t\t// the block from which the menu was triggered.\n\t\t\t\t\tif ( ! canRename ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenamingBlock( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-expanded={ renamingBlock }\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t{ renamingBlock && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tblockName={ customName || '' }\n\t\t\t\t\toriginalBlockName={ blockInformation?.title }\n\t\t\t\t\tonClose={ () => setRenamingBlock( false ) }\n\t\t\t\t\tonSave={ ( newName ) => {\n\t\t\t\t\t\t// If the new value is the block's original name (e.g. `Group`)\n\t\t\t\t\t\t// or it is an empty string then assume the intent is to reset\n\t\t\t\t\t\t// the value. Therefore reset the metadata.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnewName === blockInformation?.title ||\n\t\t\t\t\t\t\temptyString( newName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewName = undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( newName );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const withBlockRenameControl = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name, attributes, setAttributes } = props;\n\n\t\tconst metaDataSupport = getBlockSupport(\n\t\t\tname,\n\t\t\t'__experimentalMetadata',\n\t\t\tfalse\n\t\t);\n\n\t\tconst supportsBlockNaming = !! (\n\t\t\ttrue === metaDataSupport || metaDataSupport?.name\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ supportsBlockNaming && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockRenameControl\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tcustomName={ attributes?.metadata?.name }\n\t\t\t\t\t\t\tonChange={ ( newName ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t...( attributes?.metadata &&\n\t\t\t\t\t\t\t\t\t\t\tattributes?.metadata ),\n\t\t\t\t\t\t\t\t\t\tname: newName,\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/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/block-rename-ui/with-block-rename-control',\n\twithBlockRenameControl\n);\n"],"mappings":";AAAA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eDisabled = createSelector((state, clientId) => {
42
42
  const isChildSubtreeDisabled = childClientId => {
43
- const mode = state.blockEditingModes.get(childClientId);
44
- return (mode === undefined || mode === 'disabled') && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled);
43
+ return getBlockEditingMode(state, childClientId) === 'disabled' && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled);
45
44
  };
46
45
  return getBlockEditingMode(state, clientId) === 'disabled' && getBlockOrder(state, clientId).every(isChildSubtreeDisabled);
47
- }, state => [state.blockEditingModes, state.blocks.parents]);
46
+ }, state => [state.blocks.parents, state.blocks.order, state.blockEditingModes, state.blockListSettings]);
48
47
 
49
48
  /**
50
49
  * Returns a tree of block objects with only clientID and innerBlocks set.
@@ -1 +1 @@
1
- {"version":3,"names":["createSelector","getBlockOrder","getBlockParents","getBlockEditingMode","isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","isBlockSubtreeDisabled","clientId","isChildSubtreeDisabled","childClientId","mode","blockEditingModes","get","undefined","every","blocks","parents","getEnabledClientIdsTree","rootClientId","flatMap","innerBlocks","order","settings","templateLock","blockListSettings","getEnabledBlockParents","ascending","filter","parent","getRemovalPromptData","removalPromptData","getBlockRemovalRules","blockRemovalRules","getOpenedBlockSettingsMenu","openedBlockSettingsMenu","getStyleOverrides","styleOverrides"],"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockOrder,\n\tgetBlockParents,\n\tgetBlockEditingMode,\n} from './selectors';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\n/**\n * Returns true if the block with the given client ID and all of its descendants\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block and its descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = createSelector(\n\t( state, clientId ) => {\n\t\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\t\tconst mode = state.blockEditingModes.get( childClientId );\n\t\t\treturn (\n\t\t\t\t( mode === undefined || mode === 'disabled' ) &&\n\t\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\t\tisChildSubtreeDisabled\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, clientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, clientId ).every( isChildSubtreeDisabled )\n\t\t);\n\t},\n\t( state ) => [ state.blockEditingModes, state.blocks.parents ]\n);\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createSelector(\n\t( state, rootClientId = '' ) => {\n\t\treturn getBlockOrder( state, rootClientId ).flatMap( ( clientId ) => {\n\t\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tinnerBlocks: getEnabledClientIdsTree( state, clientId ),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn getEnabledClientIdsTree( state, clientId );\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function getBlockRemovalRules( state ) {\n\treturn state.blockRemovalRules;\n}\n\n/**\n * Returns the client ID of the block settings menu that is currently open.\n *\n * @param {Object} state Global application state.\n * @return {string|null} The client ID of the block menu that is currently open.\n */\nexport function getOpenedBlockSettingsMenu( state ) {\n\treturn state.openedBlockSettingsMenu;\n}\n\n/**\n * Returns all style overrides, intended to be merged with global editor styles.\n *\n * @param {Object} state Global application state.\n *\n * @return {Map} A map of style IDs to style overrides.\n */\nexport function getStyleOverrides( state ) {\n\treturn state.styleOverrides;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAc,MAAM,QAAQ;;AAEnC;AACA;AACA;AACA,SACCC,aAAa,EACbC,eAAe,EACfC,mBAAmB,QACb,aAAa;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAEC,KAAK,EAAG;EAC/C,OAAOA,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B"}
1
+ {"version":3,"names":["createSelector","getBlockOrder","getBlockParents","getBlockEditingMode","isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","isBlockSubtreeDisabled","clientId","isChildSubtreeDisabled","childClientId","every","blocks","parents","order","blockEditingModes","blockListSettings","getEnabledClientIdsTree","rootClientId","flatMap","innerBlocks","settings","templateLock","getEnabledBlockParents","ascending","filter","parent","getRemovalPromptData","removalPromptData","getBlockRemovalRules","blockRemovalRules","getOpenedBlockSettingsMenu","openedBlockSettingsMenu","getStyleOverrides","styleOverrides"],"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockOrder,\n\tgetBlockParents,\n\tgetBlockEditingMode,\n} from './selectors';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\n/**\n * Returns true if the block with the given client ID and all of its descendants\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block and its descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = createSelector(\n\t( state, clientId ) => {\n\t\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\t\treturn (\n\t\t\t\tgetBlockEditingMode( state, childClientId ) === 'disabled' &&\n\t\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\t\tisChildSubtreeDisabled\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, clientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, clientId ).every( isChildSubtreeDisabled )\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blocks.order,\n\t\tstate.blockEditingModes,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createSelector(\n\t( state, rootClientId = '' ) => {\n\t\treturn getBlockOrder( state, rootClientId ).flatMap( ( clientId ) => {\n\t\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tinnerBlocks: getEnabledClientIdsTree( state, clientId ),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn getEnabledClientIdsTree( state, clientId );\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function getBlockRemovalRules( state ) {\n\treturn state.blockRemovalRules;\n}\n\n/**\n * Returns the client ID of the block settings menu that is currently open.\n *\n * @param {Object} state Global application state.\n * @return {string|null} The client ID of the block menu that is currently open.\n */\nexport function getOpenedBlockSettingsMenu( state ) {\n\treturn state.openedBlockSettingsMenu;\n}\n\n/**\n * Returns all style overrides, intended to be merged with global editor styles.\n *\n * @param {Object} state Global application state.\n *\n * @return {Map} A map of style IDs to style overrides.\n */\nexport function getStyleOverrides( state ) {\n\treturn state.styleOverrides;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAc,MAAM,QAAQ;;AAEnC;AACA;AACA;AACA,SACCC,aAAa,EACbC,eAAe,EACfC,mBAAmB,QACb,aAAa;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAEC,KAAK,EAAG;EAC/C,OAAOA,KAAK,CAACD,sBAAsB;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,8BAA8BA,CAAED,KAAK,EAAG;EACvD,OAAOA,KAAK,EAAEE,iBAAiB,EAAEC,SAAS;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGT,cAAc,CACnD,CAAEK,KAAK,EAAEK,QAAQ,KAAM;EACtB,MAAMC,sBAAsB,GAAKC,aAAa,IAAM;IACnD,OACCT,mBAAmB,CAAEE,KAAK,EAAEO,aAAc,CAAC,KAAK,UAAU,IAC1DX,aAAa,CAAEI,KAAK,EAAEO,aAAc,CAAC,CA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,CAAC,CAACC,MAAM,CACxDC,MAAM,IAAMzB,mBAAmB,CAAEE,KAAK,EAAEuB,MAAO,CAAC,KAAK,UACxD,CAAC;AACF,CAAC,EACCvB,KAAK,IAAM,CACZA,KAAK,CAACS,MAAM,CAACC,OAAO,EACpBV,KAAK,CAACY,iBAAiB,EACvBZ,KAAK,CAACkB,QAAQ,CAACC,YAAY,EAC3BnB,KAAK,CAACa,iBAAiB,CAEzB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,oBAAoBA,CAAExB,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACyB,iBAAiB;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAE1B,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAAC2B,iBAAiB;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CAAE5B,KAAK,EAAG;EACnD,OAAOA,KAAK,CAAC6B,uBAAuB;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAE9B,KAAK,EAAG;EAC1C,OAAOA,KAAK,CAAC+B,cAAc;AAC5B"}
@@ -903,20 +903,21 @@
903
903
  fill: var(--wp-block-synced-color);
904
904
  }
905
905
 
906
- .block-editor-patterns__grid-pagination {
906
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination {
907
907
  border-top: 1px solid #2f2f2f;
908
908
  padding: 4px;
909
+ justify-content: center;
909
910
  }
910
- .block-editor-patterns__grid-pagination .components-button.is-tertiary {
911
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination .components-button.is-tertiary {
911
912
  width: auto;
912
913
  height: 32px;
913
914
  justify-content: center;
914
915
  }
915
- .block-editor-patterns__grid-pagination .components-button.is-tertiary:disabled {
916
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination .components-button.is-tertiary:disabled {
916
917
  color: #949494;
917
918
  background: none;
918
919
  }
919
- .block-editor-patterns__grid-pagination .components-button.is-tertiary:hover:not(:disabled) {
920
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination .components-button.is-tertiary:hover:not(:disabled) {
920
921
  color: #fff;
921
922
  background-color: #757575;
922
923
  }
@@ -3199,51 +3200,68 @@
3199
3200
  flex-direction: row;
3200
3201
  }
3201
3202
 
3202
- .block-editor-hooks__background__inspector-upload-container {
3203
+ .block-editor-hooks__background__inspector-media-replace-container {
3203
3204
  position: relative;
3204
3205
  }
3205
- .block-editor-hooks__background__inspector-upload-container .components-drop-zone__content-icon {
3206
+ .block-editor-hooks__background__inspector-media-replace-container .components-drop-zone__content-icon {
3206
3207
  display: none;
3207
3208
  }
3208
-
3209
- .block-editor-hooks__background__inspector-upload-container button.components-button,
3210
3209
  .block-editor-hooks__background__inspector-media-replace-container button.components-button {
3211
3210
  color: #1e1e1e;
3212
- box-shadow: inset 0 0 0 1px #ccc;
3211
+ box-shadow: inset 0 0 0 1px #ddd;
3213
3212
  width: 100%;
3214
3213
  display: block;
3215
3214
  height: 40px;
3216
3215
  }
3217
- .block-editor-hooks__background__inspector-upload-container button.components-button:hover,
3218
3216
  .block-editor-hooks__background__inspector-media-replace-container button.components-button:hover {
3219
3217
  color: var(--wp-admin-theme-color);
3220
3218
  }
3221
- .block-editor-hooks__background__inspector-upload-container button.components-button:focus,
3222
3219
  .block-editor-hooks__background__inspector-media-replace-container button.components-button:focus {
3223
3220
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
3224
3221
  }
3225
- .block-editor-hooks__background__inspector-upload-container .block-editor-hooks__background__inspector-media-replace-title,
3226
3222
  .block-editor-hooks__background__inspector-media-replace-container .block-editor-hooks__background__inspector-media-replace-title {
3227
3223
  word-break: break-all;
3228
3224
  white-space: normal;
3229
3225
  text-align: start;
3230
3226
  text-align-last: center;
3231
3227
  }
3232
-
3233
3228
  .block-editor-hooks__background__inspector-media-replace-container .components-dropdown {
3234
3229
  display: block;
3235
3230
  }
3236
- .block-editor-hooks__background__inspector-media-replace-container img {
3237
- width: 20px;
3238
- min-width: 20px;
3239
- aspect-ratio: 1;
3240
- box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
3231
+
3232
+ .block-editor-hooks__background__inspector-image-indicator-wrapper {
3233
+ background: #fff linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
3241
3234
  border-radius: 50% !important;
3235
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
3236
+ display: block;
3237
+ width: 20px;
3238
+ height: 20px;
3239
+ flex: none;
3242
3240
  }
3243
- .block-editor-hooks__background__inspector-media-replace-container .block-editor-hooks__background__inspector-readonly-logo-preview {
3244
- padding: 6px 12px;
3245
- display: flex;
3246
- height: 40px;
3241
+ .block-editor-hooks__background__inspector-image-indicator-wrapper.has-image {
3242
+ background: #fff;
3243
+ }
3244
+
3245
+ .block-editor-hooks__background__inspector-image-indicator {
3246
+ background-size: cover;
3247
+ border-radius: 50%;
3248
+ width: 20px;
3249
+ height: 20px;
3250
+ display: block;
3251
+ position: relative;
3252
+ }
3253
+
3254
+ .block-editor-hooks__background__inspector-image-indicator::after {
3255
+ content: "";
3256
+ position: absolute;
3257
+ top: -1px;
3258
+ right: -1px;
3259
+ bottom: -1px;
3260
+ left: -1px;
3261
+ border-radius: 50%;
3262
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
3263
+ border: 1px solid transparent;
3264
+ box-sizing: inherit;
3247
3265
  }
3248
3266
 
3249
3267
  .border-block-support-panel .single-column {
@@ -3833,13 +3851,10 @@
3833
3851
  border-right: 1px solid #e0e0e0;
3834
3852
  border-left: 1px solid #e0e0e0;
3835
3853
  position: absolute;
3836
- padding: 32px 24px;
3837
3854
  top: 0;
3838
3855
  right: 0;
3839
3856
  height: 100%;
3840
3857
  width: 100%;
3841
- overflow-y: auto;
3842
- scrollbar-gutter: stable both-edges;
3843
3858
  }
3844
3859
  @media (min-width: 782px) {
3845
3860
  .block-editor-inserter__patterns-category-dialog {
@@ -3849,7 +3864,10 @@
3849
3864
  }
3850
3865
  }
3851
3866
  .block-editor-inserter__patterns-category-dialog .block-editor-block-patterns-list {
3852
- margin-top: 24px;
3867
+ overflow-y: auto;
3868
+ flex-grow: 1;
3869
+ height: 100%;
3870
+ padding: 32px 24px;
3853
3871
  }
3854
3872
 
3855
3873
  .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
@@ -3861,12 +3879,21 @@
3861
3879
 
3862
3880
  .block-editor-inserter__patterns-category-panel {
3863
3881
  padding: 0 16px;
3882
+ display: flex;
3883
+ flex-direction: column;
3884
+ height: 100%;
3864
3885
  }
3865
3886
  @media (min-width: 782px) {
3866
3887
  .block-editor-inserter__patterns-category-panel {
3867
3888
  padding: 0;
3868
3889
  }
3869
3890
  }
3891
+ .block-editor-inserter__patterns-category-panel .block-editor-inserter__patterns-category-panel-header {
3892
+ padding: 16px 24px;
3893
+ }
3894
+ .block-editor-inserter__patterns-category-panel .block-editor-inserter__patterns-category-no-results {
3895
+ margin-top: 24px;
3896
+ }
3870
3897
 
3871
3898
  .block-editor-inserter__preview-content {
3872
3899
  min-height: 144px;
@@ -903,20 +903,21 @@
903
903
  fill: var(--wp-block-synced-color);
904
904
  }
905
905
 
906
- .block-editor-patterns__grid-pagination {
906
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination {
907
907
  border-top: 1px solid #2f2f2f;
908
908
  padding: 4px;
909
+ justify-content: center;
909
910
  }
910
- .block-editor-patterns__grid-pagination .components-button.is-tertiary {
911
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination .components-button.is-tertiary {
911
912
  width: auto;
912
913
  height: 32px;
913
914
  justify-content: center;
914
915
  }
915
- .block-editor-patterns__grid-pagination .components-button.is-tertiary:disabled {
916
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination .components-button.is-tertiary:disabled {
916
917
  color: #949494;
917
918
  background: none;
918
919
  }
919
- .block-editor-patterns__grid-pagination .components-button.is-tertiary:hover:not(:disabled) {
920
+ .block-editor-patterns__grid-pagination-wrapper .block-editor-patterns__grid-pagination .components-button.is-tertiary:hover:not(:disabled) {
920
921
  color: #fff;
921
922
  background-color: #757575;
922
923
  }
@@ -3200,51 +3201,68 @@
3200
3201
  flex-direction: row;
3201
3202
  }
3202
3203
 
3203
- .block-editor-hooks__background__inspector-upload-container {
3204
+ .block-editor-hooks__background__inspector-media-replace-container {
3204
3205
  position: relative;
3205
3206
  }
3206
- .block-editor-hooks__background__inspector-upload-container .components-drop-zone__content-icon {
3207
+ .block-editor-hooks__background__inspector-media-replace-container .components-drop-zone__content-icon {
3207
3208
  display: none;
3208
3209
  }
3209
-
3210
- .block-editor-hooks__background__inspector-upload-container button.components-button,
3211
3210
  .block-editor-hooks__background__inspector-media-replace-container button.components-button {
3212
3211
  color: #1e1e1e;
3213
- box-shadow: inset 0 0 0 1px #ccc;
3212
+ box-shadow: inset 0 0 0 1px #ddd;
3214
3213
  width: 100%;
3215
3214
  display: block;
3216
3215
  height: 40px;
3217
3216
  }
3218
- .block-editor-hooks__background__inspector-upload-container button.components-button:hover,
3219
3217
  .block-editor-hooks__background__inspector-media-replace-container button.components-button:hover {
3220
3218
  color: var(--wp-admin-theme-color);
3221
3219
  }
3222
- .block-editor-hooks__background__inspector-upload-container button.components-button:focus,
3223
3220
  .block-editor-hooks__background__inspector-media-replace-container button.components-button:focus {
3224
3221
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
3225
3222
  }
3226
- .block-editor-hooks__background__inspector-upload-container .block-editor-hooks__background__inspector-media-replace-title,
3227
3223
  .block-editor-hooks__background__inspector-media-replace-container .block-editor-hooks__background__inspector-media-replace-title {
3228
3224
  word-break: break-all;
3229
3225
  white-space: normal;
3230
3226
  text-align: start;
3231
3227
  text-align-last: center;
3232
3228
  }
3233
-
3234
3229
  .block-editor-hooks__background__inspector-media-replace-container .components-dropdown {
3235
3230
  display: block;
3236
3231
  }
3237
- .block-editor-hooks__background__inspector-media-replace-container img {
3238
- width: 20px;
3239
- min-width: 20px;
3240
- aspect-ratio: 1;
3241
- box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
3232
+
3233
+ .block-editor-hooks__background__inspector-image-indicator-wrapper {
3234
+ background: #fff linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
3242
3235
  border-radius: 50% !important;
3236
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
3237
+ display: block;
3238
+ width: 20px;
3239
+ height: 20px;
3240
+ flex: none;
3243
3241
  }
3244
- .block-editor-hooks__background__inspector-media-replace-container .block-editor-hooks__background__inspector-readonly-logo-preview {
3245
- padding: 6px 12px;
3246
- display: flex;
3247
- height: 40px;
3242
+ .block-editor-hooks__background__inspector-image-indicator-wrapper.has-image {
3243
+ background: #fff;
3244
+ }
3245
+
3246
+ .block-editor-hooks__background__inspector-image-indicator {
3247
+ background-size: cover;
3248
+ border-radius: 50%;
3249
+ width: 20px;
3250
+ height: 20px;
3251
+ display: block;
3252
+ position: relative;
3253
+ }
3254
+
3255
+ .block-editor-hooks__background__inspector-image-indicator::after {
3256
+ content: "";
3257
+ position: absolute;
3258
+ top: -1px;
3259
+ left: -1px;
3260
+ bottom: -1px;
3261
+ right: -1px;
3262
+ border-radius: 50%;
3263
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
3264
+ border: 1px solid transparent;
3265
+ box-sizing: inherit;
3248
3266
  }
3249
3267
 
3250
3268
  .border-block-support-panel .single-column {
@@ -3834,13 +3852,10 @@
3834
3852
  border-left: 1px solid #e0e0e0;
3835
3853
  border-right: 1px solid #e0e0e0;
3836
3854
  position: absolute;
3837
- padding: 32px 24px;
3838
3855
  top: 0;
3839
3856
  left: 0;
3840
3857
  height: 100%;
3841
3858
  width: 100%;
3842
- overflow-y: auto;
3843
- scrollbar-gutter: stable both-edges;
3844
3859
  }
3845
3860
  @media (min-width: 782px) {
3846
3861
  .block-editor-inserter__patterns-category-dialog {
@@ -3850,7 +3865,10 @@
3850
3865
  }
3851
3866
  }
3852
3867
  .block-editor-inserter__patterns-category-dialog .block-editor-block-patterns-list {
3853
- margin-top: 24px;
3868
+ overflow-y: auto;
3869
+ flex-grow: 1;
3870
+ height: 100%;
3871
+ padding: 32px 24px;
3854
3872
  }
3855
3873
 
3856
3874
  .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
@@ -3862,12 +3880,21 @@
3862
3880
 
3863
3881
  .block-editor-inserter__patterns-category-panel {
3864
3882
  padding: 0 16px;
3883
+ display: flex;
3884
+ flex-direction: column;
3885
+ height: 100%;
3865
3886
  }
3866
3887
  @media (min-width: 782px) {
3867
3888
  .block-editor-inserter__patterns-category-panel {
3868
3889
  padding: 0;
3869
3890
  }
3870
3891
  }
3892
+ .block-editor-inserter__patterns-category-panel .block-editor-inserter__patterns-category-panel-header {
3893
+ padding: 16px 24px;
3894
+ }
3895
+ .block-editor-inserter__patterns-category-panel .block-editor-inserter__patterns-category-no-results {
3896
+ margin-top: 24px;
3897
+ }
3871
3898
 
3872
3899
  .block-editor-inserter__preview-content {
3873
3900
  min-height: 144px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.10.0",
3
+ "version": "12.10.1",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -35,36 +35,36 @@
35
35
  "@emotion/react": "^11.7.1",
36
36
  "@emotion/styled": "^11.6.0",
37
37
  "@react-spring/web": "^9.4.5",
38
- "@wordpress/a11y": "^3.42.0",
39
- "@wordpress/api-fetch": "^6.39.0",
40
- "@wordpress/blob": "^3.42.0",
41
- "@wordpress/blocks": "^12.19.0",
42
- "@wordpress/commands": "^0.13.0",
43
- "@wordpress/components": "^25.8.0",
44
- "@wordpress/compose": "^6.19.0",
45
- "@wordpress/data": "^9.12.0",
46
- "@wordpress/date": "^4.42.0",
47
- "@wordpress/deprecated": "^3.42.0",
48
- "@wordpress/dom": "^3.42.0",
49
- "@wordpress/element": "^5.19.0",
50
- "@wordpress/escape-html": "^2.42.0",
51
- "@wordpress/hooks": "^3.42.0",
52
- "@wordpress/html-entities": "^3.42.0",
53
- "@wordpress/i18n": "^4.42.0",
54
- "@wordpress/icons": "^9.33.0",
55
- "@wordpress/is-shallow-equal": "^4.42.0",
56
- "@wordpress/keyboard-shortcuts": "^4.19.0",
57
- "@wordpress/keycodes": "^3.42.0",
58
- "@wordpress/notices": "^4.10.0",
59
- "@wordpress/preferences": "^3.19.0",
60
- "@wordpress/private-apis": "^0.24.0",
61
- "@wordpress/rich-text": "^6.19.0",
62
- "@wordpress/shortcode": "^3.42.0",
63
- "@wordpress/style-engine": "^1.25.0",
64
- "@wordpress/token-list": "^2.42.0",
65
- "@wordpress/url": "^3.43.0",
66
- "@wordpress/warning": "^2.42.0",
67
- "@wordpress/wordcount": "^3.42.0",
38
+ "@wordpress/a11y": "^3.42.1",
39
+ "@wordpress/api-fetch": "^6.39.1",
40
+ "@wordpress/blob": "^3.42.1",
41
+ "@wordpress/blocks": "^12.19.1",
42
+ "@wordpress/commands": "^0.13.1",
43
+ "@wordpress/components": "^25.8.1",
44
+ "@wordpress/compose": "^6.19.1",
45
+ "@wordpress/data": "^9.12.1",
46
+ "@wordpress/date": "^4.42.1",
47
+ "@wordpress/deprecated": "^3.42.1",
48
+ "@wordpress/dom": "^3.42.1",
49
+ "@wordpress/element": "^5.19.1",
50
+ "@wordpress/escape-html": "^2.42.1",
51
+ "@wordpress/hooks": "^3.42.1",
52
+ "@wordpress/html-entities": "^3.42.1",
53
+ "@wordpress/i18n": "^4.42.1",
54
+ "@wordpress/icons": "^9.33.1",
55
+ "@wordpress/is-shallow-equal": "^4.42.1",
56
+ "@wordpress/keyboard-shortcuts": "^4.19.1",
57
+ "@wordpress/keycodes": "^3.42.1",
58
+ "@wordpress/notices": "^4.10.1",
59
+ "@wordpress/preferences": "^3.19.1",
60
+ "@wordpress/private-apis": "^0.24.1",
61
+ "@wordpress/rich-text": "^6.19.1",
62
+ "@wordpress/shortcode": "^3.42.1",
63
+ "@wordpress/style-engine": "^1.25.1",
64
+ "@wordpress/token-list": "^2.42.1",
65
+ "@wordpress/url": "^3.43.1",
66
+ "@wordpress/warning": "^2.42.1",
67
+ "@wordpress/wordcount": "^3.42.1",
68
68
  "change-case": "^4.1.2",
69
69
  "classnames": "^2.3.1",
70
70
  "colord": "^2.7.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "cc35f517ed017ab7131319af3e87c359e8de175d"
89
+ "gitHead": "4987d16acb5c41b62704dc4f88225acb97ddd698"
90
90
  }
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useState } from '@wordpress/element';
9
+ import { useState, forwardRef } from '@wordpress/element';
10
10
  import {
11
11
  VisuallyHidden,
12
12
  __unstableComposite as Composite,
@@ -24,6 +24,7 @@ import { Icon, symbol } from '@wordpress/icons';
24
24
  */
25
25
  import BlockPreview from '../block-preview';
26
26
  import InserterDraggableBlocks from '../inserter-draggable-blocks';
27
+ import BlockPatternsPaging from '../block-patterns-paging';
27
28
 
28
29
  const WithToolTip = ( { showTooltip, title, children } ) => {
29
30
  if ( showTooltip ) {
@@ -140,16 +141,20 @@ function BlockPatternPlaceholder() {
140
141
  );
141
142
  }
142
143
 
143
- function BlockPatternList( {
144
- isDraggable,
145
- blockPatterns,
146
- shownPatterns,
147
- onHover,
148
- onClickPattern,
149
- orientation,
150
- label = __( 'Block Patterns' ),
151
- showTitlesAsTooltip,
152
- } ) {
144
+ function BlockPatternList(
145
+ {
146
+ isDraggable,
147
+ blockPatterns,
148
+ shownPatterns,
149
+ onHover,
150
+ onClickPattern,
151
+ orientation,
152
+ label = __( 'Block Patterns' ),
153
+ showTitlesAsTooltip,
154
+ pagingProps,
155
+ },
156
+ ref
157
+ ) {
153
158
  const composite = useCompositeState( { orientation } );
154
159
  return (
155
160
  <Composite
@@ -157,6 +162,7 @@ function BlockPatternList( {
157
162
  role="listbox"
158
163
  className="block-editor-block-patterns-list"
159
164
  aria-label={ label }
165
+ ref={ ref }
160
166
  >
161
167
  { blockPatterns.map( ( pattern ) => {
162
168
  const isShown = shownPatterns.includes( pattern );
@@ -174,8 +180,11 @@ function BlockPatternList( {
174
180
  <BlockPatternPlaceholder key={ pattern.name } />
175
181
  );
176
182
  } ) }
183
+ { pagingProps && pagingProps.numPages > 1 && (
184
+ <BlockPatternsPaging { ...pagingProps } />
185
+ ) }
177
186
  </Composite>
178
187
  );
179
188
  }
180
189
 
181
- export default BlockPatternList;
190
+ export default forwardRef( BlockPatternList );
@@ -16,7 +16,7 @@ export default function Pagination( {
16
16
  totalItems,
17
17
  } ) {
18
18
  return (
19
- <VStack>
19
+ <VStack className="block-editor-patterns__grid-pagination-wrapper">
20
20
  <Text variant="muted">
21
21
  {
22
22
  // translators: %s: Total number of patterns.
@@ -1,20 +1,23 @@
1
- .block-editor-patterns__grid-pagination {
2
- border-top: 1px solid $gray-800;
3
- padding: $grid-unit-05;
1
+ .block-editor-patterns__grid-pagination-wrapper {
4
2
 
5
- .components-button.is-tertiary {
6
- width: auto;
7
- height: $button-size-compact;
3
+ .block-editor-patterns__grid-pagination {
4
+ border-top: 1px solid $gray-800;
5
+ padding: $grid-unit-05;
8
6
  justify-content: center;
7
+ .components-button.is-tertiary {
8
+ width: auto;
9
+ height: $button-size-compact;
10
+ justify-content: center;
9
11
 
10
- &:disabled {
11
- color: $gray-600;
12
- background: none;
13
- }
12
+ &:disabled {
13
+ color: $gray-600;
14
+ background: none;
15
+ }
14
16
 
15
- &:hover:not(:disabled) {
16
- color: $white;
17
- background-color: $gray-700;
17
+ &:hover:not(:disabled) {
18
+ color: $white;
19
+ background-color: $gray-700;
20
+ }
18
21
  }
19
22
  }
20
23
  }