@wordpress/block-editor 9.5.0 → 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-lock/modal.js +2 -2
  3. package/build/components/block-lock/modal.js.map +1 -1
  4. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  5. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  6. package/build/components/block-mover/mover-description.js +95 -32
  7. package/build/components/block-mover/mover-description.js.map +1 -1
  8. package/build/components/block-settings-menu-controls/index.js +1 -1
  9. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  10. package/build/components/block-styles/preview.native.js +1 -3
  11. package/build/components/block-styles/preview.native.js.map +1 -1
  12. package/build/components/block-tools/block-selection-button.js +1 -7
  13. package/build/components/block-tools/block-selection-button.js.map +1 -1
  14. package/build/components/block-tools/index.js +4 -1
  15. package/build/components/block-tools/index.js.map +1 -1
  16. package/build/components/block-types-list/index.native.js +65 -23
  17. package/build/components/block-types-list/index.native.js.map +1 -1
  18. package/build/components/colors-gradients/control.js +1 -0
  19. package/build/components/colors-gradients/control.js.map +1 -1
  20. package/build/components/colors-gradients/dropdown.js +5 -2
  21. package/build/components/colors-gradients/dropdown.js.map +1 -1
  22. package/build/components/image-editor/cropper.js +4 -3
  23. package/build/components/image-editor/cropper.js.map +1 -1
  24. package/build/components/image-editor/index.js +3 -1
  25. package/build/components/image-editor/index.js.map +1 -1
  26. package/build/components/inserter/block-types-tab.native.js +30 -16
  27. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  28. package/build/components/inserter/preview-panel.js +8 -8
  29. package/build/components/inserter/preview-panel.js.map +1 -1
  30. package/build/components/inserter/reusable-blocks-tab.native.js +5 -1
  31. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  32. package/build/components/inserter/search-results.native.js +5 -2
  33. package/build/components/inserter/search-results.native.js.map +1 -1
  34. package/build/components/inserter/utils.native.js +21 -0
  35. package/build/components/inserter/utils.native.js.map +1 -1
  36. package/build/components/inserter-list-item/index.js +5 -1
  37. package/build/components/inserter-list-item/index.js.map +1 -1
  38. package/build/components/list-view/branch.js +1 -7
  39. package/build/components/list-view/branch.js.map +1 -1
  40. package/build/components/observe-typing/index.js +22 -8
  41. package/build/components/observe-typing/index.js.map +1 -1
  42. package/build/components/rich-text/format-toolbar-container.js +61 -12
  43. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  44. package/build/components/rich-text/index.js +2 -1
  45. package/build/components/rich-text/index.js.map +1 -1
  46. package/build/components/rich-text/use-format-types.js +36 -16
  47. package/build/components/rich-text/use-format-types.js.map +1 -1
  48. package/build/components/writing-flow/use-tab-nav.js +1 -1
  49. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  50. package/build/hooks/layout.js +14 -2
  51. package/build/hooks/layout.js.map +1 -1
  52. package/build/hooks/style.js +41 -31
  53. package/build/hooks/style.js.map +1 -1
  54. package/build/layouts/flow.js +26 -3
  55. package/build/layouts/flow.js.map +1 -1
  56. package/build-module/components/block-lock/modal.js +2 -2
  57. package/build-module/components/block-lock/modal.js.map +1 -1
  58. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
  59. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  60. package/build-module/components/block-mover/mover-description.js +97 -33
  61. package/build-module/components/block-mover/mover-description.js.map +1 -1
  62. package/build-module/components/block-settings-menu-controls/index.js +2 -2
  63. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  64. package/build-module/components/block-styles/preview.native.js +2 -3
  65. package/build-module/components/block-styles/preview.native.js.map +1 -1
  66. package/build-module/components/block-tools/block-selection-button.js +1 -7
  67. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  68. package/build-module/components/block-tools/index.js +4 -1
  69. package/build-module/components/block-tools/index.js.map +1 -1
  70. package/build-module/components/block-types-list/index.native.js +67 -25
  71. package/build-module/components/block-types-list/index.native.js.map +1 -1
  72. package/build-module/components/colors-gradients/control.js +1 -0
  73. package/build-module/components/colors-gradients/control.js.map +1 -1
  74. package/build-module/components/colors-gradients/dropdown.js +6 -3
  75. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  76. package/build-module/components/image-editor/cropper.js +4 -3
  77. package/build-module/components/image-editor/cropper.js.map +1 -1
  78. package/build-module/components/image-editor/index.js +3 -1
  79. package/build-module/components/image-editor/index.js.map +1 -1
  80. package/build-module/components/inserter/block-types-tab.native.js +31 -15
  81. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  82. package/build-module/components/inserter/preview-panel.js +9 -9
  83. package/build-module/components/inserter/preview-panel.js.map +1 -1
  84. package/build-module/components/inserter/reusable-blocks-tab.native.js +6 -2
  85. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  86. package/build-module/components/inserter/search-results.native.js +6 -3
  87. package/build-module/components/inserter/search-results.native.js.map +1 -1
  88. package/build-module/components/inserter/utils.native.js +19 -0
  89. package/build-module/components/inserter/utils.native.js.map +1 -1
  90. package/build-module/components/inserter-list-item/index.js +4 -1
  91. package/build-module/components/inserter-list-item/index.js.map +1 -1
  92. package/build-module/components/list-view/branch.js +1 -6
  93. package/build-module/components/list-view/branch.js.map +1 -1
  94. package/build-module/components/observe-typing/index.js +22 -8
  95. package/build-module/components/observe-typing/index.js.map +1 -1
  96. package/build-module/components/rich-text/format-toolbar-container.js +58 -12
  97. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  98. package/build-module/components/rich-text/index.js +2 -1
  99. package/build-module/components/rich-text/index.js.map +1 -1
  100. package/build-module/components/rich-text/use-format-types.js +37 -18
  101. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  102. package/build-module/components/writing-flow/use-tab-nav.js +1 -1
  103. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  104. package/build-module/hooks/layout.js +14 -2
  105. package/build-module/hooks/layout.js.map +1 -1
  106. package/build-module/hooks/style.js +44 -35
  107. package/build-module/hooks/style.js.map +1 -1
  108. package/build-module/layouts/flow.js +25 -3
  109. package/build-module/layouts/flow.js.map +1 -1
  110. package/build-style/style-rtl.css +2 -2
  111. package/build-style/style.css +2 -2
  112. package/package.json +28 -28
  113. package/src/components/block-lock/modal.js +5 -5
  114. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  115. package/src/components/block-mover/mover-description.js +131 -48
  116. package/src/components/block-mover/test/mover-description.js +55 -3
  117. package/src/components/block-settings-menu-controls/index.js +2 -2
  118. package/src/components/block-styles/preview.native.js +2 -2
  119. package/src/components/block-tools/block-selection-button.js +0 -5
  120. package/src/components/block-tools/index.js +4 -1
  121. package/src/components/block-types-list/index.native.js +76 -24
  122. package/src/components/block-types-list/style.native.scss +18 -0
  123. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -4
  124. package/src/components/colors/test/__snapshots__/with-colors.js.snap +1 -1
  125. package/src/components/colors/test/with-colors.js +1 -1
  126. package/src/components/colors-gradients/control.js +1 -0
  127. package/src/components/colors-gradients/dropdown.js +8 -2
  128. package/src/components/colors-gradients/style.scss +7 -8
  129. package/src/components/image-editor/cropper.js +9 -3
  130. package/src/components/image-editor/index.js +2 -0
  131. package/src/components/inserter/block-types-tab.native.js +42 -21
  132. package/src/components/inserter/preview-panel.js +6 -14
  133. package/src/components/inserter/reusable-blocks-tab.native.js +4 -2
  134. package/src/components/inserter/search-results.native.js +4 -2
  135. package/src/components/inserter/test/block-types-tab.native.js +2 -0
  136. package/src/components/inserter/test/utils.native.js +37 -0
  137. package/src/components/inserter/utils.native.js +11 -0
  138. package/src/components/inserter-list-item/index.js +4 -1
  139. package/src/components/list-view/branch.js +1 -6
  140. package/src/components/observe-typing/index.js +17 -14
  141. package/src/components/rich-text/format-toolbar-container.js +63 -14
  142. package/src/components/rich-text/index.js +1 -0
  143. package/src/components/rich-text/use-format-types.js +38 -17
  144. package/src/components/writing-flow/use-tab-nav.js +1 -1
  145. package/src/hooks/layout.js +14 -3
  146. package/src/hooks/style.js +46 -39
  147. package/src/layouts/flow.js +23 -1
@@ -6,6 +6,7 @@ import { createElement, Fragment } from "@wordpress/element";
6
6
  import { Button, __experimentalUseCustomUnits as useCustomUnits, __experimentalUnitControl as UnitControl } from '@wordpress/components';
7
7
  import { __, sprintf } from '@wordpress/i18n';
8
8
  import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
9
+ import { getCSSRules } from '@wordpress/style-engine';
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
@@ -82,7 +83,7 @@ export default {
82
83
  return null;
83
84
  },
84
85
  getLayoutStyle: function getLayoutStyle(_ref2) {
85
- var _style$spacing;
86
+ var _style$spacing, _style$spacing2;
86
87
 
87
88
  let {
88
89
  selector,
@@ -101,7 +102,7 @@ export default {
101
102
 
102
103
  const blockGapValue = blockGapStyleValue !== null && blockGapStyleValue !== void 0 && blockGapStyleValue.top && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? blockGapStyleValue === null || blockGapStyleValue === void 0 ? void 0 : blockGapStyleValue.top : '';
103
104
  let output = !!contentSize || !!wideSize ? `
104
- ${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright))')} {
105
+ ${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} {
105
106
  max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
106
107
  margin-left: auto !important;
107
108
  margin-right: auto !important;
@@ -112,7 +113,28 @@ export default {
112
113
  ${appendSelectors(selector, '> .alignfull')} {
113
114
  max-width: none;
114
115
  }
115
- ` : ''; // Output blockGap styles based on rules contained in layout definitions in theme.json.
116
+ ` : ''; // If there is custom padding, add negative margins for alignfull blocks.
117
+
118
+ if (style !== null && style !== void 0 && (_style$spacing2 = style.spacing) !== null && _style$spacing2 !== void 0 && _style$spacing2.padding) {
119
+ // The style object might be storing a preset so we need to make sure we get a usable value.
120
+ const paddingValues = getCSSRules(style);
121
+ paddingValues.forEach(rule => {
122
+ if (rule.key === 'paddingRight') {
123
+ output += `
124
+ ${appendSelectors(selector, '> .alignfull')} {
125
+ margin-right: calc(${rule.value} * -1);
126
+ }
127
+ `;
128
+ } else if (rule.key === 'paddingLeft') {
129
+ output += `
130
+ ${appendSelectors(selector, '> .alignfull')} {
131
+ margin-left: calc(${rule.value} * -1);
132
+ }
133
+ `;
134
+ }
135
+ });
136
+ } // Output blockGap styles based on rules contained in layout definitions in theme.json.
137
+
116
138
 
117
139
  if (hasBlockGapSupport && blockGapValue) {
118
140
  output += getBlockGapCSS(selector, layoutDefinitions, 'default', blockGapValue);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["Button","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","__","sprintf","Icon","positionCenter","stretchWide","useSetting","appendSelectors","getBlockGapCSS","getGapBoxControlValueFromStyle","shouldSkipSerialization","name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","wideSize","contentSize","units","availableUnits","nextWidth","parseFloat","undefined","inherit","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","getOrientation","getAlignments","alignmentInfo","getAlignmentsInfo","alignments","includes","unshift","map","alignment","info","wide","none","sizeRegex","test"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,yBAAyB,IAAIC,WAH9B,QAIO,uBAJP;AAKA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,IAAT,EAAeC,cAAf,EAA+BC,WAA/B,QAAkD,kBAAlD;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,eAAT,EAA0BC,cAA1B,QAAgD,SAAhD;AACA,SAASC,8BAAT,QAA+C,cAA/C;AACA,SAASC,uBAAT,QAAwC,gBAAxC;AAEA,e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ACC,IAAV,CAAgBlC,WAAhB,CAAL,EAAqC;AACpC;AACAuB,IAAAA,aAAa,CAACS,IAAd,GAAqBhD,OAAO,CAAED,EAAE,CAAE,aAAF,CAAJ,EAAuBiB,WAAvB,CAA5B;AACA;;AACD,MAAKiC,SAAS,CAACC,IAAV,CAAgBnC,QAAhB,CAAL,EAAkC;AACjC;AACAwB,IAAAA,aAAa,CAACQ,IAAd,GAAqB/C,OAAO,CAAED,EAAE,CAAE,aAAF,CAAJ,EAAuBgB,QAAvB,CAA5B;AACA;;AACD,SAAOwB,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapBoxControlValueFromStyle } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t} ) {\n\t\tconst { wideSize, contentSize } = layout;\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t\t'%',\n\t\t\t\t'px',\n\t\t\t\t'em',\n\t\t\t\t'rem',\n\t\t\t\t'vw',\n\t\t\t],\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls-reset\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tdisabled={ ! contentSize && ! wideSize }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcontentSize: undefined,\n\t\t\t\t\t\t\t\twideSize: undefined,\n\t\t\t\t\t\t\t\tinherit: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst { contentSize, wideSize } = layout;\n\t\tconst blockGapStyleValue = getGapBoxControlValueFromStyle(\n\t\t\tstyle?.spacing?.blockGap\n\t\t);\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tblockGapStyleValue?.top &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? blockGapStyleValue?.top\n\t\t\t\t: '';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'default',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n\n/**\n * Helper method to assign contextual info to clarify\n * alignment settings.\n *\n * Besides checking if `contentSize` and `wideSize` have a\n * value, we now show this information only if their values\n * are not a `css var`. This needs to change when parsing\n * css variables land.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752\n *\n * @param {Object} layout The layout object.\n * @return {Object} An object with contextual info per alignment.\n */\nfunction getAlignmentsInfo( layout ) {\n\tconst { contentSize, wideSize } = layout;\n\tconst alignmentInfo = {};\n\tconst sizeRegex = /^(?!0)\\d+(px|em|rem|vw|vh|%)?$/i;\n\tif ( sizeRegex.test( contentSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );\n\t}\n\tif ( sizeRegex.test( wideSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.wide = sprintf( __( 'Max %s wide' ), wideSize );\n\t}\n\treturn alignmentInfo;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["Button","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","__","sprintf","Icon","positionCenter","stretchWide","getCSSRules","useSetting","appendSelectors","getBlockGapCSS","getGapBoxControlValueFromStyle","shouldSkipSerialization","name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","wideSize","contentSize","units","availableUnits","nextWidth","parseFloat","undefined","inherit","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","padding","paddingValues","forEach","rule","key","value","getOrientation","getAlignments","alignmentInfo","getAlignmentsInfo","alignments","includes","unshift","map","alignment","info","wide","none","sizeRegex","test"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,yBAAyB,IAAIC,WAH9B,QAIO,uBAJP;AAKA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,IAAT,EAAeC,cAAf,EAA+BC,WAA/B,QAAkD,kBAAlD;AACA,SAASC,WAAT,QAA4B,yBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,eAAT,E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,KAHkB,CAAnB;;AAMA,QAAKO,WAAL,EAAmB;AAClB+B,MAAAA,UAAU,CAACE,OAAX,CAAoB;AAAExC,QAAAA,IAAI,EAAE;AAAR,OAApB;AACA;;AAED,QAAKM,QAAL,EAAgB;AACfgC,MAAAA,UAAU,CAACE,OAAX,CAAoB;AAAExC,QAAAA,IAAI,EAAE,MAAR;AAAgB2C,QAAAA,IAAI,EAAEP,aAAa,CAACQ;AAApC,OAApB;AACA;;AAEDN,IAAAA,UAAU,CAACE,OAAX,CAAoB;AAAExC,MAAAA,IAAI,EAAE,MAAR;AAAgB2C,MAAAA,IAAI,EAAEP,aAAa,CAACS;AAApC,KAApB;AAEA,WAAOP,UAAP;AACA;;AAnMa,CAAf;AAsMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASD,iBAAT,CAA4BjC,MAA5B,EAAqC;AACpC,QAAM;AAAEG,IAAAA,WAAF;AAAeD,IAAAA;AAAf,MAA4BF,MAAlC;AACA,QAAMgC,aAAa,GAAG,EAAtB;AACA,QAAMU,SAAS,GAAG,iCAAlB;;AACA,MAAKA,SAAS,CAACC,IAAV,CAAgBxC,WAAhB,CAAL,EAAqC;AACpC;AACA6B,IAAAA,aAAa,CAACS,IAAd,GAAqBvD,OAAO,CAAED,EAAE,CAAE,aAAF,CAAJ,EAAuBkB,WAAvB,CAA5B;AACA;;AACD,MAAKuC,SAAS,CAACC,IAAV,CAAgBzC,QAAhB,CAAL,EAAkC;AACjC;AACA8B,IAAAA,aAAa,CAACQ,IAAd,GAAqBtD,OAAO,CAAED,EAAE,CAAE,aAAF,CAAJ,EAAuBiB,QAAvB,CAA5B;AACA;;AACD,SAAO8B,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapBoxControlValueFromStyle } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t} ) {\n\t\tconst { wideSize, contentSize } = layout;\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t\t'%',\n\t\t\t\t'px',\n\t\t\t\t'em',\n\t\t\t\t'rem',\n\t\t\t\t'vw',\n\t\t\t],\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls-reset\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tdisabled={ ! contentSize && ! wideSize }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcontentSize: undefined,\n\t\t\t\t\t\t\t\twideSize: undefined,\n\t\t\t\t\t\t\t\tinherit: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst { contentSize, wideSize } = layout;\n\t\tconst blockGapStyleValue = getGapBoxControlValueFromStyle(\n\t\t\tstyle?.spacing?.blockGap\n\t\t);\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tblockGapStyleValue?.top &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? blockGapStyleValue?.top\n\t\t\t\t: '';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\t// If there is custom padding, add negative margins for alignfull blocks.\n\t\tif ( style?.spacing?.padding ) {\n\t\t\t// The style object might be storing a preset so we need to make sure we get a usable value.\n\t\t\tconst paddingValues = getCSSRules( style );\n\t\t\tpaddingValues.forEach( ( rule ) => {\n\t\t\t\tif ( rule.key === 'paddingRight' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-right: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t} else if ( rule.key === 'paddingLeft' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-left: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'default',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n\n/**\n * Helper method to assign contextual info to clarify\n * alignment settings.\n *\n * Besides checking if `contentSize` and `wideSize` have a\n * value, we now show this information only if their values\n * are not a `css var`. This needs to change when parsing\n * css variables land.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752\n *\n * @param {Object} layout The layout object.\n * @return {Object} An object with contextual info per alignment.\n */\nfunction getAlignmentsInfo( layout ) {\n\tconst { contentSize, wideSize } = layout;\n\tconst alignmentInfo = {};\n\tconst sizeRegex = /^(?!0)\\d+(px|em|rem|vw|vh|%)?$/i;\n\tif ( sizeRegex.test( contentSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );\n\t}\n\tif ( sizeRegex.test( wideSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.wide = sprintf( __( 'Max %s wide' ), wideSize );\n\t}\n\treturn alignmentInfo;\n}\n"]}
@@ -1680,8 +1680,8 @@
1680
1680
  margin-bottom: inherit;
1681
1681
  }
1682
1682
 
1683
- .block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content {
1684
- width: 280px;
1683
+ .block-editor-panel-color-gradient-settings__dropdown-content {
1684
+ width: 228px;
1685
1685
  }
1686
1686
 
1687
1687
  .block-editor-panel-color-gradient-settings__color-indicator {
@@ -1680,8 +1680,8 @@
1680
1680
  margin-bottom: inherit;
1681
1681
  }
1682
1682
 
1683
- .block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content {
1684
- width: 280px;
1683
+ .block-editor-panel-color-gradient-settings__dropdown-content {
1684
+ width: 228px;
1685
1685
  }
1686
1686
 
1687
1687
  .block-editor-panel-color-gradient-settings__color-indicator {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "9.5.0",
3
+ "version": "9.6.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -33,32 +33,32 @@
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.16.0",
35
35
  "@react-spring/web": "^9.4.5",
36
- "@wordpress/a11y": "^3.13.0",
37
- "@wordpress/api-fetch": "^6.10.0",
38
- "@wordpress/blob": "^3.13.0",
39
- "@wordpress/blocks": "^11.12.0",
40
- "@wordpress/components": "^19.15.0",
41
- "@wordpress/compose": "^5.11.0",
42
- "@wordpress/data": "^6.13.0",
43
- "@wordpress/date": "^4.13.0",
44
- "@wordpress/deprecated": "^3.13.0",
45
- "@wordpress/dom": "^3.13.0",
46
- "@wordpress/element": "^4.11.0",
47
- "@wordpress/hooks": "^3.13.0",
48
- "@wordpress/html-entities": "^3.13.0",
49
- "@wordpress/i18n": "^4.13.0",
50
- "@wordpress/icons": "^9.4.0",
51
- "@wordpress/is-shallow-equal": "^4.13.0",
52
- "@wordpress/keyboard-shortcuts": "^3.11.0",
53
- "@wordpress/keycodes": "^3.13.0",
54
- "@wordpress/notices": "^3.13.0",
55
- "@wordpress/rich-text": "^5.11.0",
56
- "@wordpress/shortcode": "^3.13.0",
57
- "@wordpress/style-engine": "^0.12.0",
58
- "@wordpress/token-list": "^2.13.0",
59
- "@wordpress/url": "^3.14.0",
60
- "@wordpress/warning": "^2.13.0",
61
- "@wordpress/wordcount": "^3.13.0",
36
+ "@wordpress/a11y": "^3.14.0",
37
+ "@wordpress/api-fetch": "^6.11.0",
38
+ "@wordpress/blob": "^3.14.0",
39
+ "@wordpress/blocks": "^11.13.0",
40
+ "@wordpress/components": "^19.16.0",
41
+ "@wordpress/compose": "^5.12.0",
42
+ "@wordpress/data": "^6.14.0",
43
+ "@wordpress/date": "^4.14.0",
44
+ "@wordpress/deprecated": "^3.14.0",
45
+ "@wordpress/dom": "^3.14.0",
46
+ "@wordpress/element": "^4.12.0",
47
+ "@wordpress/hooks": "^3.14.0",
48
+ "@wordpress/html-entities": "^3.14.0",
49
+ "@wordpress/i18n": "^4.14.0",
50
+ "@wordpress/icons": "^9.5.0",
51
+ "@wordpress/is-shallow-equal": "^4.14.0",
52
+ "@wordpress/keyboard-shortcuts": "^3.12.0",
53
+ "@wordpress/keycodes": "^3.14.0",
54
+ "@wordpress/notices": "^3.14.0",
55
+ "@wordpress/rich-text": "^5.12.0",
56
+ "@wordpress/shortcode": "^3.14.0",
57
+ "@wordpress/style-engine": "^0.13.0",
58
+ "@wordpress/token-list": "^2.14.0",
59
+ "@wordpress/url": "^3.15.0",
60
+ "@wordpress/warning": "^2.14.0",
61
+ "@wordpress/wordcount": "^3.14.0",
62
62
  "classnames": "^2.3.1",
63
63
  "colord": "^2.7.0",
64
64
  "diff": "^4.0.2",
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
80
+ "gitHead": "0315dbc240cb2aa146d7c1bafd251f004b88300e"
81
81
  }
@@ -88,6 +88,11 @@ export default function BlockLockModal( { clientId, onClose } ) {
88
88
  closeLabel={ __( 'Close' ) }
89
89
  onRequestClose={ onClose }
90
90
  >
91
+ <p>
92
+ { __(
93
+ 'Choose specific attributes to restrict or lock all available options.'
94
+ ) }
95
+ </p>
91
96
  <form
92
97
  onSubmit={ ( event ) => {
93
98
  event.preventDefault();
@@ -100,11 +105,6 @@ export default function BlockLockModal( { clientId, onClose } ) {
100
105
  onClose();
101
106
  } }
102
107
  >
103
- <p>
104
- { __(
105
- 'Choose specific attributes to restrict or lock all available options.'
106
- ) }
107
- </p>
108
108
  <div
109
109
  role="group"
110
110
  aria-labelledby={ instanceId }
@@ -2,7 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { Platform, findNodeHandle } from 'react-native';
5
- import { partial, first, castArray, last, compact, every } from 'lodash';
5
+ import { partial, first, castArray, last, every } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
@@ -202,7 +202,7 @@ const BlockActionsMenu = ( {
202
202
  },
203
203
  };
204
204
 
205
- const options = compact( [
205
+ const options = [
206
206
  wrapBlockMover && allOptions.backwardButton,
207
207
  wrapBlockMover && allOptions.forwardButton,
208
208
  wrapBlockSettings && allOptions.settings,
@@ -215,7 +215,7 @@ const BlockActionsMenu = ( {
215
215
  canDuplicate && allOptions.duplicateButton,
216
216
  isReusableBlockType && allOptions.convertToRegularBlocks,
217
217
  ! isLocked && allOptions.delete,
218
- ] );
218
+ ].filter( Boolean );
219
219
 
220
220
  // End early if there are no options to show.
221
221
  if ( ! options.length ) {
@@ -1,7 +1,22 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __, _n, sprintf, isRTL } from '@wordpress/i18n';
4
+ import { __, sprintf, isRTL } from '@wordpress/i18n';
5
+
6
+ const getMovementDirection = ( moveDirection, orientation ) => {
7
+ if ( moveDirection === 'up' ) {
8
+ if ( orientation === 'horizontal' ) {
9
+ return isRTL() ? 'right' : 'left';
10
+ }
11
+ return 'up';
12
+ } else if ( moveDirection === 'down' ) {
13
+ if ( orientation === 'horizontal' ) {
14
+ return isRTL() ? 'left' : 'right';
15
+ }
16
+ return 'down';
17
+ }
18
+ return null;
19
+ };
5
20
 
6
21
  /**
7
22
  * Return a label for the block movement controls depending on block position.
@@ -30,28 +45,14 @@ export function getBlockMoverDescription(
30
45
  ) {
31
46
  const position = firstIndex + 1;
32
47
 
33
- const getMovementDirection = ( moveDirection ) => {
34
- if ( moveDirection === 'up' ) {
35
- if ( orientation === 'horizontal' ) {
36
- return isRTL() ? 'right' : 'left';
37
- }
38
- return 'up';
39
- } else if ( moveDirection === 'down' ) {
40
- if ( orientation === 'horizontal' ) {
41
- return isRTL() ? 'left' : 'right';
42
- }
43
- return 'down';
44
- }
45
- return null;
46
- };
47
-
48
48
  if ( selectedCount > 1 ) {
49
49
  return getMultiBlockMoverDescription(
50
50
  selectedCount,
51
51
  firstIndex,
52
52
  isFirst,
53
53
  isLast,
54
- dir
54
+ dir,
55
+ orientation
55
56
  );
56
57
  }
57
58
 
@@ -65,7 +66,7 @@ export function getBlockMoverDescription(
65
66
 
66
67
  if ( dir > 0 && ! isLast ) {
67
68
  // Moving down.
68
- const movementDirection = getMovementDirection( 'down' );
69
+ const movementDirection = getMovementDirection( 'down', orientation );
69
70
 
70
71
  if ( movementDirection === 'down' ) {
71
72
  return sprintf(
@@ -106,7 +107,7 @@ export function getBlockMoverDescription(
106
107
 
107
108
  if ( dir > 0 && isLast ) {
108
109
  // Moving down, and is the last item.
109
- const movementDirection = getMovementDirection( 'down' );
110
+ const movementDirection = getMovementDirection( 'down', orientation );
110
111
 
111
112
  if ( movementDirection === 'down' ) {
112
113
  return sprintf(
@@ -141,7 +142,7 @@ export function getBlockMoverDescription(
141
142
 
142
143
  if ( dir < 0 && ! isFirst ) {
143
144
  // Moving up.
144
- const movementDirection = getMovementDirection( 'up' );
145
+ const movementDirection = getMovementDirection( 'up', orientation );
145
146
 
146
147
  if ( movementDirection === 'up' ) {
147
148
  return sprintf(
@@ -180,7 +181,7 @@ export function getBlockMoverDescription(
180
181
 
181
182
  if ( dir < 0 && isFirst ) {
182
183
  // Moving up, and is the first item.
183
- const movementDirection = getMovementDirection( 'up' );
184
+ const movementDirection = getMovementDirection( 'up', orientation );
184
185
 
185
186
  if ( movementDirection === 'up' ) {
186
187
  return sprintf(
@@ -223,6 +224,8 @@ export function getBlockMoverDescription(
223
224
  * @param {boolean} isLast This is the last block.
224
225
  * @param {number} dir Direction of movement (> 0 is considered to be going
225
226
  * down, < 0 is up).
227
+ * @param {string} orientation The orientation of the block movers, vertical or
228
+ * horizontal.
226
229
  *
227
230
  * @return {string} Label for the block movement controls.
228
231
  */
@@ -231,43 +234,123 @@ export function getMultiBlockMoverDescription(
231
234
  firstIndex,
232
235
  isFirst,
233
236
  isLast,
234
- dir
237
+ dir,
238
+ orientation
235
239
  ) {
236
240
  const position = firstIndex + 1;
237
241
 
238
- if ( dir < 0 && isFirst ) {
239
- return __( 'Blocks cannot be moved up as they are already at the top' );
242
+ if ( isFirst && isLast ) {
243
+ // All blocks are selected
244
+ return __( 'All blocks are selected, and cannot be moved' );
245
+ }
246
+
247
+ if ( dir > 0 && ! isLast ) {
248
+ // moving down
249
+ const movementDirection = getMovementDirection( 'down', orientation );
250
+
251
+ if ( movementDirection === 'down' ) {
252
+ return sprintf(
253
+ // translators: 1: Number of selected blocks, 2: Position of selected blocks
254
+ __( 'Move %1$d blocks from position %2$d down by one place' ),
255
+ selectedCount,
256
+ position
257
+ );
258
+ }
259
+
260
+ if ( movementDirection === 'left' ) {
261
+ return sprintf(
262
+ // translators: 1: Number of selected blocks, 2: Position of selected blocks
263
+ __( 'Move %1$d blocks from position %2$d left by one place' ),
264
+ selectedCount,
265
+ position
266
+ );
267
+ }
268
+
269
+ if ( movementDirection === 'right' ) {
270
+ return sprintf(
271
+ // translators: 1: Number of selected blocks, 2: Position of selected blocks
272
+ __( 'Move %1$d blocks from position %2$d right by one place' ),
273
+ selectedCount,
274
+ position
275
+ );
276
+ }
240
277
  }
241
278
 
242
279
  if ( dir > 0 && isLast ) {
243
- return __(
244
- 'Blocks cannot be moved down as they are already at the bottom'
245
- );
280
+ // moving down, and the selected blocks are the last item
281
+ const movementDirection = getMovementDirection( 'down', orientation );
282
+
283
+ if ( movementDirection === 'down' ) {
284
+ return __(
285
+ 'Blocks cannot be moved down as they are already at the bottom'
286
+ );
287
+ }
288
+
289
+ if ( movementDirection === 'left' ) {
290
+ return __(
291
+ 'Blocks cannot be moved left as they are already are at the leftmost position'
292
+ );
293
+ }
294
+
295
+ if ( movementDirection === 'right' ) {
296
+ return __(
297
+ 'Blocks cannot be moved right as they are already are at the rightmost position'
298
+ );
299
+ }
246
300
  }
247
301
 
248
302
  if ( dir < 0 && ! isFirst ) {
249
- return sprintf(
250
- // translators: 1: Number of selected blocks, 2: Position of selected blocks
251
- _n(
252
- 'Move %1$d block from position %2$d up by one place',
253
- 'Move %1$d blocks from position %2$d up by one place',
254
- selectedCount
255
- ),
256
- selectedCount,
257
- position
258
- );
303
+ // moving up
304
+ const movementDirection = getMovementDirection( 'up', orientation );
305
+
306
+ if ( movementDirection === 'up' ) {
307
+ return sprintf(
308
+ // translators: 1: Number of selected blocks, 2: Position of selected blocks
309
+ __( 'Move %1$d blocks from position %2$d up by one place' ),
310
+ selectedCount,
311
+ position
312
+ );
313
+ }
314
+
315
+ if ( movementDirection === 'left' ) {
316
+ return sprintf(
317
+ // translators: 1: Number of selected blocks, 2: Position of selected blocks
318
+ __( 'Move %1$d blocks from position %2$d left by one place' ),
319
+ selectedCount,
320
+ position
321
+ );
322
+ }
323
+
324
+ if ( movementDirection === 'right' ) {
325
+ return sprintf(
326
+ // translators: 1: Number of selected blocks, 2: Position of selected blocks
327
+ __( 'Move %1$d blocks from position %2$d right by one place' ),
328
+ selectedCount,
329
+ position
330
+ );
331
+ }
259
332
  }
260
333
 
261
- if ( dir > 0 && ! isLast ) {
262
- return sprintf(
263
- // translators: 1: Number of selected blocks, 2: Position of selected blocks
264
- _n(
265
- 'Move %1$d block from position %2$d down by one place',
266
- 'Move %1$d blocks from position %2$d down by one place',
267
- selectedCount
268
- ),
269
- selectedCount,
270
- position
271
- );
334
+ if ( dir < 0 && isFirst ) {
335
+ // moving up, and the selected blocks are the first item
336
+ const movementDirection = getMovementDirection( 'up', orientation );
337
+
338
+ if ( movementDirection === 'up' ) {
339
+ return __(
340
+ 'Blocks cannot be moved up as they are already at the top'
341
+ );
342
+ }
343
+
344
+ if ( movementDirection === 'left' ) {
345
+ return __(
346
+ 'Blocks cannot be moved left as they are already are at the leftmost position'
347
+ );
348
+ }
349
+
350
+ if ( movementDirection === 'right' ) {
351
+ return __(
352
+ 'Blocks cannot be moved right as they are already are at the rightmost position'
353
+ );
354
+ }
272
355
  }
273
356
  }
@@ -183,9 +183,7 @@ describe( 'block mover', () => {
183
183
  true,
184
184
  negativeDirection
185
185
  )
186
- ).toBe(
187
- 'Blocks cannot be moved up as they are already at the top'
188
- );
186
+ ).toBe( 'All blocks are selected, and cannot be moved' );
189
187
  } );
190
188
 
191
189
  it( 'generates a title for a selection of blocks at the bottom', () => {
@@ -201,5 +199,59 @@ describe( 'block mover', () => {
201
199
  'Blocks cannot be moved down as they are already at the bottom'
202
200
  );
203
201
  } );
202
+
203
+ it( 'indicates that blocks can be moved left when the orientation is horizontal and the direction is negative', () => {
204
+ expect(
205
+ getMultiBlockMoverDescription(
206
+ 4,
207
+ 1,
208
+ false,
209
+ true,
210
+ negativeDirection,
211
+ 'horizontal'
212
+ )
213
+ ).toBe( 'Move 4 blocks from position 2 left by one place' );
214
+ } );
215
+
216
+ it( 'indicates that blocks can be moved right when the orientation is horizontal and the direction is positive', () => {
217
+ expect(
218
+ getMultiBlockMoverDescription(
219
+ 4,
220
+ 0,
221
+ true,
222
+ false,
223
+ positiveDirection,
224
+ 'horizontal'
225
+ )
226
+ ).toBe( 'Move 4 blocks from position 1 right by one place' );
227
+ } );
228
+
229
+ it( 'indicates that blocks cannot be moved left when the orientation is horizontal and a selection of blocks at the left', () => {
230
+ expect(
231
+ getMultiBlockMoverDescription(
232
+ 4,
233
+ 1,
234
+ true,
235
+ true,
236
+ negativeDirection,
237
+ 'horizontal'
238
+ )
239
+ ).toBe( 'All blocks are selected, and cannot be moved' );
240
+ } );
241
+
242
+ it( 'indicates that blocks cannot be moved right when the orientation is horizontal and the block is the last block', () => {
243
+ expect(
244
+ getMultiBlockMoverDescription(
245
+ 4,
246
+ 2,
247
+ false,
248
+ true,
249
+ positiveDirection,
250
+ 'horizontal'
251
+ )
252
+ ).toBe(
253
+ 'Blocks cannot be moved right as they are already are at the rightmost position'
254
+ );
255
+ } );
204
256
  } );
205
257
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { compact, map } from 'lodash';
4
+ import { map } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -37,7 +37,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
37
37
  clientIds !== null ? clientIds : getSelectedBlockClientIds();
38
38
  return {
39
39
  selectedBlocks: map(
40
- compact( getBlocksByClientId( ids ) ),
40
+ getBlocksByClientId( ids ).filter( Boolean ),
41
41
  ( block ) => block.name
42
42
  ),
43
43
  selectedClientIds: ids,
@@ -8,8 +8,8 @@ import {
8
8
  Dimensions,
9
9
  Animated,
10
10
  Easing,
11
+ Image,
11
12
  } from 'react-native';
12
- import FastImage from 'react-native-fast-image';
13
13
 
14
14
  /**
15
15
  * WordPress dependencies
@@ -91,7 +91,7 @@ function StylePreview( { onPress, isActive, style, url } ) {
91
91
  <View style={ styles.imageWrapper }>
92
92
  { isActive &&
93
93
  getOutline( [ styles.outline, innerOutlineStyle ] ) }
94
- <FastImage
94
+ <Image
95
95
  style={ [ styles.image, styles[ name ] ] }
96
96
  source={ { uri: url } }
97
97
  />
@@ -102,7 +102,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
102
102
  getMultiSelectedBlocksEndClientId,
103
103
  getPreviousBlockClientId,
104
104
  getNextBlockClientId,
105
- isNavigationMode,
106
105
  } = useSelect( blockEditorStore );
107
106
  const {
108
107
  selectBlock,
@@ -160,10 +159,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
160
159
  selectedBlockClientId;
161
160
  }
162
161
  const startingBlockClientId = hasBlockMovingClientId();
163
- if ( isEscape && isNavigationMode() ) {
164
- clearSelectedBlock();
165
- event.preventDefault();
166
- }
167
162
  if ( isEscape && startingBlockClientId && ! event.defaultPrevented ) {
168
163
  setBlockMovingClientId( null );
169
164
  event.preventDefault();