@wordpress/block-editor 8.4.0 → 8.5.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 (369) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +56 -19
  3. package/build/components/alignment-control/index.js +13 -6
  4. package/build/components/alignment-control/index.js.map +1 -1
  5. package/build/components/block-alignment-control/index.js +13 -6
  6. package/build/components/block-alignment-control/index.js.map +1 -1
  7. package/build/components/block-draggable/index.js +2 -3
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-icon/index.js +4 -0
  10. package/build/components/block-icon/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +6 -1
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/use-block-props/index.js +1 -6
  14. package/build/components/block-list/use-block-props/index.js.map +1 -1
  15. package/build/components/block-list/use-block-props/use-focus-first-element.js +14 -17
  16. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  17. package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
  18. package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  19. package/build/components/block-list-appender/index.js +6 -1
  20. package/build/components/block-list-appender/index.js.map +1 -1
  21. package/build/components/block-lock/menu-item.js +9 -0
  22. package/build/components/block-lock/menu-item.js.map +1 -1
  23. package/build/components/block-lock/modal.js +4 -13
  24. package/build/components/block-lock/modal.js.map +1 -1
  25. package/build/components/block-lock/toolbar.js +11 -3
  26. package/build/components/block-lock/toolbar.js.map +1 -1
  27. package/build/components/block-mover/index.js +4 -0
  28. package/build/components/block-mover/index.js.map +1 -1
  29. package/build/components/block-settings-menu/block-settings-dropdown.js +50 -5
  30. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  31. package/build/components/block-switcher/index.js +1 -1
  32. package/build/components/block-switcher/index.js.map +1 -1
  33. package/build/components/block-title/index.js +2 -2
  34. package/build/components/block-title/index.js.map +1 -1
  35. package/build/components/block-title/use-block-display-title.js +1 -1
  36. package/build/components/block-title/use-block-display-title.js.map +1 -1
  37. package/build/components/block-toolbar/block-name-context.js +17 -0
  38. package/build/components/block-toolbar/block-name-context.js.map +1 -0
  39. package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
  40. package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  41. package/build/components/block-toolbar/index.js +20 -5
  42. package/build/components/block-toolbar/index.js.map +1 -1
  43. package/build/components/block-tools/index.js +0 -16
  44. package/build/components/block-tools/index.js.map +1 -1
  45. package/build/components/block-variation-transforms/index.js +92 -47
  46. package/build/components/block-variation-transforms/index.js.map +1 -1
  47. package/build/components/block-vertical-alignment-control/index.js +13 -6
  48. package/build/components/block-vertical-alignment-control/index.js.map +1 -1
  49. package/build/components/contrast-checker/index.js +4 -0
  50. package/build/components/contrast-checker/index.js.map +1 -1
  51. package/build/components/convert-to-group-buttons/index.js +8 -0
  52. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  53. package/build/components/convert-to-group-buttons/toolbar.js +105 -0
  54. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
  55. package/build/components/copy-handler/index.js +4 -0
  56. package/build/components/copy-handler/index.js.map +1 -1
  57. package/build/components/font-sizes/font-size-picker.js +4 -0
  58. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  59. package/build/components/iframe/index.js +6 -9
  60. package/build/components/iframe/index.js.map +1 -1
  61. package/build/components/index.js +18 -0
  62. package/build/components/index.js.map +1 -1
  63. package/build/components/justify-content-control/index.js +13 -6
  64. package/build/components/justify-content-control/index.js.map +1 -1
  65. package/build/components/keyboard-shortcuts/index.js +1 -1
  66. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  67. package/build/components/line-height-control/index.js +10 -3
  68. package/build/components/line-height-control/index.js.map +1 -1
  69. package/build/components/list-view/block-select-button.js +25 -6
  70. package/build/components/list-view/block-select-button.js.map +1 -1
  71. package/build/components/list-view/block.js +5 -1
  72. package/build/components/list-view/block.js.map +1 -1
  73. package/build/components/list-view/branch.js +1 -1
  74. package/build/components/list-view/branch.js.map +1 -1
  75. package/build/components/media-replace-flow/index.js +4 -0
  76. package/build/components/media-replace-flow/index.js.map +1 -1
  77. package/build/components/multi-selection-inspector/index.js +1 -1
  78. package/build/components/multi-selection-inspector/index.js.map +1 -1
  79. package/build/components/rich-text/index.js +26 -4
  80. package/build/components/rich-text/index.js.map +1 -1
  81. package/build/components/rich-text/split-value.js +12 -2
  82. package/build/components/rich-text/split-value.js.map +1 -1
  83. package/build/components/rich-text/use-firefox-compat.js +49 -0
  84. package/build/components/rich-text/use-firefox-compat.js.map +1 -0
  85. package/build/components/rich-text/use-input-rules.js +34 -2
  86. package/build/components/rich-text/use-input-rules.js.map +1 -1
  87. package/build/components/skip-to-selected-block/index.js +4 -0
  88. package/build/components/skip-to-selected-block/index.js.map +1 -1
  89. package/build/components/writing-flow/index.js +9 -1
  90. package/build/components/writing-flow/index.js.map +1 -1
  91. package/build/components/writing-flow/use-arrow-nav.js +3 -44
  92. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  93. package/build/components/writing-flow/use-click-selection.js +68 -0
  94. package/build/components/writing-flow/use-click-selection.js.map +1 -0
  95. package/build/components/writing-flow/use-drag-selection.js +134 -0
  96. package/build/components/writing-flow/use-drag-selection.js.map +1 -0
  97. package/build/components/writing-flow/use-input.js +116 -0
  98. package/build/components/writing-flow/use-input.js.map +1 -0
  99. package/build/components/writing-flow/use-multi-selection.js +18 -38
  100. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  101. package/build/components/writing-flow/use-selection-observer.js +161 -0
  102. package/build/components/writing-flow/use-selection-observer.js.map +1 -0
  103. package/build/components/writing-flow/use-tab-nav.js +1 -8
  104. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  105. package/build/hooks/border-color.js +3 -3
  106. package/build/hooks/border-color.js.map +1 -1
  107. package/build/hooks/border.js +0 -14
  108. package/build/hooks/border.js.map +1 -1
  109. package/build/hooks/color.js +20 -17
  110. package/build/hooks/color.js.map +1 -1
  111. package/build/hooks/font-family.js +5 -1
  112. package/build/hooks/font-family.js.map +1 -1
  113. package/build/hooks/font-size.js +4 -2
  114. package/build/hooks/font-size.js.map +1 -1
  115. package/build/hooks/gap.js +23 -16
  116. package/build/hooks/gap.js.map +1 -1
  117. package/build/hooks/layout.js +7 -2
  118. package/build/hooks/layout.js.map +1 -1
  119. package/build/hooks/style.js +34 -3
  120. package/build/hooks/style.js.map +1 -1
  121. package/build/hooks/utils.js +29 -0
  122. package/build/hooks/utils.js.map +1 -1
  123. package/build/layouts/flex.js +76 -12
  124. package/build/layouts/flex.js.map +1 -1
  125. package/build/layouts/flow.js +9 -4
  126. package/build/layouts/flow.js.map +1 -1
  127. package/build/store/actions.js +297 -51
  128. package/build/store/actions.js.map +1 -1
  129. package/build/store/defaults.js +5 -2
  130. package/build/store/defaults.js.map +1 -1
  131. package/build/store/reducer.js +25 -13
  132. package/build/store/reducer.js.map +1 -1
  133. package/build/store/selectors.js +142 -18
  134. package/build/store/selectors.js.map +1 -1
  135. package/build/utils/dom.js +2 -1
  136. package/build/utils/dom.js.map +1 -1
  137. package/build-module/components/alignment-control/index.js +12 -4
  138. package/build-module/components/alignment-control/index.js.map +1 -1
  139. package/build-module/components/block-alignment-control/index.js +12 -4
  140. package/build-module/components/block-alignment-control/index.js.map +1 -1
  141. package/build-module/components/block-draggable/index.js +2 -3
  142. package/build-module/components/block-draggable/index.js.map +1 -1
  143. package/build-module/components/block-icon/index.js +4 -0
  144. package/build-module/components/block-icon/index.js.map +1 -1
  145. package/build-module/components/block-inspector/index.js +6 -1
  146. package/build-module/components/block-inspector/index.js.map +1 -1
  147. package/build-module/components/block-list/use-block-props/index.js +1 -4
  148. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  149. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +15 -17
  150. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  151. package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
  152. package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  153. package/build-module/components/block-list-appender/index.js +6 -1
  154. package/build-module/components/block-list-appender/index.js.map +1 -1
  155. package/build-module/components/block-lock/menu-item.js +9 -0
  156. package/build-module/components/block-lock/menu-item.js.map +1 -1
  157. package/build-module/components/block-lock/modal.js +5 -14
  158. package/build-module/components/block-lock/modal.js.map +1 -1
  159. package/build-module/components/block-lock/toolbar.js +11 -3
  160. package/build-module/components/block-lock/toolbar.js.map +1 -1
  161. package/build-module/components/block-mover/index.js +4 -0
  162. package/build-module/components/block-mover/index.js.map +1 -1
  163. package/build-module/components/block-settings-menu/block-settings-dropdown.js +50 -7
  164. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  165. package/build-module/components/block-switcher/index.js +2 -2
  166. package/build-module/components/block-switcher/index.js.map +1 -1
  167. package/build-module/components/block-title/index.js +2 -2
  168. package/build-module/components/block-title/index.js.map +1 -1
  169. package/build-module/components/block-title/use-block-display-title.js +1 -1
  170. package/build-module/components/block-title/use-block-display-title.js.map +1 -1
  171. package/build-module/components/block-toolbar/block-name-context.js +9 -0
  172. package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
  173. package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
  174. package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  175. package/build-module/components/block-toolbar/index.js +16 -4
  176. package/build-module/components/block-toolbar/index.js.map +1 -1
  177. package/build-module/components/block-tools/index.js +0 -16
  178. package/build-module/components/block-tools/index.js.map +1 -1
  179. package/build-module/components/block-variation-transforms/index.js +95 -49
  180. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  181. package/build-module/components/block-vertical-alignment-control/index.js +12 -4
  182. package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
  183. package/build-module/components/contrast-checker/index.js +4 -0
  184. package/build-module/components/contrast-checker/index.js.map +1 -1
  185. package/build-module/components/convert-to-group-buttons/index.js +2 -1
  186. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  187. package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
  188. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
  189. package/build-module/components/copy-handler/index.js +4 -0
  190. package/build-module/components/copy-handler/index.js.map +1 -1
  191. package/build-module/components/font-sizes/font-size-picker.js +4 -0
  192. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  193. package/build-module/components/iframe/index.js +6 -9
  194. package/build-module/components/iframe/index.js.map +1 -1
  195. package/build-module/components/index.js +2 -0
  196. package/build-module/components/index.js.map +1 -1
  197. package/build-module/components/justify-content-control/index.js +12 -4
  198. package/build-module/components/justify-content-control/index.js.map +1 -1
  199. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  200. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  201. package/build-module/components/line-height-control/index.js +9 -2
  202. package/build-module/components/line-height-control/index.js.map +1 -1
  203. package/build-module/components/list-view/block-select-button.js +22 -6
  204. package/build-module/components/list-view/block-select-button.js.map +1 -1
  205. package/build-module/components/list-view/block.js +5 -1
  206. package/build-module/components/list-view/block.js.map +1 -1
  207. package/build-module/components/list-view/branch.js +1 -1
  208. package/build-module/components/list-view/branch.js.map +1 -1
  209. package/build-module/components/media-replace-flow/index.js +4 -0
  210. package/build-module/components/media-replace-flow/index.js.map +1 -1
  211. package/build-module/components/multi-selection-inspector/index.js +2 -2
  212. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  213. package/build-module/components/rich-text/index.js +25 -4
  214. package/build-module/components/rich-text/index.js.map +1 -1
  215. package/build-module/components/rich-text/split-value.js +12 -2
  216. package/build-module/components/rich-text/split-value.js.map +1 -1
  217. package/build-module/components/rich-text/use-firefox-compat.js +39 -0
  218. package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
  219. package/build-module/components/rich-text/use-input-rules.js +35 -4
  220. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  221. package/build-module/components/skip-to-selected-block/index.js +4 -0
  222. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  223. package/build-module/components/writing-flow/index.js +5 -1
  224. package/build-module/components/writing-flow/index.js.map +1 -1
  225. package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
  226. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  227. package/build-module/components/writing-flow/use-click-selection.js +57 -0
  228. package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
  229. package/build-module/components/writing-flow/use-drag-selection.js +124 -0
  230. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
  231. package/build-module/components/writing-flow/use-input.js +104 -0
  232. package/build-module/components/writing-flow/use-input.js.map +1 -0
  233. package/build-module/components/writing-flow/use-multi-selection.js +18 -37
  234. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  235. package/build-module/components/writing-flow/use-selection-observer.js +150 -0
  236. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
  237. package/build-module/components/writing-flow/use-tab-nav.js +1 -9
  238. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  239. package/build-module/hooks/border-color.js +5 -5
  240. package/build-module/hooks/border-color.js.map +1 -1
  241. package/build-module/hooks/border.js +0 -12
  242. package/build-module/hooks/border.js.map +1 -1
  243. package/build-module/hooks/color.js +19 -18
  244. package/build-module/hooks/color.js.map +1 -1
  245. package/build-module/hooks/font-family.js +3 -1
  246. package/build-module/hooks/font-family.js.map +1 -1
  247. package/build-module/hooks/font-size.js +4 -3
  248. package/build-module/hooks/font-size.js.map +1 -1
  249. package/build-module/hooks/gap.js +22 -15
  250. package/build-module/hooks/gap.js.map +1 -1
  251. package/build-module/hooks/layout.js +7 -2
  252. package/build-module/hooks/layout.js.map +1 -1
  253. package/build-module/hooks/style.js +33 -3
  254. package/build-module/hooks/style.js.map +1 -1
  255. package/build-module/hooks/utils.js +26 -0
  256. package/build-module/hooks/utils.js.map +1 -1
  257. package/build-module/layouts/flex.js +76 -13
  258. package/build-module/layouts/flex.js.map +1 -1
  259. package/build-module/layouts/flow.js +9 -5
  260. package/build-module/layouts/flow.js.map +1 -1
  261. package/build-module/store/actions.js +286 -49
  262. package/build-module/store/actions.js.map +1 -1
  263. package/build-module/store/defaults.js +5 -2
  264. package/build-module/store/defaults.js.map +1 -1
  265. package/build-module/store/reducer.js +25 -13
  266. package/build-module/store/reducer.js.map +1 -1
  267. package/build-module/store/selectors.js +138 -19
  268. package/build-module/store/selectors.js.map +1 -1
  269. package/build-module/utils/dom.js +2 -1
  270. package/build-module/utils/dom.js.map +1 -1
  271. package/build-style/style-rtl.css +107 -74
  272. package/build-style/style.css +107 -74
  273. package/build-types/utils/dom.d.ts.map +1 -1
  274. package/package.json +28 -28
  275. package/src/components/alignment-control/index.js +9 -4
  276. package/src/components/block-alignment-control/index.js +9 -4
  277. package/src/components/block-draggable/index.js +2 -5
  278. package/src/components/block-icon/index.js +3 -0
  279. package/src/components/block-inspector/index.js +4 -0
  280. package/src/components/block-list/style.scss +4 -5
  281. package/src/components/block-list/use-block-props/index.js +0 -5
  282. package/src/components/block-list/use-block-props/use-focus-first-element.js +19 -26
  283. package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
  284. package/src/components/block-list-appender/index.js +5 -0
  285. package/src/components/block-lock/menu-item.js +8 -1
  286. package/src/components/block-lock/modal.js +18 -13
  287. package/src/components/block-lock/style.scss +6 -3
  288. package/src/components/block-lock/toolbar.js +12 -2
  289. package/src/components/block-mover/index.js +3 -0
  290. package/src/components/block-mover/style.scss +4 -0
  291. package/src/components/block-settings-menu/block-settings-dropdown.js +62 -4
  292. package/src/components/block-switcher/index.js +2 -2
  293. package/src/components/block-switcher/style.scss +8 -1
  294. package/src/components/block-switcher/test/index.js +2 -2
  295. package/src/components/block-title/index.js +2 -2
  296. package/src/components/block-title/use-block-display-title.js +1 -1
  297. package/src/components/block-toolbar/block-name-context.js +8 -0
  298. package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
  299. package/src/components/block-toolbar/index.js +18 -2
  300. package/src/components/block-toolbar/style.scss +6 -0
  301. package/src/components/block-tools/index.js +0 -19
  302. package/src/components/block-tools/style.scss +3 -5
  303. package/src/components/block-variation-transforms/index.js +105 -36
  304. package/src/components/block-variation-transforms/style.scss +1 -1
  305. package/src/components/block-vertical-alignment-control/index.js +9 -4
  306. package/src/components/button-block-appender/style.scss +5 -1
  307. package/src/components/contrast-checker/index.js +3 -0
  308. package/src/components/convert-to-group-buttons/index.js +6 -1
  309. package/src/components/convert-to-group-buttons/toolbar.js +87 -0
  310. package/src/components/copy-handler/index.js +3 -0
  311. package/src/components/font-sizes/font-size-picker.js +3 -0
  312. package/src/components/iframe/index.js +5 -7
  313. package/src/components/index.js +2 -0
  314. package/src/components/justify-content-control/index.js +9 -4
  315. package/src/components/keyboard-shortcuts/index.js +1 -1
  316. package/src/components/line-height-control/index.js +8 -3
  317. package/src/components/list-view/block-select-button.js +21 -3
  318. package/src/components/list-view/block.js +8 -1
  319. package/src/components/list-view/branch.js +1 -1
  320. package/src/components/list-view/style.scss +56 -14
  321. package/src/components/media-placeholder/README.md +8 -0
  322. package/src/components/media-replace-flow/index.js +3 -0
  323. package/src/components/multi-selection-inspector/index.js +2 -2
  324. package/src/components/rich-text/index.js +24 -1
  325. package/src/components/rich-text/split-value.js +5 -1
  326. package/src/components/rich-text/use-firefox-compat.js +39 -0
  327. package/src/components/rich-text/use-input-rules.js +40 -3
  328. package/src/components/skip-to-selected-block/index.js +3 -0
  329. package/src/components/url-input/style.scss +3 -2
  330. package/src/components/writing-flow/index.js +8 -0
  331. package/src/components/writing-flow/readme.md +28 -0
  332. package/src/components/writing-flow/use-arrow-nav.js +4 -53
  333. package/src/components/writing-flow/use-click-selection.js +65 -0
  334. package/src/components/writing-flow/use-drag-selection.js +126 -0
  335. package/src/components/writing-flow/use-input.js +112 -0
  336. package/src/components/writing-flow/use-multi-selection.js +13 -36
  337. package/src/components/writing-flow/use-selection-observer.js +153 -0
  338. package/src/components/writing-flow/use-tab-nav.js +1 -11
  339. package/src/hooks/border-color.js +5 -5
  340. package/src/hooks/border.js +0 -13
  341. package/src/hooks/color.js +51 -24
  342. package/src/hooks/font-family.js +5 -2
  343. package/src/hooks/font-size.js +10 -7
  344. package/src/hooks/gap.js +25 -17
  345. package/src/hooks/layout.js +11 -1
  346. package/src/hooks/style.js +40 -4
  347. package/src/hooks/test/gap.js +25 -1
  348. package/src/hooks/test/style.js +94 -0
  349. package/src/hooks/test/utils.js +1 -1
  350. package/src/hooks/utils.js +26 -0
  351. package/src/layouts/flex.js +89 -5
  352. package/src/layouts/flow.js +15 -4
  353. package/src/store/actions.js +349 -32
  354. package/src/store/defaults.js +7 -2
  355. package/src/store/reducer.js +25 -10
  356. package/src/store/selectors.js +181 -24
  357. package/src/store/test/selectors.js +242 -5
  358. package/src/utils/dom.js +2 -1
  359. package/tsconfig.tsbuildinfo +1 -1
  360. package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
  361. package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  362. package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
  363. package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  364. package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
  365. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  366. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
  367. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  368. package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
  369. package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
@@ -18,7 +18,12 @@ import { Button, ToggleControl, Flex, FlexItem } from '@wordpress/components';
18
18
  import { appendSelectors } from './utils';
19
19
  import { getGapCSSValue } from '../hooks/gap';
20
20
  import useSetting from '../components/use-setting';
21
- import { BlockControls, JustifyContentControl } from '../components';
21
+ import {
22
+ BlockControls,
23
+ JustifyContentControl,
24
+ BlockVerticalAlignmentControl,
25
+ } from '../components';
26
+ import { shouldSkipSerialization } from '../hooks/utils';
22
27
 
23
28
  // Used with the default, horizontal flex orientation.
24
29
  const justifyContentMap = {
@@ -35,6 +40,12 @@ const alignItemsMap = {
35
40
  center: 'center',
36
41
  };
37
42
 
43
+ const verticalAlignmentMap = {
44
+ top: 'flex-start',
45
+ center: 'center',
46
+ bottom: 'flex-end',
47
+ };
48
+
38
49
  const flexWrapOptions = [ 'wrap', 'nowrap' ];
39
50
 
40
51
  export default {
@@ -76,6 +87,7 @@ export default {
76
87
  if ( layoutBlockSupport?.allowSwitching ) {
77
88
  return null;
78
89
  }
90
+ const { allowVerticalAlignment = true } = layoutBlockSupport;
79
91
  return (
80
92
  <BlockControls group="block" __experimentalShareWithChildBlocks>
81
93
  <FlexLayoutJustifyContentControl
@@ -83,25 +95,40 @@ export default {
83
95
  onChange={ onChange }
84
96
  isToolbar
85
97
  />
98
+ { allowVerticalAlignment &&
99
+ layout?.orientation !== 'vertical' && (
100
+ <FlexLayoutVerticalAlignmentControl
101
+ layout={ layout }
102
+ onChange={ onChange }
103
+ isToolbar
104
+ />
105
+ ) }
86
106
  </BlockControls>
87
107
  );
88
108
  },
89
- save: function FlexLayoutStyle( { selector, layout, style } ) {
109
+ save: function FlexLayoutStyle( { selector, layout, style, blockName } ) {
90
110
  const { orientation = 'horizontal' } = layout;
91
111
  const blockGapSupport = useSetting( 'spacing.blockGap' );
92
112
  const hasBlockGapStylesSupport = blockGapSupport !== null;
113
+ // If a block's block.json skips serialization for spacing or spacing.blockGap,
114
+ // don't apply the user-defined value to the styles.
93
115
  const blockGapValue =
94
- getGapCSSValue( style?.spacing?.blockGap, '0.5em' ) ??
95
- 'var( --wp--style--block-gap, 0.5em )';
116
+ style?.spacing?.blockGap &&
117
+ ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )
118
+ ? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )
119
+ : 'var( --wp--style--block-gap, 0.5em )';
96
120
  const justifyContent =
97
121
  justifyContentMap[ layout.justifyContent ] ||
98
122
  justifyContentMap.left;
99
123
  const flexWrap = flexWrapOptions.includes( layout.flexWrap )
100
124
  ? layout.flexWrap
101
125
  : 'wrap';
126
+ const verticalAlignment =
127
+ verticalAlignmentMap[ layout.verticalAlignment ] ||
128
+ verticalAlignmentMap.center;
102
129
  const rowOrientation = `
103
130
  flex-direction: row;
104
- align-items: center;
131
+ align-items: ${ verticalAlignment };
105
132
  justify-content: ${ justifyContent };
106
133
  `;
107
134
  const alignItems =
@@ -135,6 +162,63 @@ export default {
135
162
  },
136
163
  };
137
164
 
165
+ function FlexLayoutVerticalAlignmentControl( {
166
+ layout,
167
+ onChange,
168
+ isToolbar = false,
169
+ } ) {
170
+ const { verticalAlignment = verticalAlignmentMap.center } = layout;
171
+
172
+ const onVerticalAlignmentChange = ( value ) => {
173
+ onChange( {
174
+ ...layout,
175
+ verticalAlignment: value,
176
+ } );
177
+ };
178
+ if ( isToolbar ) {
179
+ return (
180
+ <BlockVerticalAlignmentControl
181
+ onChange={ onVerticalAlignmentChange }
182
+ value={ verticalAlignment }
183
+ />
184
+ );
185
+ }
186
+
187
+ const verticalAlignmentOptions = [
188
+ {
189
+ value: 'flex-start',
190
+ label: __( 'Align items top' ),
191
+ },
192
+ {
193
+ value: 'center',
194
+ label: __( 'Align items center' ),
195
+ },
196
+ {
197
+ value: 'flex-end',
198
+ label: __( 'Align items bottom' ),
199
+ },
200
+ ];
201
+
202
+ return (
203
+ <fieldset className="block-editor-hooks__flex-layout-vertical-alignment-control">
204
+ <legend>{ __( 'Vertical alignment' ) }</legend>
205
+ <div>
206
+ { verticalAlignmentOptions.map( ( value, icon, label ) => {
207
+ return (
208
+ <Button
209
+ key={ value }
210
+ label={ label }
211
+ icon={ icon }
212
+ isPressed={ verticalAlignment === value }
213
+ onClick={ () => onVerticalAlignmentChange( value ) }
214
+ />
215
+ );
216
+ } ) }
217
+ </div>
218
+ </fieldset>
219
+ );
220
+ }
221
+
138
222
  function FlexLayoutJustifyContentControl( {
139
223
  layout,
140
224
  onChange,
@@ -14,7 +14,8 @@ import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
14
14
  */
15
15
  import useSetting from '../components/use-setting';
16
16
  import { appendSelectors } from './utils';
17
- import { getGapValueFromStyle } from '../hooks/gap';
17
+ import { getGapBoxControlValueFromStyle } from '../hooks/gap';
18
+ import { shouldSkipSerialization } from '../hooks/utils';
18
19
 
19
20
  export default {
20
21
  name: 'default',
@@ -106,15 +107,25 @@ export default {
106
107
  toolBarControls: function DefaultLayoutToolbarControls() {
107
108
  return null;
108
109
  },
109
- save: function DefaultLayoutStyle( { selector, layout = {}, style } ) {
110
+ save: function DefaultLayoutStyle( {
111
+ selector,
112
+ layout = {},
113
+ style,
114
+ blockName,
115
+ } ) {
110
116
  const { contentSize, wideSize } = layout;
111
117
  const blockGapSupport = useSetting( 'spacing.blockGap' );
112
118
  const hasBlockGapStylesSupport = blockGapSupport !== null;
113
- const blockGapStyleValue = getGapValueFromStyle(
119
+ const blockGapStyleValue = getGapBoxControlValueFromStyle(
114
120
  style?.spacing?.blockGap
115
121
  );
122
+ // If a block's block.json skips serialization for spacing or
123
+ // spacing.blockGap, don't apply the user-defined value to the styles.
116
124
  const blockGapValue =
117
- blockGapStyleValue?.top ?? 'var( --wp--style--block-gap )';
125
+ blockGapStyleValue?.top &&
126
+ ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )
127
+ ? blockGapStyleValue?.top
128
+ : 'var( --wp--style--block-gap )';
118
129
 
119
130
  let output =
120
131
  !! contentSize || !! wideSize
@@ -100,6 +100,15 @@ export const validateBlocksToTemplate = ( blocks ) => ( {
100
100
  * text value. See `wp.richText.create`.
101
101
  */
102
102
 
103
+ /**
104
+ * A selection object.
105
+ *
106
+ * @typedef {Object} WPSelection
107
+ *
108
+ * @property {WPBlockSelection} start The selection start.
109
+ * @property {WPBlockSelection} end The selection end.
110
+ */
111
+
103
112
  /* eslint-disable jsdoc/valid-types */
104
113
  /**
105
114
  * Returns an action object used in signalling that selection state should be
@@ -601,7 +610,7 @@ export const insertBlocks = (
601
610
  * @param {?string} rootClientId Optional root client ID of block list on
602
611
  * which to insert.
603
612
  * @param {?number} index Index at which block should be inserted.
604
- * @param {Object} __unstableOptions Wether or not to show an inserter button.
613
+ * @param {Object} __unstableOptions Whether or not to show an inserter button.
605
614
  *
606
615
  * @return {Object} Action object.
607
616
  */
@@ -658,6 +667,326 @@ export const synchronizeTemplate = () => ( { select, dispatch } ) => {
658
667
  dispatch.resetBlocks( updatedBlockList );
659
668
  };
660
669
 
670
+ function mapRichTextSettings( attributeDefinition ) {
671
+ const {
672
+ multiline: multilineTag,
673
+ __unstableMultilineWrapperTags: multilineWrapperTags,
674
+ __unstablePreserveWhiteSpace: preserveWhiteSpace,
675
+ } = attributeDefinition;
676
+ return {
677
+ multilineTag,
678
+ multilineWrapperTags,
679
+ preserveWhiteSpace,
680
+ };
681
+ }
682
+
683
+ /**
684
+ * Delete the current selection.
685
+ *
686
+ * @param {boolean} isForward
687
+ */
688
+ export const __unstableDeleteSelection = ( isForward ) => ( {
689
+ registry,
690
+ select,
691
+ dispatch,
692
+ } ) => {
693
+ const selectionAnchor = select.getSelectionStart();
694
+ const selectionFocus = select.getSelectionEnd();
695
+
696
+ if ( selectionAnchor.clientId === selectionFocus.clientId ) return;
697
+
698
+ // It's not mergeable if there's no rich text selection.
699
+ if (
700
+ ! selectionAnchor.attributeKey ||
701
+ ! selectionFocus.attributeKey ||
702
+ typeof selectionAnchor.offset === 'undefined' ||
703
+ typeof selectionFocus.offset === 'undefined'
704
+ )
705
+ return false;
706
+
707
+ const anchorRootClientId = select.getBlockRootClientId(
708
+ selectionAnchor.clientId
709
+ );
710
+ const focusRootClientId = select.getBlockRootClientId(
711
+ selectionFocus.clientId
712
+ );
713
+
714
+ // It's not mergeable if the selection doesn't start and end in the same
715
+ // block list. Maybe in the future it should be allowed.
716
+ if ( anchorRootClientId !== focusRootClientId ) {
717
+ return;
718
+ }
719
+
720
+ const blockOrder = select.getBlockOrder( anchorRootClientId );
721
+ const anchorIndex = blockOrder.indexOf( selectionAnchor.clientId );
722
+ const focusIndex = blockOrder.indexOf( selectionFocus.clientId );
723
+
724
+ // Reassign selection start and end based on order.
725
+ let selectionStart, selectionEnd;
726
+
727
+ if ( anchorIndex > focusIndex ) {
728
+ selectionStart = selectionFocus;
729
+ selectionEnd = selectionAnchor;
730
+ } else {
731
+ selectionStart = selectionAnchor;
732
+ selectionEnd = selectionFocus;
733
+ }
734
+
735
+ const targetSelection = isForward ? selectionEnd : selectionStart;
736
+ const targetBlock = select.getBlock( targetSelection.clientId );
737
+ const targetBlockType = getBlockType( targetBlock.name );
738
+
739
+ if ( ! targetBlockType.merge ) {
740
+ return;
741
+ }
742
+
743
+ const selectionA = selectionStart;
744
+ const selectionB = selectionEnd;
745
+
746
+ const blockA = select.getBlock( selectionA.clientId );
747
+ const blockAType = getBlockType( blockA.name );
748
+
749
+ const blockB = select.getBlock( selectionB.clientId );
750
+ const blockBType = getBlockType( blockB.name );
751
+
752
+ const htmlA = blockA.attributes[ selectionA.attributeKey ];
753
+ const htmlB = blockB.attributes[ selectionB.attributeKey ];
754
+
755
+ const attributeDefinitionA =
756
+ blockAType.attributes[ selectionA.attributeKey ];
757
+ const attributeDefinitionB =
758
+ blockBType.attributes[ selectionB.attributeKey ];
759
+
760
+ let valueA = create( {
761
+ html: htmlA,
762
+ ...mapRichTextSettings( attributeDefinitionA ),
763
+ } );
764
+ let valueB = create( {
765
+ html: htmlB,
766
+ ...mapRichTextSettings( attributeDefinitionB ),
767
+ } );
768
+
769
+ // A robust way to retain selection position through various transforms
770
+ // is to insert a special character at the position and then recover it.
771
+ const START_OF_SELECTED_AREA = '\u0086';
772
+
773
+ valueA = remove( valueA, selectionA.offset, valueA.text.length );
774
+ valueB = insert( valueB, START_OF_SELECTED_AREA, 0, selectionB.offset );
775
+
776
+ // Clone the blocks so we don't manipulate the original.
777
+ const cloneA = cloneBlock( blockA, {
778
+ [ selectionA.attributeKey ]: toHTMLString( {
779
+ value: valueA,
780
+ ...mapRichTextSettings( attributeDefinitionA ),
781
+ } ),
782
+ } );
783
+ const cloneB = cloneBlock( blockB, {
784
+ [ selectionB.attributeKey ]: toHTMLString( {
785
+ value: valueB,
786
+ ...mapRichTextSettings( attributeDefinitionB ),
787
+ } ),
788
+ } );
789
+
790
+ const followingBlock = isForward ? cloneA : cloneB;
791
+
792
+ // We can only merge blocks with similar types
793
+ // thus, we transform the block to merge first
794
+ const blocksWithTheSameType =
795
+ blockA.name === blockB.name
796
+ ? [ followingBlock ]
797
+ : switchToBlockType( followingBlock, targetBlockType.name );
798
+
799
+ // If the block types can not match, do nothing
800
+ if ( ! blocksWithTheSameType || ! blocksWithTheSameType.length ) {
801
+ return;
802
+ }
803
+
804
+ let updatedAttributes;
805
+
806
+ if ( isForward ) {
807
+ const blockToMerge = blocksWithTheSameType.pop();
808
+ updatedAttributes = targetBlockType.merge(
809
+ blockToMerge.attributes,
810
+ cloneB.attributes
811
+ );
812
+ } else {
813
+ const blockToMerge = blocksWithTheSameType.shift();
814
+ updatedAttributes = targetBlockType.merge(
815
+ cloneA.attributes,
816
+ blockToMerge.attributes
817
+ );
818
+ }
819
+
820
+ const newAttributeKey = findKey(
821
+ updatedAttributes,
822
+ ( v ) =>
823
+ typeof v === 'string' && v.indexOf( START_OF_SELECTED_AREA ) !== -1
824
+ );
825
+
826
+ const convertedHtml = updatedAttributes[ newAttributeKey ];
827
+ const convertedValue = create( {
828
+ html: convertedHtml,
829
+ ...mapRichTextSettings( targetBlockType.attributes[ newAttributeKey ] ),
830
+ } );
831
+ const newOffset = convertedValue.text.indexOf( START_OF_SELECTED_AREA );
832
+ const newValue = remove( convertedValue, newOffset, newOffset + 1 );
833
+ const newHtml = toHTMLString( {
834
+ value: newValue,
835
+ ...mapRichTextSettings( targetBlockType.attributes[ newAttributeKey ] ),
836
+ } );
837
+
838
+ updatedAttributes[ newAttributeKey ] = newHtml;
839
+
840
+ const selectedBlockClientIds = select.getSelectedBlockClientIds();
841
+ const replacement = [
842
+ ...( isForward ? blocksWithTheSameType : [] ),
843
+ {
844
+ // Preserve the original client ID.
845
+ ...targetBlock,
846
+ attributes: {
847
+ ...targetBlock.attributes,
848
+ ...updatedAttributes,
849
+ },
850
+ },
851
+ ...( isForward ? [] : blocksWithTheSameType ),
852
+ ];
853
+
854
+ registry.batch( () => {
855
+ dispatch.selectionChange(
856
+ targetBlock.clientId,
857
+ newAttributeKey,
858
+ newOffset,
859
+ newOffset
860
+ );
861
+
862
+ dispatch.replaceBlocks(
863
+ selectedBlockClientIds,
864
+ replacement,
865
+ 0, // If we don't pass the `indexToSelect` it will default to the last block.
866
+ select.getSelectedBlocksInitialCaretPosition()
867
+ );
868
+ } );
869
+ };
870
+
871
+ /**
872
+ * Split the current selection.
873
+ */
874
+ export const __unstableSplitSelection = () => ( { select, dispatch } ) => {
875
+ const selectionAnchor = select.getSelectionStart();
876
+ const selectionFocus = select.getSelectionEnd();
877
+
878
+ if ( selectionAnchor.clientId === selectionFocus.clientId ) return;
879
+
880
+ // Can't split if the selection is not set.
881
+ if (
882
+ ! selectionAnchor.attributeKey ||
883
+ ! selectionFocus.attributeKey ||
884
+ typeof selectionAnchor.offset === 'undefined' ||
885
+ typeof selectionFocus.offset === 'undefined'
886
+ )
887
+ return;
888
+
889
+ const anchorRootClientId = select.getBlockRootClientId(
890
+ selectionAnchor.clientId
891
+ );
892
+ const focusRootClientId = select.getBlockRootClientId(
893
+ selectionFocus.clientId
894
+ );
895
+
896
+ // It's not splittable if the selection doesn't start and end in the same
897
+ // block list. Maybe in the future it should be allowed.
898
+ if ( anchorRootClientId !== focusRootClientId ) {
899
+ return;
900
+ }
901
+
902
+ const blockOrder = select.getBlockOrder( anchorRootClientId );
903
+ const anchorIndex = blockOrder.indexOf( selectionAnchor.clientId );
904
+ const focusIndex = blockOrder.indexOf( selectionFocus.clientId );
905
+
906
+ // Reassign selection start and end based on order.
907
+ let selectionStart, selectionEnd;
908
+
909
+ if ( anchorIndex > focusIndex ) {
910
+ selectionStart = selectionFocus;
911
+ selectionEnd = selectionAnchor;
912
+ } else {
913
+ selectionStart = selectionAnchor;
914
+ selectionEnd = selectionFocus;
915
+ }
916
+
917
+ const selectionA = selectionStart;
918
+ const selectionB = selectionEnd;
919
+
920
+ const blockA = select.getBlock( selectionA.clientId );
921
+ const blockAType = getBlockType( blockA.name );
922
+
923
+ const blockB = select.getBlock( selectionB.clientId );
924
+ const blockBType = getBlockType( blockB.name );
925
+
926
+ const htmlA = blockA.attributes[ selectionA.attributeKey ];
927
+ const htmlB = blockB.attributes[ selectionB.attributeKey ];
928
+
929
+ const attributeDefinitionA =
930
+ blockAType.attributes[ selectionA.attributeKey ];
931
+ const attributeDefinitionB =
932
+ blockBType.attributes[ selectionB.attributeKey ];
933
+
934
+ let valueA = create( {
935
+ html: htmlA,
936
+ ...mapRichTextSettings( attributeDefinitionA ),
937
+ } );
938
+ let valueB = create( {
939
+ html: htmlB,
940
+ ...mapRichTextSettings( attributeDefinitionB ),
941
+ } );
942
+
943
+ valueA = remove( valueA, selectionA.offset, valueA.text.length );
944
+ valueB = remove( valueB, 0, selectionB.offset );
945
+
946
+ dispatch.replaceBlocks(
947
+ select.getSelectedBlockClientIds(),
948
+ [
949
+ {
950
+ // Preserve the original client ID.
951
+ ...blockA,
952
+ attributes: {
953
+ ...blockA.attributes,
954
+ [ selectionA.attributeKey ]: toHTMLString( {
955
+ value: valueA,
956
+ ...mapRichTextSettings( attributeDefinitionA ),
957
+ } ),
958
+ },
959
+ },
960
+ createBlock( getDefaultBlockName() ),
961
+ {
962
+ // Preserve the original client ID.
963
+ ...blockB,
964
+ attributes: {
965
+ ...blockB.attributes,
966
+ [ selectionB.attributeKey ]: toHTMLString( {
967
+ value: valueB,
968
+ ...mapRichTextSettings( attributeDefinitionB ),
969
+ } ),
970
+ },
971
+ },
972
+ ],
973
+ 1, // If we don't pass the `indexToSelect` it will default to the last block.
974
+ select.getSelectedBlocksInitialCaretPosition()
975
+ );
976
+ };
977
+
978
+ /**
979
+ * Expand the selection to cover the entire blocks, removing partial selection.
980
+ */
981
+ export const __unstableExpandSelection = () => ( { select, dispatch } ) => {
982
+ const selectionAnchor = select.getSelectionStart();
983
+ const selectionFocus = select.getSelectionEnd();
984
+ dispatch.selectionChange( {
985
+ start: { clientId: selectionAnchor.clientId },
986
+ end: { clientId: selectionFocus.clientId },
987
+ } );
988
+ };
989
+
661
990
  /**
662
991
  * Action that merges two blocks.
663
992
  *
@@ -719,17 +1048,10 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
719
1048
  if ( canRestoreTextSelection ) {
720
1049
  const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
721
1050
  const html = selectedBlock.attributes[ attributeKey ];
722
- const {
723
- multiline: multilineTag,
724
- __unstableMultilineWrapperTags: multilineWrapperTags,
725
- __unstablePreserveWhiteSpace: preserveWhiteSpace,
726
- } = attributeDefinition;
727
1051
  const value = insert(
728
1052
  create( {
729
1053
  html,
730
- multilineTag,
731
- multilineWrapperTags,
732
- preserveWhiteSpace,
1054
+ ...mapRichTextSettings( attributeDefinition ),
733
1055
  } ),
734
1056
  START_OF_SELECTED_AREA,
735
1057
  offset,
@@ -738,8 +1060,7 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
738
1060
 
739
1061
  selectedBlock.attributes[ attributeKey ] = toHTMLString( {
740
1062
  value,
741
- multilineTag,
742
- preserveWhiteSpace,
1063
+ ...mapRichTextSettings( attributeDefinition ),
743
1064
  } );
744
1065
  }
745
1066
 
@@ -769,23 +1090,15 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
769
1090
  v.indexOf( START_OF_SELECTED_AREA ) !== -1
770
1091
  );
771
1092
  const convertedHtml = updatedAttributes[ newAttributeKey ];
772
- const {
773
- multiline: multilineTag,
774
- __unstableMultilineWrapperTags: multilineWrapperTags,
775
- __unstablePreserveWhiteSpace: preserveWhiteSpace,
776
- } = blockAType.attributes[ newAttributeKey ];
777
1093
  const convertedValue = create( {
778
1094
  html: convertedHtml,
779
- multilineTag,
780
- multilineWrapperTags,
781
- preserveWhiteSpace,
1095
+ ...mapRichTextSettings( blockAType.attributes[ newAttributeKey ] ),
782
1096
  } );
783
1097
  const newOffset = convertedValue.text.indexOf( START_OF_SELECTED_AREA );
784
1098
  const newValue = remove( convertedValue, newOffset, newOffset + 1 );
785
1099
  const newHtml = toHTMLString( {
786
1100
  value: newValue,
787
- multilineTag,
788
- preserveWhiteSpace,
1101
+ ...mapRichTextSettings( blockAType.attributes[ newAttributeKey ] ),
789
1102
  } );
790
1103
 
791
1104
  updatedAttributes[ newAttributeKey ] = newHtml;
@@ -978,10 +1291,10 @@ export function exitFormattedText() {
978
1291
  /**
979
1292
  * Action that changes the position of the user caret.
980
1293
  *
981
- * @param {string} clientId The selected block client ID.
982
- * @param {string} attributeKey The selected block attribute key.
983
- * @param {number} startOffset The start offset.
984
- * @param {number} endOffset The end offset.
1294
+ * @param {string|WPSelection} clientId The selected block client ID.
1295
+ * @param {string} attributeKey The selected block attribute key.
1296
+ * @param {number} startOffset The start offset.
1297
+ * @param {number} endOffset The end offset.
985
1298
  *
986
1299
  * @return {Object} Action object.
987
1300
  */
@@ -991,13 +1304,17 @@ export function selectionChange(
991
1304
  startOffset,
992
1305
  endOffset
993
1306
  ) {
994
- return {
995
- type: 'SELECTION_CHANGE',
996
- clientId,
997
- attributeKey,
998
- startOffset,
999
- endOffset,
1000
- };
1307
+ if ( typeof clientId === 'string' ) {
1308
+ return {
1309
+ type: 'SELECTION_CHANGE',
1310
+ clientId,
1311
+ attributeKey,
1312
+ startOffset,
1313
+ endOffset,
1314
+ };
1315
+ }
1316
+
1317
+ return { type: 'SELECTION_CHANGE', ...clientId };
1001
1318
  }
1002
1319
 
1003
1320
  /**
@@ -23,12 +23,13 @@ export const PREFERENCES_DEFAULTS = {
23
23
  * @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode
24
24
  * @property {string} bodyPlaceholder Empty post placeholder
25
25
  * @property {string} titlePlaceholder Empty title placeholder
26
+ * @property {boolean} canLockBlocks Whether the user can manage Block Lock state
26
27
  * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor
28
+ * @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks
27
29
  * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
28
30
  * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
29
31
  * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
30
32
  * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories
31
- * @property {boolean} __experimentalGenerateAnchors Enable/Disable auto anchor generation for Heading blocks
32
33
  * @property {boolean} __unstableGalleryWithImageBlocks Whether the user has enabled the refactored gallery block which uses InnerBlocks
33
34
  */
34
35
  export const SETTINGS_DEFAULTS = {
@@ -151,14 +152,18 @@ export const SETTINGS_DEFAULTS = {
151
152
  // List of allowed mime types and file extensions.
152
153
  allowedMimeTypes: null,
153
154
 
155
+ // Allows to disable block locking interface.
156
+ canLockBlocks: true,
157
+
154
158
  __experimentalCanUserUseUnfilteredHTML: false,
155
159
  __experimentalBlockDirectory: false,
156
160
  __mobileEnablePageTemplates: false,
157
161
  __experimentalBlockPatterns: [],
158
162
  __experimentalBlockPatternCategories: [],
159
163
  __experimentalSpotlightEntityBlocks: [],
160
- __experimentalGenerateAnchors: false,
161
164
  __unstableGalleryWithImageBlocks: false,
165
+
166
+ generateAnchors: false,
162
167
  // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
163
168
  // The setting is only kept for backward compatibility purposes.
164
169
  gradients: [