@wordpress/block-editor 8.3.1 → 8.5.1

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 (475) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +56 -18
  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-content-overlay/index.js +13 -4
  8. package/build/components/block-content-overlay/index.js.map +1 -1
  9. package/build/components/block-draggable/index.js +2 -3
  10. package/build/components/block-draggable/index.js.map +1 -1
  11. package/build/components/block-icon/index.js +4 -0
  12. package/build/components/block-icon/index.js.map +1 -1
  13. package/build/components/block-inspector/index.js +6 -1
  14. package/build/components/block-inspector/index.js.map +1 -1
  15. package/build/components/block-list/block-html.js +4 -1
  16. package/build/components/block-list/block-html.js.map +1 -1
  17. package/build/components/block-list/block.js +4 -1
  18. package/build/components/block-list/block.js.map +1 -1
  19. package/build/components/block-list/use-block-props/index.js +1 -6
  20. package/build/components/block-list/use-block-props/index.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-focus-first-element.js +22 -6
  22. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  23. package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
  24. package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  25. package/build/components/block-list-appender/index.js +6 -1
  26. package/build/components/block-list-appender/index.js.map +1 -1
  27. package/build/components/block-lock/index.js +40 -0
  28. package/build/components/block-lock/index.js.map +1 -0
  29. package/build/components/block-lock/menu-item.js +52 -0
  30. package/build/components/block-lock/menu-item.js.map +1 -0
  31. package/build/components/block-lock/modal.js +155 -0
  32. package/build/components/block-lock/modal.js.map +1 -0
  33. package/build/components/block-lock/toolbar.js +65 -0
  34. package/build/components/block-lock/toolbar.js.map +1 -0
  35. package/build/components/block-lock/use-block-lock.js +53 -0
  36. package/build/components/block-lock/use-block-lock.js.map +1 -0
  37. package/build/components/block-mover/index.js +4 -0
  38. package/build/components/block-mover/index.js.map +1 -1
  39. package/build/components/block-pattern-setup/index.js +37 -22
  40. package/build/components/block-pattern-setup/index.js.map +1 -1
  41. package/build/components/block-pattern-setup/setup-toolbar.js +1 -1
  42. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  43. package/build/components/block-preview/auto.js +6 -3
  44. package/build/components/block-preview/auto.js.map +1 -1
  45. package/build/components/block-preview/index.js +4 -2
  46. package/build/components/block-preview/index.js.map +1 -1
  47. package/build/components/block-settings-menu/block-settings-dropdown.js +75 -10
  48. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  49. package/build/components/block-settings-menu-controls/index.js +19 -9
  50. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  51. package/build/components/block-switcher/index.js +8 -3
  52. package/build/components/block-switcher/index.js.map +1 -1
  53. package/build/components/block-title/index.js +2 -2
  54. package/build/components/block-title/index.js.map +1 -1
  55. package/build/components/block-title/use-block-display-title.js +8 -6
  56. package/build/components/block-title/use-block-display-title.js.map +1 -1
  57. package/build/components/block-toolbar/block-name-context.js +17 -0
  58. package/build/components/block-toolbar/block-name-context.js.map +1 -0
  59. package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
  60. package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  61. package/build/components/block-toolbar/index.js +24 -5
  62. package/build/components/block-toolbar/index.js.map +1 -1
  63. package/build/components/block-tools/index.js +0 -16
  64. package/build/components/block-tools/index.js.map +1 -1
  65. package/build/components/block-variation-transforms/index.js +92 -47
  66. package/build/components/block-variation-transforms/index.js.map +1 -1
  67. package/build/components/block-vertical-alignment-control/index.js +13 -6
  68. package/build/components/block-vertical-alignment-control/index.js.map +1 -1
  69. package/build/components/border-radius-control/index.js +0 -1
  70. package/build/components/border-radius-control/index.js.map +1 -1
  71. package/build/components/border-radius-control/utils.js +1 -1
  72. package/build/components/border-radius-control/utils.js.map +1 -1
  73. package/build/components/colors-gradients/control.js +3 -1
  74. package/build/components/colors-gradients/control.js.map +1 -1
  75. package/build/components/contrast-checker/index.js +4 -0
  76. package/build/components/contrast-checker/index.js.map +1 -1
  77. package/build/components/convert-to-group-buttons/index.js +8 -0
  78. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  79. package/build/components/convert-to-group-buttons/toolbar.js +105 -0
  80. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
  81. package/build/components/copy-handler/index.js +4 -0
  82. package/build/components/copy-handler/index.js.map +1 -1
  83. package/build/components/date-format-picker/index.js +132 -0
  84. package/build/components/date-format-picker/index.js.map +1 -0
  85. package/build/components/font-sizes/font-size-picker.js +4 -0
  86. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  87. package/build/components/iframe/index.js +6 -9
  88. package/build/components/iframe/index.js.map +1 -1
  89. package/build/components/index.js +27 -0
  90. package/build/components/index.js.map +1 -1
  91. package/build/components/justify-content-control/index.js +13 -6
  92. package/build/components/justify-content-control/index.js.map +1 -1
  93. package/build/components/keyboard-shortcuts/index.js +1 -1
  94. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  95. package/build/components/line-height-control/index.js +15 -6
  96. package/build/components/line-height-control/index.js.map +1 -1
  97. package/build/components/list-view/block-select-button.js +18 -23
  98. package/build/components/list-view/block-select-button.js.map +1 -1
  99. package/build/components/list-view/block.js +38 -13
  100. package/build/components/list-view/block.js.map +1 -1
  101. package/build/components/list-view/branch.js +16 -13
  102. package/build/components/list-view/branch.js.map +1 -1
  103. package/build/components/list-view/index.js +7 -1
  104. package/build/components/list-view/index.js.map +1 -1
  105. package/build/components/list-view/use-block-selection.js +9 -2
  106. package/build/components/list-view/use-block-selection.js.map +1 -1
  107. package/build/components/media-replace-flow/index.js +4 -0
  108. package/build/components/media-replace-flow/index.js.map +1 -1
  109. package/build/components/multi-selection-inspector/index.js +1 -1
  110. package/build/components/multi-selection-inspector/index.js.map +1 -1
  111. package/build/components/rich-text/index.js +27 -5
  112. package/build/components/rich-text/index.js.map +1 -1
  113. package/build/components/rich-text/index.native.js +13 -9
  114. package/build/components/rich-text/index.native.js.map +1 -1
  115. package/build/components/rich-text/split-value.js +12 -2
  116. package/build/components/rich-text/split-value.js.map +1 -1
  117. package/build/components/rich-text/use-firefox-compat.js +49 -0
  118. package/build/components/rich-text/use-firefox-compat.js.map +1 -0
  119. package/build/components/rich-text/use-input-rules.js +34 -2
  120. package/build/components/rich-text/use-input-rules.js.map +1 -1
  121. package/build/components/skip-to-selected-block/index.js +4 -0
  122. package/build/components/skip-to-selected-block/index.js.map +1 -1
  123. package/build/components/url-popover/image-url-input-ui.js +11 -27
  124. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  125. package/build/components/writing-flow/index.js +9 -1
  126. package/build/components/writing-flow/index.js.map +1 -1
  127. package/build/components/writing-flow/use-arrow-nav.js +3 -44
  128. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  129. package/build/components/writing-flow/use-click-selection.js +68 -0
  130. package/build/components/writing-flow/use-click-selection.js.map +1 -0
  131. package/build/components/writing-flow/use-drag-selection.js +134 -0
  132. package/build/components/writing-flow/use-drag-selection.js.map +1 -0
  133. package/build/components/writing-flow/use-input.js +116 -0
  134. package/build/components/writing-flow/use-input.js.map +1 -0
  135. package/build/components/writing-flow/use-multi-selection.js +18 -38
  136. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  137. package/build/components/writing-flow/use-selection-observer.js +161 -0
  138. package/build/components/writing-flow/use-selection-observer.js.map +1 -0
  139. package/build/components/writing-flow/use-tab-nav.js +1 -8
  140. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  141. package/build/hooks/anchor.js +7 -6
  142. package/build/hooks/anchor.js.map +1 -1
  143. package/build/hooks/border-color.js +3 -3
  144. package/build/hooks/border-color.js.map +1 -1
  145. package/build/hooks/border.js +0 -14
  146. package/build/hooks/border.js.map +1 -1
  147. package/build/hooks/color.js +20 -17
  148. package/build/hooks/color.js.map +1 -1
  149. package/build/hooks/font-family.js +5 -1
  150. package/build/hooks/font-family.js.map +1 -1
  151. package/build/hooks/font-size.js +4 -2
  152. package/build/hooks/font-size.js.map +1 -1
  153. package/build/hooks/gap.js +77 -5
  154. package/build/hooks/gap.js.map +1 -1
  155. package/build/hooks/layout.js +7 -2
  156. package/build/hooks/layout.js.map +1 -1
  157. package/build/hooks/style.js +34 -3
  158. package/build/hooks/style.js.map +1 -1
  159. package/build/hooks/utils.js +29 -0
  160. package/build/hooks/utils.js.map +1 -1
  161. package/build/layouts/flex.js +82 -15
  162. package/build/layouts/flex.js.map +1 -1
  163. package/build/layouts/flow.js +22 -13
  164. package/build/layouts/flow.js.map +1 -1
  165. package/build/store/actions.js +297 -51
  166. package/build/store/actions.js.map +1 -1
  167. package/build/store/defaults.js +5 -1
  168. package/build/store/defaults.js.map +1 -1
  169. package/build/store/reducer.js +25 -13
  170. package/build/store/reducer.js.map +1 -1
  171. package/build/store/selectors.js +197 -23
  172. package/build/store/selectors.js.map +1 -1
  173. package/build/utils/dom.js +2 -1
  174. package/build/utils/dom.js.map +1 -1
  175. package/build-module/components/alignment-control/index.js +12 -4
  176. package/build-module/components/alignment-control/index.js.map +1 -1
  177. package/build-module/components/block-alignment-control/index.js +12 -4
  178. package/build-module/components/block-alignment-control/index.js.map +1 -1
  179. package/build-module/components/block-content-overlay/index.js +13 -4
  180. package/build-module/components/block-content-overlay/index.js.map +1 -1
  181. package/build-module/components/block-draggable/index.js +2 -3
  182. package/build-module/components/block-draggable/index.js.map +1 -1
  183. package/build-module/components/block-icon/index.js +4 -0
  184. package/build-module/components/block-icon/index.js.map +1 -1
  185. package/build-module/components/block-inspector/index.js +6 -1
  186. package/build-module/components/block-inspector/index.js.map +1 -1
  187. package/build-module/components/block-list/block-html.js +5 -2
  188. package/build-module/components/block-list/block-html.js.map +1 -1
  189. package/build-module/components/block-list/block.js +5 -2
  190. package/build-module/components/block-list/block.js.map +1 -1
  191. package/build-module/components/block-list/use-block-props/index.js +1 -4
  192. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  193. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +22 -6
  194. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  195. package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
  196. package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  197. package/build-module/components/block-list-appender/index.js +6 -1
  198. package/build-module/components/block-list-appender/index.js.map +1 -1
  199. package/build-module/components/block-lock/index.js +5 -0
  200. package/build-module/components/block-lock/index.js.map +1 -0
  201. package/build-module/components/block-lock/menu-item.js +39 -0
  202. package/build-module/components/block-lock/menu-item.js.map +1 -0
  203. package/build-module/components/block-lock/modal.js +138 -0
  204. package/build-module/components/block-lock/modal.js.map +1 -0
  205. package/build-module/components/block-lock/toolbar.js +51 -0
  206. package/build-module/components/block-lock/toolbar.js.map +1 -0
  207. package/build-module/components/block-lock/use-block-lock.js +44 -0
  208. package/build-module/components/block-lock/use-block-lock.js.map +1 -0
  209. package/build-module/components/block-mover/index.js +4 -0
  210. package/build-module/components/block-mover/index.js.map +1 -1
  211. package/build-module/components/block-pattern-setup/index.js +39 -24
  212. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  213. package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -1
  214. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  215. package/build-module/components/block-preview/auto.js +6 -3
  216. package/build-module/components/block-preview/auto.js.map +1 -1
  217. package/build-module/components/block-preview/index.js +4 -2
  218. package/build-module/components/block-preview/index.js.map +1 -1
  219. package/build-module/components/block-settings-menu/block-settings-dropdown.js +75 -12
  220. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  221. package/build-module/components/block-settings-menu-controls/index.js +18 -9
  222. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  223. package/build-module/components/block-switcher/index.js +9 -4
  224. package/build-module/components/block-switcher/index.js.map +1 -1
  225. package/build-module/components/block-title/index.js +2 -2
  226. package/build-module/components/block-title/index.js.map +1 -1
  227. package/build-module/components/block-title/use-block-display-title.js +8 -6
  228. package/build-module/components/block-title/use-block-display-title.js.map +1 -1
  229. package/build-module/components/block-toolbar/block-name-context.js +9 -0
  230. package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
  231. package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
  232. package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
  233. package/build-module/components/block-toolbar/index.js +19 -4
  234. package/build-module/components/block-toolbar/index.js.map +1 -1
  235. package/build-module/components/block-tools/index.js +0 -16
  236. package/build-module/components/block-tools/index.js.map +1 -1
  237. package/build-module/components/block-variation-transforms/index.js +95 -49
  238. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  239. package/build-module/components/block-vertical-alignment-control/index.js +12 -4
  240. package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
  241. package/build-module/components/border-radius-control/index.js +0 -1
  242. package/build-module/components/border-radius-control/index.js.map +1 -1
  243. package/build-module/components/border-radius-control/utils.js +1 -1
  244. package/build-module/components/border-radius-control/utils.js.map +1 -1
  245. package/build-module/components/colors-gradients/control.js +3 -1
  246. package/build-module/components/colors-gradients/control.js.map +1 -1
  247. package/build-module/components/contrast-checker/index.js +4 -0
  248. package/build-module/components/contrast-checker/index.js.map +1 -1
  249. package/build-module/components/convert-to-group-buttons/index.js +2 -1
  250. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  251. package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
  252. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
  253. package/build-module/components/copy-handler/index.js +4 -0
  254. package/build-module/components/copy-handler/index.js.map +1 -1
  255. package/build-module/components/date-format-picker/index.js +122 -0
  256. package/build-module/components/date-format-picker/index.js.map +1 -0
  257. package/build-module/components/font-sizes/font-size-picker.js +4 -0
  258. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  259. package/build-module/components/iframe/index.js +6 -9
  260. package/build-module/components/iframe/index.js.map +1 -1
  261. package/build-module/components/index.js +3 -0
  262. package/build-module/components/index.js.map +1 -1
  263. package/build-module/components/justify-content-control/index.js +12 -4
  264. package/build-module/components/justify-content-control/index.js.map +1 -1
  265. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  266. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  267. package/build-module/components/line-height-control/index.js +14 -5
  268. package/build-module/components/line-height-control/index.js.map +1 -1
  269. package/build-module/components/list-view/block-select-button.js +19 -23
  270. package/build-module/components/list-view/block-select-button.js.map +1 -1
  271. package/build-module/components/list-view/block.js +36 -13
  272. package/build-module/components/list-view/block.js.map +1 -1
  273. package/build-module/components/list-view/branch.js +16 -13
  274. package/build-module/components/list-view/branch.js.map +1 -1
  275. package/build-module/components/list-view/index.js +7 -1
  276. package/build-module/components/list-view/index.js.map +1 -1
  277. package/build-module/components/list-view/use-block-selection.js +10 -3
  278. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  279. package/build-module/components/media-replace-flow/index.js +4 -0
  280. package/build-module/components/media-replace-flow/index.js.map +1 -1
  281. package/build-module/components/multi-selection-inspector/index.js +2 -2
  282. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  283. package/build-module/components/rich-text/index.js +26 -5
  284. package/build-module/components/rich-text/index.js.map +1 -1
  285. package/build-module/components/rich-text/index.native.js +13 -9
  286. package/build-module/components/rich-text/index.native.js.map +1 -1
  287. package/build-module/components/rich-text/split-value.js +12 -2
  288. package/build-module/components/rich-text/split-value.js.map +1 -1
  289. package/build-module/components/rich-text/use-firefox-compat.js +39 -0
  290. package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
  291. package/build-module/components/rich-text/use-input-rules.js +35 -4
  292. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  293. package/build-module/components/skip-to-selected-block/index.js +4 -0
  294. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  295. package/build-module/components/url-popover/image-url-input-ui.js +12 -28
  296. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  297. package/build-module/components/writing-flow/index.js +5 -1
  298. package/build-module/components/writing-flow/index.js.map +1 -1
  299. package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
  300. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  301. package/build-module/components/writing-flow/use-click-selection.js +57 -0
  302. package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
  303. package/build-module/components/writing-flow/use-drag-selection.js +124 -0
  304. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
  305. package/build-module/components/writing-flow/use-input.js +104 -0
  306. package/build-module/components/writing-flow/use-input.js.map +1 -0
  307. package/build-module/components/writing-flow/use-multi-selection.js +18 -37
  308. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  309. package/build-module/components/writing-flow/use-selection-observer.js +150 -0
  310. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
  311. package/build-module/components/writing-flow/use-tab-nav.js +1 -9
  312. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  313. package/build-module/hooks/anchor.js +7 -6
  314. package/build-module/hooks/anchor.js.map +1 -1
  315. package/build-module/hooks/border-color.js +5 -5
  316. package/build-module/hooks/border-color.js.map +1 -1
  317. package/build-module/hooks/border.js +0 -12
  318. package/build-module/hooks/border.js.map +1 -1
  319. package/build-module/hooks/color.js +19 -18
  320. package/build-module/hooks/color.js.map +1 -1
  321. package/build-module/hooks/font-family.js +3 -1
  322. package/build-module/hooks/font-family.js.map +1 -1
  323. package/build-module/hooks/font-size.js +4 -3
  324. package/build-module/hooks/font-size.js.map +1 -1
  325. package/build-module/hooks/gap.js +75 -7
  326. package/build-module/hooks/gap.js.map +1 -1
  327. package/build-module/hooks/layout.js +7 -2
  328. package/build-module/hooks/layout.js.map +1 -1
  329. package/build-module/hooks/style.js +33 -3
  330. package/build-module/hooks/style.js.map +1 -1
  331. package/build-module/hooks/utils.js +26 -0
  332. package/build-module/hooks/utils.js.map +1 -1
  333. package/build-module/layouts/flex.js +81 -16
  334. package/build-module/layouts/flex.js.map +1 -1
  335. package/build-module/layouts/flow.js +20 -13
  336. package/build-module/layouts/flow.js.map +1 -1
  337. package/build-module/store/actions.js +286 -49
  338. package/build-module/store/actions.js.map +1 -1
  339. package/build-module/store/defaults.js +5 -1
  340. package/build-module/store/defaults.js.map +1 -1
  341. package/build-module/store/reducer.js +25 -13
  342. package/build-module/store/reducer.js.map +1 -1
  343. package/build-module/store/selectors.js +186 -22
  344. package/build-module/store/selectors.js.map +1 -1
  345. package/build-module/utils/dom.js +2 -1
  346. package/build-module/utils/dom.js.map +1 -1
  347. package/build-style/style-rtl.css +248 -49
  348. package/build-style/style.css +248 -49
  349. package/build-types/utils/dom.d.ts.map +1 -1
  350. package/package.json +28 -27
  351. package/src/components/alignment-control/index.js +9 -4
  352. package/src/components/block-alignment-control/index.js +9 -4
  353. package/src/components/block-content-overlay/index.js +19 -2
  354. package/src/components/block-draggable/index.js +2 -5
  355. package/src/components/block-icon/index.js +3 -0
  356. package/src/components/block-inspector/index.js +4 -0
  357. package/src/components/block-list/block-html.js +8 -4
  358. package/src/components/block-list/block.js +5 -1
  359. package/src/components/block-list/style.scss +4 -5
  360. package/src/components/block-list/use-block-props/index.js +0 -5
  361. package/src/components/block-list/use-block-props/use-focus-first-element.js +27 -6
  362. package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
  363. package/src/components/block-list-appender/index.js +5 -0
  364. package/src/components/block-lock/index.js +4 -0
  365. package/src/components/block-lock/menu-item.js +39 -0
  366. package/src/components/block-lock/modal.js +194 -0
  367. package/src/components/block-lock/style.scss +70 -0
  368. package/src/components/block-lock/toolbar.js +51 -0
  369. package/src/components/block-lock/use-block-lock.js +49 -0
  370. package/src/components/block-mover/index.js +3 -0
  371. package/src/components/block-mover/style.scss +4 -0
  372. package/src/components/block-pattern-setup/index.js +84 -59
  373. package/src/components/block-pattern-setup/setup-toolbar.js +3 -1
  374. package/src/components/block-pattern-setup/style.scss +32 -26
  375. package/src/components/block-preview/auto.js +10 -1
  376. package/src/components/block-preview/index.js +2 -0
  377. package/src/components/block-settings-menu/block-settings-dropdown.js +109 -9
  378. package/src/components/block-settings-menu-controls/index.js +33 -12
  379. package/src/components/block-switcher/index.js +15 -3
  380. package/src/components/block-switcher/style.scss +15 -4
  381. package/src/components/block-switcher/test/__snapshots__/index.js.snap +15 -13
  382. package/src/components/block-switcher/test/index.js +2 -2
  383. package/src/components/block-title/README.md +6 -1
  384. package/src/components/block-title/index.js +2 -2
  385. package/src/components/block-title/test/index.js +43 -1
  386. package/src/components/block-title/use-block-display-title.js +10 -7
  387. package/src/components/block-toolbar/block-name-context.js +8 -0
  388. package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
  389. package/src/components/block-toolbar/index.js +24 -2
  390. package/src/components/block-toolbar/style.scss +10 -0
  391. package/src/components/block-tools/index.js +0 -19
  392. package/src/components/block-tools/style.scss +27 -0
  393. package/src/components/block-variation-transforms/index.js +105 -36
  394. package/src/components/block-variation-transforms/style.scss +1 -1
  395. package/src/components/block-vertical-alignment-control/index.js +9 -4
  396. package/src/components/border-radius-control/index.js +0 -1
  397. package/src/components/border-radius-control/test/utils.js +4 -0
  398. package/src/components/border-radius-control/utils.js +2 -1
  399. package/src/components/button-block-appender/style.scss +5 -1
  400. package/src/components/color-palette/test/__snapshots__/control.js.snap +70 -4
  401. package/src/components/colors-gradients/control.js +1 -1
  402. package/src/components/colors-gradients/style.scss +6 -0
  403. package/src/components/contrast-checker/index.js +3 -0
  404. package/src/components/convert-to-group-buttons/index.js +6 -1
  405. package/src/components/convert-to-group-buttons/toolbar.js +87 -0
  406. package/src/components/copy-handler/index.js +3 -0
  407. package/src/components/date-format-picker/README.md +58 -0
  408. package/src/components/date-format-picker/index.js +161 -0
  409. package/src/components/date-format-picker/style.scss +31 -0
  410. package/src/components/font-sizes/font-size-picker.js +3 -0
  411. package/src/components/iframe/index.js +5 -7
  412. package/src/components/index.js +3 -0
  413. package/src/components/justify-content-control/index.js +9 -4
  414. package/src/components/keyboard-shortcuts/index.js +1 -1
  415. package/src/components/line-height-control/index.js +11 -6
  416. package/src/components/link-control/README.md +1 -1
  417. package/src/components/list-view/block-select-button.js +14 -31
  418. package/src/components/list-view/block.js +55 -13
  419. package/src/components/list-view/branch.js +37 -15
  420. package/src/components/list-view/index.js +6 -0
  421. package/src/components/list-view/style.scss +56 -14
  422. package/src/components/list-view/use-block-selection.js +15 -2
  423. package/src/components/media-placeholder/README.md +8 -0
  424. package/src/components/media-replace-flow/index.js +3 -0
  425. package/src/components/multi-selection-inspector/index.js +2 -2
  426. package/src/components/rich-text/index.js +25 -2
  427. package/src/components/rich-text/index.native.js +24 -8
  428. package/src/components/rich-text/split-value.js +5 -1
  429. package/src/components/rich-text/use-firefox-compat.js +39 -0
  430. package/src/components/rich-text/use-input-rules.js +40 -3
  431. package/src/components/skip-to-selected-block/index.js +3 -0
  432. package/src/components/url-input/style.scss +3 -2
  433. package/src/components/url-popover/image-url-input-ui.js +16 -29
  434. package/src/components/writing-flow/index.js +8 -0
  435. package/src/components/writing-flow/readme.md +28 -0
  436. package/src/components/writing-flow/use-arrow-nav.js +4 -53
  437. package/src/components/writing-flow/use-click-selection.js +65 -0
  438. package/src/components/writing-flow/use-drag-selection.js +126 -0
  439. package/src/components/writing-flow/use-input.js +112 -0
  440. package/src/components/writing-flow/use-multi-selection.js +13 -36
  441. package/src/components/writing-flow/use-selection-observer.js +153 -0
  442. package/src/components/writing-flow/use-tab-nav.js +1 -11
  443. package/src/hooks/anchor.js +8 -6
  444. package/src/hooks/border-color.js +5 -5
  445. package/src/hooks/border.js +0 -13
  446. package/src/hooks/color.js +51 -24
  447. package/src/hooks/font-family.js +5 -2
  448. package/src/hooks/font-size.js +10 -7
  449. package/src/hooks/gap.js +91 -12
  450. package/src/hooks/layout.js +11 -1
  451. package/src/hooks/style.js +40 -4
  452. package/src/hooks/test/gap.js +66 -0
  453. package/src/hooks/test/style.js +94 -0
  454. package/src/hooks/test/utils.js +1 -1
  455. package/src/hooks/utils.js +26 -0
  456. package/src/layouts/flex.js +93 -6
  457. package/src/layouts/flow.js +28 -12
  458. package/src/store/actions.js +349 -32
  459. package/src/store/defaults.js +7 -1
  460. package/src/store/reducer.js +25 -10
  461. package/src/store/selectors.js +229 -27
  462. package/src/store/test/selectors.js +305 -5
  463. package/src/style.scss +2 -0
  464. package/src/utils/dom.js +2 -1
  465. package/tsconfig.tsbuildinfo +1 -1
  466. package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
  467. package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  468. package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
  469. package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  470. package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
  471. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
  472. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
  473. package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
  474. package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
  475. package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
@@ -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,7 +23,9 @@ 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
@@ -150,14 +152,18 @@ export const SETTINGS_DEFAULTS = {
150
152
  // List of allowed mime types and file extensions.
151
153
  allowedMimeTypes: null,
152
154
 
155
+ // Allows to disable block locking interface.
156
+ canLockBlocks: true,
157
+
153
158
  __experimentalCanUserUseUnfilteredHTML: false,
154
159
  __experimentalBlockDirectory: false,
155
160
  __mobileEnablePageTemplates: false,
156
161
  __experimentalBlockPatterns: [],
157
162
  __experimentalBlockPatternCategories: [],
158
163
  __experimentalSpotlightEntityBlocks: [],
159
- __experimentalGenerateAnchors: false,
160
164
  __unstableGalleryWithImageBlocks: false,
165
+
166
+ generateAnchors: false,
161
167
  // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
162
168
  // The setting is only kept for backward compatibility purposes.
163
169
  gradients: [
@@ -1278,17 +1278,24 @@ function selectionHelper( state = {}, action ) {
1278
1278
  export function selection( state = {}, action ) {
1279
1279
  switch ( action.type ) {
1280
1280
  case 'SELECTION_CHANGE':
1281
+ if ( action.clientId ) {
1282
+ return {
1283
+ selectionStart: {
1284
+ clientId: action.clientId,
1285
+ attributeKey: action.attributeKey,
1286
+ offset: action.startOffset,
1287
+ },
1288
+ selectionEnd: {
1289
+ clientId: action.clientId,
1290
+ attributeKey: action.attributeKey,
1291
+ offset: action.endOffset,
1292
+ },
1293
+ };
1294
+ }
1295
+
1281
1296
  return {
1282
- selectionStart: {
1283
- clientId: action.clientId,
1284
- attributeKey: action.attributeKey,
1285
- offset: action.startOffset,
1286
- },
1287
- selectionEnd: {
1288
- clientId: action.clientId,
1289
- attributeKey: action.attributeKey,
1290
- offset: action.endOffset,
1291
- },
1297
+ selectionStart: action.start || state.selectionStart,
1298
+ selectionEnd: action.end || state.selectionEnd,
1292
1299
  };
1293
1300
  case 'RESET_SELECTION':
1294
1301
  const { selectionStart, selectionEnd } = action;
@@ -1298,6 +1305,14 @@ export function selection( state = {}, action ) {
1298
1305
  };
1299
1306
  case 'MULTI_SELECT':
1300
1307
  const { start, end } = action;
1308
+
1309
+ if (
1310
+ start === state.selectionStart?.clientId &&
1311
+ end === state.selectionEnd?.clientId
1312
+ ) {
1313
+ return state;
1314
+ }
1315
+
1301
1316
  return {
1302
1317
  selectionStart: { clientId: start },
1303
1318
  selectionEnd: { clientId: end },