@wordpress/block-editor 12.6.0 → 12.7.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 (199) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +2 -2
  3. package/build/autocompleters/block.js +6 -2
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-editing-mode/index.js +1 -1
  6. package/build/components/block-editing-mode/index.js.map +1 -1
  7. package/build/components/block-list/block.js +4 -2
  8. package/build/components/block-list/block.js.map +1 -1
  9. package/build/components/block-list/index.js +2 -4
  10. package/build/components/block-list/index.js.map +1 -1
  11. package/build/components/block-parent-selector/index.js +6 -21
  12. package/build/components/block-parent-selector/index.js.map +1 -1
  13. package/build/components/block-preview/auto.js +6 -1
  14. package/build/components/block-preview/auto.js.map +1 -1
  15. package/build/components/block-settings-menu/block-settings-dropdown.js +3 -17
  16. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  17. package/build/components/block-toolbar/index.js +4 -34
  18. package/build/components/block-toolbar/index.js.map +1 -1
  19. package/build/components/block-toolbar/utils.js +56 -51
  20. package/build/components/block-toolbar/utils.js.map +1 -1
  21. package/build/components/block-tools/block-contextual-toolbar.js +4 -2
  22. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  23. package/build/components/block-variation-picker/index.native.js +10 -20
  24. package/build/components/block-variation-picker/index.native.js.map +1 -1
  25. package/build/components/editor-styles/index.js +2 -2
  26. package/build/components/editor-styles/index.js.map +1 -1
  27. package/build/components/font-sizes/fluid-utils.js +11 -11
  28. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  29. package/build/components/global-styles/behaviors-panel.js +66 -0
  30. package/build/components/global-styles/behaviors-panel.js.map +1 -0
  31. package/build/components/global-styles/hooks.js +118 -4
  32. package/build/components/global-styles/hooks.js.map +1 -1
  33. package/build/components/global-styles/index.js +20 -0
  34. package/build/components/global-styles/index.js.map +1 -1
  35. package/build/components/global-styles/typography-utils.js +4 -4
  36. package/build/components/global-styles/typography-utils.js.map +1 -1
  37. package/build/components/global-styles/utils.js +1 -1
  38. package/build/components/global-styles/utils.js.map +1 -1
  39. package/build/components/inserter/hooks/use-block-types-state.js +6 -2
  40. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  41. package/build/components/inserter/hooks/use-debounced-input.js +5 -7
  42. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -1
  43. package/build/components/inserter/hooks/use-patterns-state.js +3 -2
  44. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  45. package/build/components/inserter/reusable-blocks-tab.js +3 -2
  46. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  47. package/build/components/inserter-list-item/index.js +1 -1
  48. package/build/components/inserter-list-item/index.js.map +1 -1
  49. package/build/components/link-control/index.js +47 -6
  50. package/build/components/link-control/index.js.map +1 -1
  51. package/build/components/link-control/link-preview.js +3 -3
  52. package/build/components/link-control/link-preview.js.map +1 -1
  53. package/build/components/list-view/use-list-view-drop-zone.js +6 -1
  54. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  55. package/build/components/media-replace-flow/index.native.js +15 -3
  56. package/build/components/media-replace-flow/index.native.js.map +1 -1
  57. package/build/components/rich-text/format-edit.js +57 -28
  58. package/build/components/rich-text/format-edit.js.map +1 -1
  59. package/build/components/rich-text/get-rich-text-values.js +11 -18
  60. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  61. package/build/components/spacing-sizes-control/utils.js +2 -2
  62. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  63. package/build/hooks/behaviors.js +5 -12
  64. package/build/hooks/behaviors.js.map +1 -1
  65. package/build/hooks/border.js +2 -1
  66. package/build/hooks/border.js.map +1 -1
  67. package/build/hooks/style.js +11 -2
  68. package/build/hooks/style.js.map +1 -1
  69. package/build/private-apis.js +4 -1
  70. package/build/private-apis.js.map +1 -1
  71. package/build/store/actions.js +2 -3
  72. package/build/store/actions.js.map +1 -1
  73. package/build/store/selectors.js +4 -71
  74. package/build/store/selectors.js.map +1 -1
  75. package/build-module/autocompleters/block.js +7 -3
  76. package/build-module/autocompleters/block.js.map +1 -1
  77. package/build-module/components/block-editing-mode/index.js +1 -1
  78. package/build-module/components/block-editing-mode/index.js.map +1 -1
  79. package/build-module/components/block-list/block.js +4 -2
  80. package/build-module/components/block-list/block.js.map +1 -1
  81. package/build-module/components/block-list/index.js +2 -3
  82. package/build-module/components/block-list/index.js.map +1 -1
  83. package/build-module/components/block-parent-selector/index.js +7 -22
  84. package/build-module/components/block-parent-selector/index.js.map +1 -1
  85. package/build-module/components/block-preview/auto.js +6 -1
  86. package/build-module/components/block-preview/auto.js.map +1 -1
  87. package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -18
  88. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  89. package/build-module/components/block-toolbar/index.js +6 -36
  90. package/build-module/components/block-toolbar/index.js.map +1 -1
  91. package/build-module/components/block-toolbar/utils.js +54 -49
  92. package/build-module/components/block-toolbar/utils.js.map +1 -1
  93. package/build-module/components/block-tools/block-contextual-toolbar.js +4 -2
  94. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  95. package/build-module/components/block-variation-picker/index.native.js +13 -23
  96. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  97. package/build-module/components/editor-styles/index.js +2 -2
  98. package/build-module/components/editor-styles/index.js.map +1 -1
  99. package/build-module/components/font-sizes/fluid-utils.js +11 -11
  100. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  101. package/build-module/components/global-styles/behaviors-panel.js +57 -0
  102. package/build-module/components/global-styles/behaviors-panel.js.map +1 -0
  103. package/build-module/components/global-styles/hooks.js +115 -5
  104. package/build-module/components/global-styles/hooks.js.map +1 -1
  105. package/build-module/components/global-styles/index.js +2 -1
  106. package/build-module/components/global-styles/index.js.map +1 -1
  107. package/build-module/components/global-styles/typography-utils.js +4 -4
  108. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  109. package/build-module/components/global-styles/utils.js +1 -1
  110. package/build-module/components/global-styles/utils.js.map +1 -1
  111. package/build-module/components/inserter/hooks/use-block-types-state.js +7 -3
  112. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  113. package/build-module/components/inserter/hooks/use-debounced-input.js +5 -7
  114. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -1
  115. package/build-module/components/inserter/hooks/use-patterns-state.js +3 -2
  116. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  117. package/build-module/components/inserter/reusable-blocks-tab.js +3 -2
  118. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  119. package/build-module/components/inserter-list-item/index.js +1 -1
  120. package/build-module/components/inserter-list-item/index.js.map +1 -1
  121. package/build-module/components/link-control/index.js +45 -6
  122. package/build-module/components/link-control/index.js.map +1 -1
  123. package/build-module/components/link-control/link-preview.js +3 -3
  124. package/build-module/components/link-control/link-preview.js.map +1 -1
  125. package/build-module/components/list-view/use-list-view-drop-zone.js +6 -1
  126. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  127. package/build-module/components/media-replace-flow/index.native.js +15 -3
  128. package/build-module/components/media-replace-flow/index.native.js.map +1 -1
  129. package/build-module/components/rich-text/format-edit.js +51 -26
  130. package/build-module/components/rich-text/format-edit.js.map +1 -1
  131. package/build-module/components/rich-text/get-rich-text-values.js +13 -18
  132. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
  133. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  134. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  135. package/build-module/hooks/behaviors.js +5 -12
  136. package/build-module/hooks/behaviors.js.map +1 -1
  137. package/build-module/hooks/border.js +2 -1
  138. package/build-module/hooks/border.js.map +1 -1
  139. package/build-module/hooks/style.js +11 -2
  140. package/build-module/hooks/style.js.map +1 -1
  141. package/build-module/private-apis.js +3 -1
  142. package/build-module/private-apis.js.map +1 -1
  143. package/build-module/store/actions.js +2 -3
  144. package/build-module/store/actions.js.map +1 -1
  145. package/build-module/store/selectors.js +4 -69
  146. package/build-module/store/selectors.js.map +1 -1
  147. package/build-style/style-rtl.css +18 -5
  148. package/build-style/style.css +18 -5
  149. package/package.json +31 -31
  150. package/src/autocompleters/block.js +21 -6
  151. package/src/components/block-draggable/test/index.native.js +2 -3
  152. package/src/components/block-editing-mode/index.js +1 -1
  153. package/src/components/block-list/block.js +6 -1
  154. package/src/components/block-list/index.js +3 -6
  155. package/src/components/block-list/test/block-invalid-warning.native.js +8 -1
  156. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +24 -0
  157. package/src/components/block-parent-selector/index.js +30 -42
  158. package/src/components/block-preview/auto.js +8 -1
  159. package/src/components/block-preview/style.scss +2 -1
  160. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -13
  161. package/src/components/block-toolbar/index.js +36 -63
  162. package/src/components/block-toolbar/utils.js +57 -45
  163. package/src/components/block-tools/block-contextual-toolbar.js +43 -35
  164. package/src/components/block-tools/style.scss +17 -5
  165. package/src/components/block-variation-picker/index.native.js +52 -72
  166. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  167. package/src/components/editor-styles/index.js +2 -2
  168. package/src/components/font-sizes/fluid-utils.js +17 -17
  169. package/src/components/font-sizes/test/fluid-utils.js +6 -6
  170. package/src/components/global-styles/behaviors-panel.js +71 -0
  171. package/src/components/global-styles/hooks.js +114 -5
  172. package/src/components/global-styles/index.js +3 -0
  173. package/src/components/global-styles/test/typography-utils.js +6 -6
  174. package/src/components/global-styles/typography-utils.js +4 -4
  175. package/src/components/global-styles/utils.js +2 -1
  176. package/src/components/inserter/hooks/use-block-types-state.js +15 -6
  177. package/src/components/inserter/hooks/use-debounced-input.js +8 -7
  178. package/src/components/inserter/hooks/use-patterns-state.js +2 -1
  179. package/src/components/inserter/reusable-blocks-tab.js +4 -1
  180. package/src/components/inserter-list-item/index.js +3 -1
  181. package/src/components/link-control/README.md +12 -3
  182. package/src/components/link-control/index.js +43 -6
  183. package/src/components/link-control/link-preview.js +6 -4
  184. package/src/components/link-control/style.scss +3 -2
  185. package/src/components/link-control/test/index.js +2 -1
  186. package/src/components/list-view/use-list-view-drop-zone.js +5 -1
  187. package/src/components/media-replace-flow/index.native.js +12 -3
  188. package/src/components/media-upload/test/index.native.js +1 -0
  189. package/src/components/rich-text/format-edit.js +62 -38
  190. package/src/components/rich-text/get-rich-text-values.js +22 -28
  191. package/src/components/spacing-sizes-control/test/utils.js +9 -1
  192. package/src/components/spacing-sizes-control/utils.js +2 -2
  193. package/src/hooks/behaviors.js +10 -16
  194. package/src/hooks/border.js +2 -1
  195. package/src/hooks/style.js +7 -3
  196. package/src/private-apis.js +2 -0
  197. package/src/store/actions.js +22 -28
  198. package/src/store/selectors.js +3 -80
  199. package/src/store/test/selectors.js +7 -6
@@ -332,6 +332,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
332
332
  .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
333
333
  display: none;
334
334
  }
335
+ .block-editor-block-contextual-toolbar.is-collapsed::after {
336
+ content: "";
337
+ position: absolute;
338
+ right: 100%;
339
+ width: 48px;
340
+ height: 100%;
341
+ background: linear-gradient(to left, #fff, transparent);
342
+ }
335
343
  @media (min-width: 782px) {
336
344
  .block-editor-block-contextual-toolbar.is-fixed {
337
345
  margin-right: 180px;
@@ -351,11 +359,11 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
351
359
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
352
360
  width: initial;
353
361
  }
354
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers {
362
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar {
355
363
  flex-grow: initial;
356
364
  width: initial;
357
365
  }
358
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers::before {
366
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar::before {
359
367
  content: "";
360
368
  width: 1px;
361
369
  height: 24px;
@@ -473,7 +481,10 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
473
481
  }
474
482
  @media (min-width: 960px) {
475
483
  .block-editor-block-contextual-toolbar.is-fixed {
476
- width: calc(100% - 240px - 256px);
484
+ width: auto;
485
+ }
486
+ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
487
+ width: calc(100% - 280px - 256px);
477
488
  }
478
489
  }
479
490
 
@@ -1011,6 +1022,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1011
1022
  overflow: hidden;
1012
1023
  }
1013
1024
  .block-editor-block-preview__container .block-editor-block-preview__content {
1025
+ width: 100%;
1014
1026
  top: 0;
1015
1027
  right: 0;
1016
1028
  transform-origin: top right;
@@ -1972,7 +1984,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1972
1984
  flex-direction: row-reverse;
1973
1985
  justify-content: flex-start;
1974
1986
  gap: 8px;
1975
- padding: 8px;
1987
+ padding: 8px 16px 16px;
1976
1988
  order: 20;
1977
1989
  }
1978
1990
 
@@ -2077,9 +2089,9 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2077
2089
  }
2078
2090
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2079
2091
  display: block;
2080
- margin-bottom: 0.2em;
2081
2092
  font-weight: 500;
2082
2093
  position: relative;
2094
+ line-height: 24px;
2083
2095
  }
2084
2096
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
2085
2097
  font-weight: 600;
@@ -2141,6 +2153,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2141
2153
  display: flex;
2142
2154
  flex-direction: row;
2143
2155
  width: 100%;
2156
+ align-items: center;
2144
2157
  }
2145
2158
 
2146
2159
  .block-editor-link-control__search-item-bottom {
@@ -332,6 +332,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
332
332
  .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
333
333
  display: none;
334
334
  }
335
+ .block-editor-block-contextual-toolbar.is-collapsed::after {
336
+ content: "";
337
+ position: absolute;
338
+ left: 100%;
339
+ width: 48px;
340
+ height: 100%;
341
+ background: linear-gradient(to right, #fff, transparent);
342
+ }
335
343
  @media (min-width: 782px) {
336
344
  .block-editor-block-contextual-toolbar.is-fixed {
337
345
  margin-left: 180px;
@@ -351,11 +359,11 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
351
359
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
352
360
  width: initial;
353
361
  }
354
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers {
362
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar {
355
363
  flex-grow: initial;
356
364
  width: initial;
357
365
  }
358
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers::before {
366
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar::before {
359
367
  content: "";
360
368
  width: 1px;
361
369
  height: 24px;
@@ -473,7 +481,10 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
473
481
  }
474
482
  @media (min-width: 960px) {
475
483
  .block-editor-block-contextual-toolbar.is-fixed {
476
- width: calc(100% - 240px - 256px);
484
+ width: auto;
485
+ }
486
+ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
487
+ width: calc(100% - 280px - 256px);
477
488
  }
478
489
  }
479
490
 
@@ -1011,6 +1022,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1011
1022
  overflow: hidden;
1012
1023
  }
1013
1024
  .block-editor-block-preview__container .block-editor-block-preview__content {
1025
+ width: 100%;
1014
1026
  top: 0;
1015
1027
  left: 0;
1016
1028
  transform-origin: top left;
@@ -1973,7 +1985,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1973
1985
  flex-direction: row-reverse;
1974
1986
  justify-content: flex-start;
1975
1987
  gap: 8px;
1976
- padding: 8px;
1988
+ padding: 8px 16px 16px;
1977
1989
  order: 20;
1978
1990
  }
1979
1991
 
@@ -2078,9 +2090,9 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2078
2090
  }
2079
2091
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2080
2092
  display: block;
2081
- margin-bottom: 0.2em;
2082
2093
  font-weight: 500;
2083
2094
  position: relative;
2095
+ line-height: 24px;
2084
2096
  }
2085
2097
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
2086
2098
  font-weight: 600;
@@ -2142,6 +2154,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2142
2154
  display: flex;
2143
2155
  flex-direction: row;
2144
2156
  width: 100%;
2157
+ align-items: center;
2145
2158
  }
2146
2159
 
2147
2160
  .block-editor-link-control__search-item-bottom {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.6.0",
3
+ "version": "12.7.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -35,35 +35,35 @@
35
35
  "@emotion/react": "^11.7.1",
36
36
  "@emotion/styled": "^11.6.0",
37
37
  "@react-spring/web": "^9.4.5",
38
- "@wordpress/a11y": "^3.38.0",
39
- "@wordpress/api-fetch": "^6.35.0",
40
- "@wordpress/blob": "^3.38.0",
41
- "@wordpress/blocks": "^12.15.0",
42
- "@wordpress/components": "^25.4.0",
43
- "@wordpress/compose": "^6.15.0",
44
- "@wordpress/data": "^9.8.0",
45
- "@wordpress/date": "^4.38.0",
46
- "@wordpress/deprecated": "^3.38.0",
47
- "@wordpress/dom": "^3.38.0",
48
- "@wordpress/element": "^5.15.0",
49
- "@wordpress/escape-html": "^2.38.0",
50
- "@wordpress/hooks": "^3.38.0",
51
- "@wordpress/html-entities": "^3.38.0",
52
- "@wordpress/i18n": "^4.38.0",
53
- "@wordpress/icons": "^9.29.0",
54
- "@wordpress/is-shallow-equal": "^4.38.0",
55
- "@wordpress/keyboard-shortcuts": "^4.15.0",
56
- "@wordpress/keycodes": "^3.38.0",
57
- "@wordpress/notices": "^4.6.0",
58
- "@wordpress/preferences": "^3.15.0",
59
- "@wordpress/private-apis": "^0.20.0",
60
- "@wordpress/rich-text": "^6.15.0",
61
- "@wordpress/shortcode": "^3.38.0",
62
- "@wordpress/style-engine": "^1.21.0",
63
- "@wordpress/token-list": "^2.38.0",
64
- "@wordpress/url": "^3.39.0",
65
- "@wordpress/warning": "^2.38.0",
66
- "@wordpress/wordcount": "^3.38.0",
38
+ "@wordpress/a11y": "^3.39.0",
39
+ "@wordpress/api-fetch": "^6.36.0",
40
+ "@wordpress/blob": "^3.39.0",
41
+ "@wordpress/blocks": "^12.16.0",
42
+ "@wordpress/components": "^25.5.0",
43
+ "@wordpress/compose": "^6.16.0",
44
+ "@wordpress/data": "^9.9.0",
45
+ "@wordpress/date": "^4.39.0",
46
+ "@wordpress/deprecated": "^3.39.0",
47
+ "@wordpress/dom": "^3.39.0",
48
+ "@wordpress/element": "^5.16.0",
49
+ "@wordpress/escape-html": "^2.39.0",
50
+ "@wordpress/hooks": "^3.39.0",
51
+ "@wordpress/html-entities": "^3.39.0",
52
+ "@wordpress/i18n": "^4.39.0",
53
+ "@wordpress/icons": "^9.30.0",
54
+ "@wordpress/is-shallow-equal": "^4.39.0",
55
+ "@wordpress/keyboard-shortcuts": "^4.16.0",
56
+ "@wordpress/keycodes": "^3.39.0",
57
+ "@wordpress/notices": "^4.7.0",
58
+ "@wordpress/preferences": "^3.16.0",
59
+ "@wordpress/private-apis": "^0.21.0",
60
+ "@wordpress/rich-text": "^6.16.0",
61
+ "@wordpress/shortcode": "^3.39.0",
62
+ "@wordpress/style-engine": "^1.22.0",
63
+ "@wordpress/token-list": "^2.39.0",
64
+ "@wordpress/url": "^3.40.0",
65
+ "@wordpress/warning": "^2.39.0",
66
+ "@wordpress/wordcount": "^3.39.0",
67
67
  "change-case": "^4.1.2",
68
68
  "classnames": "^2.3.1",
69
69
  "colord": "^2.7.0",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "6f14d11ed4cb59df110a28ebaa23ecba95eb673a"
88
+ "gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
89
89
  }
@@ -5,6 +5,7 @@ import { useSelect } from '@wordpress/data';
5
5
  import {
6
6
  createBlock,
7
7
  createBlocksFromInnerBlocksTemplate,
8
+ parse,
8
9
  } from '@wordpress/blocks';
9
10
  import { useMemo } from '@wordpress/element';
10
11
 
@@ -116,14 +117,28 @@ function createBlockCompleter() {
116
117
  return ! ( /\S/.test( before ) || /\S/.test( after ) );
117
118
  },
118
119
  getOptionCompletion( inserterItem ) {
119
- const { name, initialAttributes, innerBlocks } = inserterItem;
120
+ const {
121
+ name,
122
+ initialAttributes,
123
+ innerBlocks,
124
+ syncStatus,
125
+ content,
126
+ } = inserterItem;
127
+
120
128
  return {
121
129
  action: 'replace',
122
- value: createBlock(
123
- name,
124
- initialAttributes,
125
- createBlocksFromInnerBlocksTemplate( innerBlocks )
126
- ),
130
+ value:
131
+ syncStatus === 'unsynced'
132
+ ? parse( content, {
133
+ __unstableSkipMigrationLogs: true,
134
+ } )
135
+ : createBlock(
136
+ name,
137
+ initialAttributes,
138
+ createBlocksFromInnerBlocksTemplate(
139
+ innerBlocks
140
+ )
141
+ ),
127
142
  };
128
143
  },
129
144
  };
@@ -16,7 +16,6 @@ import TextInputState from 'react-native/Libraries/Components/TextInput/TextInpu
16
16
  */
17
17
  import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
18
18
  import { registerCoreBlocks } from '@wordpress/block-library';
19
- import '@wordpress/jest-console';
20
19
 
21
20
  /**
22
21
  * Internal dependencies
@@ -383,7 +382,7 @@ describe( 'BlockDraggable', () => {
383
382
  // activate the gesture. Since this not available in tests, the library
384
383
  // displays a warning message.
385
384
  expect( console ).toHaveWarnedWith(
386
- '[react-native-gesture-handler] You have to use react-native-reanimated in order to control the state of the gesture.'
385
+ '[Reanimated] You can not use setGestureState in non-worklet function.'
387
386
  );
388
387
  expect( getEditorHtml() ).toMatchSnapshot(
389
388
  'Paragraph block moved from first to second position'
@@ -411,7 +410,7 @@ describe( 'BlockDraggable', () => {
411
410
  // activate the gesture. Since this not available in tests, the library
412
411
  // displays a warning message.
413
412
  expect( console ).toHaveWarnedWith(
414
- '[react-native-gesture-handler] You have to use react-native-reanimated in order to control the state of the gesture.'
413
+ '[Reanimated] You can not use setGestureState in non-worklet function.'
415
414
  );
416
415
  expect( getEditorHtml() ).toMatchSnapshot(
417
416
  'Spacer block moved from third to first position'
@@ -66,6 +66,6 @@ export function useBlockEditingMode( mode ) {
66
66
  unsetBlockEditingMode( clientId );
67
67
  }
68
68
  };
69
- }, [ clientId, mode ] );
69
+ }, [ clientId, mode, setBlockEditingMode, unsetBlockEditingMode ] );
70
70
  return blockEditingMode;
71
71
  }
@@ -505,9 +505,14 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
505
505
  ) {
506
506
  __unstableMarkLastChangeAsPersistent();
507
507
  }
508
+ //Unsynced patterns are nested in an array so we need to flatten them.
509
+ const replacementBlocks =
510
+ blocks?.length === 1 && Array.isArray( blocks[ 0 ] )
511
+ ? blocks[ 0 ]
512
+ : blocks;
508
513
  replaceBlocks(
509
514
  [ ownProps.clientId ],
510
- blocks,
515
+ replacementBlocks,
511
516
  indexToSelect,
512
517
  initialPosition
513
518
  );
@@ -33,7 +33,6 @@ import { useInBetweenInserter } from './use-in-between-inserter';
33
33
  import { store as blockEditorStore } from '../../store';
34
34
  import { usePreParsePatterns } from '../../utils/pre-parse-patterns';
35
35
  import { LayoutProvider, defaultLayout } from './layout';
36
- import BlockToolsBackCompat from '../block-tools/back-compat';
37
36
  import { useBlockSelectionClearer } from '../block-selection-clearer';
38
37
  import { useInnerBlocksProps } from '../inner-blocks';
39
38
  import {
@@ -127,11 +126,9 @@ function Root( { className, ...settings } ) {
127
126
  export default function BlockList( settings ) {
128
127
  usePreParsePatterns();
129
128
  return (
130
- <BlockToolsBackCompat>
131
- <BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>
132
- <Root { ...settings } />
133
- </BlockEditContextProvider>
134
- </BlockToolsBackCompat>
129
+ <BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>
130
+ <Root { ...settings } />
131
+ </BlockEditContextProvider>
135
132
  );
136
133
  }
137
134
 
@@ -19,6 +19,10 @@ describe( 'Block invalid warning', () => {
19
19
  <div styless="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
20
20
  <!-- /wp:spacer -->`,
21
21
  } );
22
+ expect( console ).toHaveErrored();
23
+ expect( console ).toHaveWarnedWith(
24
+ 'Encountered unexpected attribute `styless`.'
25
+ );
22
26
 
23
27
  // Assert
24
28
  const warningElement = screen.getByText( /Problem displaying block./ );
@@ -32,7 +36,10 @@ describe( 'Block invalid warning', () => {
32
36
  <div styless="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
33
37
  <!-- /wp:spacer -->`,
34
38
  } );
35
-
39
+ expect( console ).toHaveErrored();
40
+ expect( console ).toHaveWarnedWith(
41
+ 'Encountered unexpected attribute `styless`.'
42
+ );
36
43
  // Act
37
44
  fireEvent.press( screen.getByText( /Problem displaying block./ ) );
38
45
  const spacerBlock = getBlock( screen, 'Spacer' );
@@ -63,7 +63,19 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
63
63
  accessibilityRole="button"
64
64
  accessibilityState={
65
65
  {
66
+ "busy": undefined,
67
+ "checked": undefined,
66
68
  "disabled": false,
69
+ "expanded": undefined,
70
+ "selected": undefined,
71
+ }
72
+ }
73
+ accessibilityValue={
74
+ {
75
+ "max": undefined,
76
+ "min": undefined,
77
+ "now": undefined,
78
+ "text": undefined,
67
79
  }
68
80
  }
69
81
  accessible={true}
@@ -130,7 +142,19 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
130
142
  accessibilityRole="button"
131
143
  accessibilityState={
132
144
  {
145
+ "busy": undefined,
146
+ "checked": undefined,
133
147
  "disabled": true,
148
+ "expanded": undefined,
149
+ "selected": undefined,
150
+ }
151
+ }
152
+ accessibilityValue={
153
+ {
154
+ "max": undefined,
155
+ "min": undefined,
156
+ "now": undefined,
157
+ "text": undefined,
134
158
  }
135
159
  }
136
160
  accessible={true}
@@ -12,7 +12,7 @@ import { useRef } from '@wordpress/element';
12
12
  */
13
13
  import useBlockDisplayInformation from '../use-block-display-information';
14
14
  import BlockIcon from '../block-icon';
15
- import { useShowMoversGestures } from '../block-toolbar/utils';
15
+ import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
16
16
  import { store as blockEditorStore } from '../../store';
17
17
  import { unlock } from '../../lock-unlock';
18
18
 
@@ -23,52 +23,40 @@ import { unlock } from '../../lock-unlock';
23
23
  * @return {WPComponent} Parent block selector.
24
24
  */
25
25
  export default function BlockParentSelector() {
26
- const { selectBlock, toggleBlockHighlight } =
27
- useDispatch( blockEditorStore );
28
- const { firstParentClientId, isVisible, isDistractionFree } = useSelect(
29
- ( select ) => {
30
- const {
31
- getBlockName,
32
- getBlockParents,
33
- getSelectedBlockClientId,
34
- getSettings,
35
- getBlockEditingMode,
36
- } = unlock( select( blockEditorStore ) );
37
- const { hasBlockSupport } = select( blocksStore );
38
- const selectedBlockClientId = getSelectedBlockClientId();
39
- const parents = getBlockParents( selectedBlockClientId );
40
- const _firstParentClientId = parents[ parents.length - 1 ];
41
- const parentBlockName = getBlockName( _firstParentClientId );
42
- const _parentBlockType = getBlockType( parentBlockName );
43
- const settings = getSettings();
44
- return {
45
- firstParentClientId: _firstParentClientId,
46
- isVisible:
47
- _firstParentClientId &&
48
- getBlockEditingMode( _firstParentClientId ) === 'default' &&
49
- hasBlockSupport(
50
- _parentBlockType,
51
- '__experimentalParentSelector',
52
- true
53
- ),
54
- isDistractionFree: settings.isDistractionFree,
55
- };
56
- },
57
- []
58
- );
26
+ const { selectBlock } = useDispatch( blockEditorStore );
27
+ const { firstParentClientId, isVisible } = useSelect( ( select ) => {
28
+ const {
29
+ getBlockName,
30
+ getBlockParents,
31
+ getSelectedBlockClientId,
32
+ getBlockEditingMode,
33
+ } = unlock( select( blockEditorStore ) );
34
+ const { hasBlockSupport } = select( blocksStore );
35
+ const selectedBlockClientId = getSelectedBlockClientId();
36
+ const parents = getBlockParents( selectedBlockClientId );
37
+ const _firstParentClientId = parents[ parents.length - 1 ];
38
+ const parentBlockName = getBlockName( _firstParentClientId );
39
+ const _parentBlockType = getBlockType( parentBlockName );
40
+ return {
41
+ firstParentClientId: _firstParentClientId,
42
+ isVisible:
43
+ _firstParentClientId &&
44
+ getBlockEditingMode( _firstParentClientId ) === 'default' &&
45
+ hasBlockSupport(
46
+ _parentBlockType,
47
+ '__experimentalParentSelector',
48
+ true
49
+ ),
50
+ };
51
+ }, [] );
59
52
  const blockInformation = useBlockDisplayInformation( firstParentClientId );
60
53
 
61
54
  // Allows highlighting the parent block outline when focusing or hovering
62
55
  // the parent block selector within the child.
63
56
  const nodeRef = useRef();
64
- const { gestures: showMoversGestures } = useShowMoversGestures( {
57
+ const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {
65
58
  ref: nodeRef,
66
- onChange( isFocused ) {
67
- if ( isFocused && isDistractionFree ) {
68
- return;
69
- }
70
- toggleBlockHighlight( firstParentClientId, isFocused );
71
- },
59
+ highlightParent: true,
72
60
  } );
73
61
 
74
62
  if ( ! isVisible ) {
@@ -80,7 +68,7 @@ export default function BlockParentSelector() {
80
68
  className="block-editor-block-parent-selector"
81
69
  key={ firstParentClientId }
82
70
  ref={ nodeRef }
83
- { ...showMoversGestures }
71
+ { ...showHoveredOrFocusedGestures }
84
72
  >
85
73
  <ToolbarButton
86
74
  className="block-editor-block-parent-selector__button"
@@ -58,12 +58,19 @@ function ScaledBlockPreview( {
58
58
  MemoizedBlockList = MemoizedBlockList || pure( BlockList );
59
59
 
60
60
  const scale = containerWidth / viewportWidth;
61
+ const aspectRatio = contentHeight
62
+ ? containerWidth / ( contentHeight * scale )
63
+ : 0;
61
64
  return (
62
65
  <Disabled
63
66
  className="block-editor-block-preview__content"
64
67
  style={ {
65
68
  transform: `scale(${ scale })`,
66
- height: contentHeight * scale,
69
+ // Using width + aspect-ratio instead of height here triggers browsers' native
70
+ // handling of scrollbar's visibility. It prevents the flickering issue seen
71
+ // in https://github.com/WordPress/gutenberg/issues/52027.
72
+ // See https://github.com/WordPress/gutenberg/pull/52921 for more info.
73
+ aspectRatio,
67
74
  maxHeight:
68
75
  contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined,
69
76
  minHeight,
@@ -11,8 +11,9 @@
11
11
  overflow: hidden;
12
12
 
13
13
  .block-editor-block-preview__content {
14
- // This element receives inline styles for width, height, and transform-scale.
14
+ // This element receives inline styles for transform-scale and aspect-ratio.
15
15
  // Those inline styles are calculated to fit a perfect thumbnail.
16
+ width: 100%;
16
17
 
17
18
  // Vertical alignment. It works with the transform: translate(-50%, -50%)`,
18
19
  top: 0;
@@ -31,7 +31,7 @@ import BlockHTMLConvertButton from './block-html-convert-button';
31
31
  import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
32
32
  import BlockSettingsMenuControls from '../block-settings-menu-controls';
33
33
  import { store as blockEditorStore } from '../../store';
34
- import { useShowMoversGestures } from '../block-toolbar/utils';
34
+ import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
35
35
 
36
36
  const POPOVER_PROPS = {
37
37
  className: 'block-editor-block-settings-menu__popover',
@@ -60,7 +60,6 @@ export function BlockSettingsDropdown( {
60
60
  const firstBlockClientId = blockClientIds[ 0 ];
61
61
  const {
62
62
  firstParentClientId,
63
- isDistractionFree,
64
63
  onlyBlock,
65
64
  parentBlockType,
66
65
  previousBlockClientId,
@@ -73,7 +72,6 @@ export function BlockSettingsDropdown( {
73
72
  getBlockRootClientId,
74
73
  getPreviousBlockClientId,
75
74
  getSelectedBlockClientIds,
76
- getSettings,
77
75
  getBlockAttributes,
78
76
  } = select( blockEditorStore );
79
77
 
@@ -86,7 +84,6 @@ export function BlockSettingsDropdown( {
86
84
 
87
85
  return {
88
86
  firstParentClientId: _firstParentClientId,
89
- isDistractionFree: getSettings().isDistractionFree,
90
87
  onlyBlock: 1 === getBlockCount( _firstParentClientId ),
91
88
  parentBlockType:
92
89
  _firstParentClientId &&
@@ -122,8 +119,7 @@ export function BlockSettingsDropdown( {
122
119
  }, [] );
123
120
  const isMatch = __unstableUseShortcutEventMatch();
124
121
 
125
- const { selectBlock, toggleBlockHighlight } =
126
- useDispatch( blockEditorStore );
122
+ const { selectBlock } = useDispatch( blockEditorStore );
127
123
  const hasSelectedBlocks = selectedBlockClientIds.length > 0;
128
124
 
129
125
  const updateSelectionAfterDuplicate = useCallback(
@@ -168,14 +164,9 @@ export function BlockSettingsDropdown( {
168
164
  // Allows highlighting the parent block outline when focusing or hovering
169
165
  // the parent block selector within the child.
170
166
  const selectParentButtonRef = useRef();
171
- const { gestures: showParentOutlineGestures } = useShowMoversGestures( {
167
+ const showParentOutlineGestures = useShowHoveredOrFocusedGestures( {
172
168
  ref: selectParentButtonRef,
173
- onChange( isFocused ) {
174
- if ( isFocused && isDistractionFree ) {
175
- return;
176
- }
177
- toggleBlockHighlight( firstParentClientId, isFocused );
178
- },
169
+ highlightParent: true,
179
170
  } );
180
171
 
181
172
  // This can occur when the selected block (the parent)