@wordpress/block-editor 15.11.0 → 15.12.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 (393) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-breadcrumb/index.cjs +10 -2
  3. package/build/components/block-breadcrumb/index.cjs.map +2 -2
  4. package/build/components/block-controls/index.cjs +1 -1
  5. package/build/components/block-controls/index.cjs.map +2 -2
  6. package/build/components/block-inspector/index.cjs +8 -21
  7. package/build/components/block-inspector/index.cjs.map +3 -3
  8. package/build/components/block-list/block.cjs +6 -3
  9. package/build/components/block-list/block.cjs.map +3 -3
  10. package/build/components/block-list/index.cjs +26 -18
  11. package/build/components/block-list/index.cjs.map +2 -2
  12. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +39 -19
  13. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
  14. package/build/components/block-list/use-in-between-inserter.cjs +4 -4
  15. package/build/components/block-list/use-in-between-inserter.cjs.map +2 -2
  16. package/build/components/block-settings-menu/block-settings-dropdown.cjs +10 -7
  17. package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
  18. package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs +1 -1
  19. package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs.map +2 -2
  20. package/build/components/block-settings-menu-controls/index.cjs +11 -16
  21. package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
  22. package/build/components/block-toolbar/block-toolbar-icon.cjs +6 -4
  23. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  24. package/build/components/block-toolbar/index.cjs +2 -2
  25. package/build/components/block-toolbar/index.cjs.map +2 -2
  26. package/build/components/block-tools/index.cjs +2 -26
  27. package/build/components/block-tools/index.cjs.map +2 -2
  28. package/build/components/block-variation-transforms/index.cjs +1 -2
  29. package/build/components/block-variation-transforms/index.cjs.map +2 -2
  30. package/build/components/block-visibility/index.cjs +7 -9
  31. package/build/components/block-visibility/index.cjs.map +3 -3
  32. package/build/components/block-visibility/modal.cjs +18 -103
  33. package/build/components/block-visibility/modal.cjs.map +2 -2
  34. package/build/components/block-visibility/use-block-visibility.cjs +1 -1
  35. package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
  36. package/build/components/block-visibility/utils.cjs +5 -1
  37. package/build/components/block-visibility/utils.cjs.map +2 -2
  38. package/build/components/block-visibility/viewport-menu-item.cjs +11 -4
  39. package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
  40. package/build/components/block-visibility/viewport-toolbar.cjs +4 -6
  41. package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
  42. package/build/components/block-visibility/viewport-visibility-info.cjs +121 -0
  43. package/build/components/block-visibility/viewport-visibility-info.cjs.map +7 -0
  44. package/build/components/color-palette/with-color-context.cjs +1 -1
  45. package/build/components/color-palette/with-color-context.cjs.map +2 -2
  46. package/build/components/color-style-selector/index.cjs +1 -1
  47. package/build/components/color-style-selector/index.cjs.map +2 -2
  48. package/build/components/colors/with-colors.cjs +5 -3
  49. package/build/components/colors/with-colors.cjs.map +2 -2
  50. package/build/components/colors-gradients/dropdown.cjs +1 -1
  51. package/build/components/colors-gradients/dropdown.cjs.map +2 -2
  52. package/build/components/editable-text/index.cjs +5 -1
  53. package/build/components/editable-text/index.cjs.map +2 -2
  54. package/build/components/font-sizes/with-font-sizes.cjs +5 -3
  55. package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
  56. package/build/components/global-styles/advanced-panel.cjs +26 -13
  57. package/build/components/global-styles/advanced-panel.cjs.map +2 -2
  58. package/build/components/global-styles/filters-panel.cjs +1 -1
  59. package/build/components/global-styles/filters-panel.cjs.map +2 -2
  60. package/build/components/global-styles/shadow-panel-components.cjs +1 -1
  61. package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
  62. package/build/components/gradients/with-gradient.cjs +1 -1
  63. package/build/components/gradients/with-gradient.cjs.map +2 -2
  64. package/build/components/inserter/index.cjs +1 -0
  65. package/build/components/inserter/index.cjs.map +2 -2
  66. package/build/components/inspector-controls/fill.cjs +12 -2
  67. package/build/components/inspector-controls/fill.cjs.map +2 -2
  68. package/build/components/inspector-controls/index.cjs +1 -1
  69. package/build/components/inspector-controls/index.cjs.map +2 -2
  70. package/build/components/inspector-controls-tabs/index.cjs +3 -3
  71. package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
  72. package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
  73. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  74. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +2 -2
  75. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
  76. package/build/components/list-view/block-select-button.cjs +8 -16
  77. package/build/components/list-view/block-select-button.cjs.map +2 -2
  78. package/build/components/list-view/block.cjs +29 -34
  79. package/build/components/list-view/block.cjs.map +3 -3
  80. package/build/components/list-view/utils.cjs +3 -1
  81. package/build/components/list-view/utils.cjs.map +2 -2
  82. package/build/components/media-replace-flow/index.cjs +2 -2
  83. package/build/components/media-replace-flow/index.cjs.map +2 -2
  84. package/build/components/provider/index.cjs +7 -8
  85. package/build/components/provider/index.cjs.map +2 -2
  86. package/build/components/provider/with-registry-provider.cjs +1 -1
  87. package/build/components/provider/with-registry-provider.cjs.map +2 -2
  88. package/build/components/rich-text/index.cjs +1 -1
  89. package/build/components/rich-text/index.cjs.map +2 -2
  90. package/build/components/use-block-commands/index.cjs +2 -34
  91. package/build/components/use-block-commands/index.cjs.map +2 -2
  92. package/build/components/use-block-display-information/index.cjs +1 -1
  93. package/build/components/use-block-display-information/index.cjs.map +2 -2
  94. package/build/components/writing-flow/index.cjs +2 -0
  95. package/build/components/writing-flow/index.cjs.map +2 -2
  96. package/build/components/writing-flow/use-arrow-nav.cjs +3 -0
  97. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  98. package/build/components/writing-flow/use-drag-selection.cjs +2 -1
  99. package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
  100. package/build/components/writing-flow/use-preview-mode-nav.cjs +92 -0
  101. package/build/components/writing-flow/use-preview-mode-nav.cjs.map +7 -0
  102. package/build/hooks/block-renaming.cjs +1 -1
  103. package/build/hooks/block-renaming.cjs.map +2 -2
  104. package/build/hooks/cross-origin-isolation.cjs +1 -1
  105. package/build/hooks/cross-origin-isolation.cjs.map +2 -2
  106. package/build/hooks/custom-css.cjs +141 -0
  107. package/build/hooks/custom-css.cjs.map +7 -0
  108. package/build/hooks/fit-text.cjs +14 -7
  109. package/build/hooks/fit-text.cjs.map +2 -2
  110. package/build/hooks/grid-visualizer.cjs +1 -1
  111. package/build/hooks/grid-visualizer.cjs.map +2 -2
  112. package/build/hooks/index.cjs +4 -2
  113. package/build/hooks/index.cjs.map +3 -3
  114. package/build/hooks/layout.cjs +10 -4
  115. package/build/hooks/layout.cjs.map +2 -2
  116. package/build/hooks/list-view.cjs +9 -5
  117. package/build/hooks/list-view.cjs.map +3 -3
  118. package/build/hooks/utils.cjs +2 -2
  119. package/build/hooks/utils.cjs.map +2 -2
  120. package/build/layouts/grid.cjs +12 -1
  121. package/build/layouts/grid.cjs.map +2 -2
  122. package/build/store/actions.cjs +5 -0
  123. package/build/store/actions.cjs.map +2 -2
  124. package/build/store/defaults.cjs +3 -0
  125. package/build/store/defaults.cjs.map +2 -2
  126. package/build/store/private-selectors.cjs +46 -38
  127. package/build/store/private-selectors.cjs.map +2 -2
  128. package/build/store/reducer.cjs +5 -7
  129. package/build/store/reducer.cjs.map +2 -2
  130. package/build/store/selectors.cjs +15 -0
  131. package/build/store/selectors.cjs.map +2 -2
  132. package/build/utils/fit-text-utils.cjs +18 -4
  133. package/build/utils/fit-text-utils.cjs.map +2 -2
  134. package/build-module/components/block-breadcrumb/index.mjs +10 -2
  135. package/build-module/components/block-breadcrumb/index.mjs.map +2 -2
  136. package/build-module/components/block-controls/index.mjs +1 -1
  137. package/build-module/components/block-controls/index.mjs.map +2 -2
  138. package/build-module/components/block-inspector/index.mjs +8 -21
  139. package/build-module/components/block-inspector/index.mjs.map +2 -2
  140. package/build-module/components/block-list/block.mjs +6 -3
  141. package/build-module/components/block-list/block.mjs.map +3 -3
  142. package/build-module/components/block-list/index.mjs +26 -18
  143. package/build-module/components/block-list/index.mjs.map +2 -2
  144. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +39 -19
  145. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
  146. package/build-module/components/block-list/use-in-between-inserter.mjs +4 -4
  147. package/build-module/components/block-list/use-in-between-inserter.mjs.map +2 -2
  148. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +10 -7
  149. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
  150. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs +1 -1
  151. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs.map +2 -2
  152. package/build-module/components/block-settings-menu-controls/index.mjs +12 -17
  153. package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
  154. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +6 -4
  155. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  156. package/build-module/components/block-toolbar/index.mjs +3 -3
  157. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  158. package/build-module/components/block-tools/index.mjs +2 -26
  159. package/build-module/components/block-tools/index.mjs.map +2 -2
  160. package/build-module/components/block-variation-transforms/index.mjs +1 -2
  161. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  162. package/build-module/components/block-visibility/index.mjs +6 -9
  163. package/build-module/components/block-visibility/index.mjs.map +2 -2
  164. package/build-module/components/block-visibility/modal.mjs +18 -103
  165. package/build-module/components/block-visibility/modal.mjs.map +2 -2
  166. package/build-module/components/block-visibility/use-block-visibility.mjs +1 -1
  167. package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
  168. package/build-module/components/block-visibility/utils.mjs +5 -1
  169. package/build-module/components/block-visibility/utils.mjs.map +2 -2
  170. package/build-module/components/block-visibility/viewport-menu-item.mjs +11 -4
  171. package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
  172. package/build-module/components/block-visibility/viewport-toolbar.mjs +4 -6
  173. package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
  174. package/build-module/components/block-visibility/viewport-visibility-info.mjs +95 -0
  175. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +7 -0
  176. package/build-module/components/color-palette/with-color-context.mjs +1 -1
  177. package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
  178. package/build-module/components/color-style-selector/index.mjs +1 -1
  179. package/build-module/components/color-style-selector/index.mjs.map +2 -2
  180. package/build-module/components/colors/with-colors.mjs +5 -3
  181. package/build-module/components/colors/with-colors.mjs.map +2 -2
  182. package/build-module/components/colors-gradients/dropdown.mjs +1 -1
  183. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  184. package/build-module/components/editable-text/index.mjs +5 -1
  185. package/build-module/components/editable-text/index.mjs.map +2 -2
  186. package/build-module/components/font-sizes/with-font-sizes.mjs +5 -3
  187. package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
  188. package/build-module/components/global-styles/advanced-panel.mjs +22 -13
  189. package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
  190. package/build-module/components/global-styles/filters-panel.mjs +1 -1
  191. package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
  192. package/build-module/components/global-styles/shadow-panel-components.mjs +1 -1
  193. package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
  194. package/build-module/components/gradients/with-gradient.mjs +1 -1
  195. package/build-module/components/gradients/with-gradient.mjs.map +2 -2
  196. package/build-module/components/inserter/index.mjs +1 -0
  197. package/build-module/components/inserter/index.mjs.map +2 -2
  198. package/build-module/components/inspector-controls/fill.mjs +12 -2
  199. package/build-module/components/inspector-controls/fill.mjs.map +2 -2
  200. package/build-module/components/inspector-controls/index.mjs +1 -1
  201. package/build-module/components/inspector-controls/index.mjs.map +2 -2
  202. package/build-module/components/inspector-controls-tabs/index.mjs +3 -3
  203. package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
  204. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
  205. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  206. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +2 -2
  207. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
  208. package/build-module/components/list-view/block-select-button.mjs +8 -16
  209. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  210. package/build-module/components/list-view/block.mjs +31 -36
  211. package/build-module/components/list-view/block.mjs.map +2 -2
  212. package/build-module/components/list-view/utils.mjs +3 -1
  213. package/build-module/components/list-view/utils.mjs.map +2 -2
  214. package/build-module/components/media-replace-flow/index.mjs +2 -2
  215. package/build-module/components/media-replace-flow/index.mjs.map +2 -2
  216. package/build-module/components/provider/index.mjs +7 -8
  217. package/build-module/components/provider/index.mjs.map +2 -2
  218. package/build-module/components/provider/with-registry-provider.mjs +1 -1
  219. package/build-module/components/provider/with-registry-provider.mjs.map +2 -2
  220. package/build-module/components/rich-text/index.mjs +1 -1
  221. package/build-module/components/rich-text/index.mjs.map +2 -2
  222. package/build-module/components/use-block-commands/index.mjs +3 -37
  223. package/build-module/components/use-block-commands/index.mjs.map +2 -2
  224. package/build-module/components/use-block-display-information/index.mjs +1 -1
  225. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  226. package/build-module/components/writing-flow/index.mjs +2 -0
  227. package/build-module/components/writing-flow/index.mjs.map +2 -2
  228. package/build-module/components/writing-flow/use-arrow-nav.mjs +3 -0
  229. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  230. package/build-module/components/writing-flow/use-drag-selection.mjs +2 -1
  231. package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
  232. package/build-module/components/writing-flow/use-preview-mode-nav.mjs +67 -0
  233. package/build-module/components/writing-flow/use-preview-mode-nav.mjs.map +7 -0
  234. package/build-module/hooks/block-renaming.mjs +1 -1
  235. package/build-module/hooks/block-renaming.mjs.map +2 -2
  236. package/build-module/hooks/cross-origin-isolation.mjs +1 -1
  237. package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
  238. package/build-module/hooks/custom-css.mjs +112 -0
  239. package/build-module/hooks/custom-css.mjs.map +7 -0
  240. package/build-module/hooks/fit-text.mjs +14 -7
  241. package/build-module/hooks/fit-text.mjs.map +2 -2
  242. package/build-module/hooks/grid-visualizer.mjs +1 -1
  243. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  244. package/build-module/hooks/index.mjs +4 -2
  245. package/build-module/hooks/index.mjs.map +2 -2
  246. package/build-module/hooks/layout.mjs +10 -4
  247. package/build-module/hooks/layout.mjs.map +2 -2
  248. package/build-module/hooks/list-view.mjs +10 -6
  249. package/build-module/hooks/list-view.mjs.map +2 -2
  250. package/build-module/hooks/utils.mjs +2 -2
  251. package/build-module/hooks/utils.mjs.map +2 -2
  252. package/build-module/layouts/grid.mjs +12 -1
  253. package/build-module/layouts/grid.mjs.map +2 -2
  254. package/build-module/store/actions.mjs +5 -0
  255. package/build-module/store/actions.mjs.map +2 -2
  256. package/build-module/store/defaults.mjs +3 -0
  257. package/build-module/store/defaults.mjs.map +2 -2
  258. package/build-module/store/private-selectors.mjs +43 -41
  259. package/build-module/store/private-selectors.mjs.map +2 -2
  260. package/build-module/store/reducer.mjs +5 -7
  261. package/build-module/store/reducer.mjs.map +2 -2
  262. package/build-module/store/selectors.mjs +15 -0
  263. package/build-module/store/selectors.mjs.map +2 -2
  264. package/build-module/utils/fit-text-utils.mjs +18 -4
  265. package/build-module/utils/fit-text-utils.mjs.map +2 -2
  266. package/build-style/content-rtl.css +10 -0
  267. package/build-style/content.css +10 -0
  268. package/build-style/style-rtl.css +3 -0
  269. package/build-style/style.css +3 -0
  270. package/package.json +39 -39
  271. package/src/components/block-breadcrumb/index.js +6 -1
  272. package/src/components/block-controls/index.js +1 -1
  273. package/src/components/block-controls/test/index.js +1 -0
  274. package/src/components/block-edit/test/edit.js +10 -0
  275. package/src/components/block-inspector/index.js +15 -36
  276. package/src/components/block-list/block.js +5 -2
  277. package/src/components/block-list/content.scss +11 -0
  278. package/src/components/block-list/index.js +25 -17
  279. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +51 -36
  280. package/src/components/block-list/use-in-between-inserter.js +8 -6
  281. package/src/components/block-preview/test/index.js +11 -7
  282. package/src/components/block-settings-menu/block-settings-dropdown.js +11 -6
  283. package/src/components/block-settings-menu-controls/edit-section-menu-item.js +1 -7
  284. package/src/components/block-settings-menu-controls/index.js +16 -18
  285. package/src/components/block-switcher/test/index.js +2 -0
  286. package/src/components/block-switcher/test/use-transformed.patterns.js +2 -0
  287. package/src/components/block-switcher/test/utils.js +2 -0
  288. package/src/components/block-toolbar/block-toolbar-icon.js +6 -10
  289. package/src/components/block-toolbar/index.js +3 -9
  290. package/src/components/block-tools/index.js +2 -29
  291. package/src/components/block-variation-transforms/index.js +1 -4
  292. package/src/components/block-visibility/index.js +3 -19
  293. package/src/components/block-visibility/modal.js +16 -14
  294. package/src/components/block-visibility/test/use-block-visibility.js +27 -25
  295. package/src/components/block-visibility/test/utils.js +24 -8
  296. package/src/components/block-visibility/use-block-visibility.js +1 -4
  297. package/src/components/block-visibility/utils.js +9 -1
  298. package/src/components/block-visibility/viewport-menu-item.js +11 -5
  299. package/src/components/block-visibility/viewport-toolbar.js +5 -6
  300. package/src/components/block-visibility/viewport-visibility-info.js +131 -0
  301. package/src/components/color-palette/with-color-context.js +1 -1
  302. package/src/components/color-style-selector/index.js +2 -3
  303. package/src/components/colors/with-colors.js +23 -20
  304. package/src/components/colors-gradients/dropdown.js +2 -3
  305. package/src/components/editable-text/index.js +5 -1
  306. package/src/components/font-sizes/with-font-sizes.js +13 -10
  307. package/src/components/global-styles/advanced-panel.js +35 -16
  308. package/src/components/global-styles/filters-panel.js +2 -3
  309. package/src/components/global-styles/shadow-panel-components.js +1 -1
  310. package/src/components/global-styles/style.scss +9 -5
  311. package/src/components/gradients/with-gradient.js +7 -4
  312. package/src/components/inner-blocks/test/index.js +2 -0
  313. package/src/components/inserter/index.js +1 -0
  314. package/src/components/inserter/stories/index.story.jsx +31 -24
  315. package/src/components/inspector-controls/fill.js +25 -5
  316. package/src/components/inspector-controls/index.js +1 -1
  317. package/src/components/inspector-controls-tabs/index.js +6 -2
  318. package/src/components/inspector-controls-tabs/styles-tab.js +7 -8
  319. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -4
  320. package/src/components/link-control/test/index.js +6 -1
  321. package/src/components/list-view/block-select-button.js +16 -25
  322. package/src/components/list-view/block.js +38 -43
  323. package/src/components/list-view/utils.js +4 -2
  324. package/src/components/media-replace-flow/index.js +3 -3
  325. package/src/components/media-replace-flow/test/index.js +13 -11
  326. package/src/components/provider/index.js +11 -10
  327. package/src/components/provider/test/use-block-sync.js +1 -0
  328. package/src/components/provider/with-registry-provider.js +1 -1
  329. package/src/components/rich-text/index.js +1 -1
  330. package/src/components/use-block-commands/index.js +0 -41
  331. package/src/components/use-block-display-information/index.js +1 -5
  332. package/src/components/writing-flow/index.js +2 -0
  333. package/src/components/writing-flow/use-arrow-nav.js +5 -0
  334. package/src/components/writing-flow/use-drag-selection.js +7 -1
  335. package/src/components/writing-flow/use-preview-mode-nav.js +102 -0
  336. package/src/hooks/block-renaming.js +5 -2
  337. package/src/hooks/cross-origin-isolation.js +19 -18
  338. package/src/hooks/custom-css.js +176 -0
  339. package/src/hooks/fit-text.js +20 -5
  340. package/src/hooks/grid-visualizer.js +15 -14
  341. package/src/hooks/index.js +4 -2
  342. package/src/hooks/layout.js +55 -43
  343. package/src/hooks/list-view.js +10 -6
  344. package/src/hooks/test/align.js +1 -0
  345. package/src/hooks/test/allowed-blocks.js +8 -0
  346. package/src/hooks/test/auto-inspector-controls.js +4 -0
  347. package/src/hooks/test/font-size.js +1 -0
  348. package/src/hooks/test/metadata.js +4 -0
  349. package/src/hooks/test/text-align.js +1 -0
  350. package/src/hooks/utils.js +123 -119
  351. package/src/layouts/grid.js +19 -3
  352. package/src/layouts/test/grid.js +1 -1
  353. package/src/store/actions.js +7 -0
  354. package/src/store/defaults.js +4 -0
  355. package/src/store/private-selectors.js +94 -64
  356. package/src/store/reducer.js +11 -18
  357. package/src/store/selectors.js +25 -0
  358. package/src/store/test/actions.js +7 -0
  359. package/src/store/test/private-selectors.js +116 -119
  360. package/src/store/test/reducer.js +262 -266
  361. package/src/store/test/registry-selectors.js +2 -0
  362. package/src/store/test/selectors.js +19 -0
  363. package/src/utils/fit-text-utils.js +31 -5
  364. package/build/components/block-visibility/block-visibility-info.cjs +0 -63
  365. package/build/components/block-visibility/block-visibility-info.cjs.map +0 -7
  366. package/build/components/block-visibility/menu-item.cjs +0 -109
  367. package/build/components/block-visibility/menu-item.cjs.map +0 -7
  368. package/build/components/block-visibility/toolbar.cjs +0 -92
  369. package/build/components/block-visibility/toolbar.cjs.map +0 -7
  370. package/build/components/content-lock/index.cjs +0 -31
  371. package/build/components/content-lock/index.cjs.map +0 -7
  372. package/build/components/content-lock/modify-content-lock-menu-item.cjs +0 -70
  373. package/build/components/content-lock/modify-content-lock-menu-item.cjs.map +0 -7
  374. package/build/hooks/content-lock-ui.cjs +0 -68
  375. package/build/hooks/content-lock-ui.cjs.map +0 -7
  376. package/build-module/components/block-visibility/block-visibility-info.mjs +0 -47
  377. package/build-module/components/block-visibility/block-visibility-info.mjs.map +0 -7
  378. package/build-module/components/block-visibility/menu-item.mjs +0 -88
  379. package/build-module/components/block-visibility/menu-item.mjs.map +0 -7
  380. package/build-module/components/block-visibility/toolbar.mjs +0 -71
  381. package/build-module/components/block-visibility/toolbar.mjs.map +0 -7
  382. package/build-module/components/content-lock/index.mjs +0 -6
  383. package/build-module/components/content-lock/index.mjs.map +0 -7
  384. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs +0 -45
  385. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs.map +0 -7
  386. package/build-module/hooks/content-lock-ui.mjs +0 -47
  387. package/build-module/hooks/content-lock-ui.mjs.map +0 -7
  388. package/src/components/block-visibility/block-visibility-info.js +0 -62
  389. package/src/components/block-visibility/menu-item.js +0 -96
  390. package/src/components/block-visibility/toolbar.js +0 -88
  391. package/src/components/content-lock/index.js +0 -1
  392. package/src/components/content-lock/modify-content-lock-menu-item.js +0 -67
  393. package/src/hooks/content-lock-ui.js +0 -76
@@ -248,6 +248,13 @@ export const selectPreviousBlock =
248
248
  const firstParentClientId = select.getBlockRootClientId( clientId );
249
249
  if ( firstParentClientId ) {
250
250
  dispatch.selectBlock( firstParentClientId, -1 );
251
+ } else {
252
+ // Fallback to next block when no previous block and no parent
253
+ const nextBlockClientId =
254
+ select.getNextBlockClientId( clientId );
255
+ if ( nextBlockClientId ) {
256
+ dispatch.selectBlock( nextBlockClientId, 0 );
257
+ }
251
258
  }
252
259
  }
253
260
  };
@@ -157,6 +157,10 @@ export const SETTINGS_DEFAULTS = {
157
157
  // Allows to disable block locking interface.
158
158
  canLockBlocks: true,
159
159
 
160
+ // Whether the user can edit custom CSS (requires edit_css capability).
161
+ // Defaults to false for safety - PHP passes true when user has capability.
162
+ canEditCSS: false,
163
+
160
164
  // Allows to disable Openverse media category in the inserter.
161
165
  enableOpenverseMediaCategory: true,
162
166
 
@@ -36,12 +36,8 @@ import {
36
36
  reusableBlocksSelectKey,
37
37
  sectionRootClientIdKey,
38
38
  isIsolatedEditorKey,
39
- deviceTypeKey,
40
39
  } from './private-keys';
41
- import {
42
- BLOCK_VISIBILITY_VIEWPORT_ENTRIES,
43
- BLOCK_VISIBILITY_VIEWPORTS,
44
- } from '../components/block-visibility/constants';
40
+ import { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';
45
41
 
46
42
  const { isContentBlock } = unlock( blocksPrivateApis );
47
43
 
@@ -527,7 +523,6 @@ export function isSectionBlock( state, clientId ) {
527
523
 
528
524
  if (
529
525
  ( attributes?.metadata?.patternName || isTemplatePart ) &&
530
- !! window?.__experimentalContentOnlyPatternInsertion &&
531
526
  ! isIsolatedEditor
532
527
  ) {
533
528
  return true;
@@ -703,18 +698,22 @@ export function getInsertionPoint( state ) {
703
698
  }
704
699
 
705
700
  /**
706
- * Returns true if the block is hidden, or false otherwise.
701
+ * Returns true if the block is hidden anywhere, or false otherwise.
702
+ *
703
+ * This selector checks whether a block has visibility metadata set that would
704
+ * hide it at any viewport or everywhere. It's useful for flagging blocks that
705
+ * have visibility restrictions.
707
706
  *
708
- * A block is considered hidden if:
707
+ * A block is considered hidden anywhere if:
709
708
  * - blockVisibility is false (hidden everywhere)
710
- * - blockVisibility is an object with the current device preview set to false
709
+ * - blockVisibility.viewport has any viewport set to false (hidden at specific screen sizes)
711
710
  *
712
711
  * @param {Object} state Global application state.
713
712
  * @param {string} clientId Client ID of the block.
714
713
  *
715
- * @return {boolean} Whether the block is hidden.
714
+ * @return {boolean} Whether the block is hidden anywhere.
716
715
  */
717
- export const isBlockHidden = ( state, clientId ) => {
716
+ export const isBlockHiddenAnywhere = ( state, clientId ) => {
718
717
  const blockName = getBlockName( state, clientId );
719
718
  if ( ! hasBlockSupport( blockName, 'visibility', true ) ) {
720
719
  return false;
@@ -726,79 +725,110 @@ export const isBlockHidden = ( state, clientId ) => {
726
725
  return true;
727
726
  }
728
727
 
729
- if ( ! window.__experimentalHideBlocksBasedOnScreenSize ) {
730
- return false;
728
+ if (
729
+ typeof blockVisibility?.viewport === 'object' &&
730
+ blockVisibility?.viewport !== null
731
+ ) {
732
+ // Check if the block is hidden at any viewport.
733
+ return Object.values( BLOCK_VISIBILITY_VIEWPORTS ).some(
734
+ ( viewport ) =>
735
+ blockVisibility?.viewport?.[ viewport.key ] === false
736
+ );
731
737
  }
738
+ return false;
739
+ };
732
740
 
733
- // Check viewport-specific hiding based on current device preview
734
- // Only apply when a device is explicitly selected.
735
- if ( typeof blockVisibility === 'object' && blockVisibility !== null ) {
736
- const settings = getSettings( state );
737
- const viewportType =
738
- settings[ deviceTypeKey ] ?? BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
739
- const viewportKey = viewportType.toLowerCase();
740
- return blockVisibility?.[ viewportKey ] === false;
741
+ /**
742
+ * Returns true if the block is hidden everywhere (blockVisibility is false).
743
+ *
744
+ * A block is considered hidden everywhere when blockVisibility is explicitly
745
+ * set to false, which means it's hidden on all viewports.
746
+ *
747
+ * @param {Object} state Global application state.
748
+ * @param {string} clientId Client ID of the block.
749
+ *
750
+ * @return {boolean} Whether the block is hidden everywhere.
751
+ */
752
+ export const isBlockHiddenEverywhere = ( state, clientId ) => {
753
+ const blockName = getBlockName( state, clientId );
754
+ if ( ! hasBlockSupport( blockName, 'visibility', true ) ) {
755
+ return false;
741
756
  }
757
+ const attributes = state.blocks.attributes.get( clientId );
758
+ const blockVisibility = attributes?.metadata?.blockVisibility;
742
759
 
760
+ if ( blockVisibility === false ) {
761
+ return true;
762
+ }
743
763
  return false;
744
764
  };
745
765
 
746
766
  /**
747
- * Returns true if any of the provided blocks are hidden.
767
+ * Returns true if any parent block (immediate or further up the chain) is hidden everywhere.
748
768
  *
749
- * @param {Object} state Global application state.
750
- * @param {Array} clientIds Array of block client IDs to check.
751
- * @return {boolean} Whether any block is hidden.
769
+ * Checks all parent blocks in the hierarchy and returns true if any of them
770
+ * is hidden everywhere.
771
+ *
772
+ * @param {Object} state Global application state.
773
+ * @param {string} clientId Client ID of the block.
774
+ *
775
+ * @return {boolean} Whether any parent block is hidden everywhere.
752
776
  */
753
- export const areBlocksHidden = ( state, clientIds ) => {
754
- if ( ! clientIds || clientIds.length === 0 ) {
755
- return false;
756
- }
757
- return clientIds.some( ( clientId ) => isBlockHidden( state, clientId ) );
777
+ export const isBlockParentHiddenEverywhere = ( state, clientId ) => {
778
+ const parents = getBlockParents( state, clientId );
779
+ return parents.some( ( parentId ) =>
780
+ isBlockHiddenEverywhere( state, parentId )
781
+ );
758
782
  };
759
783
 
760
784
  /**
761
- * Checks if at least one block in an array is hidden according to viewport visibility metadata.
785
+ * Returns true if the block is hidden at the given viewport.
762
786
  *
763
- * This is typically used to determine if the block visibility button should be shown in the toolbar.
764
- * TODO: This is temporary for now. Later the UI will
765
- * want to know where exactly the block is hidden, e.g., to display icons or other things.
787
+ * A block is considered hidden at a viewport if:
788
+ * - blockVisibility is false (hidden everywhere)
789
+ * - blockVisibility is an object with the specified viewport set to false
766
790
  *
767
- * A block is considered hidden if:
768
- * - Its `blockVisibility` metadata is `false` (hidden everywhere), or
769
- * - Any viewport is set to `false`
791
+ * @param {Object} state Global application state.
792
+ * @param {string} clientId Client ID of the block.
793
+ * @param {string} viewport Viewport to check ('desktop', 'tablet', 'mobile').
770
794
  *
771
- * @param {Object} state Global application state.
772
- * @param {Array} clientIds Array of block client IDs to check.
773
- * @return {boolean} `true` if at least one block meets the visibility criteria, `false` otherwise.
795
+ * @return {boolean} Whether the block is hidden at the viewport.
774
796
  */
775
- export const areBlocksHiddenAnywhere = ( state, clientIds ) => {
776
- if ( ! clientIds?.length ) {
777
- return false;
797
+ export const isBlockHiddenAtViewport = ( state, clientId, viewport ) => {
798
+ if ( isBlockHiddenEverywhere( state, clientId ) ) {
799
+ return true;
778
800
  }
779
- return clientIds.some( ( clientId ) => {
780
- if ( ! clientId ) {
781
- return false;
782
- }
783
-
784
- const attributes = state.blocks.attributes.get( clientId );
785
- const blockVisibility = attributes?.metadata?.blockVisibility;
786
-
787
- // If explicitly hidden everywhere (false), return true.
788
- if ( typeof blockVisibility === 'boolean' ) {
789
- return blockVisibility === false;
790
- }
791
801
 
792
- // If not an object, block is not hidden in any viewport.
793
- if ( 'object' !== typeof blockVisibility ) {
794
- return false;
795
- }
802
+ const attributes = state.blocks.attributes.get( clientId );
803
+ const blockVisibilityViewport =
804
+ attributes?.metadata?.blockVisibility?.viewport;
805
+ if (
806
+ typeof blockVisibilityViewport === 'object' &&
807
+ blockVisibilityViewport !== null &&
808
+ typeof viewport === 'string'
809
+ ) {
810
+ return blockVisibilityViewport?.[ viewport.toLowerCase() ] === false;
811
+ }
812
+ return false;
813
+ };
796
814
 
797
- // Check viewport-specific visibility.
798
- return BLOCK_VISIBILITY_VIEWPORT_ENTRIES.some(
799
- ( [ , { key } ] ) => blockVisibility?.[ key ] === false
800
- );
801
- } );
815
+ /**
816
+ * Returns true if any parent block (immediate or further up the chain) is hidden at the given viewport.
817
+ *
818
+ * Checks all parent blocks in the hierarchy and returns true if any of them
819
+ * is hidden at the specified viewport.
820
+ *
821
+ * @param {Object} state Global application state.
822
+ * @param {string} clientId Client ID of the block.
823
+ * @param {string} viewport Viewport to check ('desktop', 'tablet', 'mobile').
824
+ *
825
+ * @return {boolean} Whether any parent block is hidden at the viewport.
826
+ */
827
+ export const isBlockParentHiddenAtViewport = ( state, clientId, viewport ) => {
828
+ const parents = getBlockParents( state, clientId );
829
+ return parents.some( ( parentId ) =>
830
+ isBlockHiddenAtViewport( state, parentId, viewport )
831
+ );
802
832
  };
803
833
 
804
834
  /**
@@ -2283,22 +2283,17 @@ function getDerivedBlockEditingModesForTree( state, treeClientId = '' ) {
2283
2283
 
2284
2284
  // Use array.from for better back compat. Older versions of the iterator returned
2285
2285
  // from `keys()` didn't have the `filter` method.
2286
- const unsyncedPatternClientIds =
2287
- !! window?.__experimentalContentOnlyPatternInsertion &&
2288
- ! isIsolatedEditor
2289
- ? Array.from( state.blocks.attributes.keys() ).filter(
2290
- ( clientId ) =>
2291
- state.blocks.attributes.get( clientId )?.metadata
2292
- ?.patternName
2293
- )
2294
- : [];
2286
+ const unsyncedPatternClientIds = isIsolatedEditor
2287
+ ? []
2288
+ : Array.from( state.blocks.attributes.keys() ).filter(
2289
+ ( clientId ) =>
2290
+ state.blocks.attributes.get( clientId )?.metadata
2291
+ ?.patternName
2292
+ );
2295
2293
  const contentOnlyParents = [
2296
2294
  ...contentOnlyTemplateLockedClientIds,
2297
2295
  ...unsyncedPatternClientIds,
2298
- ...( window?.__experimentalContentOnlyPatternInsertion &&
2299
- ! isIsolatedEditor
2300
- ? templatePartClientIds
2301
- : [] ),
2296
+ ...( isIsolatedEditor ? [] : templatePartClientIds ),
2302
2297
  ];
2303
2298
 
2304
2299
  traverseBlockTree( state, treeClientId, ( block ) => {
@@ -2323,11 +2318,9 @@ function getDerivedBlockEditingModesForTree( state, treeClientId = '' ) {
2323
2318
  return;
2324
2319
  }
2325
2320
 
2326
- // For the content only pattern experiment, disable blocks that are outside of the edited section.
2327
- if ( window?.__experimentalContentOnlyPatternInsertion ) {
2328
- derivedBlockEditingModes.set( clientId, 'disabled' );
2329
- return;
2330
- }
2321
+ // Disable blocks that are outside of the edited section.
2322
+ derivedBlockEditingModes.set( clientId, 'disabled' );
2323
+ return;
2331
2324
  }
2332
2325
 
2333
2326
  // If the block already has an explicit block editing mode set,
@@ -1681,6 +1681,11 @@ const canInsertBlockTypeUnmemoized = (
1681
1681
  blockName,
1682
1682
  rootClientId = null
1683
1683
  ) => {
1684
+ // Disable insertion in preview mode.
1685
+ if ( state.settings.isPreviewMode ) {
1686
+ return false;
1687
+ }
1688
+
1684
1689
  if ( ! isBlockVisibleInTheInserter( state, blockName, rootClientId ) ) {
1685
1690
  return false;
1686
1691
  }
@@ -1868,6 +1873,11 @@ export function canInsertBlocks( state, clientIds, rootClientId = null ) {
1868
1873
  * @return {boolean} Whether the given block is allowed to be removed.
1869
1874
  */
1870
1875
  export function canRemoveBlock( state, clientId ) {
1876
+ // Disable removal in preview mode.
1877
+ if ( state.settings.isPreviewMode ) {
1878
+ return false;
1879
+ }
1880
+
1871
1881
  const attributes = getBlockAttributes( state, clientId );
1872
1882
  if ( attributes === null ) {
1873
1883
  return true;
@@ -1930,6 +1940,11 @@ export function canRemoveBlocks( state, clientIds ) {
1930
1940
  * @return {boolean} Whether the given block is allowed to be moved.
1931
1941
  */
1932
1942
  export function canMoveBlock( state, clientId ) {
1943
+ // Disable moving in preview mode.
1944
+ if ( state.settings.isPreviewMode ) {
1945
+ return false;
1946
+ }
1947
+
1933
1948
  const attributes = getBlockAttributes( state, clientId );
1934
1949
  if ( attributes === null ) {
1935
1950
  return true;
@@ -1991,6 +2006,11 @@ export function canMoveBlocks( state, clientIds ) {
1991
2006
  * @return {boolean} Whether the given block is allowed to be edited.
1992
2007
  */
1993
2008
  export function canEditBlock( state, clientId ) {
2009
+ // Disable editing in preview mode.
2010
+ if ( state.settings.isPreviewMode ) {
2011
+ return false;
2012
+ }
2013
+
1994
2014
  const attributes = getBlockAttributes( state, clientId );
1995
2015
  if ( attributes === null ) {
1996
2016
  return true;
@@ -2011,6 +2031,11 @@ export function canEditBlock( state, clientId ) {
2011
2031
  * @return {boolean} Whether a given block type can be locked/unlocked.
2012
2032
  */
2013
2033
  export function canLockBlockType( state, nameOrType ) {
2034
+ // Disable locking in preview mode.
2035
+ if ( state.settings.isPreviewMode ) {
2036
+ return false;
2037
+ }
2038
+
2014
2039
  if ( ! hasBlockSupport( nameOrType, 'lock', true ) ) {
2015
2040
  return false;
2016
2041
  }
@@ -60,6 +60,7 @@ const {
60
60
 
61
61
  describe( 'actions', () => {
62
62
  const defaultBlockSettings = {
63
+ apiVersion: 3,
63
64
  attributes: {
64
65
  content: {},
65
66
  },
@@ -863,6 +864,7 @@ describe( 'actions', () => {
863
864
 
864
865
  it( 'should merge the blocks if blocks of the same type', () => {
865
866
  registerBlockType( 'core/test-block', {
867
+ apiVersion: 3,
866
868
  attributes: {
867
869
  content: {},
868
870
  },
@@ -933,6 +935,7 @@ describe( 'actions', () => {
933
935
 
934
936
  it( 'should not merge the blocks have different types without transformation', () => {
935
937
  registerBlockType( 'core/test-block', {
938
+ apiVersion: 3,
936
939
  attributes: {
937
940
  content: {},
938
941
  },
@@ -986,6 +989,7 @@ describe( 'actions', () => {
986
989
 
987
990
  it( 'should transform and merge the blocks', () => {
988
991
  registerBlockType( 'core/test-block', {
992
+ apiVersion: 3,
989
993
  attributes: {
990
994
  content: {
991
995
  type: 'string',
@@ -1004,6 +1008,7 @@ describe( 'actions', () => {
1004
1008
  title: 'test block',
1005
1009
  } );
1006
1010
  registerBlockType( 'core/test-block-2', {
1011
+ apiVersion: 3,
1007
1012
  attributes: {
1008
1013
  content2: {
1009
1014
  type: 'string',
@@ -1081,6 +1086,7 @@ describe( 'actions', () => {
1081
1086
 
1082
1087
  it( 'should not merge the blocks if blockB editing mode is `disabled`', () => {
1083
1088
  registerBlockType( 'core/test-block', {
1089
+ apiVersion: 3,
1084
1090
  attributes: {
1085
1091
  content: {},
1086
1092
  },
@@ -1140,6 +1146,7 @@ describe( 'actions', () => {
1140
1146
 
1141
1147
  it( 'should not merge the blocks if blockA editing mode is `disabled`', () => {
1142
1148
  registerBlockType( 'core/test-block', {
1149
+ apiVersion: 3,
1143
1150
  attributes: {
1144
1151
  content: {},
1145
1152
  },