@wordpress/block-library 8.28.1 → 8.28.2

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 (56) hide show
  1. package/build/button/index.js +0 -1
  2. package/build/button/index.js.map +1 -1
  3. package/build/heading/index.js +0 -1
  4. package/build/heading/index.js.map +1 -1
  5. package/build/image/image.js +69 -3
  6. package/build/image/image.js.map +1 -1
  7. package/build/image/index.js +1 -1
  8. package/build/navigation/constants.js +1 -2
  9. package/build/navigation/constants.js.map +1 -1
  10. package/build/navigation/edit/index.js +0 -4
  11. package/build/navigation/edit/index.js.map +1 -1
  12. package/build/navigation/view.js +0 -23
  13. package/build/navigation/view.js.map +1 -1
  14. package/build/paragraph/index.js +1 -1
  15. package/build/paragraph/transforms.js +1 -1
  16. package/build-module/button/index.js +0 -1
  17. package/build-module/button/index.js.map +1 -1
  18. package/build-module/heading/index.js +0 -1
  19. package/build-module/heading/index.js.map +1 -1
  20. package/build-module/image/image.js +70 -4
  21. package/build-module/image/image.js.map +1 -1
  22. package/build-module/image/index.js +1 -1
  23. package/build-module/navigation/constants.js +0 -1
  24. package/build-module/navigation/constants.js.map +1 -1
  25. package/build-module/navigation/edit/index.js +1 -5
  26. package/build-module/navigation/edit/index.js.map +1 -1
  27. package/build-module/navigation/view.js +0 -23
  28. package/build-module/navigation/view.js.map +1 -1
  29. package/build-module/paragraph/index.js +1 -1
  30. package/build-module/paragraph/transforms.js +1 -1
  31. package/build-style/editor-rtl.css +8 -2
  32. package/build-style/editor.css +8 -2
  33. package/build-style/image/editor-rtl.css +4 -0
  34. package/build-style/image/editor.css +4 -0
  35. package/build-style/navigation/editor-rtl.css +4 -2
  36. package/build-style/navigation/editor.css +4 -2
  37. package/build-style/navigation/style-rtl.css +18 -14
  38. package/build-style/navigation/style.css +18 -14
  39. package/build-style/style-rtl.css +18 -14
  40. package/build-style/style.css +18 -14
  41. package/package.json +34 -34
  42. package/src/button/block.json +0 -1
  43. package/src/footnotes/index.php +24 -11
  44. package/src/heading/block.json +0 -1
  45. package/src/image/block.json +1 -6
  46. package/src/image/editor.scss +5 -0
  47. package/src/image/image.js +112 -2
  48. package/src/navigation/constants.js +0 -2
  49. package/src/navigation/edit/index.js +1 -11
  50. package/src/navigation/editor.scss +1 -1
  51. package/src/navigation/index.php +95 -54
  52. package/src/navigation/style.scss +16 -18
  53. package/src/navigation/view.js +0 -26
  54. package/src/navigation-link/index.php +0 -1
  55. package/src/paragraph/block.json +1 -1
  56. package/src/search/index.php +1 -1
@@ -2,11 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { store, getContext, getElement } from '@wordpress/interactivity';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import { NAVIGATION_MOBILE_COLLAPSE } from './constants';
10
5
  const focusableSelectors = ['a[href]', 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])', 'button:not([disabled]):not([aria-hidden])', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
11
6
 
12
7
  // This is a fix for Safari in iOS/iPadOS. Without it, Safari doesn't focus out
@@ -175,24 +170,6 @@ const {
175
170
  const focusableElements = ref.querySelectorAll(focusableSelectors);
176
171
  focusableElements?.[0]?.focus();
177
172
  }
178
- },
179
- initNav() {
180
- const context = getContext();
181
- const mediaQuery = window.matchMedia(`(max-width: ${NAVIGATION_MOBILE_COLLAPSE})`);
182
-
183
- // Run once to set the initial state.
184
- context.isCollapsed = mediaQuery.matches;
185
- function handleCollapse(event) {
186
- context.isCollapsed = event.matches;
187
- }
188
-
189
- // Run on resize to update the state.
190
- mediaQuery.addEventListener('change', handleCollapse);
191
-
192
- // Remove the listener when the component is unmounted.
193
- return () => {
194
- mediaQuery.removeEventListener('change', handleCollapse);
195
- };
196
173
  }
197
174
  }
198
175
  }, {
@@ -1 +1 @@
1
- {"version":3,"names":["store","getContext","getElement","NAVIGATION_MOBILE_COLLAPSE","focusableSelectors","document","addEventListener","state","actions","roleAttribute","ctx","type","isMenuOpen","ariaModal","ariaLabel","Object","values","menuOpenedBy","filter","Boolean","length","overlayOpenedBy","submenuOpenedBy","openMenuOnHover","openMenu","closeMenuOnHover","closeMenu","openMenuOnClick","ref","previousFocus","closeMenuOnClick","openMenuOnFocus","toggleMenuOnClick","window","activeElement","focus","click","handleMenuKeydown","event","firstFocusableElement","lastFocusableElement","key","shiftKey","preventDefault","handleMenuFocusout","modal","relatedTarget","contains","target","menuOpenedOn","documentElement","classList","add","menuClosedOn","remove","callbacks","initMenu","focusableElements","querySelectorAll","focusFirstElement","initNav","context","mediaQuery","matchMedia","isCollapsed","matches","handleCollapse","removeEventListener","lock"],"sources":["@wordpress/block-library/src/navigation/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\n/**\n * Internal dependencies\n */\nimport { NAVIGATION_MOBILE_COLLAPSE } from './constants';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n// This is a fix for Safari in iOS/iPadOS. Without it, Safari doesn't focus out\n// when the user taps in the body. It can be removed once we add an overlay to\n// capture the clicks, instead of relying on the focusout event.\ndocument.addEventListener( 'click', () => {} );\n\nconst { state, actions } = store(\n\t'core/navigation',\n\t{\n\t\tstate: {\n\t\t\tget roleAttribute() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay' && state.isMenuOpen\n\t\t\t\t\t? 'dialog'\n\t\t\t\t\t: null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay' && state.isMenuOpen\n\t\t\t\t\t? 'true'\n\t\t\t\t\t: null;\n\t\t\t},\n\t\t\tget ariaLabel() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay' && state.isMenuOpen\n\t\t\t\t\t? ctx.ariaLabel\n\t\t\t\t\t: null;\n\t\t\t},\n\t\t\tget isMenuOpen() {\n\t\t\t\t// The menu is opened if either `click`, `hover` or `focus` is true.\n\t\t\t\treturn (\n\t\t\t\t\tObject.values( state.menuOpenedBy ).filter( Boolean )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t},\n\t\t\tget menuOpenedBy() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay'\n\t\t\t\t\t? ctx.overlayOpenedBy\n\t\t\t\t\t: ctx.submenuOpenedBy;\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\topenMenuOnHover() {\n\t\t\t\tconst { type, overlayOpenedBy } = getContext();\n\t\t\t\tif (\n\t\t\t\t\ttype === 'submenu' &&\n\t\t\t\t\t// Only open on hover if the overlay is closed.\n\t\t\t\t\tObject.values( overlayOpenedBy || {} ).filter( Boolean )\n\t\t\t\t\t\t.length === 0\n\t\t\t\t)\n\t\t\t\t\tactions.openMenu( 'hover' );\n\t\t\t},\n\t\t\tcloseMenuOnHover() {\n\t\t\t\tactions.closeMenu( 'hover' );\n\t\t\t},\n\t\t\topenMenuOnClick() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tctx.previousFocus = ref;\n\t\t\t\tactions.openMenu( 'click' );\n\t\t\t},\n\t\t\tcloseMenuOnClick() {\n\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t},\n\t\t\topenMenuOnFocus() {\n\t\t\t\tactions.openMenu( 'focus' );\n\t\t\t},\n\t\t\ttoggleMenuOnClick() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\t// Safari won't send focus to the clicked element, so we need to manually place it: https://bugs.webkit.org/show_bug.cgi?id=22261\n\t\t\t\tif ( window.document.activeElement !== ref ) ref.focus();\n\t\t\t\tconst { menuOpenedBy } = state;\n\t\t\t\tif ( menuOpenedBy.click || menuOpenedBy.focus ) {\n\t\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t\t} else {\n\t\t\t\t\tctx.previousFocus = ref;\n\t\t\t\t\tactions.openMenu( 'click' );\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleMenuKeydown( event ) {\n\t\t\t\tconst { type, firstFocusableElement, lastFocusableElement } =\n\t\t\t\t\tgetContext();\n\t\t\t\tif ( state.menuOpenedBy.click ) {\n\t\t\t\t\t// If Escape close the menu.\n\t\t\t\t\tif ( event?.key === 'Escape' ) {\n\t\t\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Trap focus if it is an overlay (main menu).\n\t\t\t\t\tif ( type === 'overlay' && event.key === 'Tab' ) {\n\t\t\t\t\t\t// If shift + tab it change the direction.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\tfirstFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tlastFocusableElement.focus();\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\tlastFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tfirstFocusableElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleMenuFocusout( event ) {\n\t\t\t\tconst { modal } = getContext();\n\t\t\t\t// If focus is outside modal, and in the document, close menu\n\t\t\t\t// event.target === The element losing focus\n\t\t\t\t// event.relatedTarget === The element receiving focus (if any)\n\t\t\t\t// When focusout is outsite the document,\n\t\t\t\t// `window.document.activeElement` doesn't change.\n\n\t\t\t\t// The event.relatedTarget is null when something outside the navigation menu is clicked. This is only necessary for Safari.\n\t\t\t\tif (\n\t\t\t\t\tevent.relatedTarget === null ||\n\t\t\t\t\t( ! modal?.contains( event.relatedTarget ) &&\n\t\t\t\t\t\tevent.target !== window.document.activeElement )\n\t\t\t\t) {\n\t\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t\t}\n\t\t\t},\n\n\t\t\topenMenu( menuOpenedOn = 'click' ) {\n\t\t\t\tconst { type } = getContext();\n\t\t\t\tstate.menuOpenedBy[ menuOpenedOn ] = true;\n\t\t\t\tif ( type === 'overlay' ) {\n\t\t\t\t\t// Add a `has-modal-open` class to the <html> root.\n\t\t\t\t\tdocument.documentElement.classList.add( 'has-modal-open' );\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tcloseMenu( menuClosedOn = 'click' ) {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tstate.menuOpenedBy[ menuClosedOn ] = false;\n\t\t\t\t// Check if the menu is still open or not.\n\t\t\t\tif ( ! state.isMenuOpen ) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tctx.modal?.contains( window.document.activeElement )\n\t\t\t\t\t) {\n\t\t\t\t\t\tctx.previousFocus?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tctx.modal = null;\n\t\t\t\t\tctx.previousFocus = null;\n\t\t\t\t\tif ( ctx.type === 'overlay' ) {\n\t\t\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t\t\t'has-modal-open'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\tinitMenu() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tif ( state.isMenuOpen ) {\n\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\tctx.modal = ref;\n\t\t\t\t\tctx.firstFocusableElement = focusableElements[ 0 ];\n\t\t\t\t\tctx.lastFocusableElement =\n\t\t\t\t\t\tfocusableElements[ focusableElements.length - 1 ];\n\t\t\t\t}\n\t\t\t},\n\t\t\tfocusFirstElement() {\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tif ( state.isMenuOpen ) {\n\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\tfocusableElements?.[ 0 ]?.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitNav() {\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst mediaQuery = window.matchMedia(\n\t\t\t\t\t`(max-width: ${ NAVIGATION_MOBILE_COLLAPSE })`\n\t\t\t\t);\n\n\t\t\t\t// Run once to set the initial state.\n\t\t\t\tcontext.isCollapsed = mediaQuery.matches;\n\n\t\t\t\tfunction handleCollapse( event ) {\n\t\t\t\t\tcontext.isCollapsed = event.matches;\n\t\t\t\t}\n\n\t\t\t\t// Run on resize to update the state.\n\t\t\t\tmediaQuery.addEventListener( 'change', handleCollapse );\n\n\t\t\t\t// Remove the listener when the component is unmounted.\n\t\t\t\treturn () => {\n\t\t\t\t\tmediaQuery.removeEventListener( 'change', handleCollapse );\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,UAAU,EAAEC,UAAU,QAAQ,0BAA0B;;AAExE;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,aAAa;AAExD,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,+DAA+D,EAC/D,2CAA2C,EAC3C,6CAA6C,EAC7C,2CAA2C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AAG,CAAC8B,gBAAgB,CAAEtD,kBAAmB,CAAC;QAC3CM,GAAG,CAACmC,KAAK,GAAGjB,GAAG;QACflB,GAAG,CAAC6B,qBAAqB,GAAGkB,iBAAiB,CAAE,CAAC,CAAE;QAClD/C,GAAG,CAAC8B,oBAAoB,GACvBiB,iBAAiB,CAAEA,iBAAiB,CAACrC,MAAM,GAAG,CAAC,CAAE;MACnD;IACD,CAAC;IACDuC,iBAAiBA,CAAA,EAAG;MACnB,MAAM;QAAE/B;MAAI,CAAC,GAAG1B,UAAU,CAAC,CAAC;MAC5B,IAAKK,KAAK,CAACK,UAAU,EAAG;QACvB,MAAM6C,iBAAiB,GACtB7B,GAAG,CAAC8B,gBAAgB,CAAEtD,kBAAmB,CAAC;QAC3CqD,iBAAiB,GAAI,CAAC,CAAE,EAAEtB,KAAK,CAAC,CAAC;MAClC;IACD,CAAC;IACDyB,OAAOA,CAAA,EAAG;MACT,MAAMC,OAAO,GAAG5D,UAAU,CAAC,CAAC;MAC5B,MAAM6D,UAAU,GAAG7B,MAAM,CAAC8B,UAAU,CAClC,eAAe5D,0BAA4B,GAC7C,CAAC;;MAED;MACA0D,OAAO,CAACG,WAAW,GAAGF,UAAU,CAACG,OAAO;MAExC,SAASC,cAAcA,CAAE5B,KAAK,EAAG;QAChCuB,OAAO,CAACG,WAAW,GAAG1B,KAAK,CAAC2B,OAAO;MACpC;;MAEA;MACAH,UAAU,CAACxD,gBAAgB,CAAE,QAAQ,EAAE4D,cAAe,CAAC;;MAEvD;MACA,OAAO,MAAM;QACZJ,UAAU,CAACK,mBAAmB,CAAE,QAAQ,EAAED,cAAe,CAAC;MAC3D,CAAC;IACF;EACD;AACD,CAAC,EACD;EAAEE,IAAI,EAAE;AAAK,CACd,CAAC"}
1
+ {"version":3,"names":["store","getContext","getElement","focusableSelectors","document","addEventListener","state","actions","roleAttribute","ctx","type","isMenuOpen","ariaModal","ariaLabel","Object","values","menuOpenedBy","filter","Boolean","length","overlayOpenedBy","submenuOpenedBy","openMenuOnHover","openMenu","closeMenuOnHover","closeMenu","openMenuOnClick","ref","previousFocus","closeMenuOnClick","openMenuOnFocus","toggleMenuOnClick","window","activeElement","focus","click","handleMenuKeydown","event","firstFocusableElement","lastFocusableElement","key","shiftKey","preventDefault","handleMenuFocusout","modal","relatedTarget","contains","target","menuOpenedOn","documentElement","classList","add","menuClosedOn","remove","callbacks","initMenu","focusableElements","querySelectorAll","focusFirstElement","lock"],"sources":["@wordpress/block-library/src/navigation/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n// This is a fix for Safari in iOS/iPadOS. Without it, Safari doesn't focus out\n// when the user taps in the body. It can be removed once we add an overlay to\n// capture the clicks, instead of relying on the focusout event.\ndocument.addEventListener( 'click', () => {} );\n\nconst { state, actions } = store(\n\t'core/navigation',\n\t{\n\t\tstate: {\n\t\t\tget roleAttribute() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay' && state.isMenuOpen\n\t\t\t\t\t? 'dialog'\n\t\t\t\t\t: null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay' && state.isMenuOpen\n\t\t\t\t\t? 'true'\n\t\t\t\t\t: null;\n\t\t\t},\n\t\t\tget ariaLabel() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay' && state.isMenuOpen\n\t\t\t\t\t? ctx.ariaLabel\n\t\t\t\t\t: null;\n\t\t\t},\n\t\t\tget isMenuOpen() {\n\t\t\t\t// The menu is opened if either `click`, `hover` or `focus` is true.\n\t\t\t\treturn (\n\t\t\t\t\tObject.values( state.menuOpenedBy ).filter( Boolean )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t},\n\t\t\tget menuOpenedBy() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn ctx.type === 'overlay'\n\t\t\t\t\t? ctx.overlayOpenedBy\n\t\t\t\t\t: ctx.submenuOpenedBy;\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\topenMenuOnHover() {\n\t\t\t\tconst { type, overlayOpenedBy } = getContext();\n\t\t\t\tif (\n\t\t\t\t\ttype === 'submenu' &&\n\t\t\t\t\t// Only open on hover if the overlay is closed.\n\t\t\t\t\tObject.values( overlayOpenedBy || {} ).filter( Boolean )\n\t\t\t\t\t\t.length === 0\n\t\t\t\t)\n\t\t\t\t\tactions.openMenu( 'hover' );\n\t\t\t},\n\t\t\tcloseMenuOnHover() {\n\t\t\t\tactions.closeMenu( 'hover' );\n\t\t\t},\n\t\t\topenMenuOnClick() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tctx.previousFocus = ref;\n\t\t\t\tactions.openMenu( 'click' );\n\t\t\t},\n\t\t\tcloseMenuOnClick() {\n\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t},\n\t\t\topenMenuOnFocus() {\n\t\t\t\tactions.openMenu( 'focus' );\n\t\t\t},\n\t\t\ttoggleMenuOnClick() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\t// Safari won't send focus to the clicked element, so we need to manually place it: https://bugs.webkit.org/show_bug.cgi?id=22261\n\t\t\t\tif ( window.document.activeElement !== ref ) ref.focus();\n\t\t\t\tconst { menuOpenedBy } = state;\n\t\t\t\tif ( menuOpenedBy.click || menuOpenedBy.focus ) {\n\t\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t\t} else {\n\t\t\t\t\tctx.previousFocus = ref;\n\t\t\t\t\tactions.openMenu( 'click' );\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleMenuKeydown( event ) {\n\t\t\t\tconst { type, firstFocusableElement, lastFocusableElement } =\n\t\t\t\t\tgetContext();\n\t\t\t\tif ( state.menuOpenedBy.click ) {\n\t\t\t\t\t// If Escape close the menu.\n\t\t\t\t\tif ( event?.key === 'Escape' ) {\n\t\t\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Trap focus if it is an overlay (main menu).\n\t\t\t\t\tif ( type === 'overlay' && event.key === 'Tab' ) {\n\t\t\t\t\t\t// If shift + tab it change the direction.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\tfirstFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tlastFocusableElement.focus();\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\tlastFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tfirstFocusableElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleMenuFocusout( event ) {\n\t\t\t\tconst { modal } = getContext();\n\t\t\t\t// If focus is outside modal, and in the document, close menu\n\t\t\t\t// event.target === The element losing focus\n\t\t\t\t// event.relatedTarget === The element receiving focus (if any)\n\t\t\t\t// When focusout is outsite the document,\n\t\t\t\t// `window.document.activeElement` doesn't change.\n\n\t\t\t\t// The event.relatedTarget is null when something outside the navigation menu is clicked. This is only necessary for Safari.\n\t\t\t\tif (\n\t\t\t\t\tevent.relatedTarget === null ||\n\t\t\t\t\t( ! modal?.contains( event.relatedTarget ) &&\n\t\t\t\t\t\tevent.target !== window.document.activeElement )\n\t\t\t\t) {\n\t\t\t\t\tactions.closeMenu( 'click' );\n\t\t\t\t\tactions.closeMenu( 'focus' );\n\t\t\t\t}\n\t\t\t},\n\n\t\t\topenMenu( menuOpenedOn = 'click' ) {\n\t\t\t\tconst { type } = getContext();\n\t\t\t\tstate.menuOpenedBy[ menuOpenedOn ] = true;\n\t\t\t\tif ( type === 'overlay' ) {\n\t\t\t\t\t// Add a `has-modal-open` class to the <html> root.\n\t\t\t\t\tdocument.documentElement.classList.add( 'has-modal-open' );\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tcloseMenu( menuClosedOn = 'click' ) {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tstate.menuOpenedBy[ menuClosedOn ] = false;\n\t\t\t\t// Check if the menu is still open or not.\n\t\t\t\tif ( ! state.isMenuOpen ) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tctx.modal?.contains( window.document.activeElement )\n\t\t\t\t\t) {\n\t\t\t\t\t\tctx.previousFocus?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tctx.modal = null;\n\t\t\t\t\tctx.previousFocus = null;\n\t\t\t\t\tif ( ctx.type === 'overlay' ) {\n\t\t\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t\t\t'has-modal-open'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\tinitMenu() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tif ( state.isMenuOpen ) {\n\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\tctx.modal = ref;\n\t\t\t\t\tctx.firstFocusableElement = focusableElements[ 0 ];\n\t\t\t\t\tctx.lastFocusableElement =\n\t\t\t\t\t\tfocusableElements[ focusableElements.length - 1 ];\n\t\t\t\t}\n\t\t\t},\n\t\t\tfocusFirstElement() {\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tif ( state.isMenuOpen ) {\n\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\tfocusableElements?.[ 0 ]?.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,UAAU,EAAEC,UAAU,QAAQ,0BAA0B;AAExE,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,+DAA+D,EAC/D,2CAA2C,EAC3C,6CAA6C,EAC7C,2CAA2C,EAC3C,mBAAmB,EACnB,iCAAiC,CACjC;;AAED;AACA;AACA;AACAC,QAAQ,CAACC,gBAAgB,CAAE,OAAO,EAAE,MAAM,CAAC,CAAE,CAAC;AAE9C,MAAM;EAAEC,KAAK;EAAEC;AAAQ,CAAC,GAAGP,KAAK,CAC/B,iBAAiB,EACjB;EACCM,KAAK,EAAE;IACN,IAAIE,aAAaA,CAAA,EAAG;MACnB,MAAMC,GAAG,GAAGR,UAAU,CAAC,CAAC;MACxB,OAAOQ,GAAG,CAACC,IAAI,KAAK,SAAS,IAAIJ,KAAK,CAACK,UAAU,GAC9C,QAAQ,GACR,IAAI;IACR,CAAC;IACD,IAAIC,SAASA,CAAA,EAAG;MACf,MAAMH,GAAG,GAAGR,UAAU,CAAC,CAAC;MACxB,OAAOQ,GAAG,CAACC,IAAI,KAAK,SAAS,IAAIJ,KAAK,CAACK,UAAU,GAC9C,MAAM,GACN,IAAI;IACR,CAAC;IACD,IAAIE,SAASA,CAAA,EAAG;MACf,MAAMJ,GAAG,GAAGR,UAAU,CAAC,CAAC;MACxB,OAAOQ,GAAG,CAACC,IAAI,KAAK,SAAS,IAAIJ,KAAK,CAACK,UAAU,GAC9CF,GAAG,C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CAACmB,aAAa,EAAEM,KAAK,CAAC,CAAC;QAC3B;QACAzB,GAAG,CAACmC,KAAK,GAAG,IAAI;QAChBnC,GAAG,CAACmB,aAAa,GAAG,IAAI;QACxB,IAAKnB,GAAG,CAACC,IAAI,KAAK,SAAS,EAAG;UAC7BN,QAAQ,CAAC6C,eAAe,CAACC,SAAS,CAACG,MAAM,CACxC,gBACD,CAAC;QACF;MACD;IACD;EACD,CAAC;EACDC,SAAS,EAAE;IACVC,QAAQA,CAAA,EAAG;MACV,MAAM9C,GAAG,GAAGR,UAAU,CAAC,CAAC;MACxB,MAAM;QAAE0B;MAAI,CAAC,GAAGzB,UAAU,CAAC,CAAC;MAC5B,IAAKI,KAAK,CAACK,UAAU,EAAG;QACvB,MAAM6C,iBAAiB,GACtB7B,GAAG,CAAC8B,gBAAgB,CAAEtD,kBAAmB,CAAC;QAC3CM,GAAG,CAACmC,KAAK,GAAGjB,GAAG;QACflB,GAAG,CAAC6B,qBAAqB,GAAGkB,iBAAiB,CAAE,CAAC,CAAE;QAClD/C,GAAG,CAAC8B,oBAAoB,GACvBiB,iBAAiB,CAAEA,iBAAiB,CAACrC,MAAM,GAAG,CAAC,CAAE;MACnD;IACD,CAAC;IACDuC,iBAAiBA,CAAA,EAAG;MACnB,MAAM;QAAE/B;MAAI,CAAC,GAAGzB,UAAU,CAAC,CAAC;MAC5B,IAAKI,KAAK,CAACK,UAAU,EAAG;QACvB,MAAM6C,iBAAiB,GACtB7B,GAAG,CAAC8B,gBAAgB,CAAEtD,kBAAmB,CAAC;QAC3CqD,iBAAiB,GAAI,CAAC,CAAE,EAAEtB,KAAK,CAAC,CAAC;MAClC;IACD;EACD;AACD,CAAC,EACD;EAAEyB,IAAI,EAAE;AAAK,CACd,CAAC"}
@@ -19,7 +19,7 @@ const metadata = {
19
19
  description: "Start with the basic building block of all narrative.",
20
20
  keywords: ["text"],
21
21
  textdomain: "default",
22
- usesContext: ["postId", "pattern/overrides"],
22
+ usesContext: ["postId"],
23
23
  attributes: {
24
24
  align: {
25
25
  type: "string"
@@ -17,7 +17,7 @@ const {
17
17
  description: "Start with the basic building block of all narrative.",
18
18
  keywords: ["text"],
19
19
  textdomain: "default",
20
- usesContext: ["postId", "pattern/overrides"],
20
+ usesContext: ["postId"],
21
21
  attributes: {
22
22
  align: {
23
23
  type: "string"
@@ -1458,6 +1458,10 @@ figure.wp-block-image:not(.wp-block) {
1458
1458
  padding-left: 0;
1459
1459
  }
1460
1460
 
1461
+ .wp-block-image__toolbar_content_textarea {
1462
+ width: 250px;
1463
+ }
1464
+
1461
1465
  .wp-block-latest-posts {
1462
1466
  padding-right: 2.5em;
1463
1467
  }
@@ -1861,8 +1865,10 @@ figure.wp-block-image:not(.wp-block) {
1861
1865
  /**
1862
1866
  * Mobile menu.
1863
1867
  */
1864
- .is-collapsed .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
1865
- display: none;
1868
+ @media (min-width: 600px) {
1869
+ .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
1870
+ display: none;
1871
+ }
1866
1872
  }
1867
1873
 
1868
1874
  .wp-block-navigation__responsive-container.is-menu-open {
@@ -1466,6 +1466,10 @@ figure.wp-block-image:not(.wp-block) {
1466
1466
  padding-right: 0;
1467
1467
  }
1468
1468
 
1469
+ .wp-block-image__toolbar_content_textarea {
1470
+ width: 250px;
1471
+ }
1472
+
1469
1473
  .wp-block-latest-posts {
1470
1474
  padding-left: 2.5em;
1471
1475
  }
@@ -1869,8 +1873,10 @@ figure.wp-block-image:not(.wp-block) {
1869
1873
  /**
1870
1874
  * Mobile menu.
1871
1875
  */
1872
- .is-collapsed .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
1873
- display: none;
1876
+ @media (min-width: 600px) {
1877
+ .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
1878
+ display: none;
1879
+ }
1874
1880
  }
1875
1881
 
1876
1882
  .wp-block-navigation__responsive-container.is-menu-open {
@@ -231,4 +231,8 @@ figure.wp-block-image:not(.wp-block) {
231
231
  width: 36px;
232
232
  padding-right: 0;
233
233
  padding-left: 0;
234
+ }
235
+
236
+ .wp-block-image__toolbar_content_textarea {
237
+ width: 250px;
234
238
  }
@@ -231,4 +231,8 @@ figure.wp-block-image:not(.wp-block) {
231
231
  width: 36px;
232
232
  padding-left: 0;
233
233
  padding-right: 0;
234
+ }
235
+
236
+ .wp-block-image__toolbar_content_textarea {
237
+ width: 250px;
234
238
  }
@@ -391,8 +391,10 @@
391
391
  /**
392
392
  * Mobile menu.
393
393
  */
394
- .is-collapsed .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
395
- display: none;
394
+ @media (min-width: 600px) {
395
+ .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
396
+ display: none;
397
+ }
396
398
  }
397
399
 
398
400
  .wp-block-navigation__responsive-container.is-menu-open {
@@ -391,8 +391,10 @@
391
391
  /**
392
392
  * Mobile menu.
393
393
  */
394
- .is-collapsed .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
395
- display: none;
394
+ @media (min-width: 600px) {
395
+ .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close {
396
+ display: none;
397
+ }
396
398
  }
397
399
 
398
400
  .wp-block-navigation__responsive-container.is-menu-open {
@@ -504,18 +504,20 @@ button.wp-block-navigation-item__content {
504
504
  left: auto;
505
505
  right: auto;
506
506
  }
507
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) {
508
- display: block;
509
- width: 100%;
510
- position: relative;
511
- z-index: auto;
512
- background-color: inherit;
513
- }
514
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close {
515
- display: none;
516
- }
517
- :not(.is-collapsed) > .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
518
- right: 0;
507
+ @media (min-width: 600px) {
508
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
509
+ display: block;
510
+ width: 100%;
511
+ position: relative;
512
+ z-index: auto;
513
+ background-color: inherit;
514
+ }
515
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close {
516
+ display: none;
517
+ }
518
+ .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
519
+ right: 0;
520
+ }
519
521
  }
520
522
 
521
523
  .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
@@ -559,8 +561,10 @@ button.wp-block-navigation-item__content {
559
561
  font-weight: inherit;
560
562
  font-size: inherit;
561
563
  }
562
- :not(.is-collapsed) > .wp-block-navigation__responsive-container-open {
563
- display: none;
564
+ @media (min-width: 600px) {
565
+ .wp-block-navigation__responsive-container-open:not(.always-shown) {
566
+ display: none;
567
+ }
564
568
  }
565
569
 
566
570
  .wp-block-navigation__responsive-container-close {
@@ -504,18 +504,20 @@ button.wp-block-navigation-item__content {
504
504
  right: auto;
505
505
  left: auto;
506
506
  }
507
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) {
508
- display: block;
509
- width: 100%;
510
- position: relative;
511
- z-index: auto;
512
- background-color: inherit;
513
- }
514
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close {
515
- display: none;
516
- }
517
- :not(.is-collapsed) > .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
518
- left: 0;
507
+ @media (min-width: 600px) {
508
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
509
+ display: block;
510
+ width: 100%;
511
+ position: relative;
512
+ z-index: auto;
513
+ background-color: inherit;
514
+ }
515
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close {
516
+ display: none;
517
+ }
518
+ .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
519
+ left: 0;
520
+ }
519
521
  }
520
522
 
521
523
  .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
@@ -559,8 +561,10 @@ button.wp-block-navigation-item__content {
559
561
  font-weight: inherit;
560
562
  font-size: inherit;
561
563
  }
562
- :not(.is-collapsed) > .wp-block-navigation__responsive-container-open {
563
- display: none;
564
+ @media (min-width: 600px) {
565
+ .wp-block-navigation__responsive-container-open:not(.always-shown) {
566
+ display: none;
567
+ }
564
568
  }
565
569
 
566
570
  .wp-block-navigation__responsive-container-close {
@@ -2568,18 +2568,20 @@ button.wp-block-navigation-item__content {
2568
2568
  left: auto;
2569
2569
  right: auto;
2570
2570
  }
2571
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) {
2572
- display: block;
2573
- width: 100%;
2574
- position: relative;
2575
- z-index: auto;
2576
- background-color: inherit;
2577
- }
2578
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close {
2579
- display: none;
2580
- }
2581
- :not(.is-collapsed) > .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
2582
- right: 0;
2571
+ @media (min-width: 600px) {
2572
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
2573
+ display: block;
2574
+ width: 100%;
2575
+ position: relative;
2576
+ z-index: auto;
2577
+ background-color: inherit;
2578
+ }
2579
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close {
2580
+ display: none;
2581
+ }
2582
+ .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
2583
+ right: 0;
2584
+ }
2583
2585
  }
2584
2586
 
2585
2587
  .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
@@ -2623,8 +2625,10 @@ button.wp-block-navigation-item__content {
2623
2625
  font-weight: inherit;
2624
2626
  font-size: inherit;
2625
2627
  }
2626
- :not(.is-collapsed) > .wp-block-navigation__responsive-container-open {
2627
- display: none;
2628
+ @media (min-width: 600px) {
2629
+ .wp-block-navigation__responsive-container-open:not(.always-shown) {
2630
+ display: none;
2631
+ }
2628
2632
  }
2629
2633
 
2630
2634
  .wp-block-navigation__responsive-container-close {
@@ -2598,18 +2598,20 @@ button.wp-block-navigation-item__content {
2598
2598
  right: auto;
2599
2599
  left: auto;
2600
2600
  }
2601
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) {
2602
- display: block;
2603
- width: 100%;
2604
- position: relative;
2605
- z-index: auto;
2606
- background-color: inherit;
2607
- }
2608
- :not(.is-collapsed) > .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close {
2609
- display: none;
2610
- }
2611
- :not(.is-collapsed) > .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
2612
- left: 0;
2601
+ @media (min-width: 600px) {
2602
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
2603
+ display: block;
2604
+ width: 100%;
2605
+ position: relative;
2606
+ z-index: auto;
2607
+ background-color: inherit;
2608
+ }
2609
+ .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close {
2610
+ display: none;
2611
+ }
2612
+ .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
2613
+ left: 0;
2614
+ }
2613
2615
  }
2614
2616
 
2615
2617
  .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
@@ -2653,8 +2655,10 @@ button.wp-block-navigation-item__content {
2653
2655
  font-weight: inherit;
2654
2656
  font-size: inherit;
2655
2657
  }
2656
- :not(.is-collapsed) > .wp-block-navigation__responsive-container-open {
2657
- display: none;
2658
+ @media (min-width: 600px) {
2659
+ .wp-block-navigation__responsive-container-open:not(.always-shown) {
2660
+ display: none;
2661
+ }
2658
2662
  }
2659
2663
 
2660
2664
  .wp-block-navigation__responsive-container-close {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.28.1",
3
+ "version": "8.28.2",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,38 +31,38 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.51.0",
35
- "@wordpress/api-fetch": "^6.48.0",
36
- "@wordpress/autop": "^3.51.0",
37
- "@wordpress/blob": "^3.51.0",
38
- "@wordpress/block-editor": "^12.19.1",
39
- "@wordpress/blocks": "^12.28.1",
40
- "@wordpress/components": "^26.0.1",
41
- "@wordpress/compose": "^6.28.0",
42
- "@wordpress/core-data": "^6.28.1",
43
- "@wordpress/data": "^9.21.0",
44
- "@wordpress/date": "^4.51.0",
45
- "@wordpress/deprecated": "^3.51.0",
46
- "@wordpress/dom": "^3.51.0",
47
- "@wordpress/element": "^5.28.0",
48
- "@wordpress/escape-html": "^2.51.0",
49
- "@wordpress/hooks": "^3.51.0",
50
- "@wordpress/html-entities": "^3.51.0",
51
- "@wordpress/i18n": "^4.51.0",
52
- "@wordpress/icons": "^9.42.0",
53
- "@wordpress/interactivity": "^5.0.0",
54
- "@wordpress/interactivity-router": "^1.1.0",
55
- "@wordpress/keycodes": "^3.51.0",
56
- "@wordpress/notices": "^4.19.0",
57
- "@wordpress/patterns": "^1.12.1",
58
- "@wordpress/primitives": "^3.49.0",
59
- "@wordpress/private-apis": "^0.33.0",
60
- "@wordpress/reusable-blocks": "^4.28.1",
61
- "@wordpress/rich-text": "^6.28.1",
62
- "@wordpress/server-side-render": "^4.28.1",
63
- "@wordpress/url": "^3.52.0",
64
- "@wordpress/viewport": "^5.28.0",
65
- "@wordpress/wordcount": "^3.51.0",
34
+ "@wordpress/a11y": "^3.51.1",
35
+ "@wordpress/api-fetch": "^6.48.1",
36
+ "@wordpress/autop": "^3.51.1",
37
+ "@wordpress/blob": "^3.51.1",
38
+ "@wordpress/block-editor": "^12.19.2",
39
+ "@wordpress/blocks": "^12.28.2",
40
+ "@wordpress/components": "^26.0.2",
41
+ "@wordpress/compose": "^6.28.1",
42
+ "@wordpress/core-data": "^6.28.2",
43
+ "@wordpress/data": "^9.21.1",
44
+ "@wordpress/date": "^4.51.1",
45
+ "@wordpress/deprecated": "^3.51.1",
46
+ "@wordpress/dom": "^3.51.1",
47
+ "@wordpress/element": "^5.28.1",
48
+ "@wordpress/escape-html": "^2.51.1",
49
+ "@wordpress/hooks": "^3.51.1",
50
+ "@wordpress/html-entities": "^3.51.1",
51
+ "@wordpress/i18n": "^4.51.1",
52
+ "@wordpress/icons": "^9.42.1",
53
+ "@wordpress/interactivity": "^5.0.1",
54
+ "@wordpress/interactivity-router": "^1.1.1",
55
+ "@wordpress/keycodes": "^3.51.1",
56
+ "@wordpress/notices": "^4.19.1",
57
+ "@wordpress/patterns": "^1.12.2",
58
+ "@wordpress/primitives": "^3.49.1",
59
+ "@wordpress/private-apis": "^0.33.1",
60
+ "@wordpress/reusable-blocks": "^4.28.2",
61
+ "@wordpress/rich-text": "^6.28.2",
62
+ "@wordpress/server-side-render": "^4.28.2",
63
+ "@wordpress/url": "^3.52.1",
64
+ "@wordpress/viewport": "^5.28.1",
65
+ "@wordpress/wordcount": "^3.51.1",
66
66
  "change-case": "^4.1.2",
67
67
  "classnames": "^2.3.1",
68
68
  "colord": "^2.7.0",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "5902fc0f490528da6965dd4cf97f11192bcf5956"
83
+ "gitHead": "730beb7fd33d3382d6032c3f33e451625a0fcf36"
84
84
  }
@@ -8,7 +8,6 @@
8
8
  "description": "Prompt visitors to take action with a button-style link.",
9
9
  "keywords": [ "link" ],
10
10
  "textdomain": "default",
11
- "usesContext": [ "pattern/overrides" ],
12
11
  "attributes": {
13
12
  "tagName": {
14
13
  "type": "string",
@@ -68,15 +68,30 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
68
68
  * @since 6.3.0
69
69
  */
70
70
  function register_block_core_footnotes() {
71
- $post_types = get_post_types(
71
+ register_block_type_from_metadata(
72
+ __DIR__ . '/footnotes',
72
73
  array(
73
- 'show_in_rest' => true,
74
- 'public' => true,
74
+ 'render_callback' => 'render_block_core_footnotes',
75
75
  )
76
76
  );
77
+ }
78
+ add_action( 'init', 'register_block_core_footnotes' );
79
+
80
+
81
+ /**
82
+ * Registers the footnotes meta field required for footnotes to work.
83
+ *
84
+ * @since 6.5.0
85
+ */
86
+ function register_block_core_footnotes_post_meta() {
87
+ $post_types = get_post_types( array( 'show_in_rest' => true ) );
77
88
  foreach ( $post_types as $post_type ) {
78
89
  // Only register the meta field if the post type supports the editor, custom fields, and revisions.
79
- if ( post_type_supports( $post_type, 'editor' ) && post_type_supports( $post_type, 'custom-fields' ) && post_type_supports( $post_type, 'revisions' ) ) {
90
+ if (
91
+ post_type_supports( $post_type, 'editor' ) &&
92
+ post_type_supports( $post_type, 'custom-fields' ) &&
93
+ post_type_supports( $post_type, 'revisions' )
94
+ ) {
80
95
  register_post_meta(
81
96
  $post_type,
82
97
  'footnotes',
@@ -89,14 +104,12 @@ function register_block_core_footnotes() {
89
104
  );
90
105
  }
91
106
  }
92
- register_block_type_from_metadata(
93
- __DIR__ . '/footnotes',
94
- array(
95
- 'render_callback' => 'render_block_core_footnotes',
96
- )
97
- );
98
107
  }
99
- add_action( 'init', 'register_block_core_footnotes' );
108
+ /**
109
+ * Most post types are registered at priority 10, so use priority 20 here in
110
+ * order to catch them.
111
+ */
112
+ add_action( 'init', 'register_block_core_footnotes_post_meta', 20 );
100
113
 
101
114
  /**
102
115
  * Adds the footnotes field to the revisions display.
@@ -7,7 +7,6 @@
7
7
  "description": "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.",
8
8
  "keywords": [ "title", "subtitle" ],
9
9
  "textdomain": "default",
10
- "usesContext": [ "pattern/overrides" ],
11
10
  "attributes": {
12
11
  "textAlign": {
13
12
  "type": "string"
@@ -4,12 +4,7 @@
4
4
  "name": "core/image",
5
5
  "title": "Image",
6
6
  "category": "media",
7
- "usesContext": [
8
- "allowResize",
9
- "imageCrop",
10
- "fixedHeight",
11
- "pattern/overrides"
12
- ],
7
+ "usesContext": [ "allowResize", "imageCrop", "fixedHeight" ],
13
8
  "description": "Insert an image to make a visual statement.",
14
9
  "keywords": [ "img", "photo", "picture" ],
15
10
  "textdomain": "default",
@@ -181,3 +181,8 @@ figure.wp-block-image:not(.wp-block) {
181
181
  padding-right: 0;
182
182
  }
183
183
  }
184
+
185
+ .wp-block-image__toolbar_content_textarea {
186
+ // Corresponds to the size of the textarea in the block inspector.
187
+ width: 250px;
188
+ }