@wordpress/block-editor 14.13.0 → 14.14.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 (81) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/background-image-control/index.js +2 -5
  3. package/build/components/background-image-control/index.js.map +1 -1
  4. package/build/components/block-popover/use-popover-scroll.js +2 -1
  5. package/build/components/block-popover/use-popover-scroll.js.map +1 -1
  6. package/build/components/block-settings-menu/block-settings-dropdown.js +26 -6
  7. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  8. package/build/components/iframe/index.js +9 -7
  9. package/build/components/iframe/index.js.map +1 -1
  10. package/build/components/inserter/block-patterns-explorer/index.js +6 -3
  11. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  12. package/build/components/inserter/block-patterns-explorer/pattern-list.js +6 -2
  13. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  14. package/build/components/inserter/block-patterns-tab/index.js +1 -1
  15. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  16. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  17. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  18. package/build/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  19. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  20. package/build/components/inserter/category-tabs/index.js +1 -1
  21. package/build/components/inserter/category-tabs/index.js.map +1 -1
  22. package/build/components/keyboard-shortcuts/index.js +27 -0
  23. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  24. package/build/components/media-placeholder/index.js +2 -1
  25. package/build/components/media-placeholder/index.js.map +1 -1
  26. package/build/components/tool-selector/index.js +1 -1
  27. package/build/components/tool-selector/index.js.map +1 -1
  28. package/build/hooks/layout.js +1 -1
  29. package/build/hooks/layout.js.map +1 -1
  30. package/build/hooks/use-zoom-out.js +1 -12
  31. package/build/hooks/use-zoom-out.js.map +1 -1
  32. package/build-module/components/background-image-control/index.js +2 -5
  33. package/build-module/components/background-image-control/index.js.map +1 -1
  34. package/build-module/components/block-popover/use-popover-scroll.js +2 -1
  35. package/build-module/components/block-popover/use-popover-scroll.js.map +1 -1
  36. package/build-module/components/block-settings-menu/block-settings-dropdown.js +26 -6
  37. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  38. package/build-module/components/iframe/index.js +9 -7
  39. package/build-module/components/iframe/index.js.map +1 -1
  40. package/build-module/components/inserter/block-patterns-explorer/index.js +6 -3
  41. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  42. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +6 -2
  43. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  44. package/build-module/components/inserter/block-patterns-tab/index.js +1 -1
  45. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  46. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  47. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  48. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  49. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  50. package/build-module/components/inserter/category-tabs/index.js +1 -1
  51. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  52. package/build-module/components/keyboard-shortcuts/index.js +27 -0
  53. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  54. package/build-module/components/media-placeholder/index.js +2 -1
  55. package/build-module/components/media-placeholder/index.js.map +1 -1
  56. package/build-module/components/tool-selector/index.js +1 -1
  57. package/build-module/components/tool-selector/index.js.map +1 -1
  58. package/build-module/hooks/layout.js +1 -1
  59. package/build-module/hooks/layout.js.map +1 -1
  60. package/build-module/hooks/use-zoom-out.js +2 -12
  61. package/build-module/hooks/use-zoom-out.js.map +1 -1
  62. package/build-style/style-rtl.css +6 -0
  63. package/build-style/style.css +6 -0
  64. package/package.json +34 -34
  65. package/src/components/background-image-control/index.js +1 -6
  66. package/src/components/block-popover/use-popover-scroll.js +2 -1
  67. package/src/components/block-settings-menu/block-settings-dropdown.js +26 -7
  68. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  69. package/src/components/iframe/index.js +16 -13
  70. package/src/components/inserter/block-patterns-explorer/index.js +6 -4
  71. package/src/components/inserter/block-patterns-explorer/pattern-list.js +5 -1
  72. package/src/components/inserter/block-patterns-tab/index.js +1 -3
  73. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
  74. package/src/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
  75. package/src/components/inserter/category-tabs/index.js +1 -3
  76. package/src/components/inserter/style.scss +5 -0
  77. package/src/components/keyboard-shortcuts/index.js +30 -0
  78. package/src/components/media-placeholder/index.js +1 -0
  79. package/src/components/tool-selector/index.js +1 -1
  80. package/src/hooks/layout.js +1 -1
  81. package/src/hooks/use-zoom-out.js +2 -10
@@ -74,7 +74,7 @@ function ToolSelector(props, ref) {
74
74
  })
75
75
  }), /*#__PURE__*/_jsx("div", {
76
76
  className: "block-editor-tool-selector__help",
77
- children: __('Tools provide different sets of interactions for blocks. Toggle between simplified content tools (Write) and advanced visual editing tools (Design).')
77
+ children: __('Tools provide different sets of interactions for blocks. Choose between simplified content tools (Write) and advanced visual editing tools (Design).')
78
78
  })]
79
79
  })
80
80
  });
@@ -1 +1 @@
1
- {"version":3,"names":["Dropdown","Button","MenuItemsChoice","SVG","Path","NavigableMenu","__","useSelect","useDispatch","forwardRef","Icon","edit","editIcon","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","selectIcon","xmlns","width","height","viewBox","children","d","ToolSelector","props","ref","mode","select","__unstableGetEditorMode","__unstableSetEditorMode","renderToggle","isOpen","onToggle","size","icon","onClick","label","popoverProps","placement","renderContent","className","role","value","onSelect","newMode","choices","info"],"sources":["@wordpress/block-editor/src/components/tool-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdown,\n\tButton,\n\tMenuItemsChoice,\n\tSVG,\n\tPath,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, edit as editIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst selectIcon = (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth=\"24\"\n\t\theight=\"24\"\n\t\tviewBox=\"0 0 24 24\"\n\t>\n\t\t<Path d=\"M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z\" />\n\t</SVG>\n);\n\nfunction ToolSelector( props, ref ) {\n\tconst mode = useSelect(\n\t\t( select ) => select( blockEditorStore ).__unstableGetEditorMode(),\n\t\t[]\n\t);\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\ticon={ mode === 'navigation' ? editIcon : selectIcon }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Tools' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\trenderContent={ () => (\n\t\t\t\t<>\n\t\t\t\t\t<NavigableMenu\n\t\t\t\t\t\tclassName=\"block-editor-tool-selector__menu\"\n\t\t\t\t\t\trole=\"menu\"\n\t\t\t\t\t\taria-label={ __( 'Tools' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tmode === 'navigation' ? 'navigation' : 'edit'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ ( newMode ) => {\n\t\t\t\t\t\t\t\t__unstableSetEditorMode( newMode );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tchoices={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'navigation',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ editIcon } />\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Write' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tinfo: __( 'Focus on content.' ),\n\t\t\t\t\t\t\t\t\t'aria-label': __( 'Write' ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'edit',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ selectIcon }\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Design' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tinfo: __( 'Edit layout and styles.' ),\n\t\t\t\t\t\t\t\t\t'aria-label': __( 'Design' ),\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</NavigableMenu>\n\t\t\t\t\t<div className=\"block-editor-tool-selector__help\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Tools provide different sets of interactions for blocks. Toggle between simplified content tools (Write) and advanced visual editing tools (Design).'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( ToolSelector );\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,MAAM,EACNC,eAAe,EACfC,GAAG,EACHC,IAAI,EACJC,aAAa,QACP,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;;AAEzD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExD,MAAMC,UAAU,gBACfL,IAAA,CAACb,GAAG;EACHmB,KAAK,EAAC,4BAA4B;EAClCC,KAAK,EAAC,IAAI;EACVC,MAAM,EAAC,IAAI;EACXC,OAAO,EAAC,WAAW;EAAAC,QAAA,eAEnBV,IAAA,CAACZ,IAAI;IAACuB,CAAC,EAAC;EAA2N,CAAE;AAAC,CAClO,CACL;AAED,SAASC,YAAYA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACnC,MAAMC,IAAI,GAAGxB,SAAS,CACnByB,MAAM,IAAMA,MAAM,CAAElB,gBAAiB,CAAC,CAACmB,uBAAuB,CAAC,CAAC,EAClE,EACD,CAAC;EACD,MAAM;IAAEC;EAAwB,CAAC,GAAG1B,WAAW,CAAEM,gBAAiB,CAAC;EAEnE,oBACCE,IAAA,CAAChB,QAAQ;IACRmC,YAAY,EAAGA,CAAE;MAAEC,MAA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CAAC;YACrC,YAAY,EAAEA,EAAE,CAAE,QAAS;UAC5B,CAAC;QACC,CACH;MAAC,CACY,CAAC,eAChBU,IAAA;QAAK6B,SAAS,EAAC,kCAAkC;QAAAnB,QAAA,EAC9CpB,EAAE,CACH,sJACD;MAAC,CACG,CAAC;IAAA,CACL;EACA,CACH,CAAC;AAEJ;AAEA,eAAeG,UAAU,CAAEmB,YAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Dropdown","Button","MenuItemsChoice","SVG","Path","NavigableMenu","__","useSelect","useDispatch","forwardRef","Icon","edit","editIcon","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","selectIcon","xmlns","width","height","viewBox","children","d","ToolSelector","props","ref","mode","select","__unstableGetEditorMode","__unstableSetEditorMode","renderToggle","isOpen","onToggle","size","icon","onClick","label","popoverProps","placement","renderContent","className","role","value","onSelect","newMode","choices","info"],"sources":["@wordpress/block-editor/src/components/tool-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdown,\n\tButton,\n\tMenuItemsChoice,\n\tSVG,\n\tPath,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, edit as editIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst selectIcon = (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth=\"24\"\n\t\theight=\"24\"\n\t\tviewBox=\"0 0 24 24\"\n\t>\n\t\t<Path d=\"M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z\" />\n\t</SVG>\n);\n\nfunction ToolSelector( props, ref ) {\n\tconst mode = useSelect(\n\t\t( select ) => select( blockEditorStore ).__unstableGetEditorMode(),\n\t\t[]\n\t);\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\ticon={ mode === 'navigation' ? editIcon : selectIcon }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Tools' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\trenderContent={ () => (\n\t\t\t\t<>\n\t\t\t\t\t<NavigableMenu\n\t\t\t\t\t\tclassName=\"block-editor-tool-selector__menu\"\n\t\t\t\t\t\trole=\"menu\"\n\t\t\t\t\t\taria-label={ __( 'Tools' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tmode === 'navigation' ? 'navigation' : 'edit'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ ( newMode ) => {\n\t\t\t\t\t\t\t\t__unstableSetEditorMode( newMode );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tchoices={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'navigation',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ editIcon } />\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Write' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tinfo: __( 'Focus on content.' ),\n\t\t\t\t\t\t\t\t\t'aria-label': __( 'Write' ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'edit',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ selectIcon }\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Design' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tinfo: __( 'Edit layout and styles.' ),\n\t\t\t\t\t\t\t\t\t'aria-label': __( 'Design' ),\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</NavigableMenu>\n\t\t\t\t\t<div className=\"block-editor-tool-selector__help\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Tools provide different sets of interactions for blocks. Choose between simplified content tools (Write) and advanced visual editing tools (Design).'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( ToolSelector );\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,MAAM,EACNC,eAAe,EACfC,GAAG,EACHC,IAAI,EACJC,aAAa,QACP,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI,EAAEC,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;;AAEzD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AA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AK,EACJhB,IAAI,KAAK,YAAY,GAAG,YAAY,GAAG,MACvC;UACDiB,QAAQ,EAAKC,OAAO,IAAM;YACzBf,uBAAuB,CAAEe,OAAQ,CAAC;UACnC,CAAG;UACHC,OAAO,EAAG,CACT;YACCH,KAAK,EAAE,YAAY;YACnBN,KAAK,eACJrB,KAAA,CAAAF,SAAA;cAAAQ,QAAA,gBACCV,IAAA,CAACN,IAAI;gBAAC6B,IAAI,EAAG3B;cAAU,CAAE,CAAC,EACxBN,EAAE,CAAE,OAAQ,CAAC;YAAA,CACd,CACF;YACD6C,IAAI,EAAE7C,EAAE,CAAE,mBAAoB,CAAC;YAC/B,YAAY,EAAEA,EAAE,CAAE,OAAQ;UAC3B,CAAC,EACD;YACCyC,KAAK,EAAE,MAAM;YACbN,KAAK,eACJrB,KAAA,CAAAF,SAAA;cAAAQ,QAAA,GACGL,UAAU,EACVf,EAAE,CAAE,QAAS,CAAC;YAAA,CACf,CACF;YACD6C,IAAI,EAAE7C,EAAE,CAAE,yBAA0B,CAAC;YACrC,YAAY,EAAEA,EAAE,CAAE,QAAS;UAC5B,CAAC;QACC,CACH;MAAC,CACY,CAAC,eAChBU,IAAA;QAAK6B,SAAS,EAAC,kCAAkC;QAAAnB,QAAA,EAC9CpB,EAAE,CACH,sJACD;MAAC,CACG,CAAC;IAAA,CACL;EACA,CACH,CAAC;AAEJ;AAEA,eAAeG,UAAU,CAAEmB,YAAa,CAAC","ignoreList":[]}
@@ -208,7 +208,7 @@ function LayoutPanelPure({
208
208
  type: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? 'default' : 'constrained'
209
209
  }
210
210
  }),
211
- help: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? __('Nested blocks use content width with options for full and wide widths.') : __('Nested blocks will fill the width of this container. Toggle to constrain.')
211
+ help: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? __('Nested blocks use content width with options for full and wide widths.') : __('Nested blocks will fill the width of this container.')
212
212
  })
213
213
  }), !inherit && allowSwitching && /*#__PURE__*/_jsx(LayoutTypeSwitcher, {
214
214
  type: blockLayoutType,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","ToggleControl","PanelBody","privateApis","componentsPrivateApis","__","store","blockEditorStore","InspectorControls","useSettings","getLayoutType","getLayoutTypes","useBlockEditingMode","LAYOUT_DEFINITIONS","useBlockSettings","useStyleOverride","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","layoutBlockSupportKey","kebabCase","hasLayoutBlockSupport","blockName","useLayoutClasses","blockAttributes","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","hasGlobalPadding","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","getLayoutStyle","LayoutPanelPure","setAttributes","name","clientId","settings","layoutSettings","themeSupportsLayout","supportsLayout","blockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","blockSupportAndLayout","defaultType","blockLayoutType","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","children","title","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","shareWithChildBlocks","edit","attributeKeys","hasSupport","__next40pxDefaultSize","isBlock","hideLabelFromVision","isAdaptiveWidth","value","map","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","layoutClasses","id","selectorPrefix","css","layoutClassNames","__unstableLayoutClassNames","withLayoutStyles","blockSupportsLayout","extraProps","getBlockSettings","disableLayoutStyles","undefined"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t( usedLayout?.inherit ||\n\t\t\t\t\tusedLayout?.contentSize ||\n\t\t\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\t\t\tselect( blockEditorStore ).getSettings().__experimentalFeatures\n\t\t\t\t\t?.useRootPaddingAwareAlignments\n\t\t\t);\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...layout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\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\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\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\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\t__nextHasNoMarginBottom\n\t\t\thideLabelFromVision\n\t\t\tisAdaptiveWidth\n\t\t\tvalue={ type }\n\t\t\tonChange={ onChange }\n\t\t>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tvalue={ name }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { clientId, name, attributes } = props;\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\tconst extraProps = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t);\n\t\t\t\tconst { disableLayoutStyles } = getSettings();\n\n\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t);\n\n\t\t\t\treturn { blockGapSupport };\n\t\t\t},\n\t\t\t[ blockSupportsLayout, clientId ]\n\t\t);\n\n\t\tif ( ! extraProps ) {\n\t\t\treturn (\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles\n\t\t\t\tblock={ BlockListBlock }\n\t\t\t\tprops={ props }\n\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t{ ...extraProps }\n\t\t\t/>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twith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W;IACtC,CACD,CAAC;EAEJ;EAEA,oBACC5G,IAAA,CAAC6F,qBAAqB;IACrBC,KAAK,EAAGC,cAAgB;IACxBC,KAAK,EAAGA,KAAO;IACfC,aAAa,EAAGA,aAAe;IAAA,GAC1BQ;EAAU,CACf,CAAC;AAEJ,CAAC,EACD,kBACD,CAAC;AAEDlI,SAAS,CACR,0BAA0B,EAC1B,0BAA0B,EAC1BmH,YACD,CAAC;AACDnH,SAAS,CACR,uBAAuB,EACvB,uCAAuC,EACvCgI,gBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","ToggleControl","PanelBody","privateApis","componentsPrivateApis","__","store","blockEditorStore","InspectorControls","useSettings","getLayoutType","getLayoutTypes","useBlockEditingMode","LAYOUT_DEFINITIONS","useBlockSettings","useStyleOverride","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","layoutBlockSupportKey","kebabCase","hasLayoutBlockSupport","blockName","useLayoutClasses","blockAttributes","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","hasGlobalPadding","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","getLayoutStyle","LayoutPanelPure","setAttributes","name","clientId","settings","layoutSettings","themeSupportsLayout","supportsLayout","blockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","blockSupportAndLayout","defaultType","blockLayoutType","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","children","title","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","shareWithChildBlocks","edit","attributeKeys","hasSupport","__next40pxDefaultSize","isBlock","hideLabelFromVision","isAdaptiveWidth","value","map","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","layoutClasses","id","selectorPrefix","css","layoutClassNames","__unstableLayoutClassNames","withLayoutStyles","blockSupportsLayout","extraProps","getBlockSettings","disableLayoutStyles","undefined"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t( usedLayout?.inherit ||\n\t\t\t\t\tusedLayout?.contentSize ||\n\t\t\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\t\t\tselect( blockEditorStore ).getSettings().__experimentalFeatures\n\t\t\t\t\t?.useRootPaddingAwareAlignments\n\t\t\t);\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...layout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\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\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\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\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\t__nextHasNoMarginBottom\n\t\t\thideLabelFromVision\n\t\t\tisAdaptiveWidth\n\t\t\tvalue={ type }\n\t\t\tonChange={ onChange }\n\t\t>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tvalue={ name }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { clientId, name, attributes } = props;\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\tconst extraProps = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t);\n\t\t\t\tconst { disableLayoutStyles } = getSettings();\n\n\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t);\n\n\t\t\t\treturn { blockGapSupport };\n\t\t\t},\n\t\t\t[ blockSupportsLayout, clientId ]\n\t\t);\n\n\t\tif ( ! extraProps ) {\n\t\t\treturn (\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles\n\t\t\t\tblock={ BlockListBlock }\n\t\t\t\tprops={ props }\n\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t{ ...extraProps }\n\t\t\t/>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,0BAA0B,EAAEC,aAAa,QAAQ,oBAAoB;AAC9E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,eAAe,EAAEC,eAAe,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,gCAAgC,IAAIC,kBAAkB,EACtDC,sCAAsC,IAAIC,wBAAwB,EAClEC,aAAa,EACbC,SAAS,EACTC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SAASC,aAAa,EAAEC,cAAc,QAAQ,YAAY;AAC1D,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS;AAC5D,SAASC,MAAM,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExC,MAAMC,qBAAqB,GAAG,QAAQ;AACtC,MAAM;EAAEC;AAAU,CAAC,GAAGR,MAAM,CAAEZ,qBAAsB,CAAC;AAErD,SAASqB,qBAAqBA,CAAEC,SAAS,EAA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,EACR,kBACD,CAAC;IAED,OAAO;MAAEN;IAAgB,CAAC;EAC3B,CAAC,EACD,CAAE+D,mBAAmB,EAAEzD,QAAQ,CAChC,CAAC;EAED,IAAK,CAAE0D,UAAU,EAAG;IACnB,oBACCzG,IAAA,CAAC+F,cAAc;MAAA,GACTC,KAAK;MACVM,0BAA0B,EACzBE,mBAAmB,GAAGP,aAAa,GAAGW;IACtC,CACD,CAAC;EAEJ;EAEA,oBACC5G,IAAA,CAAC6F,qBAAqB;IACrBC,KAAK,EAAGC,cAAgB;IACxBC,KAAK,EAAGA,KAAO;IACfC,aAAa,EAAGA,aAAe;IAAA,GAC1BQ;EAAU,CACf,CAAC;AAEJ,CAAC,EACD,kBACD,CAAC;AAEDlI,SAAS,CACR,0BAA0B,EAC1B,0BAA0B,EAC1BmH,YACD,CAAC;AACDnH,SAAS,CACR,uBAAuB,EACvB,uCAAuC,EACvCgI,gBACD,CAAC","ignoreList":[]}
@@ -2,14 +2,13 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
- import { useEffect, useRef, useContext } from '@wordpress/element';
5
+ import { useEffect, useRef } from '@wordpress/element';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
10
  import { store as blockEditorStore } from '../store';
11
11
  import { unlock } from '../lock-unlock';
12
- import BlockContext from '../components/block-context';
13
12
 
14
13
  /**
15
14
  * A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.
@@ -20,9 +19,6 @@ import BlockContext from '../components/block-context';
20
19
  * @param {boolean} enabled If we should enter into zoomOut mode or not
21
20
  */
22
21
  export function useZoomOut(enabled = true) {
23
- const {
24
- postId
25
- } = useContext(BlockContext);
26
22
  const {
27
23
  setZoomLevel,
28
24
  resetZoomLevel
@@ -46,7 +42,6 @@ export function useZoomOut(enabled = true) {
46
42
  }, []);
47
43
  const controlZoomLevelRef = useRef(false);
48
44
  const isEnabledRef = useRef(enabled);
49
- const postIdRef = useRef(postId);
50
45
 
51
46
  /**
52
47
  * This hook tracks if the zoom state was changed manually by the user via clicking
@@ -63,11 +58,6 @@ export function useZoomOut(enabled = true) {
63
58
  }, [isZoomedOut]);
64
59
  useEffect(() => {
65
60
  isEnabledRef.current = enabled;
66
-
67
- // If the user created a new post/page, we should take control of the zoom level.
68
- if (postIdRef.current !== postId) {
69
- controlZoomLevelRef.current = true;
70
- }
71
61
  if (enabled !== isZoomOut()) {
72
62
  controlZoomLevelRef.current = true;
73
63
  if (enabled) {
@@ -82,6 +72,6 @@ export function useZoomOut(enabled = true) {
82
72
  resetZoomLevel();
83
73
  }
84
74
  };
85
- }, [enabled, isZoomOut, postId, resetZoomLevel, setZoomLevel]);
75
+ }, [enabled, isZoomOut, resetZoomLevel, setZoomLevel]);
86
76
  }
87
77
  //# sourceMappingURL=use-zoom-out.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useEffect","useRef","useContext","store","blockEditorStore","unlock","BlockContext","useZoomOut","enabled","postId","setZoomLevel","resetZoomLevel","isZoomedOut","isZoomOut","select","_isZoomOut","controlZoomLevelRef","isEnabledRef","postIdRef","current"],"sources":["@wordpress/block-editor/src/hooks/use-zoom-out.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport BlockContext from '../components/block-context';\n\n/**\n * A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.\n * Concepts:\n * - If we most recently changed the zoom level for them (in or out), we always resetZoomLevel() level when unmounting.\n * - If the user most recently changed the zoom level (manually toggling), we do nothing when unmounting.\n *\n * @param {boolean} enabled If we should enter into zoomOut mode or not\n */\nexport function useZoomOut( enabled = true ) {\n\tconst { postId } = useContext( BlockContext );\n\tconst { setZoomLevel, resetZoomLevel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\t/**\n\t * We need access to both the value and the function. The value is to trigger a useEffect hook\n\t * and the function is to check zoom out within another hook without triggering a re-render.\n\t */\n\tconst { isZoomedOut, isZoomOut } = useSelect( ( select ) => {\n\t\tconst { isZoomOut: _isZoomOut } = unlock( select( blockEditorStore ) );\n\t\treturn {\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t\tisZoomOut: _isZoomOut,\n\t\t};\n\t}, [] );\n\n\tconst controlZoomLevelRef = useRef( false );\n\tconst isEnabledRef = useRef( enabled );\n\tconst postIdRef = useRef( postId );\n\n\t/**\n\t * This hook tracks if the zoom state was changed manually by the user via clicking\n\t * the zoom out button. We only want this to run when isZoomedOut changes, so we use\n\t * a ref to track the enabled state.\n\t */\n\tuseEffect( () => {\n\t\t// If the zoom state changed (isZoomOut) and it does not match the requested zoom\n\t\t// state (zoomOut), then it means the user manually changed the zoom state while\n\t\t// this hook was mounted, and we should no longer control the zoom state.\n\t\tif ( isZoomedOut !== isEnabledRef.current ) {\n\t\t\tcontrolZoomLevelRef.current = false;\n\t\t}\n\t}, [ isZoomedOut ] );\n\n\tuseEffect( () => {\n\t\tisEnabledRef.current = enabled;\n\n\t\t// If the user created a new post/page, we should take control of the zoom level.\n\t\tif ( postIdRef.current !== postId ) {\n\t\t\tcontrolZoomLevelRef.current = true;\n\t\t}\n\n\t\tif ( enabled !== isZoomOut() ) {\n\t\t\tcontrolZoomLevelRef.current = true;\n\n\t\t\tif ( enabled ) {\n\t\t\t\tsetZoomLevel( 'auto-scaled' );\n\t\t\t} else {\n\t\t\t\tresetZoomLevel();\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\t// If we are controlling zoom level and are zoomed out, reset the zoom level.\n\t\t\tif ( controlZoomLevelRef.current && isZoomOut() ) {\n\t\t\t\tresetZoomLevel();\n\t\t\t}\n\t\t};\n\t}, [ enabled, isZoomOut, postId, resetZoomLevel, setZoomLevel ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SA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AAO;;IAE9B;IACA,IAAKU,SAAS,CAACC,OAAO,KAAKV,MAAM,EAAG;MACnCO,mBAAmB,CAACG,OAAO,GAAG,IAAI;IACnC;IAEA,IAAKX,OAAO,KAAKK,SAAS,CAAC,CAAC,EAAG;MAC9BG,mBAAmB,CAACG,OAAO,GAAG,IAAI;MAElC,IAAKX,OAAO,EAAG;QACdE,YAAY,CAAE,aAAc,CAAC;MAC9B,CAAC,MAAM;QACNC,cAAc,CAAC,CAAC;MACjB;IACD;IAEA,OAAO,MAAM;MACZ;MACA,IAAKK,mBAAmB,CAACG,OAAO,IAAIN,SAAS,CAAC,CAAC,EAAG;QACjDF,cAAc,CAAC,CAAC;MACjB;IACD,CAAC;EACF,CAAC,EAAE,CAAEH,OAAO,EAAEK,SAAS,EAAEJ,MAAM,EAAEE,cAAc,EAAED,YAAY,CAAG,CAAC;AAClE","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","useEffect","useRef","store","blockEditorStore","unlock","useZoomOut","enabled","setZoomLevel","resetZoomLevel","isZoomedOut","isZoomOut","select","_isZoomOut","controlZoomLevelRef","isEnabledRef","current"],"sources":["@wordpress/block-editor/src/hooks/use-zoom-out.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.\n * Concepts:\n * - If we most recently changed the zoom level for them (in or out), we always resetZoomLevel() level when unmounting.\n * - If the user most recently changed the zoom level (manually toggling), we do nothing when unmounting.\n *\n * @param {boolean} enabled If we should enter into zoomOut mode or not\n */\nexport function useZoomOut( enabled = true ) {\n\tconst { setZoomLevel, resetZoomLevel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\t/**\n\t * We need access to both the value and the function. The value is to trigger a useEffect hook\n\t * and the function is to check zoom out within another hook without triggering a re-render.\n\t */\n\tconst { isZoomedOut, isZoomOut } = useSelect( ( select ) => {\n\t\tconst { isZoomOut: _isZoomOut } = unlock( select( blockEditorStore ) );\n\t\treturn {\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t\tisZoomOut: _isZoomOut,\n\t\t};\n\t}, [] );\n\n\tconst controlZoomLevelRef = useRef( false );\n\tconst isEnabledRef = useRef( enabled );\n\n\t/**\n\t * This hook tracks if the zoom state was changed manually by the user via clicking\n\t * the zoom out button. We only want this to run when isZoomedOut changes, so we use\n\t * a ref to track the enabled state.\n\t */\n\tuseEffect( () => {\n\t\t// If the zoom state changed (isZoomOut) and it does not match the requested zoom\n\t\t// state (zoomOut), then it means the user manually changed the zoom state while\n\t\t// this hook was mounted, and we should no longer control the zoom state.\n\t\tif ( isZoomedOut !== isEnabledRef.current ) {\n\t\t\tcontrolZoomLevelRef.current = false;\n\t\t}\n\t}, [ isZoomedOut ] );\n\n\tuseEffect( () => {\n\t\tisEnabledRef.current = enabled;\n\n\t\tif ( enabled !== isZoomOut() ) {\n\t\t\tcontrolZoomLevelRef.current = true;\n\n\t\t\tif ( enabled ) {\n\t\t\t\tsetZoomLevel( 'auto-scaled' );\n\t\t\t} else {\n\t\t\t\tresetZoomLevel();\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\t// If we are controlling zoom level and are zoomed out, reset the zoom level.\n\t\t\tif ( controlZoomLevelRef.current && isZoomOut() ) {\n\t\t\t\tresetZoomLevel();\n\t\t\t}\n\t\t};\n\t}, [ enabled, isZoomOut, resetZoomLevel, setZoomLevel ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,MAAM,QAAQ,gBAAgB;;AAEv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EF,OAAO,EAAEI,SAAS,EAAEF,cAAc,EAAED,YAAY,CAAG,CAAC;AAC1D","ignoreList":[]}
@@ -4357,8 +4357,14 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
4357
4357
  }
4358
4358
 
4359
4359
  .block-editor-tabbed-sidebar__tabpanel .block-editor-inserter__help-text {
4360
+ display: none;
4360
4361
  padding: 0 24px 16px;
4361
4362
  }
4363
+ @media (min-width: 480px) {
4364
+ .block-editor-tabbed-sidebar__tabpanel .block-editor-inserter__help-text {
4365
+ display: block;
4366
+ }
4367
+ }
4362
4368
 
4363
4369
  .spacing-sizes-control .spacing-sizes-control__custom-value-input,
4364
4370
  .spacing-sizes-control .spacing-sizes-control__label {
@@ -4358,8 +4358,14 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
4358
4358
  }
4359
4359
 
4360
4360
  .block-editor-tabbed-sidebar__tabpanel .block-editor-inserter__help-text {
4361
+ display: none;
4361
4362
  padding: 0 24px 16px;
4362
4363
  }
4364
+ @media (min-width: 480px) {
4365
+ .block-editor-tabbed-sidebar__tabpanel .block-editor-inserter__help-text {
4366
+ display: block;
4367
+ }
4368
+ }
4363
4369
 
4364
4370
  .spacing-sizes-control .spacing-sizes-control__custom-value-input,
4365
4371
  .spacing-sizes-control .spacing-sizes-control__label {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "14.13.0",
3
+ "version": "14.14.1",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,38 +37,38 @@
37
37
  "@emotion/react": "^11.7.1",
38
38
  "@emotion/styled": "^11.6.0",
39
39
  "@react-spring/web": "^9.4.5",
40
- "@wordpress/a11y": "^4.18.0",
41
- "@wordpress/api-fetch": "^7.18.0",
42
- "@wordpress/blob": "^4.18.0",
43
- "@wordpress/block-serialization-default-parser": "^5.18.0",
44
- "@wordpress/blocks": "^14.7.0",
45
- "@wordpress/commands": "^1.18.0",
46
- "@wordpress/components": "^29.4.0",
47
- "@wordpress/compose": "^7.18.0",
48
- "@wordpress/data": "^10.18.0",
49
- "@wordpress/date": "^5.18.0",
50
- "@wordpress/deprecated": "^4.18.0",
51
- "@wordpress/dom": "^4.18.0",
52
- "@wordpress/element": "^6.18.0",
53
- "@wordpress/escape-html": "^3.18.0",
54
- "@wordpress/hooks": "^4.18.0",
55
- "@wordpress/html-entities": "^4.18.0",
56
- "@wordpress/i18n": "^5.18.0",
57
- "@wordpress/icons": "^10.18.0",
58
- "@wordpress/is-shallow-equal": "^5.18.0",
59
- "@wordpress/keyboard-shortcuts": "^5.18.0",
60
- "@wordpress/keycodes": "^4.18.0",
61
- "@wordpress/notices": "^5.18.0",
62
- "@wordpress/preferences": "^4.18.0",
63
- "@wordpress/priority-queue": "^3.18.0",
64
- "@wordpress/private-apis": "^1.18.0",
65
- "@wordpress/rich-text": "^7.18.0",
66
- "@wordpress/style-engine": "^2.18.0",
67
- "@wordpress/token-list": "^3.18.0",
68
- "@wordpress/upload-media": "^0.3.0",
69
- "@wordpress/url": "^4.18.0",
70
- "@wordpress/warning": "^3.18.0",
71
- "@wordpress/wordcount": "^4.18.0",
40
+ "@wordpress/a11y": "^4.19.1",
41
+ "@wordpress/api-fetch": "^7.19.1",
42
+ "@wordpress/blob": "^4.19.1",
43
+ "@wordpress/block-serialization-default-parser": "^5.19.1",
44
+ "@wordpress/blocks": "^14.8.1",
45
+ "@wordpress/commands": "^1.19.1",
46
+ "@wordpress/components": "^29.5.1",
47
+ "@wordpress/compose": "^7.19.1",
48
+ "@wordpress/data": "^10.19.1",
49
+ "@wordpress/date": "^5.19.1",
50
+ "@wordpress/deprecated": "^4.19.1",
51
+ "@wordpress/dom": "^4.19.1",
52
+ "@wordpress/element": "^6.19.1",
53
+ "@wordpress/escape-html": "^3.19.1",
54
+ "@wordpress/hooks": "^4.19.1",
55
+ "@wordpress/html-entities": "^4.19.1",
56
+ "@wordpress/i18n": "^5.19.1",
57
+ "@wordpress/icons": "^10.19.1",
58
+ "@wordpress/is-shallow-equal": "^5.19.1",
59
+ "@wordpress/keyboard-shortcuts": "^5.19.1",
60
+ "@wordpress/keycodes": "^4.19.1",
61
+ "@wordpress/notices": "^5.19.1",
62
+ "@wordpress/preferences": "^4.19.1",
63
+ "@wordpress/priority-queue": "^3.19.1",
64
+ "@wordpress/private-apis": "^1.19.1",
65
+ "@wordpress/rich-text": "^7.19.1",
66
+ "@wordpress/style-engine": "^2.19.1",
67
+ "@wordpress/token-list": "^3.19.1",
68
+ "@wordpress/upload-media": "^0.4.1",
69
+ "@wordpress/url": "^4.19.1",
70
+ "@wordpress/warning": "^3.19.1",
71
+ "@wordpress/wordcount": "^4.19.1",
72
72
  "change-case": "^4.1.2",
73
73
  "clsx": "^2.1.1",
74
74
  "colord": "^2.7.0",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "afe4fb333177642180ac020f1030c5685eab7183"
94
+ "gitHead": "6f49fee89f840761f7fedf662713cbd4a71723e9"
95
95
  }
@@ -313,12 +313,6 @@ function BackgroundImageControls( {
313
313
 
314
314
  // Drag and drop callback, restricting image to one.
315
315
  const onFilesDrop = ( filesList ) => {
316
- if ( filesList?.length > 1 ) {
317
- onUploadError(
318
- __( 'Only one image can be used as a background image.' )
319
- );
320
- return;
321
- }
322
316
  getSettings().mediaUpload( {
323
317
  allowedTypes: [ IMAGE_BACKGROUND_TYPE ],
324
318
  filesList,
@@ -326,6 +320,7 @@ function BackgroundImageControls( {
326
320
  onSelectMedia( image );
327
321
  },
328
322
  onError: onUploadError,
323
+ multiple: false,
329
324
  } );
330
325
  };
331
326
 
@@ -14,7 +14,7 @@ const scrollContainerCache = new WeakMap();
14
14
  * @param {Object} contentRef
15
15
  */
16
16
  function usePopoverScroll( contentRef ) {
17
- return useRefEffect(
17
+ const effect = useRefEffect(
18
18
  ( node ) => {
19
19
  function onWheel( event ) {
20
20
  const { deltaX, deltaY } = event;
@@ -36,6 +36,7 @@ function usePopoverScroll( contentRef ) {
36
36
  },
37
37
  [ contentRef ]
38
38
  );
39
+ return contentRef ? effect : null;
39
40
  }
40
41
 
41
42
  export default usePopoverScroll;
@@ -11,7 +11,6 @@ import { useDispatch, useSelect } from '@wordpress/data';
11
11
  import { moreVertical } from '@wordpress/icons';
12
12
  import { Children, cloneElement } from '@wordpress/element';
13
13
  import { __ } from '@wordpress/i18n';
14
- import { displayShortcut } from '@wordpress/keycodes';
15
14
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
16
15
  import { pipe, useCopyToClipboard } from '@wordpress/compose';
17
16
 
@@ -39,16 +38,27 @@ function CopyMenuItem( {
39
38
  label,
40
39
  shortcut,
41
40
  eventType = 'copy',
41
+ __experimentalUpdateSelection: updateSelection = false,
42
42
  } ) {
43
43
  const { getBlocksByClientId } = useSelect( blockEditorStore );
44
+ const { removeBlocks } = useDispatch( blockEditorStore );
44
45
  const notifyCopy = useNotifyCopy();
45
46
  const ref = useCopyToClipboard(
46
47
  () => serialize( getBlocksByClientId( clientIds ) ),
47
48
  () => {
48
- if ( onCopy && eventType === 'copy' ) {
49
- onCopy();
49
+ switch ( eventType ) {
50
+ case 'copy':
51
+ case 'copyStyles':
52
+ onCopy();
53
+ notifyCopy( eventType, clientIds );
54
+ break;
55
+ case 'cut':
56
+ notifyCopy( eventType, clientIds );
57
+ removeBlocks( clientIds, updateSelection );
58
+ break;
59
+ default:
60
+ break;
50
61
  }
51
- notifyCopy( eventType, clientIds );
52
62
  }
53
63
  );
54
64
  const copyMenuItemLabel = label ? label : __( 'Copy' );
@@ -127,6 +137,8 @@ export function BlockSettingsDropdown( {
127
137
  const shortcuts = useSelect( ( select ) => {
128
138
  const { getShortcutRepresentation } = select( keyboardShortcutsStore );
129
139
  return {
140
+ copy: getShortcutRepresentation( 'core/block-editor/copy' ),
141
+ cut: getShortcutRepresentation( 'core/block-editor/cut' ),
130
142
  duplicate: getShortcutRepresentation(
131
143
  'core/block-editor/duplicate'
132
144
  ),
@@ -266,9 +278,16 @@ export function BlockSettingsDropdown( {
266
278
  <CopyMenuItem
267
279
  clientIds={ clientIds }
268
280
  onCopy={ onCopy }
269
- shortcut={ displayShortcut.primary(
270
- 'c'
271
- ) }
281
+ shortcut={ shortcuts.copy }
282
+ />
283
+ <CopyMenuItem
284
+ clientIds={ clientIds }
285
+ label={ __( 'Cut' ) }
286
+ eventType="cut"
287
+ shortcut={ shortcuts.cut }
288
+ __experimentalUpdateSelection={
289
+ ! __experimentalSelectBlock
290
+ }
272
291
  />
273
292
  { canDuplicate && (
274
293
  <MenuItem
@@ -203,7 +203,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
203
203
  class="components-circular-option-picker"
204
204
  >
205
205
  <div
206
- aria-label="Custom color picker."
206
+ aria-label="Custom color picker"
207
207
  id="components-circular-option-picker-0"
208
208
  role="listbox"
209
209
  >
@@ -131,8 +131,23 @@ function Iframe( {
131
131
  function preventFileDropDefault( event ) {
132
132
  event.preventDefault();
133
133
  }
134
+
135
+ const { ownerDocument } = node;
136
+
137
+ // Ideally ALL classes that are added through get_body_class should
138
+ // be added in the editor too, which we'll somehow have to get from
139
+ // the server in the future (which will run the PHP filters).
140
+ setBodyClasses(
141
+ Array.from( ownerDocument.body.classList ).filter(
142
+ ( name ) =>
143
+ name.startsWith( 'admin-color-' ) ||
144
+ name.startsWith( 'post-type-' ) ||
145
+ name === 'wp-embed-responsive'
146
+ )
147
+ );
148
+
134
149
  function onLoad() {
135
- const { contentDocument, ownerDocument } = node;
150
+ const { contentDocument } = node;
136
151
  const { documentElement } = contentDocument;
137
152
  iFrameDocument = contentDocument;
138
153
 
@@ -140,18 +155,6 @@ function Iframe( {
140
155
 
141
156
  clearerRef( documentElement );
142
157
 
143
- // Ideally ALL classes that are added through get_body_class should
144
- // be added in the editor too, which we'll somehow have to get from
145
- // the server in the future (which will run the PHP filters).
146
- setBodyClasses(
147
- Array.from( ownerDocument.body.classList ).filter(
148
- ( name ) =>
149
- name.startsWith( 'admin-color-' ) ||
150
- name.startsWith( 'post-type-' ) ||
151
- name === 'wp-embed-responsive'
152
- )
153
- );
154
-
155
158
  contentDocument.dir = ownerDocument.dir;
156
159
 
157
160
  for ( const compatStyle of getCompatibilityStyles() ) {
@@ -12,10 +12,11 @@ import PatternExplorerSidebar from './pattern-explorer-sidebar';
12
12
  import PatternList from './pattern-list';
13
13
  import { usePatternCategories } from '../block-patterns-tab/use-pattern-categories';
14
14
 
15
- function PatternsExplorer( { initialCategory, rootClientId } ) {
15
+ function PatternsExplorer( { initialCategory, rootClientId, onModalClose } ) {
16
16
  const [ searchValue, setSearchValue ] = useState( '' );
17
- const [ selectedCategory, setSelectedCategory ] =
18
- useState( initialCategory );
17
+ const [ selectedCategory, setSelectedCategory ] = useState(
18
+ initialCategory?.name
19
+ );
19
20
 
20
21
  const patternCategories = usePatternCategories( rootClientId );
21
22
 
@@ -33,6 +34,7 @@ function PatternsExplorer( { initialCategory, rootClientId } ) {
33
34
  selectedCategory={ selectedCategory }
34
35
  patternCategories={ patternCategories }
35
36
  rootClientId={ rootClientId }
37
+ onModalClose={ onModalClose }
36
38
  />
37
39
  </div>
38
40
  );
@@ -45,7 +47,7 @@ function PatternsExplorerModal( { onModalClose, ...restProps } ) {
45
47
  onRequestClose={ onModalClose }
46
48
  isFullScreen
47
49
  >
48
- <PatternsExplorer { ...restProps } />
50
+ <PatternsExplorer onModalClose={ onModalClose } { ...restProps } />
49
51
  </Modal>
50
52
  );
51
53
  }
@@ -52,6 +52,7 @@ function PatternList( {
52
52
  selectedCategory,
53
53
  patternCategories,
54
54
  rootClientId,
55
+ onModalClose,
55
56
  } ) {
56
57
  const container = useRef();
57
58
  const debouncedSpeak = useDebounce( speak, 500 );
@@ -152,7 +153,10 @@ function PatternList( {
152
153
  <>
153
154
  <BlockPatternsList
154
155
  blockPatterns={ pagingProps.categoryPatterns }
155
- onClickPattern={ onClickPattern }
156
+ onClickPattern={ ( pattern, blocks ) => {
157
+ onClickPattern( pattern, blocks );
158
+ onModalClose();
159
+ } }
156
160
  isDraggable={ false }
157
161
  />
158
162
  <BlockPatternsPaging { ...pagingProps } />
@@ -70,9 +70,7 @@ function BlockPatternsTab( {
70
70
  ) }
71
71
  { showPatternsExplorer && (
72
72
  <PatternsExplorerModal
73
- initialCategory={
74
- selectedCategory?.name || categories[ 0 ]?.name
75
- }
73
+ initialCategory={ selectedCategory || categories[ 0 ] }
76
74
  patternCategories={ categories }
77
75
  onModalClose={ () => setShowPatternsExplorer( false ) }
78
76
  rootClientId={ rootClientId }