@wordpress/block-editor 12.4.0 → 12.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (524) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -0
  3. package/build/components/block-draggable/index.js +6 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-draggable/index.native.js +2 -2
  6. package/build/components/block-draggable/index.native.js.map +1 -1
  7. package/build/components/block-edit/edit.js +25 -13
  8. package/build/components/block-edit/edit.js.map +1 -1
  9. package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
  10. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  11. package/build/components/block-heading-level-dropdown/index.native.js +4 -3
  12. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  13. package/build/components/block-list/block-outline.native.js +14 -18
  14. package/build/components/block-list/block-outline.native.js.map +1 -1
  15. package/build/components/block-list/block.native.js +21 -42
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-lock/toolbar.js +25 -6
  18. package/build/components/block-lock/toolbar.js.map +1 -1
  19. package/build/components/block-mover/index.native.js +1 -1
  20. package/build/components/block-mover/index.native.js.map +1 -1
  21. package/build/components/block-parent-selector/index.js +8 -5
  22. package/build/components/block-parent-selector/index.js.map +1 -1
  23. package/build/components/block-removal-warning-modal/index.js +15 -25
  24. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  25. package/build/components/block-settings/button.native.js +2 -2
  26. package/build/components/block-settings/button.native.js.map +1 -1
  27. package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +10 -11
  28. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  29. package/build/components/block-toolbar/index.js +12 -8
  30. package/build/components/block-toolbar/index.js.map +1 -1
  31. package/build/components/block-toolbar/index.native.js +62 -3
  32. package/build/components/block-toolbar/index.native.js.map +1 -1
  33. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  34. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  35. package/build/components/colors-gradients/control.js +4 -2
  36. package/build/components/colors-gradients/control.js.map +1 -1
  37. package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
  38. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  39. package/build/components/dimensions-tool/index.js +207 -0
  40. package/build/components/dimensions-tool/index.js.map +1 -0
  41. package/build/components/dimensions-tool/scale-tool.js +111 -0
  42. package/build/components/dimensions-tool/scale-tool.js.map +1 -0
  43. package/build/components/dimensions-tool/width-height-tool.js +125 -0
  44. package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
  45. package/build/components/global-styles/color-panel.js +22 -16
  46. package/build/components/global-styles/color-panel.js.map +1 -1
  47. package/build/components/global-styles/dimensions-panel.js +13 -2
  48. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  49. package/build/components/global-styles/filters-panel.js +1 -1
  50. package/build/components/global-styles/filters-panel.js.map +1 -1
  51. package/build/components/global-styles/get-block-css-selector.js +4 -8
  52. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  53. package/build/components/global-styles/hooks.js +15 -25
  54. package/build/components/global-styles/hooks.js.map +1 -1
  55. package/build/components/global-styles/typography-panel.js +52 -5
  56. package/build/components/global-styles/typography-panel.js.map +1 -1
  57. package/build/components/global-styles/use-global-styles-output.js +12 -18
  58. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build/components/global-styles/utils.js +6 -6
  60. package/build/components/global-styles/utils.js.map +1 -1
  61. package/build/components/iframe/index.js +36 -48
  62. package/build/components/iframe/index.js.map +1 -1
  63. package/build/components/iframe/use-compatibility-styles.js +5 -0
  64. package/build/components/iframe/use-compatibility-styles.js.map +1 -1
  65. package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
  66. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  67. package/build/components/image-editor/use-save-image.js +1 -2
  68. package/build/components/image-editor/use-save-image.js.map +1 -1
  69. package/build/components/image-size-control/index.js +6 -0
  70. package/build/components/image-size-control/index.js.map +1 -1
  71. package/build/components/index.js +9 -0
  72. package/build/components/index.js.map +1 -1
  73. package/build/components/inner-blocks/index.js +3 -1
  74. package/build/components/inner-blocks/index.js.map +1 -1
  75. package/build/components/inner-blocks/index.native.js +3 -1
  76. package/build/components/inner-blocks/index.native.js.map +1 -1
  77. package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
  78. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  79. package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  80. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  81. package/build/components/inserter/block-patterns-tab.js +7 -35
  82. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  83. package/build/components/inserter/hooks/use-block-types-state.js +3 -4
  84. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  85. package/build/components/inserter/hooks/use-patterns-state.js +9 -3
  86. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  87. package/build/components/inserter/index.js +2 -4
  88. package/build/components/inserter/index.js.map +1 -1
  89. package/build/components/inserter/index.native.js +21 -32
  90. package/build/components/inserter/index.native.js.map +1 -1
  91. package/build/components/inserter/media-tab/hooks.js +2 -21
  92. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  93. package/build/components/inserter/reusable-block-rename-hint.js +82 -0
  94. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  95. package/build/components/inserter/reusable-blocks-tab.js +6 -2
  96. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  97. package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
  98. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  99. package/build/components/inserter/tabs.native.js +1 -1
  100. package/build/components/inserter/tabs.native.js.map +1 -1
  101. package/build/components/inserter-draggable-blocks/index.js +9 -1
  102. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  103. package/build/components/link-control/constants.js +1 -1
  104. package/build/components/link-control/constants.js.map +1 -1
  105. package/build/components/link-control/index.js +21 -16
  106. package/build/components/link-control/index.js.map +1 -1
  107. package/build/components/link-control/search-create-button.js +5 -21
  108. package/build/components/link-control/search-create-button.js.map +1 -1
  109. package/build/components/link-control/search-input.js +4 -4
  110. package/build/components/link-control/search-input.js.map +1 -1
  111. package/build/components/link-control/search-item.js +13 -30
  112. package/build/components/link-control/search-item.js.map +1 -1
  113. package/build/components/link-control/search-results.js +2 -2
  114. package/build/components/link-control/search-results.js.map +1 -1
  115. package/build/components/link-control/settings-drawer.js +2 -3
  116. package/build/components/link-control/settings-drawer.js.map +1 -1
  117. package/build/components/list-view/appender.js +2 -6
  118. package/build/components/list-view/appender.js.map +1 -1
  119. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  120. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  121. package/build/components/media-placeholder/index.native.js +65 -31
  122. package/build/components/media-placeholder/index.native.js.map +1 -1
  123. package/build/components/preview-options/index.js +2 -2
  124. package/build/components/preview-options/index.js.map +1 -1
  125. package/build/components/provider/index.js +5 -2
  126. package/build/components/provider/index.js.map +1 -1
  127. package/build/components/provider/use-block-sync.js +21 -0
  128. package/build/components/provider/use-block-sync.js.map +1 -1
  129. package/build/components/resolution-tool/index.js +55 -0
  130. package/build/components/resolution-tool/index.js.map +1 -0
  131. package/build/components/rich-text/content.js +0 -36
  132. package/build/components/rich-text/content.js.map +1 -1
  133. package/build/components/rich-text/get-rich-text-values.js +118 -0
  134. package/build/components/rich-text/get-rich-text-values.js.map +1 -0
  135. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  136. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  137. package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
  138. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  139. package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
  140. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  141. package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
  142. package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  143. package/build/components/spacing-sizes-control/utils.js +1 -1
  144. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  145. package/build/components/url-input/index.js +4 -2
  146. package/build/components/url-input/index.js.map +1 -1
  147. package/build/components/use-block-display-information/index.js +7 -3
  148. package/build/components/use-block-display-information/index.js.map +1 -1
  149. package/build/components/use-block-drop-zone/index.native.js +49 -8
  150. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  151. package/build/components/use-setting/index.js +5 -9
  152. package/build/components/use-setting/index.js.map +1 -1
  153. package/build/components/writing-flow/use-tab-nav.js +10 -27
  154. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  155. package/build/components/writing-mode-control/index.js +70 -0
  156. package/build/components/writing-mode-control/index.js.map +1 -0
  157. package/build/hooks/behaviors.js +25 -20
  158. package/build/hooks/behaviors.js.map +1 -1
  159. package/build/hooks/margin.js +1 -1
  160. package/build/hooks/margin.js.map +1 -1
  161. package/build/hooks/padding.js +1 -1
  162. package/build/hooks/padding.js.map +1 -1
  163. package/build/hooks/supports.js +7 -1
  164. package/build/hooks/supports.js.map +1 -1
  165. package/build/hooks/typography.js +2 -1
  166. package/build/hooks/typography.js.map +1 -1
  167. package/build/hooks/utils.js +5 -9
  168. package/build/hooks/utils.js.map +1 -1
  169. package/build/private-apis.js +16 -3
  170. package/build/private-apis.js.map +1 -1
  171. package/build/private-apis.native.js +3 -0
  172. package/build/private-apis.native.js.map +1 -1
  173. package/build/store/actions.js +196 -2
  174. package/build/store/actions.js.map +1 -1
  175. package/build/store/defaults.js +1 -0
  176. package/build/store/defaults.js.map +1 -1
  177. package/build/store/index.js +10 -1
  178. package/build/store/index.js.map +1 -1
  179. package/build/store/private-actions.js +46 -40
  180. package/build/store/private-actions.js.map +1 -1
  181. package/build/store/private-selectors.js +8 -9
  182. package/build/store/private-selectors.js.map +1 -1
  183. package/build/store/reducer.js +22 -9
  184. package/build/store/reducer.js.map +1 -1
  185. package/build/store/selectors.js +52 -23
  186. package/build/store/selectors.js.map +1 -1
  187. package/build/utils/object.js +38 -2
  188. package/build/utils/object.js.map +1 -1
  189. package/build-module/components/block-draggable/index.js +6 -3
  190. package/build-module/components/block-draggable/index.js.map +1 -1
  191. package/build-module/components/block-draggable/index.native.js +2 -2
  192. package/build-module/components/block-draggable/index.native.js.map +1 -1
  193. package/build-module/components/block-edit/edit.js +27 -10
  194. package/build-module/components/block-edit/edit.js.map +1 -1
  195. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
  196. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  197. package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
  198. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  199. package/build-module/components/block-list/block-outline.native.js +14 -18
  200. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  201. package/build-module/components/block-list/block.native.js +24 -43
  202. package/build-module/components/block-list/block.native.js.map +1 -1
  203. package/build-module/components/block-lock/toolbar.js +25 -7
  204. package/build-module/components/block-lock/toolbar.js.map +1 -1
  205. package/build-module/components/block-mover/index.native.js +3 -3
  206. package/build-module/components/block-mover/index.native.js.map +1 -1
  207. package/build-module/components/block-parent-selector/index.js +7 -5
  208. package/build-module/components/block-parent-selector/index.js.map +1 -1
  209. package/build-module/components/block-removal-warning-modal/index.js +17 -24
  210. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  211. package/build-module/components/block-settings/button.native.js +3 -3
  212. package/build-module/components/block-settings/button.native.js.map +1 -1
  213. package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +13 -13
  214. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  215. package/build-module/components/block-toolbar/index.js +12 -8
  216. package/build-module/components/block-toolbar/index.js.map +1 -1
  217. package/build-module/components/block-toolbar/index.native.js +60 -4
  218. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  219. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  220. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  221. package/build-module/components/colors-gradients/control.js +3 -2
  222. package/build-module/components/colors-gradients/control.js.map +1 -1
  223. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
  224. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  225. package/build-module/components/dimensions-tool/index.js +195 -0
  226. package/build-module/components/dimensions-tool/index.js.map +1 -0
  227. package/build-module/components/dimensions-tool/scale-tool.js +103 -0
  228. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
  229. package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
  230. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
  231. package/build-module/components/global-styles/color-panel.js +22 -16
  232. package/build-module/components/global-styles/color-panel.js.map +1 -1
  233. package/build-module/components/global-styles/dimensions-panel.js +13 -2
  234. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  235. package/build-module/components/global-styles/filters-panel.js +2 -2
  236. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  237. package/build-module/components/global-styles/get-block-css-selector.js +4 -8
  238. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  239. package/build-module/components/global-styles/hooks.js +14 -24
  240. package/build-module/components/global-styles/hooks.js.map +1 -1
  241. package/build-module/components/global-styles/typography-panel.js +51 -5
  242. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  243. package/build-module/components/global-styles/use-global-styles-output.js +13 -18
  244. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  245. package/build-module/components/global-styles/utils.js +5 -5
  246. package/build-module/components/global-styles/utils.js.map +1 -1
  247. package/build-module/components/iframe/index.js +37 -49
  248. package/build-module/components/iframe/index.js.map +1 -1
  249. package/build-module/components/iframe/use-compatibility-styles.js +5 -0
  250. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
  251. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  252. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  253. package/build-module/components/image-editor/use-save-image.js +1 -2
  254. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  255. package/build-module/components/image-size-control/index.js +5 -0
  256. package/build-module/components/image-size-control/index.js.map +1 -1
  257. package/build-module/components/index.js +1 -0
  258. package/build-module/components/index.js.map +1 -1
  259. package/build-module/components/inner-blocks/index.js +3 -1
  260. package/build-module/components/inner-blocks/index.js.map +1 -1
  261. package/build-module/components/inner-blocks/index.native.js +3 -1
  262. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  263. package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
  264. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  265. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  266. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  267. package/build-module/components/inserter/block-patterns-tab.js +7 -33
  268. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  269. package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
  270. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  271. package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
  272. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  273. package/build-module/components/inserter/index.js +2 -4
  274. package/build-module/components/inserter/index.js.map +1 -1
  275. package/build-module/components/inserter/index.native.js +22 -33
  276. package/build-module/components/inserter/index.native.js.map +1 -1
  277. package/build-module/components/inserter/media-tab/hooks.js +2 -21
  278. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  279. package/build-module/components/inserter/reusable-block-rename-hint.js +67 -0
  280. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  281. package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
  282. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  283. package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
  284. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  285. package/build-module/components/inserter/tabs.native.js +1 -1
  286. package/build-module/components/inserter/tabs.native.js.map +1 -1
  287. package/build-module/components/inserter-draggable-blocks/index.js +9 -2
  288. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  289. package/build-module/components/link-control/constants.js +1 -1
  290. package/build-module/components/link-control/constants.js.map +1 -1
  291. package/build-module/components/link-control/index.js +21 -16
  292. package/build-module/components/link-control/index.js.map +1 -1
  293. package/build-module/components/link-control/search-create-button.js +7 -20
  294. package/build-module/components/link-control/search-create-button.js.map +1 -1
  295. package/build-module/components/link-control/search-input.js +4 -4
  296. package/build-module/components/link-control/search-input.js.map +1 -1
  297. package/build-module/components/link-control/search-item.js +14 -28
  298. package/build-module/components/link-control/search-item.js.map +1 -1
  299. package/build-module/components/link-control/search-results.js +3 -3
  300. package/build-module/components/link-control/search-results.js.map +1 -1
  301. package/build-module/components/link-control/settings-drawer.js +4 -5
  302. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  303. package/build-module/components/list-view/appender.js +2 -6
  304. package/build-module/components/list-view/appender.js.map +1 -1
  305. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  306. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  307. package/build-module/components/media-placeholder/index.native.js +66 -33
  308. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  309. package/build-module/components/preview-options/index.js +2 -2
  310. package/build-module/components/preview-options/index.js.map +1 -1
  311. package/build-module/components/provider/index.js +5 -2
  312. package/build-module/components/provider/index.js.map +1 -1
  313. package/build-module/components/provider/use-block-sync.js +21 -0
  314. package/build-module/components/provider/use-block-sync.js.map +1 -1
  315. package/build-module/components/resolution-tool/index.js +45 -0
  316. package/build-module/components/resolution-tool/index.js.map +1 -0
  317. package/build-module/components/rich-text/content.js +1 -36
  318. package/build-module/components/rich-text/content.js.map +1 -1
  319. package/build-module/components/rich-text/get-rich-text-values.js +105 -0
  320. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
  321. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  322. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  323. package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
  324. package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  325. package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
  326. package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  327. package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
  328. package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  329. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  330. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  331. package/build-module/components/url-input/index.js +4 -2
  332. package/build-module/components/url-input/index.js.map +1 -1
  333. package/build-module/components/use-block-display-information/index.js +7 -3
  334. package/build-module/components/use-block-display-information/index.js.map +1 -1
  335. package/build-module/components/use-block-drop-zone/index.native.js +50 -8
  336. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  337. package/build-module/components/use-setting/index.js +5 -9
  338. package/build-module/components/use-setting/index.js.map +1 -1
  339. package/build-module/components/writing-flow/use-tab-nav.js +8 -26
  340. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  341. package/build-module/components/writing-mode-control/index.js +57 -0
  342. package/build-module/components/writing-mode-control/index.js.map +1 -0
  343. package/build-module/hooks/behaviors.js +26 -20
  344. package/build-module/hooks/behaviors.js.map +1 -1
  345. package/build-module/hooks/margin.js +1 -1
  346. package/build-module/hooks/margin.js.map +1 -1
  347. package/build-module/hooks/padding.js +1 -1
  348. package/build-module/hooks/padding.js.map +1 -1
  349. package/build-module/hooks/supports.js +7 -1
  350. package/build-module/hooks/supports.js.map +1 -1
  351. package/build-module/hooks/typography.js +2 -1
  352. package/build-module/hooks/typography.js.map +1 -1
  353. package/build-module/hooks/utils.js +6 -9
  354. package/build-module/hooks/utils.js.map +1 -1
  355. package/build-module/private-apis.js +11 -2
  356. package/build-module/private-apis.js.map +1 -1
  357. package/build-module/private-apis.native.js +2 -0
  358. package/build-module/private-apis.native.js.map +1 -1
  359. package/build-module/store/actions.js +193 -3
  360. package/build-module/store/actions.js.map +1 -1
  361. package/build-module/store/defaults.js +1 -0
  362. package/build-module/store/defaults.js.map +1 -1
  363. package/build-module/store/index.js +10 -1
  364. package/build-module/store/index.js.map +1 -1
  365. package/build-module/store/private-actions.js +45 -36
  366. package/build-module/store/private-actions.js.map +1 -1
  367. package/build-module/store/private-selectors.js +5 -5
  368. package/build-module/store/private-selectors.js.map +1 -1
  369. package/build-module/store/reducer.js +22 -9
  370. package/build-module/store/reducer.js.map +1 -1
  371. package/build-module/store/selectors.js +49 -21
  372. package/build-module/store/selectors.js.map +1 -1
  373. package/build-module/utils/object.js +34 -2
  374. package/build-module/utils/object.js.map +1 -1
  375. package/build-style/content-rtl.css +4 -0
  376. package/build-style/content.css +4 -0
  377. package/build-style/style-rtl.css +137 -129
  378. package/build-style/style.css +137 -129
  379. package/package.json +33 -32
  380. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
  381. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
  382. package/src/components/block-controls/README.md +89 -0
  383. package/src/components/block-draggable/index.js +13 -4
  384. package/src/components/block-draggable/index.native.js +7 -3
  385. package/src/components/block-draggable/style.scss +1 -0
  386. package/src/components/block-draggable/test/index.native.js +0 -54
  387. package/src/components/block-edit/edit.js +26 -9
  388. package/src/components/block-edit/test/edit.js +1 -1
  389. package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
  390. package/src/components/block-heading-level-dropdown/index.native.js +8 -4
  391. package/src/components/block-inspector/style.scss +2 -1
  392. package/src/components/block-list/block-outline.native.js +26 -25
  393. package/src/components/block-list/block.native.js +24 -38
  394. package/src/components/block-list/block.native.scss +18 -40
  395. package/src/components/block-list/style.native.scss +3 -3
  396. package/src/components/block-lock/toolbar.js +34 -6
  397. package/src/components/block-mover/index.native.js +3 -3
  398. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
  399. package/src/components/block-parent-selector/index.js +13 -8
  400. package/src/components/block-removal-warning-modal/index.js +17 -33
  401. package/src/components/block-settings/button.native.js +12 -6
  402. package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +19 -18
  403. package/src/components/block-toolbar/index.js +11 -9
  404. package/src/components/block-toolbar/index.native.js +86 -6
  405. package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
  406. package/src/components/block-toolbar/test/index.native.js +42 -0
  407. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  408. package/src/components/block-tools/style.scss +73 -26
  409. package/src/components/button-block-appender/styles.native.scss +2 -2
  410. package/src/components/caption/README.md +49 -0
  411. package/src/components/colors-gradients/control.js +3 -2
  412. package/src/components/default-block-appender/content.scss +11 -0
  413. package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
  414. package/src/components/dimensions-tool/index.js +212 -0
  415. package/src/components/dimensions-tool/scale-tool.js +124 -0
  416. package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
  417. package/src/components/dimensions-tool/stories/index.js +54 -0
  418. package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
  419. package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
  420. package/src/components/dimensions-tool/test/index.js +641 -0
  421. package/src/components/dimensions-tool/width-height-tool.js +113 -0
  422. package/src/components/font-family/README.md +71 -0
  423. package/src/components/global-styles/color-panel.js +24 -17
  424. package/src/components/global-styles/dimensions-panel.js +8 -2
  425. package/src/components/global-styles/filters-panel.js +2 -2
  426. package/src/components/global-styles/get-block-css-selector.js +5 -9
  427. package/src/components/global-styles/hooks.js +22 -26
  428. package/src/components/global-styles/typography-panel.js +57 -5
  429. package/src/components/global-styles/use-global-styles-output.js +36 -18
  430. package/src/components/global-styles/utils.js +15 -6
  431. package/src/components/iframe/index.js +30 -56
  432. package/src/components/iframe/use-compatibility-styles.js +5 -0
  433. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
  434. package/src/components/image-editor/use-save-image.js +0 -1
  435. package/src/components/image-size-control/index.js +6 -0
  436. package/src/components/index.js +1 -0
  437. package/src/components/inner-blocks/README.md +10 -0
  438. package/src/components/inner-blocks/index.js +4 -0
  439. package/src/components/inner-blocks/index.native.js +4 -0
  440. package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
  441. package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
  442. package/src/components/inserter/block-patterns-tab.js +8 -56
  443. package/src/components/inserter/hooks/use-block-types-state.js +3 -4
  444. package/src/components/inserter/hooks/use-patterns-state.js +35 -19
  445. package/src/components/inserter/index.js +2 -3
  446. package/src/components/inserter/index.native.js +17 -36
  447. package/src/components/inserter/media-tab/hooks.js +2 -22
  448. package/src/components/inserter/reusable-block-rename-hint.js +69 -0
  449. package/src/components/inserter/reusable-blocks-tab.js +5 -1
  450. package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
  451. package/src/components/inserter/style.native.scss +10 -15
  452. package/src/components/inserter/style.scss +28 -0
  453. package/src/components/inserter/tabs.native.js +5 -1
  454. package/src/components/inserter-draggable-blocks/index.js +13 -2
  455. package/src/components/link-control/constants.js +1 -1
  456. package/src/components/link-control/index.js +36 -29
  457. package/src/components/link-control/search-create-button.js +8 -26
  458. package/src/components/link-control/search-input.js +4 -3
  459. package/src/components/link-control/search-item.js +21 -43
  460. package/src/components/link-control/search-results.js +48 -46
  461. package/src/components/link-control/settings-drawer.js +6 -5
  462. package/src/components/link-control/style.scss +58 -123
  463. package/src/components/link-control/test/index.js +161 -123
  464. package/src/components/list-view/appender.js +5 -6
  465. package/src/components/list-view/style.scss +1 -2
  466. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  467. package/src/components/media-placeholder/index.native.js +108 -59
  468. package/src/components/media-placeholder/styles.native.scss +59 -24
  469. package/src/components/media-replace-flow/test/index.js +1 -1
  470. package/src/components/panel-color-settings/README.md +98 -0
  471. package/src/components/preview-options/README.md +18 -17
  472. package/src/components/preview-options/index.js +2 -2
  473. package/src/components/provider/index.js +9 -2
  474. package/src/components/provider/test/use-block-sync.js +21 -6
  475. package/src/components/provider/use-block-sync.js +19 -0
  476. package/src/components/recursion-provider/README.md +101 -0
  477. package/src/components/resolution-tool/index.js +56 -0
  478. package/src/components/resolution-tool/stories/index.js +48 -0
  479. package/src/components/rich-text/content.js +1 -46
  480. package/src/components/rich-text/get-rich-text-values.js +105 -0
  481. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  482. package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
  483. package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
  484. package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
  485. package/src/components/spacing-sizes-control/utils.js +1 -1
  486. package/src/components/text-transform-control/README.md +44 -0
  487. package/src/components/url-input/index.js +2 -0
  488. package/src/components/use-block-display-information/index.js +12 -5
  489. package/src/components/use-block-drop-zone/index.native.js +65 -28
  490. package/src/components/use-setting/index.js +8 -8
  491. package/src/components/writing-flow/use-tab-nav.js +10 -33
  492. package/src/components/writing-mode-control/index.js +68 -0
  493. package/src/components/writing-mode-control/style.scss +18 -0
  494. package/src/hooks/behaviors.js +25 -16
  495. package/src/hooks/margin.js +4 -1
  496. package/src/hooks/padding.js +4 -1
  497. package/src/hooks/supports.js +7 -0
  498. package/src/hooks/typography.js +2 -0
  499. package/src/hooks/utils.js +8 -7
  500. package/src/private-apis.js +13 -1
  501. package/src/private-apis.native.js +2 -0
  502. package/src/store/actions.js +195 -3
  503. package/src/store/defaults.js +1 -0
  504. package/src/store/index.js +10 -0
  505. package/src/store/private-actions.js +39 -39
  506. package/src/store/private-selectors.js +5 -8
  507. package/src/store/reducer.js +22 -9
  508. package/src/store/selectors.js +87 -25
  509. package/src/store/test/actions.js +114 -0
  510. package/src/store/test/private-actions.js +56 -0
  511. package/src/store/test/private-selectors.js +5 -5
  512. package/src/store/test/reducer.js +14 -7
  513. package/src/store/test/selectors.js +1 -1
  514. package/src/utils/object.js +32 -2
  515. package/src/utils/test/object.js +36 -0
  516. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  517. package/build/components/block-mobile-toolbar/index.native.js +0 -135
  518. package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
  519. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  520. package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
  521. package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
  522. package/src/components/block-mobile-toolbar/index.native.js +0 -127
  523. package/src/components/block-mobile-toolbar/style.native.scss +0 -16
  524. /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
@@ -2,11 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Platform } from '@wordpress/element';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- import { blockTypePromptMessages } from '../components/block-removal-warning-modal';
10
5
 
11
6
  const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
12
7
  /**
@@ -24,12 +19,17 @@ const privateSettings = ['inserterMediaCategories', 'blockInspectorAnimation'];
24
19
  * Action that updates the block editor settings and
25
20
  * conditionally preserves the experimental ones.
26
21
  *
27
- * @param {Object} settings Updated settings
28
- * @param {boolean} stripExperimentalSettings Whether to strip experimental settings.
22
+ * @param {Object} settings Updated settings
23
+ * @param {Object} options Options object.
24
+ * @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings.
25
+ * @param {boolean} options.reset Whether to reset the settings.
29
26
  * @return {Object} Action object
30
27
  */
31
28
 
32
- export function __experimentalUpdateSettings(settings, stripExperimentalSettings = false) {
29
+ export function __experimentalUpdateSettings(settings, {
30
+ stripExperimentalSettings = false,
31
+ reset = false
32
+ } = {}) {
33
33
  let cleanSettings = settings; // There are no plugins in the mobile apps, so there is no
34
34
  // need to strip the experimental settings:
35
35
 
@@ -45,7 +45,8 @@ export function __experimentalUpdateSettings(settings, stripExperimentalSettings
45
45
 
46
46
  return {
47
47
  type: 'UPDATE_SETTINGS',
48
- settings: cleanSettings
48
+ settings: cleanSettings,
49
+ reset
49
50
  };
50
51
  }
51
52
  /**
@@ -147,26 +148,18 @@ export const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemov
147
148
  // confirmation that they intended to remove such block(s). However,
148
149
  // the editor instance is responsible for presenting those confirmation
149
150
  // prompts to the user. Any instance opting into removal prompts must
150
- // register using `toggleRemovalPromptSupport()`.
151
+ // register using `setBlockRemovalRules()`.
151
152
  //
152
153
  // @see https://github.com/WordPress/gutenberg/pull/51145
153
154
 
154
155
 
155
- if (!forceRemove && // FIXME: Without this existence check, the unit tests for
156
- // `__experimentalDeleteReusableBlock` in
157
- // `packages/reusable-blocks/src/store/test/actions.js` fail due to
158
- // the fact that the `registry` object passed to the thunk actions
159
- // doesn't include this private action. This needs to be
160
- // investigated to understand whether it's a real smell or if it's
161
- // because not all store code has been updated to accommodate
162
- // private selectors.
163
- select.isRemovalPromptSupported && select.isRemovalPromptSupported()) {
156
+ const rules = !forceRemove && select.getBlockRemovalRules();
157
+
158
+ if (rules) {
164
159
  const blockNamesForPrompt = new Set(); // Given a list of client IDs of blocks that the user intended to
165
160
  // remove, perform a tree search (BFS) to find all block names
166
161
  // corresponding to "important" blocks, i.e. blocks that require a
167
162
  // removal prompt.
168
- //
169
- // @see blockTypePromptMessages
170
163
 
171
164
  const queue = [...clientIds];
172
165
 
@@ -174,7 +167,7 @@ export const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemov
174
167
  const clientId = queue.shift();
175
168
  const blockName = select.getBlockName(clientId);
176
169
 
177
- if (blockTypePromptMessages[blockName]) {
170
+ if (rules[blockName]) {
178
171
  blockNamesForPrompt.add(blockName);
179
172
  }
180
173
 
@@ -185,7 +178,7 @@ export const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemov
185
178
 
186
179
 
187
180
  if (blockNamesForPrompt.size) {
188
- dispatch(displayRemovalPrompt(clientIds, selectPrevious, Array.from(blockNamesForPrompt)));
181
+ dispatch(displayBlockRemovalPrompt(clientIds, selectPrevious, Array.from(blockNamesForPrompt)));
189
182
  return;
190
183
  }
191
184
  }
@@ -238,7 +231,7 @@ export const ensureDefaultBlock = () => ({
238
231
  * Returns an action object used in signalling that a block removal prompt must
239
232
  * be displayed.
240
233
  *
241
- * Contrast with `toggleRemovalPromptSupport`.
234
+ * Contrast with `setBlockRemovalRules`.
242
235
  *
243
236
  * @param {string|string[]} clientIds Client IDs of blocks to remove.
244
237
  * @param {boolean} selectPrevious True if the previous block
@@ -246,13 +239,16 @@ export const ensureDefaultBlock = () => ({
246
239
  * (if no previous block exists)
247
240
  * should be selected
248
241
  * when a block is removed.
249
- * @param {string[]} blockNamesForPrompt Names of blocks requiring user
242
+ * @param {string[]} blockNamesForPrompt Names of the blocks that
243
+ * triggered the need for
244
+ * confirmation before removal.
245
+ *
250
246
  * @return {Object} Action object.
251
247
  */
252
248
 
253
- export function displayRemovalPrompt(clientIds, selectPrevious, blockNamesForPrompt) {
249
+ function displayBlockRemovalPrompt(clientIds, selectPrevious, blockNamesForPrompt) {
254
250
  return {
255
- type: 'DISPLAY_REMOVAL_PROMPT',
251
+ type: 'DISPLAY_BLOCK_REMOVAL_PROMPT',
256
252
  clientIds,
257
253
  selectPrevious,
258
254
  blockNamesForPrompt
@@ -266,25 +262,38 @@ export function displayRemovalPrompt(clientIds, selectPrevious, blockNamesForPro
266
262
  * @return {Object} Action object.
267
263
  */
268
264
 
269
- export function clearRemovalPrompt() {
265
+
266
+ export function clearBlockRemovalPrompt() {
270
267
  return {
271
- type: 'CLEAR_REMOVAL_PROMPT'
268
+ type: 'CLEAR_BLOCK_REMOVAL_PROMPT'
272
269
  };
273
270
  }
274
271
  /**
275
- * Returns an action object used in signalling that a removal prompt display
276
- * mechanism is available or unavailable in the current editor.
272
+ * Returns an action object used to set up any rules that a block editor may
273
+ * provide in order to prevent a user from accidentally removing certain
274
+ * blocks. These rules are then used to display a confirmation prompt to the
275
+ * user. For instance, in the Site Editor, the Query Loop block is important
276
+ * enough to warrant such confirmation.
277
+ *
278
+ * IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks`
279
+ * action that the editor will be responsible for displaying block removal
280
+ * prompts and confirming deletions. This action is meant to be used by
281
+ * component `BlockRemovalWarningModal` only.
282
+ *
283
+ * The data is a record whose keys are block types (e.g. 'core/query') and
284
+ * whose values are the explanation to be shown to users (e.g. 'Query Loop
285
+ * displays a list of posts or pages.').
277
286
  *
278
- * Contrast with `displayRemovalPrompt`.
287
+ * Contrast with `displayBlockRemovalPrompt`.
279
288
  *
280
- * @param {boolean} status Whether a prompt display mechanism exists.
289
+ * @param {Record<string,string>|false} rules Block removal rules.
281
290
  * @return {Object} Action object.
282
291
  */
283
292
 
284
- export function toggleRemovalPromptSupport(status = true) {
293
+ export function setBlockRemovalRules(rules = false) {
285
294
  return {
286
- type: 'TOGGLE_REMOVAL_PROMPT_SUPPORT',
287
- status
295
+ type: 'SET_BLOCK_REMOVAL_RULES',
296
+ rules
288
297
  };
289
298
  }
290
299
  //# sourceMappingURL=private-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/store/private-actions.js"],"names":["Platform","blockTypePromptMessages","castArray","maybeArray","Array","isArray","privateSettings","__experimentalUpdateSettings","settings","stripExperimentalSettings","cleanSettings","OS","key","includes","type","hideBlockInterface","showBlockInterface","setBlockEditingMode","clientId","mode","unsetBlockEditingMode","privateRemoveBlocks","clientIds","selectPrevious","forceRemove","select","dispatch","length","rootClientId","getBlockRootClientId","canRemoveBlocks","isRemovalPromptSupported","blockNamesForPrompt","Set","queue","shift","blockName","getBlockName","add","innerBlocks","getBlockOrder","push","size","displayRemovalPrompt","from","selectPreviousBlock","ensureDefaultBlock","count","getBlockCount","__unstableHasCustomAppender","getSettings","insertDefaultBlock","clearRemovalPrompt","toggleRemovalPromptSupport","status"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SAASC,uBAAT,QAAwC,2CAAxC;;AAEA,MAAMC,SAAS,GAAKC,UAAF,IACjBC,KAAK,CAACC,OAAN,CAAeF,UAAf,IAA8BA,UAA9B,GAA2C,CAAEA,UAAF,CAD5C;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,eAAe,GAAG,CACvB,yBADuB,EAEvB,yBAFuB,CAAxB;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,4BAAT,CACNC,QADM,EAENC,yBAAyB,GAAG,KAFtB,EAGL;AACD,MAAIC,aAAa,GAAGF,QAApB,CADC,CAED;AACA;;AACA,MAAKC,yBAAyB,IAAIT,QAAQ,CAACW,EAAT,KAAgB,KAAlD,EAA0D;AACzDD,IAAAA,aAAa,GAAG,EAAhB;;AACA,SAAM,MAAME,GAAZ,IAAmBJ,QAAnB,EAA8B;AAC7B,UAAK,CAAEF,eAAe,CAACO,QAAhB,CAA0BD,GAA1B,CAAP,EAAyC;AACxCF,QAAAA,aAAa,CAAEE,GAAF,CAAb,GAAuBJ,QAAQ,CAAEI,GAAF,CAA/B;AACA;AACD;AACD;;AACD,SAAO;AACNE,IAAAA,IAAI,EAAE,iBADA;AAENN,IAAAA,QAAQ,EAAEE;AAFJ,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,kBAAT,GAA8B;AACpC,SAAO;AACND,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,kBAAT,GAA8B;AACpC,SAAO;AACNF,IAAAA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EAAd;;AACA,MAAKD,KAAK,GAAG,CAAb,EAAiB;AAChB;AACA,GAN0B,CAQ3B;AACA;AACA;;;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAkCxB,MAAM,CAACyB,WAAP,EAAxC;;AACA,MAAKD,2BAAL,EAAmC;AAClC;AACA;;AAEDvB,EAAAA,QAAQ,CAACyB,kBAAT;AACA,CAnBK;AAqBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASR,oBAAT,CACNrB,SADM,EAENC,cAFM,EAGNS,mBAHM,EAIL;AACD,SAAO;AACNlB,IAAAA,IAAI,EAAE,wBADA;AAENQ,IAAAA,SAFM;AAGNC,IAAAA,cAHM;AAINS,IAAAA;AAJM,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASoB,kBAAT,GAA8B;AACpC,SAAO;AACNtC,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASuC,0BAAT,CAAqCC,MAAM,GAAG,IAA9C,EAAqD;AAC3D,SAAO;AACNxC,IAAAA,IAAI,EAAE,+BADA;AAENwC,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { blockTypePromptMessages } from '../components/block-removal-warning-modal';\n\nconst castArray = ( maybeArray ) =>\n\tArray.isArray( maybeArray ) ? maybeArray : [ maybeArray ];\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {boolean} stripExperimentalSettings Whether to strip experimental settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\tstripExperimentalSettings = false\n) {\n\tlet cleanSettings = settings;\n\t// There are no plugins in the mobile apps, so there is no\n\t// need to strip the experimental settings:\n\tif ( stripExperimentalSettings && Platform.OS === 'web' ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in settings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = settings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode\n */\n\n/**\n * Sets the block editing mode for a given block.\n *\n * @see useBlockEditingMode\n *\n * @param {string} clientId The block client ID, or `''` for the root container.\n * @param {BlockEditingMode} mode The block editing mode. One of `'disabled'`,\n * `'contentOnly'`, or `'default'`.\n *\n * @return {Object} Action object.\n */\nexport function setBlockEditingMode( clientId = '', mode ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_EDITING_MODE',\n\t\tclientId,\n\t\tmode,\n\t};\n}\n\n/**\n * Clears the block editing mode for a given block.\n *\n * @see useBlockEditingMode\n *\n * @param {string} clientId The block client ID, or `''` for the root container.\n *\n * @return {Object} Action object.\n */\nexport function unsetBlockEditingMode( clientId = '' ) {\n\treturn {\n\t\ttype: 'UNSET_BLOCK_EDITING_MODE',\n\t\tclientId,\n\t};\n}\n\n/**\n * Yields action objects used in signalling that the blocks corresponding to\n * the set of specified client IDs are to be removed.\n *\n * Compared to `removeBlocks`, this private interface exposes an additional\n * parameter; see `forceRemove`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {boolean} forceRemove Whether to force the operation,\n * bypassing any checks for certain\n * block types.\n */\nexport const privateRemoveBlocks =\n\t( clientIds, selectPrevious = true, forceRemove = false ) =>\n\t( { select, dispatch } ) => {\n\t\tif ( ! clientIds || ! clientIds.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tclientIds = castArray( clientIds );\n\t\tconst rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );\n\t\tconst canRemoveBlocks = select.canRemoveBlocks(\n\t\t\tclientIds,\n\t\t\trootClientId\n\t\t);\n\n\t\tif ( ! canRemoveBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In certain editing contexts, we'd like to prevent accidental removal\n\t\t// of important blocks. For example, in the site editor, the Query Loop\n\t\t// block is deemed important. In such cases, we'll ask the user for\n\t\t// confirmation that they intended to remove such block(s). However,\n\t\t// the editor instance is responsible for presenting those confirmation\n\t\t// prompts to the user. Any instance opting into removal prompts must\n\t\t// register using `toggleRemovalPromptSupport()`.\n\t\t//\n\t\t// @see https://github.com/WordPress/gutenberg/pull/51145\n\t\tif (\n\t\t\t! forceRemove &&\n\t\t\t// FIXME: Without this existence check, the unit tests for\n\t\t\t// `__experimentalDeleteReusableBlock` in\n\t\t\t// `packages/reusable-blocks/src/store/test/actions.js` fail due to\n\t\t\t// the fact that the `registry` object passed to the thunk actions\n\t\t\t// doesn't include this private action. This needs to be\n\t\t\t// investigated to understand whether it's a real smell or if it's\n\t\t\t// because not all store code has been updated to accommodate\n\t\t\t// private selectors.\n\t\t\tselect.isRemovalPromptSupported &&\n\t\t\tselect.isRemovalPromptSupported()\n\t\t) {\n\t\t\tconst blockNamesForPrompt = new Set();\n\n\t\t\t// Given a list of client IDs of blocks that the user intended to\n\t\t\t// remove, perform a tree search (BFS) to find all block names\n\t\t\t// corresponding to \"important\" blocks, i.e. blocks that require a\n\t\t\t// removal prompt.\n\t\t\t//\n\t\t\t// @see blockTypePromptMessages\n\t\t\tconst queue = [ ...clientIds ];\n\t\t\twhile ( queue.length ) {\n\t\t\t\tconst clientId = queue.shift();\n\t\t\t\tconst blockName = select.getBlockName( clientId );\n\t\t\t\tif ( blockTypePromptMessages[ blockName ] ) {\n\t\t\t\t\tblockNamesForPrompt.add( blockName );\n\t\t\t\t}\n\t\t\t\tconst innerBlocks = select.getBlockOrder( clientId );\n\t\t\t\tqueue.push( ...innerBlocks );\n\t\t\t}\n\n\t\t\t// If any such blocks were found, trigger the removal prompt and\n\t\t\t// skip any other steps (thus postponing actual removal).\n\t\t\tif ( blockNamesForPrompt.size ) {\n\t\t\t\tdispatch(\n\t\t\t\t\tdisplayRemovalPrompt(\n\t\t\t\t\t\tclientIds,\n\t\t\t\t\t\tselectPrevious,\n\t\t\t\t\t\tArray.from( blockNamesForPrompt )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( selectPrevious ) {\n\t\t\tdispatch.selectPreviousBlock( clientIds[ 0 ], selectPrevious );\n\t\t}\n\n\t\tdispatch( { type: 'REMOVE_BLOCKS', clientIds } );\n\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tdispatch( ensureDefaultBlock() );\n\t};\n\n/**\n * Action which will insert a default block insert action if there\n * are no other blocks at the root of the editor. This action should be used\n * in actions which may result in no blocks remaining in the editor (removal,\n * replacement, etc).\n */\nexport const ensureDefaultBlock =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tconst count = select.getBlockCount();\n\t\tif ( count > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there's an custom appender, don't insert default block.\n\t\t// We have to remember to manually move the focus elsewhere to\n\t\t// prevent it from being lost though.\n\t\tconst { __unstableHasCustomAppender } = select.getSettings();\n\t\tif ( __unstableHasCustomAppender ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.insertDefaultBlock();\n\t};\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be displayed.\n *\n * Contrast with `toggleRemovalPromptSupport`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {string[]} blockNamesForPrompt Names of blocks requiring user\n * @return {Object} Action object.\n */\nexport function displayRemovalPrompt(\n\tclientIds,\n\tselectPrevious,\n\tblockNamesForPrompt\n) {\n\treturn {\n\t\ttype: 'DISPLAY_REMOVAL_PROMPT',\n\t\tclientIds,\n\t\tselectPrevious,\n\t\tblockNamesForPrompt,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be cleared, either be cause the user has confirmed or canceled the request\n * for removal.\n *\n * @return {Object} Action object.\n */\nexport function clearRemovalPrompt() {\n\treturn {\n\t\ttype: 'CLEAR_REMOVAL_PROMPT',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a removal prompt display\n * mechanism is available or unavailable in the current editor.\n *\n * Contrast with `displayRemovalPrompt`.\n *\n * @param {boolean} status Whether a prompt display mechanism exists.\n * @return {Object} Action object.\n */\nexport function toggleRemovalPromptSupport( status = true ) {\n\treturn {\n\t\ttype: 'TOGGLE_REMOVAL_PROMPT_SUPPORT',\n\t\tstatus,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/store/private-actions.js"],"names":["Platform","castArray","maybeArray","Array","isArray","privateSettings","__experimentalUpdateSettings","settings","stripExperimentalSettings","reset","cleanSettings","OS","key","includes","type","hideBlockInterface","showBlockInterface","setBlockEditingMode","clientId","mode","unsetBlockEditingMode","privateRemoveBlocks","clientIds","selectPrevious","forceRemove","select","dispatch","length","rootClientId","getBlockRootClientId","canRemoveBlocks","rules","getBlockRemovalRules","blockNamesForPrompt","Set","queue","shift","blockName","getBlockName","add","innerBlocks","getBlockOrder","push","size","displayBlockRemovalPrompt","from","selectPreviousBlock","ensureDefaultBlock","count","getBlockCount","__unstableHasCustomAppender","getSettings","insertDefaultBlock","clearBlockRemovalPrompt","setBlockRemovalRules"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;;AAEA,MAAMC,SAAS,GAAKC,UAAF,IACjBC,KAAK,CAACC,OAAN,CAAeF,UAAf,IAA8BA,UAA9B,GAA2C,CAAEA,UAAF,CAD5C;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,eAAe,GAAG,CACvB,yBADuB,EAEvB,yBAFuB,CAAxB;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,4BAAT,CACNC,QADM,EAEN;AAAEC,EAAAA,yBAAyB,GAAG,KAA9B;AAAqCC,EAAAA,KAAK,GAAG;AAA7C,IAAuD,EAFjD,EAGL;AACD,MAAIC,aAAa,GAAGH,QAApB,CADC,CAED;AACA;;AACA,MAAKC,yBAAyB,IAAIR,QAAQ,CAACW,EAAT,KAAgB,KAAlD,EAA0D;AACzDD,IAAAA,aAAa,GAAG,EAAhB;;AACA,SAAM,MAAME,GAAZ,IAAmBL,QAAnB,EAA8B;AAC7B,UAAK,CAAEF,eAAe,CAACQ,QAAhB,CAA0BD,GAA1B,CAAP,EAAyC;AACxCF,QAAAA,aAAa,CAAEE,GAAF,CAAb,GAAuBL,QAAQ,CAAEK,GAAF,CAA/B;AACA;AACD;AACD;;AACD,SAAO;AACNE,IAAAA,IAAI,EAAE,iBADA;AAENP,IAAAA,QAAQ,EAAEG,aAFJ;AAGND,IAAAA;AAHM,GAAP;AAKA;AAED;AACA;AACA;AACA;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MACA,CAAE;AAAEtB,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAAF,KAA4B;AAC3B;AACA;AACA,QAAMsB,KAAK,GAAGvB,MAAM,CAACwB,aAAP,EAAd;;AACA,MAAKD,KAAK,GAAG,CAAb,EAAiB;AAChB;AACA,GAN0B,CAQ3B;AACA;AACA;;;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAkCzB,MAAM,CAAC0B,WAAP,EAAxC;;AACA,MAAKD,2BAAL,EAAmC;AAClC;AACA;;AAEDxB,EAAAA,QAAQ,CAAC0B,kBAAT;AACA,CAnBK;AAqBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASR,yBAAT,CACCtB,SADD,EAECC,cAFD,EAGCU,mBAHD,EAIE;AACD,SAAO;AACNnB,IAAAA,IAAI,EAAE,8BADA;AAENQ,IAAAA,SAFM;AAGNC,IAAAA,cAHM;AAINU,IAAAA;AAJM,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASoB,uBAAT,GAAmC;AACzC,SAAO;AACNvC,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASwC,oBAAT,CAA+BvB,KAAK,GAAG,KAAvC,EAA+C;AACrD,SAAO;AACNjB,IAAAA,IAAI,EAAE,yBADA;AAENiB,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform } from '@wordpress/element';\n\nconst castArray = ( maybeArray ) =>\n\tArray.isArray( maybeArray ) ? maybeArray : [ maybeArray ];\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {Object} options Options object.\n * @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings.\n * @param {boolean} options.reset Whether to reset the settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\t{ stripExperimentalSettings = false, reset = false } = {}\n) {\n\tlet cleanSettings = settings;\n\t// There are no plugins in the mobile apps, so there is no\n\t// need to strip the experimental settings:\n\tif ( stripExperimentalSettings && Platform.OS === 'web' ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in settings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = settings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t\treset,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode\n */\n\n/**\n * Sets the block editing mode for a given block.\n *\n * @see useBlockEditingMode\n *\n * @param {string} clientId The block client ID, or `''` for the root container.\n * @param {BlockEditingMode} mode The block editing mode. One of `'disabled'`,\n * `'contentOnly'`, or `'default'`.\n *\n * @return {Object} Action object.\n */\nexport function setBlockEditingMode( clientId = '', mode ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_EDITING_MODE',\n\t\tclientId,\n\t\tmode,\n\t};\n}\n\n/**\n * Clears the block editing mode for a given block.\n *\n * @see useBlockEditingMode\n *\n * @param {string} clientId The block client ID, or `''` for the root container.\n *\n * @return {Object} Action object.\n */\nexport function unsetBlockEditingMode( clientId = '' ) {\n\treturn {\n\t\ttype: 'UNSET_BLOCK_EDITING_MODE',\n\t\tclientId,\n\t};\n}\n\n/**\n * Yields action objects used in signalling that the blocks corresponding to\n * the set of specified client IDs are to be removed.\n *\n * Compared to `removeBlocks`, this private interface exposes an additional\n * parameter; see `forceRemove`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {boolean} forceRemove Whether to force the operation,\n * bypassing any checks for certain\n * block types.\n */\nexport const privateRemoveBlocks =\n\t( clientIds, selectPrevious = true, forceRemove = false ) =>\n\t( { select, dispatch } ) => {\n\t\tif ( ! clientIds || ! clientIds.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tclientIds = castArray( clientIds );\n\t\tconst rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );\n\t\tconst canRemoveBlocks = select.canRemoveBlocks(\n\t\t\tclientIds,\n\t\t\trootClientId\n\t\t);\n\n\t\tif ( ! canRemoveBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In certain editing contexts, we'd like to prevent accidental removal\n\t\t// of important blocks. For example, in the site editor, the Query Loop\n\t\t// block is deemed important. In such cases, we'll ask the user for\n\t\t// confirmation that they intended to remove such block(s). However,\n\t\t// the editor instance is responsible for presenting those confirmation\n\t\t// prompts to the user. Any instance opting into removal prompts must\n\t\t// register using `setBlockRemovalRules()`.\n\t\t//\n\t\t// @see https://github.com/WordPress/gutenberg/pull/51145\n\t\tconst rules = ! forceRemove && select.getBlockRemovalRules();\n\t\tif ( rules ) {\n\t\t\tconst blockNamesForPrompt = new Set();\n\n\t\t\t// Given a list of client IDs of blocks that the user intended to\n\t\t\t// remove, perform a tree search (BFS) to find all block names\n\t\t\t// corresponding to \"important\" blocks, i.e. blocks that require a\n\t\t\t// removal prompt.\n\t\t\tconst queue = [ ...clientIds ];\n\t\t\twhile ( queue.length ) {\n\t\t\t\tconst clientId = queue.shift();\n\t\t\t\tconst blockName = select.getBlockName( clientId );\n\t\t\t\tif ( rules[ blockName ] ) {\n\t\t\t\t\tblockNamesForPrompt.add( blockName );\n\t\t\t\t}\n\t\t\t\tconst innerBlocks = select.getBlockOrder( clientId );\n\t\t\t\tqueue.push( ...innerBlocks );\n\t\t\t}\n\n\t\t\t// If any such blocks were found, trigger the removal prompt and\n\t\t\t// skip any other steps (thus postponing actual removal).\n\t\t\tif ( blockNamesForPrompt.size ) {\n\t\t\t\tdispatch(\n\t\t\t\t\tdisplayBlockRemovalPrompt(\n\t\t\t\t\t\tclientIds,\n\t\t\t\t\t\tselectPrevious,\n\t\t\t\t\t\tArray.from( blockNamesForPrompt )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( selectPrevious ) {\n\t\t\tdispatch.selectPreviousBlock( clientIds[ 0 ], selectPrevious );\n\t\t}\n\n\t\tdispatch( { type: 'REMOVE_BLOCKS', clientIds } );\n\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tdispatch( ensureDefaultBlock() );\n\t};\n\n/**\n * Action which will insert a default block insert action if there\n * are no other blocks at the root of the editor. This action should be used\n * in actions which may result in no blocks remaining in the editor (removal,\n * replacement, etc).\n */\nexport const ensureDefaultBlock =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tconst count = select.getBlockCount();\n\t\tif ( count > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there's an custom appender, don't insert default block.\n\t\t// We have to remember to manually move the focus elsewhere to\n\t\t// prevent it from being lost though.\n\t\tconst { __unstableHasCustomAppender } = select.getSettings();\n\t\tif ( __unstableHasCustomAppender ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.insertDefaultBlock();\n\t};\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be displayed.\n *\n * Contrast with `setBlockRemovalRules`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {string[]} blockNamesForPrompt Names of the blocks that\n * triggered the need for\n * confirmation before removal.\n *\n * @return {Object} Action object.\n */\nfunction displayBlockRemovalPrompt(\n\tclientIds,\n\tselectPrevious,\n\tblockNamesForPrompt\n) {\n\treturn {\n\t\ttype: 'DISPLAY_BLOCK_REMOVAL_PROMPT',\n\t\tclientIds,\n\t\tselectPrevious,\n\t\tblockNamesForPrompt,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be cleared, either be cause the user has confirmed or canceled the request\n * for removal.\n *\n * @return {Object} Action object.\n */\nexport function clearBlockRemovalPrompt() {\n\treturn {\n\t\ttype: 'CLEAR_BLOCK_REMOVAL_PROMPT',\n\t};\n}\n\n/**\n * Returns an action object used to set up any rules that a block editor may\n * provide in order to prevent a user from accidentally removing certain\n * blocks. These rules are then used to display a confirmation prompt to the\n * user. For instance, in the Site Editor, the Query Loop block is important\n * enough to warrant such confirmation.\n *\n * IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks`\n * action that the editor will be responsible for displaying block removal\n * prompts and confirming deletions. This action is meant to be used by\n * component `BlockRemovalWarningModal` only.\n *\n * The data is a record whose keys are block types (e.g. 'core/query') and\n * whose values are the explanation to be shown to users (e.g. 'Query Loop\n * displays a list of posts or pages.').\n *\n * Contrast with `displayBlockRemovalPrompt`.\n *\n * @param {Record<string,string>|false} rules Block removal rules.\n * @return {Object} Action object.\n */\nexport function setBlockRemovalRules( rules = false ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_REMOVAL_RULES',\n\t\trules,\n\t};\n}\n"]}
@@ -124,16 +124,16 @@ export const isBlockSubtreeDisabled = createSelector((state, clientId) => {
124
124
  * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.
125
125
  */
126
126
 
127
- export const getListViewClientIdsTree = createSelector((state, rootClientId = '') => {
127
+ export const getEnabledClientIdsTree = createSelector((state, rootClientId = '') => {
128
128
  return getBlockOrder(state, rootClientId).flatMap(clientId => {
129
129
  if (getBlockEditingMode(state, clientId) !== 'disabled') {
130
130
  return [{
131
131
  clientId,
132
- innerBlocks: getListViewClientIdsTree(state, clientId)
132
+ innerBlocks: getEnabledClientIdsTree(state, clientId)
133
133
  }];
134
134
  }
135
135
 
136
- return getListViewClientIdsTree(state, clientId);
136
+ return getEnabledClientIdsTree(state, clientId);
137
137
  });
138
138
  }, state => [state.blocks.order, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
139
139
  /**
@@ -171,7 +171,7 @@ export function getRemovalPromptData(state) {
171
171
  * @return {boolean} Whether removal prompt exists.
172
172
  */
173
173
 
174
- export function isRemovalPromptSupported(state) {
175
- return state.isRemovalPromptSupported;
174
+ export function getBlockRemovalRules(state) {
175
+ return state.blockRemovalRules;
176
176
  }
177
177
  //# sourceMappingURL=private-selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"names":["createSelector","select","store","blocksStore","getBlockRootClientId","getTemplateLock","getBlockName","getBlockOrder","getBlockParents","isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","getBlockEditingMode","clientId","blockEditingModes","has","get","rootClientId","templateLock","name","isContent","__experimentalHasContentRoleAttribute","parentMode","isBlockSubtreeDisabled","isChildSubtreeDisabled","childClientId","mode","undefined","every","blocks","parents","getListViewClientIdsTree","flatMap","innerBlocks","order","settings","blockListSettings","getEnabledBlockParents","ascending","filter","parent","getRemovalPromptData","removalPromptData","isRemovalPromptSupported"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,c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,QADD;AAECoB,QAAAA,WAAW,EAAEF,wBAAwB,CACpCvB,KADoC,EAEpCK,QAFoC;AAFtC,OADM,CAAP;AASA;;AACD,WAAOkB,wBAAwB,CAAEvB,KAAF,EAASK,QAAT,CAA/B;AACA,GAbM,CAAP;AAcA,CAhBoD,EAiBnDL,KAAF,IAAa,CACZA,KAAK,CAACqB,MAAN,CAAaK,KADD,EAEZ1B,KAAK,CAACM,iBAFM,EAGZN,KAAK,CAAC2B,QAAN,CAAejB,YAHH,EAIZV,KAAK,CAAC4B,iBAJM,CAjBwC,CAA/C;AAyBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,sBAAsB,GAAGvC,cAAc,CACnD,CAAEU,KAAF,EAASK,QAAT,EAAmByB,SAAS,GAAG,KAA/B,KAA0C;AACzC,SAAOhC,eAAe,CAAEE,KAAF,EAASK,QAAT,EAAmByB,SAAnB,CAAf,CAA8CC,MAA9C,CACJC,MAAF,IAAc5B,mBAAmB,CAAEJ,KAAF,EAASgC,MAAT,CAAnB,KAAyC,UADjD,CAAP;AAGA,CALkD,EAMjDhC,KAAF,IAAa,CACZA,KAAK,CAACqB,MAAN,CAAaC,OADD,EAEZtB,KAAK,CAACM,iBAFM,EAGZN,KAAK,CAAC2B,QAAN,CAAejB,YAHH,EAIZV,KAAK,CAAC4B,iBAJM,CANsC,CAA7C;AAcP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,oBAAT,CAA+BjC,KAA/B,EAAuC;AAC7C,SAAOA,KAAK,CAACkC,iBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,wBAAT,CAAmCnC,KAAnC,EAA2C;AACjD,SAAOA,KAAK,CAACmC,wBAAb;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockRootClientId,\n\tgetTemplateLock,\n\tgetBlockName,\n\tgetBlockOrder,\n\tgetBlockParents,\n} from './selectors';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\n/**\n * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode\n */\n\n/**\n * Returns the block editing mode for a given block.\n *\n * The mode can be one of three options:\n *\n * - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be\n * selected.\n * - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the\n * toolbar, the block movers, block settings.\n * - `'default'`: Allows editing the block as normal.\n *\n * Blocks can set a mode using the `useBlockEditingMode` hook.\n *\n * The mode is inherited by all of the block's inner blocks, unless they have\n * their own mode.\n *\n * A template lock can also set a mode. If the template lock is `'contentOnly'`,\n * the block's mode is overridden to `'contentOnly'` if the block has a content\n * role attribute, or `'disabled'` otherwise.\n *\n * @see useBlockEditingMode\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID, or `''` for the root container.\n *\n * @return {BlockEditingMode} The block editing mode. One of `'disabled'`,\n * `'contentOnly'`, or `'default'`.\n */\nexport function getBlockEditingMode( state, clientId = '' ) {\n\tif ( state.blockEditingModes.has( clientId ) ) {\n\t\treturn state.blockEditingModes.get( clientId );\n\t}\n\tif ( ! clientId ) {\n\t\treturn 'default';\n\t}\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\tif ( templateLock === 'contentOnly' ) {\n\t\tconst name = getBlockName( state, clientId );\n\t\t// TODO: Terrible hack! We're calling the global select() function\n\t\t// here instead of using createRegistrySelector(). The problem with\n\t\t// using createRegistrySelector() is that then the public\n\t\t// block-editor selectors (e.g. canInsertBlockTypeUnmemoized) can't\n\t\t// call this private block-editor selector due to a bug in\n\t\t// @wordpress/data. See\n\t\t// https://github.com/WordPress/gutenberg/pull/50985.\n\t\tconst isContent =\n\t\t\tselect( blocksStore ).__experimentalHasContentRoleAttribute( name );\n\t\treturn isContent ? 'contentOnly' : 'disabled';\n\t}\n\tconst parentMode = getBlockEditingMode( state, rootClientId );\n\treturn parentMode === 'contentOnly' ? 'default' : parentMode;\n}\n\n/**\n * Returns true if the block with the given client ID and all of its descendants\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block and its descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = createSelector(\n\t( state, clientId ) => {\n\t\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\t\tconst mode = state.blockEditingModes.get( childClientId );\n\t\t\treturn (\n\t\t\t\t( mode === undefined || mode === 'disabled' ) &&\n\t\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\t\tisChildSubtreeDisabled\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, clientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, clientId ).every( isChildSubtreeDisabled )\n\t\t);\n\t},\n\t( state ) => [ state.blockEditingModes, state.blocks.parents ]\n);\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getListViewClientIdsTree = createSelector(\n\t( state, rootClientId = '' ) => {\n\t\treturn getBlockOrder( state, rootClientId ).flatMap( ( clientId ) => {\n\t\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tinnerBlocks: getListViewClientIdsTree(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tclientId\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn getListViewClientIdsTree( state, clientId );\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function isRemovalPromptSupported( state ) {\n\treturn state.isRemovalPromptSupported;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"names":["createSelector","select","store","blocksStore","getBlockRootClientId","getTemplateLock","getBlockName","getBlockOrder","getBlockParents","isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","getBlockEditingMode","clientId","blockEditingModes","has","get","rootClientId","templateLock","name","isContent","__experimentalHasContentRoleAttribute","parentMode","isBlockSubtreeDisabled","isChildSubtreeDisabled","childClientId","mode","undefined","every","blocks","parents","getEnabledClientIdsTree","flatMap","innerBlocks","order","settings","blockListSettings","getEnabledBlockParents","ascending","filter","parent","getRemovalPromptData","removalPromptData","getBlockRemovalRules","blockRemovalRules"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,SACCC,oBADD,EAECC,eAFD,EAGCC,YAHD,EAICC,aAJD,EAKCC,eALD,QAMO,aANP;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sBAAT,CAAiCC,KAAjC,EAAyC;AAC/C,SAAOA,KAAK,CAACD,sBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,8BAAT,CAAyCD,KAAzC,EAAiD;AACvD,SAAOA,KAAK,EAAEE,iBAAP,EAA0BC,SAAjC;AACA;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BJ,KAA9B,EAAqCK,QAAQ,GAAG,EAAhD,EAAqD;AAC3D,MAAKL,KAAK,CAACM,iBAAN,CAAwBC,GAAxB,CAA6BF,QAA7B,CAAL,EAA+C;AAC9C,WAAOL,KAAK,CAACM,iBAAN,CAAwBE,GAAxB,CAA6BH,QAA7B,CAAP;AACA;;AACD,MAAK,CAAEA,QAAP,EAAkB;AAC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AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,oBAAT,CAA+BjC,KAA/B,EAAuC;AAC7C,SAAOA,KAAK,CAACkC,iBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,oBAAT,CAA+BnC,KAA/B,EAAuC;AAC7C,SAAOA,KAAK,CAACoC,iBAAb;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockRootClientId,\n\tgetTemplateLock,\n\tgetBlockName,\n\tgetBlockOrder,\n\tgetBlockParents,\n} from './selectors';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\n/**\n * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode\n */\n\n/**\n * Returns the block editing mode for a given block.\n *\n * The mode can be one of three options:\n *\n * - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be\n * selected.\n * - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the\n * toolbar, the block movers, block settings.\n * - `'default'`: Allows editing the block as normal.\n *\n * Blocks can set a mode using the `useBlockEditingMode` hook.\n *\n * The mode is inherited by all of the block's inner blocks, unless they have\n * their own mode.\n *\n * A template lock can also set a mode. If the template lock is `'contentOnly'`,\n * the block's mode is overridden to `'contentOnly'` if the block has a content\n * role attribute, or `'disabled'` otherwise.\n *\n * @see useBlockEditingMode\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID, or `''` for the root container.\n *\n * @return {BlockEditingMode} The block editing mode. One of `'disabled'`,\n * `'contentOnly'`, or `'default'`.\n */\nexport function getBlockEditingMode( state, clientId = '' ) {\n\tif ( state.blockEditingModes.has( clientId ) ) {\n\t\treturn state.blockEditingModes.get( clientId );\n\t}\n\tif ( ! clientId ) {\n\t\treturn 'default';\n\t}\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\tif ( templateLock === 'contentOnly' ) {\n\t\tconst name = getBlockName( state, clientId );\n\t\t// TODO: Terrible hack! We're calling the global select() function\n\t\t// here instead of using createRegistrySelector(). The problem with\n\t\t// using createRegistrySelector() is that then the public\n\t\t// block-editor selectors (e.g. canInsertBlockTypeUnmemoized) can't\n\t\t// call this private block-editor selector due to a bug in\n\t\t// @wordpress/data. See\n\t\t// https://github.com/WordPress/gutenberg/pull/50985.\n\t\tconst isContent =\n\t\t\tselect( blocksStore ).__experimentalHasContentRoleAttribute( name );\n\t\treturn isContent ? 'contentOnly' : 'disabled';\n\t}\n\tconst parentMode = getBlockEditingMode( state, rootClientId );\n\treturn parentMode === 'contentOnly' ? 'default' : parentMode;\n}\n\n/**\n * Returns true if the block with the given client ID and all of its descendants\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block and its descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = createSelector(\n\t( state, clientId ) => {\n\t\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\t\tconst mode = state.blockEditingModes.get( childClientId );\n\t\t\treturn (\n\t\t\t\t( mode === undefined || mode === 'disabled' ) &&\n\t\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\t\tisChildSubtreeDisabled\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, clientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, clientId ).every( isChildSubtreeDisabled )\n\t\t);\n\t},\n\t( state ) => [ state.blockEditingModes, state.blocks.parents ]\n);\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createSelector(\n\t( state, rootClientId = '' ) => {\n\t\treturn getBlockOrder( state, rootClientId ).flatMap( ( clientId ) => {\n\t\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tinnerBlocks: getEnabledClientIdsTree( state, clientId ),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn getEnabledClientIdsTree( state, clientId );\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function getBlockRemovalRules( state ) {\n\treturn state.blockRemovalRules;\n}\n"]}
@@ -1407,7 +1407,7 @@ export function isSelectionEnabled(state = true, action) {
1407
1407
 
1408
1408
  function removalPromptData(state = false, action) {
1409
1409
  switch (action.type) {
1410
- case 'DISPLAY_REMOVAL_PROMPT':
1410
+ case 'DISPLAY_BLOCK_REMOVAL_PROMPT':
1411
1411
  const {
1412
1412
  clientIds,
1413
1413
  selectPrevious,
@@ -1419,26 +1419,34 @@ function removalPromptData(state = false, action) {
1419
1419
  blockNamesForPrompt
1420
1420
  };
1421
1421
 
1422
- case 'CLEAR_REMOVAL_PROMPT':
1422
+ case 'CLEAR_BLOCK_REMOVAL_PROMPT':
1423
1423
  return false;
1424
1424
  }
1425
1425
 
1426
1426
  return state;
1427
1427
  }
1428
1428
  /**
1429
- * Reducer prompt availability state.
1429
+ * Reducer returning any rules that a block editor may provide in order to
1430
+ * prevent a user from accidentally removing certain blocks. These rules are
1431
+ * then used to display a confirmation prompt to the user. For instance, in the
1432
+ * Site Editor, the Query Loop block is important enough to warrant such
1433
+ * confirmation.
1434
+ *
1435
+ * The data is a record whose keys are block types (e.g. 'core/query') and
1436
+ * whose values are the explanation to be shown to users (e.g. 'Query Loop
1437
+ * displays a list of posts or pages.').
1430
1438
  *
1431
1439
  * @param {boolean} state Current state.
1432
1440
  * @param {Object} action Dispatched action.
1433
1441
  *
1434
- * @return {boolean} Updated state.
1442
+ * @return {Record<string,string>} Updated state.
1435
1443
  */
1436
1444
 
1437
1445
 
1438
- function isRemovalPromptSupported(state = false, action) {
1446
+ function blockRemovalRules(state = false, action) {
1439
1447
  switch (action.type) {
1440
- case 'TOGGLE_REMOVAL_PROMPT_SUPPORT':
1441
- return action.status;
1448
+ case 'SET_BLOCK_REMOVAL_RULES':
1449
+ return action.rules;
1442
1450
  }
1443
1451
 
1444
1452
  return state;
@@ -1548,6 +1556,12 @@ export function template(state = {
1548
1556
  export function settings(state = SETTINGS_DEFAULTS, action) {
1549
1557
  switch (action.type) {
1550
1558
  case 'UPDATE_SETTINGS':
1559
+ if (action.reset) {
1560
+ return { ...SETTINGS_DEFAULTS,
1561
+ ...action.settings
1562
+ };
1563
+ }
1564
+
1551
1565
  return { ...state,
1552
1566
  ...action.settings
1553
1567
  };
@@ -1769,7 +1783,6 @@ export function lastBlockInserted(state = {}, action) {
1769
1783
  switch (action.type) {
1770
1784
  case 'INSERT_BLOCKS':
1771
1785
  case 'REPLACE_BLOCKS':
1772
- case 'REPLACE_INNER_BLOCKS':
1773
1786
  if (!action.blocks.length) {
1774
1787
  return state;
1775
1788
  }
@@ -1858,7 +1871,7 @@ const combinedReducers = combineReducers({
1858
1871
  blockVisibility,
1859
1872
  blockEditingModes,
1860
1873
  removalPromptData,
1861
- isRemovalPromptSupported
1874
+ blockRemovalRules
1862
1875
  });
1863
1876
 
1864
1877
  function withAutomaticChangeReset(reducer) {