@wordpress/block-editor 12.15.0 → 12.16.1-next.79a6196f.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 (927) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +12 -10
  4. package/build/components/block-canvas/index.js +21 -7
  5. package/build/components/block-canvas/index.js.map +1 -1
  6. package/build/components/block-card/index.js +2 -2
  7. package/build/components/block-card/index.js.map +1 -1
  8. package/build/components/block-controls/hook.js +3 -23
  9. package/build/components/block-controls/hook.js.map +1 -1
  10. package/build/components/block-draggable/draggable-chip.js +6 -1
  11. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  12. package/build/components/block-draggable/index.js +76 -6
  13. package/build/components/block-draggable/index.js.map +1 -1
  14. package/build/components/block-draggable/index.native.js +0 -6
  15. package/build/components/block-draggable/index.native.js.map +1 -1
  16. package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  17. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  18. package/build/components/block-edit/context.js +5 -1
  19. package/build/components/block-edit/context.js.map +1 -1
  20. package/build/components/block-edit/index.js +18 -9
  21. package/build/components/block-edit/index.js.map +1 -1
  22. package/build/components/block-editing-mode/index.js +2 -3
  23. package/build/components/block-editing-mode/index.js.map +1 -1
  24. package/build/components/block-info-slot-fill/index.js +3 -4
  25. package/build/components/block-info-slot-fill/index.js.map +1 -1
  26. package/build/components/block-inspector/index.js +1 -1
  27. package/build/components/block-inspector/index.js.map +1 -1
  28. package/build/components/block-list/block-list-item-cell.native.js +1 -0
  29. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  30. package/build/components/block-list/block.js +257 -95
  31. package/build/components/block-list/block.js.map +1 -1
  32. package/build/components/block-list/block.native.js +58 -23
  33. package/build/components/block-list/block.native.js.map +1 -1
  34. package/build/components/block-list/index.native.js +3 -5
  35. package/build/components/block-list/index.native.js.map +1 -1
  36. package/build/components/block-list/private-block-context.js +14 -0
  37. package/build/components/block-list/private-block-context.js.map +1 -0
  38. package/build/components/block-list/use-block-props/index.js +49 -69
  39. package/build/components/block-list/use-block-props/index.js.map +1 -1
  40. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  41. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  42. package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
  43. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  44. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  45. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  46. package/build/components/block-list/use-in-between-inserter.js +3 -2
  47. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  48. package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
  49. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  50. package/build/components/block-lock/toolbar.js +21 -27
  51. package/build/components/block-lock/toolbar.js.map +1 -1
  52. package/build/components/block-mover/index.js +2 -1
  53. package/build/components/block-mover/index.js.map +1 -1
  54. package/build/components/block-patterns-list/index.js +5 -5
  55. package/build/components/block-patterns-list/index.js.map +1 -1
  56. package/build/components/block-removal-warning-modal/index.js +2 -9
  57. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  58. package/build/components/block-rename/modal.js +3 -0
  59. package/build/components/block-rename/modal.js.map +1 -1
  60. package/build/components/block-settings/container.native.js +6 -4
  61. package/build/components/block-settings/container.native.js.map +1 -1
  62. package/build/components/block-styles/index.js +1 -1
  63. package/build/components/block-styles/index.js.map +1 -1
  64. package/build/components/block-styles/index.native.js +3 -2
  65. package/build/components/block-styles/index.native.js.map +1 -1
  66. package/build/components/block-switcher/index.js +4 -4
  67. package/build/components/block-switcher/index.js.map +1 -1
  68. package/build/components/block-toolbar/index.js +90 -29
  69. package/build/components/block-toolbar/index.js.map +1 -1
  70. package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
  71. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  72. package/build/components/block-tools/block-toolbar-popover.js +84 -0
  73. package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
  74. package/build/components/block-tools/index.js +27 -24
  75. package/build/components/block-tools/index.js.map +1 -1
  76. package/build/components/block-types-list/index.native.js +4 -3
  77. package/build/components/block-types-list/index.native.js.map +1 -1
  78. package/build/components/block-variation-picker/index.native.js +2 -1
  79. package/build/components/block-variation-picker/index.native.js.map +1 -1
  80. package/build/components/block-variation-transforms/index.js +29 -2
  81. package/build/components/block-variation-transforms/index.js.map +1 -1
  82. package/build/components/border-radius-control/linked-button.js +1 -1
  83. package/build/components/border-radius-control/linked-button.js.map +1 -1
  84. package/build/components/colors/utils.js +10 -2
  85. package/build/components/colors/utils.js.map +1 -1
  86. package/build/components/colors/with-colors.js +6 -2
  87. package/build/components/colors/with-colors.js.map +1 -1
  88. package/build/components/colors-gradients/control.js +28 -17
  89. package/build/components/colors-gradients/control.js.map +1 -1
  90. package/build/components/duotone-control/index.js +1 -4
  91. package/build/components/duotone-control/index.js.map +1 -1
  92. package/build/components/font-sizes/utils.js +10 -2
  93. package/build/components/font-sizes/utils.js.map +1 -1
  94. package/build/components/global-styles/border-panel.js +2 -1
  95. package/build/components/global-styles/border-panel.js.map +1 -1
  96. package/build/components/global-styles/color-panel.js +24 -21
  97. package/build/components/global-styles/color-panel.js.map +1 -1
  98. package/build/components/global-styles/dimensions-panel.js +4 -3
  99. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  100. package/build/components/global-styles/effects-panel.js +2 -1
  101. package/build/components/global-styles/effects-panel.js.map +1 -1
  102. package/build/components/global-styles/filters-panel.js +6 -3
  103. package/build/components/global-styles/filters-panel.js.map +1 -1
  104. package/build/components/global-styles/get-global-styles-changes.js +192 -0
  105. package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
  106. package/build/components/global-styles/hooks.js +3 -2
  107. package/build/components/global-styles/hooks.js.map +1 -1
  108. package/build/components/global-styles/image-settings-panel.js +7 -1
  109. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  110. package/build/components/global-styles/index.js +7 -0
  111. package/build/components/global-styles/index.js.map +1 -1
  112. package/build/components/global-styles/typography-panel.js +43 -36
  113. package/build/components/global-styles/typography-panel.js.map +1 -1
  114. package/build/components/global-styles/use-global-styles-output.js +22 -8
  115. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  116. package/build/components/global-styles/utils.js +8 -1
  117. package/build/components/global-styles/utils.js.map +1 -1
  118. package/build/components/height-control/index.js +6 -2
  119. package/build/components/height-control/index.js.map +1 -1
  120. package/build/components/image-link-destinations/index.native.js +118 -0
  121. package/build/components/image-link-destinations/index.native.js.map +1 -0
  122. package/build/components/image-size-control/index.js +2 -2
  123. package/build/components/image-size-control/index.js.map +1 -1
  124. package/build/components/index.native.js +14 -5
  125. package/build/components/index.native.js.map +1 -1
  126. package/build/components/inner-blocks/index.js +61 -22
  127. package/build/components/inner-blocks/index.js.map +1 -1
  128. package/build/components/inner-blocks/index.native.js +18 -4
  129. package/build/components/inner-blocks/index.native.js.map +1 -1
  130. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  131. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  132. package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
  133. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  134. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  135. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  136. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
  137. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  138. package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
  139. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  140. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
  141. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  142. package/build/components/inserter/block-patterns-tab/utils.js +10 -14
  143. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  144. package/build/components/inserter/hooks/use-block-types-state.js +4 -14
  145. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  146. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  147. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  148. package/build/components/inserter/index.js +1 -2
  149. package/build/components/inserter/index.js.map +1 -1
  150. package/build/components/inserter/library.js +3 -7
  151. package/build/components/inserter/library.js.map +1 -1
  152. package/build/components/inserter/media-tab/media-panel.js +2 -2
  153. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  154. package/build/components/inserter/menu.js +26 -33
  155. package/build/components/inserter/menu.js.map +1 -1
  156. package/build/components/inserter/preview-panel.js +2 -2
  157. package/build/components/inserter/preview-panel.js.map +1 -1
  158. package/build/components/inserter/tabs.js +21 -21
  159. package/build/components/inserter/tabs.js.map +1 -1
  160. package/build/components/inserter-button/index.native.js +98 -0
  161. package/build/components/inserter-button/index.native.js.map +1 -0
  162. package/build/components/inserter-button/sparkles.js +23 -0
  163. package/build/components/inserter-button/sparkles.js.map +1 -0
  164. package/build/components/inserter-draggable-blocks/index.js +8 -4
  165. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  166. package/build/components/inserter-list-item/index.js +2 -4
  167. package/build/components/inserter-list-item/index.js.map +1 -1
  168. package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
  169. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  170. package/build/components/inspector-controls/fill.js +3 -3
  171. package/build/components/inspector-controls/fill.js.map +1 -1
  172. package/build/components/inspector-controls/fill.native.js +3 -3
  173. package/build/components/inspector-controls/fill.native.js.map +1 -1
  174. package/build/components/inspector-controls-tabs/index.js +34 -23
  175. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  176. package/build/components/list-view/block-select-button.js +4 -0
  177. package/build/components/list-view/block-select-button.js.map +1 -1
  178. package/build/components/list-view/block.js +57 -3
  179. package/build/components/list-view/block.js.map +1 -1
  180. package/build/components/media-upload-progress/constants.js +19 -0
  181. package/build/components/media-upload-progress/constants.js.map +1 -0
  182. package/build/components/media-upload-progress/index.native.js +42 -17
  183. package/build/components/media-upload-progress/index.native.js.map +1 -1
  184. package/build/components/navigable-toolbar/index.js +11 -16
  185. package/build/components/navigable-toolbar/index.js.map +1 -1
  186. package/build/components/plain-text/index.native.js +8 -3
  187. package/build/components/plain-text/index.native.js.map +1 -1
  188. package/build/components/preview-options/index.js +6 -62
  189. package/build/components/preview-options/index.js.map +1 -1
  190. package/build/components/provider/index.js +3 -1
  191. package/build/components/provider/index.js.map +1 -1
  192. package/build/components/provider/use-block-sync.js +7 -1
  193. package/build/components/provider/use-block-sync.js.map +1 -1
  194. package/build/components/rich-text/content.js +26 -23
  195. package/build/components/rich-text/content.js.map +1 -1
  196. package/build/components/rich-text/get-rich-text-values.js +2 -1
  197. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  198. package/build/components/rich-text/index.js +19 -37
  199. package/build/components/rich-text/index.js.map +1 -1
  200. package/build/components/rich-text/index.native.js +9 -16
  201. package/build/components/rich-text/index.native.js.map +1 -1
  202. package/build/components/rich-text/native/get-format-colors.native.js +22 -24
  203. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  204. package/build/components/rich-text/native/index.native.js +22 -57
  205. package/build/components/rich-text/native/index.native.js.map +1 -1
  206. package/build/components/rich-text/use-input-rules.js +7 -3
  207. package/build/components/rich-text/use-input-rules.js.map +1 -1
  208. package/build/components/rich-text/use-mark-persistent.js +1 -1
  209. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  210. package/build/components/rich-text/with-deprecations.js +50 -0
  211. package/build/components/rich-text/with-deprecations.js.map +1 -0
  212. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  213. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  214. package/build/components/url-input/index.js +9 -6
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/use-block-commands/index.js +14 -18
  217. package/build/components/use-block-commands/index.js.map +1 -1
  218. package/build/components/use-block-drop-zone/index.js +108 -17
  219. package/build/components/use-block-drop-zone/index.js.map +1 -1
  220. package/build/components/use-moving-animation/index.js +100 -92
  221. package/build/components/use-moving-animation/index.js.map +1 -1
  222. package/build/components/use-on-block-drop/index.js +9 -12
  223. package/build/components/use-on-block-drop/index.js.map +1 -1
  224. package/build/components/use-resize-canvas/index.js +4 -1
  225. package/build/components/use-resize-canvas/index.js.map +1 -1
  226. package/build/components/use-settings/index.js +14 -0
  227. package/build/components/use-settings/index.js.map +1 -1
  228. package/build/components/writing-flow/index.js +0 -1
  229. package/build/components/writing-flow/index.js.map +1 -1
  230. package/build/components/writing-flow/use-drag-selection.js +15 -4
  231. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  232. package/build/components/writing-flow/use-selection-observer.js +73 -27
  233. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  234. package/build/components/writing-flow/use-tab-nav.js +7 -4
  235. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  236. package/build/hooks/align.js +21 -69
  237. package/build/hooks/align.js.map +1 -1
  238. package/build/hooks/align.native.js +11 -1
  239. package/build/hooks/align.native.js.map +1 -1
  240. package/build/hooks/anchor.js +14 -30
  241. package/build/hooks/anchor.js.map +1 -1
  242. package/build/hooks/aria-label.js +9 -1
  243. package/build/hooks/aria-label.js.map +1 -1
  244. package/build/hooks/background.js +198 -36
  245. package/build/hooks/background.js.map +1 -1
  246. package/build/hooks/block-hooks.js +24 -32
  247. package/build/hooks/block-hooks.js.map +1 -1
  248. package/build/hooks/block-renaming.js +18 -22
  249. package/build/hooks/block-renaming.js.map +1 -1
  250. package/build/hooks/border.js +53 -80
  251. package/build/hooks/border.js.map +1 -1
  252. package/build/hooks/color.js +79 -90
  253. package/build/hooks/color.js.map +1 -1
  254. package/build/hooks/content-lock-ui.js +29 -29
  255. package/build/hooks/content-lock-ui.js.map +1 -1
  256. package/build/hooks/custom-class-name.js +13 -30
  257. package/build/hooks/custom-class-name.js.map +1 -1
  258. package/build/hooks/custom-class-name.native.js +9 -1
  259. package/build/hooks/custom-class-name.native.js.map +1 -1
  260. package/build/hooks/dimensions.js +13 -14
  261. package/build/hooks/dimensions.js.map +1 -1
  262. package/build/hooks/duotone.js +31 -61
  263. package/build/hooks/duotone.js.map +1 -1
  264. package/build/hooks/font-family.js +23 -28
  265. package/build/hooks/font-family.js.map +1 -1
  266. package/build/hooks/font-size.js +52 -120
  267. package/build/hooks/font-size.js.map +1 -1
  268. package/build/hooks/index.js +27 -16
  269. package/build/hooks/index.js.map +1 -1
  270. package/build/hooks/index.native.js +15 -6
  271. package/build/hooks/index.native.js.map +1 -1
  272. package/build/hooks/layout-child.js +68 -0
  273. package/build/hooks/layout-child.js.map +1 -0
  274. package/build/hooks/layout.js +25 -104
  275. package/build/hooks/layout.js.map +1 -1
  276. package/build/hooks/padding.js +2 -2
  277. package/build/hooks/padding.js.map +1 -1
  278. package/build/hooks/position.js +40 -62
  279. package/build/hooks/position.js.map +1 -1
  280. package/build/hooks/style.js +52 -89
  281. package/build/hooks/style.js.map +1 -1
  282. package/build/hooks/typography.js +25 -10
  283. package/build/hooks/typography.js.map +1 -1
  284. package/build/hooks/typography.native.js +43 -18
  285. package/build/hooks/typography.native.js.map +1 -1
  286. package/build/hooks/use-typography-props.js +10 -2
  287. package/build/hooks/use-typography-props.js.map +1 -1
  288. package/build/hooks/utils.js +200 -10
  289. package/build/hooks/utils.js.map +1 -1
  290. package/build/private-apis.js +2 -6
  291. package/build/private-apis.js.map +1 -1
  292. package/build/private-apis.native.js +0 -2
  293. package/build/private-apis.native.js.map +1 -1
  294. package/build/store/actions.js +0 -16
  295. package/build/store/actions.js.map +1 -1
  296. package/build/store/private-actions.js +54 -0
  297. package/build/store/private-actions.js.map +1 -1
  298. package/build/store/private-selectors.js +46 -0
  299. package/build/store/private-selectors.js.map +1 -1
  300. package/build/store/reducer.js +18 -2
  301. package/build/store/reducer.js.map +1 -1
  302. package/build/store/selectors.js +11 -73
  303. package/build/store/selectors.js.map +1 -1
  304. package/build/store/undo-ignore.js +12 -0
  305. package/build/store/undo-ignore.js.map +1 -0
  306. package/build/store/utils.js +66 -0
  307. package/build/store/utils.js.map +1 -0
  308. package/build/utils/get-px-from-css-unit.js +16 -0
  309. package/build/utils/get-px-from-css-unit.js.map +1 -0
  310. package/build/utils/index.js +2 -2
  311. package/build/utils/index.js.map +1 -1
  312. package/build/utils/object.js +38 -99
  313. package/build/utils/object.js.map +1 -1
  314. package/build/utils/selection.js +9 -1
  315. package/build/utils/selection.js.map +1 -1
  316. package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
  317. package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  318. package/build-module/components/block-canvas/index.js +22 -8
  319. package/build-module/components/block-canvas/index.js.map +1 -1
  320. package/build-module/components/block-card/index.js +2 -2
  321. package/build-module/components/block-card/index.js.map +1 -1
  322. package/build-module/components/block-controls/hook.js +4 -24
  323. package/build-module/components/block-controls/hook.js.map +1 -1
  324. package/build-module/components/block-draggable/draggable-chip.js +6 -1
  325. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  326. package/build-module/components/block-draggable/index.js +76 -6
  327. package/build-module/components/block-draggable/index.js.map +1 -1
  328. package/build-module/components/block-draggable/index.native.js +1 -7
  329. package/build-module/components/block-draggable/index.native.js.map +1 -1
  330. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  331. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  332. package/build-module/components/block-edit/context.js +2 -0
  333. package/build-module/components/block-edit/context.js.map +1 -1
  334. package/build-module/components/block-edit/index.js +19 -10
  335. package/build-module/components/block-edit/index.js.map +1 -1
  336. package/build-module/components/block-editing-mode/index.js +3 -4
  337. package/build-module/components/block-editing-mode/index.js.map +1 -1
  338. package/build-module/components/block-info-slot-fill/index.js +3 -3
  339. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  340. package/build-module/components/block-inspector/index.js +1 -1
  341. package/build-module/components/block-inspector/index.js.map +1 -1
  342. package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
  343. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  344. package/build-module/components/block-list/block.js +261 -99
  345. package/build-module/components/block-list/block.js.map +1 -1
  346. package/build-module/components/block-list/block.native.js +60 -25
  347. package/build-module/components/block-list/block.native.js.map +1 -1
  348. package/build-module/components/block-list/index.native.js +3 -5
  349. package/build-module/components/block-list/index.native.js.map +1 -1
  350. package/build-module/components/block-list/private-block-context.js +6 -0
  351. package/build-module/components/block-list/private-block-context.js.map +1 -0
  352. package/build-module/components/block-list/use-block-props/index.js +50 -70
  353. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  354. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  355. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  356. package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
  357. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  358. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  359. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  360. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  361. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  362. package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
  363. package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  364. package/build-module/components/block-lock/toolbar.js +22 -28
  365. package/build-module/components/block-lock/toolbar.js.map +1 -1
  366. package/build-module/components/block-mover/index.js +2 -1
  367. package/build-module/components/block-mover/index.js.map +1 -1
  368. package/build-module/components/block-patterns-list/index.js +6 -6
  369. package/build-module/components/block-patterns-list/index.js.map +1 -1
  370. package/build-module/components/block-removal-warning-modal/index.js +3 -10
  371. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  372. package/build-module/components/block-rename/modal.js +3 -0
  373. package/build-module/components/block-rename/modal.js.map +1 -1
  374. package/build-module/components/block-settings/container.native.js +4 -2
  375. package/build-module/components/block-settings/container.native.js.map +1 -1
  376. package/build-module/components/block-styles/index.js +1 -1
  377. package/build-module/components/block-styles/index.js.map +1 -1
  378. package/build-module/components/block-styles/index.native.js +3 -2
  379. package/build-module/components/block-styles/index.native.js.map +1 -1
  380. package/build-module/components/block-switcher/index.js +4 -4
  381. package/build-module/components/block-switcher/index.js.map +1 -1
  382. package/build-module/components/block-toolbar/index.js +89 -27
  383. package/build-module/components/block-toolbar/index.js.map +1 -1
  384. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
  385. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  386. package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
  387. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
  388. package/build-module/components/block-tools/index.js +27 -24
  389. package/build-module/components/block-tools/index.js.map +1 -1
  390. package/build-module/components/block-types-list/index.native.js +2 -1
  391. package/build-module/components/block-types-list/index.native.js.map +1 -1
  392. package/build-module/components/block-variation-picker/index.native.js +2 -1
  393. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  394. package/build-module/components/block-variation-transforms/index.js +30 -3
  395. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  396. package/build-module/components/border-radius-control/linked-button.js +1 -1
  397. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  398. package/build-module/components/colors/utils.js +9 -1
  399. package/build-module/components/colors/utils.js.map +1 -1
  400. package/build-module/components/colors/with-colors.js +5 -1
  401. package/build-module/components/colors/with-colors.js.map +1 -1
  402. package/build-module/components/colors-gradients/control.js +29 -18
  403. package/build-module/components/colors-gradients/control.js.map +1 -1
  404. package/build-module/components/duotone-control/index.js +1 -4
  405. package/build-module/components/duotone-control/index.js.map +1 -1
  406. package/build-module/components/font-sizes/utils.js +9 -1
  407. package/build-module/components/font-sizes/utils.js.map +1 -1
  408. package/build-module/components/global-styles/border-panel.js +3 -2
  409. package/build-module/components/global-styles/border-panel.js.map +1 -1
  410. package/build-module/components/global-styles/color-panel.js +26 -23
  411. package/build-module/components/global-styles/color-panel.js.map +1 -1
  412. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  413. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  414. package/build-module/components/global-styles/effects-panel.js +3 -2
  415. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  416. package/build-module/components/global-styles/filters-panel.js +8 -5
  417. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  418. package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
  419. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
  420. package/build-module/components/global-styles/hooks.js +3 -2
  421. package/build-module/components/global-styles/hooks.js.map +1 -1
  422. package/build-module/components/global-styles/image-settings-panel.js +7 -1
  423. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  424. package/build-module/components/global-styles/index.js +1 -0
  425. package/build-module/components/global-styles/index.js.map +1 -1
  426. package/build-module/components/global-styles/typography-panel.js +45 -38
  427. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  428. package/build-module/components/global-styles/use-global-styles-output.js +15 -1
  429. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  430. package/build-module/components/global-styles/utils.js +7 -0
  431. package/build-module/components/global-styles/utils.js.map +1 -1
  432. package/build-module/components/height-control/index.js +6 -2
  433. package/build-module/components/height-control/index.js.map +1 -1
  434. package/build-module/components/image-link-destinations/index.native.js +109 -0
  435. package/build-module/components/image-link-destinations/index.native.js.map +1 -0
  436. package/build-module/components/image-size-control/index.js +2 -2
  437. package/build-module/components/image-size-control/index.js.map +1 -1
  438. package/build-module/components/index.native.js +3 -1
  439. package/build-module/components/index.native.js.map +1 -1
  440. package/build-module/components/inner-blocks/index.js +62 -23
  441. package/build-module/components/inner-blocks/index.js.map +1 -1
  442. package/build-module/components/inner-blocks/index.native.js +18 -4
  443. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  444. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  445. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  446. package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
  447. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  448. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  449. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  450. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
  451. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  452. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
  453. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  454. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
  455. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  456. package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
  457. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  458. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
  459. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  460. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
  461. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  462. package/build-module/components/inserter/index.js +1 -2
  463. package/build-module/components/inserter/index.js.map +1 -1
  464. package/build-module/components/inserter/library.js +3 -7
  465. package/build-module/components/inserter/library.js.map +1 -1
  466. package/build-module/components/inserter/media-tab/media-panel.js +1 -1
  467. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  468. package/build-module/components/inserter/menu.js +26 -33
  469. package/build-module/components/inserter/menu.js.map +1 -1
  470. package/build-module/components/inserter/preview-panel.js +2 -2
  471. package/build-module/components/inserter/preview-panel.js.map +1 -1
  472. package/build-module/components/inserter/tabs.js +22 -22
  473. package/build-module/components/inserter/tabs.js.map +1 -1
  474. package/build-module/components/inserter-button/index.native.js +89 -0
  475. package/build-module/components/inserter-button/index.native.js.map +1 -0
  476. package/build-module/components/inserter-button/sparkles.js +15 -0
  477. package/build-module/components/inserter-button/sparkles.js.map +1 -0
  478. package/build-module/components/inserter-draggable-blocks/index.js +9 -5
  479. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  480. package/build-module/components/inserter-list-item/index.js +2 -4
  481. package/build-module/components/inserter-list-item/index.js.map +1 -1
  482. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
  483. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  484. package/build-module/components/inspector-controls/fill.js +3 -3
  485. package/build-module/components/inspector-controls/fill.js.map +1 -1
  486. package/build-module/components/inspector-controls/fill.native.js +3 -3
  487. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  488. package/build-module/components/inspector-controls-tabs/index.js +35 -24
  489. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  490. package/build-module/components/list-view/block-select-button.js +4 -0
  491. package/build-module/components/list-view/block-select-button.js.map +1 -1
  492. package/build-module/components/list-view/block.js +58 -4
  493. package/build-module/components/list-view/block.js.map +1 -1
  494. package/build-module/components/media-upload-progress/constants.js +7 -0
  495. package/build-module/components/media-upload-progress/constants.js.map +1 -0
  496. package/build-module/components/media-upload-progress/index.native.js +37 -8
  497. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  498. package/build-module/components/navigable-toolbar/index.js +11 -16
  499. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  500. package/build-module/components/plain-text/index.native.js +6 -1
  501. package/build-module/components/plain-text/index.native.js.map +1 -1
  502. package/build-module/components/preview-options/index.js +6 -62
  503. package/build-module/components/preview-options/index.js.map +1 -1
  504. package/build-module/components/provider/index.js +3 -1
  505. package/build-module/components/provider/index.js.map +1 -1
  506. package/build-module/components/provider/use-block-sync.js +7 -1
  507. package/build-module/components/provider/use-block-sync.js.map +1 -1
  508. package/build-module/components/rich-text/content.js +25 -21
  509. package/build-module/components/rich-text/content.js.map +1 -1
  510. package/build-module/components/rich-text/get-rich-text-values.js +2 -1
  511. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
  512. package/build-module/components/rich-text/index.js +21 -39
  513. package/build-module/components/rich-text/index.js.map +1 -1
  514. package/build-module/components/rich-text/index.native.js +10 -18
  515. package/build-module/components/rich-text/index.native.js.map +1 -1
  516. package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
  517. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  518. package/build-module/components/rich-text/native/index.native.js +22 -56
  519. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  520. package/build-module/components/rich-text/use-input-rules.js +7 -3
  521. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  522. package/build-module/components/rich-text/use-mark-persistent.js +1 -1
  523. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  524. package/build-module/components/rich-text/with-deprecations.js +42 -0
  525. package/build-module/components/rich-text/with-deprecations.js.map +1 -0
  526. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  527. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  528. package/build-module/components/url-input/index.js +9 -6
  529. package/build-module/components/url-input/index.js.map +1 -1
  530. package/build-module/components/use-block-commands/index.js +14 -18
  531. package/build-module/components/use-block-commands/index.js.map +1 -1
  532. package/build-module/components/use-block-drop-zone/index.js +107 -18
  533. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  534. package/build-module/components/use-moving-animation/index.js +102 -94
  535. package/build-module/components/use-moving-animation/index.js.map +1 -1
  536. package/build-module/components/use-on-block-drop/index.js +9 -12
  537. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  538. package/build-module/components/use-resize-canvas/index.js +4 -1
  539. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  540. package/build-module/components/use-settings/index.js +13 -1
  541. package/build-module/components/use-settings/index.js.map +1 -1
  542. package/build-module/components/writing-flow/index.js +0 -1
  543. package/build-module/components/writing-flow/index.js.map +1 -1
  544. package/build-module/components/writing-flow/use-drag-selection.js +15 -4
  545. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  546. package/build-module/components/writing-flow/use-selection-observer.js +73 -27
  547. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  548. package/build-module/components/writing-flow/use-tab-nav.js +7 -4
  549. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  550. package/build-module/hooks/align.js +20 -67
  551. package/build-module/hooks/align.js.map +1 -1
  552. package/build-module/hooks/align.native.js +1 -0
  553. package/build-module/hooks/align.native.js.map +1 -1
  554. package/build-module/hooks/anchor.js +12 -27
  555. package/build-module/hooks/anchor.js.map +1 -1
  556. package/build-module/hooks/aria-label.js +7 -1
  557. package/build-module/hooks/aria-label.js.map +1 -1
  558. package/build-module/hooks/background.js +197 -37
  559. package/build-module/hooks/background.js.map +1 -1
  560. package/build-module/hooks/block-hooks.js +22 -30
  561. package/build-module/hooks/block-hooks.js.map +1 -1
  562. package/build-module/hooks/block-renaming.js +17 -21
  563. package/build-module/hooks/block-renaming.js.map +1 -1
  564. package/build-module/hooks/border.js +52 -79
  565. package/build-module/hooks/border.js.map +1 -1
  566. package/build-module/hooks/color.js +78 -88
  567. package/build-module/hooks/color.js.map +1 -1
  568. package/build-module/hooks/content-lock-ui.js +27 -27
  569. package/build-module/hooks/content-lock-ui.js.map +1 -1
  570. package/build-module/hooks/custom-class-name.js +12 -28
  571. package/build-module/hooks/custom-class-name.js.map +1 -1
  572. package/build-module/hooks/custom-class-name.native.js +7 -1
  573. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  574. package/build-module/hooks/dimensions.js +15 -16
  575. package/build-module/hooks/dimensions.js.map +1 -1
  576. package/build-module/hooks/duotone.js +30 -61
  577. package/build-module/hooks/duotone.js.map +1 -1
  578. package/build-module/hooks/font-family.js +20 -25
  579. package/build-module/hooks/font-family.js.map +1 -1
  580. package/build-module/hooks/font-size.js +50 -120
  581. package/build-module/hooks/font-size.js.map +1 -1
  582. package/build-module/hooks/index.js +20 -16
  583. package/build-module/hooks/index.js.map +1 -1
  584. package/build-module/hooks/index.native.js +10 -6
  585. package/build-module/hooks/index.native.js.map +1 -1
  586. package/build-module/hooks/layout-child.js +60 -0
  587. package/build-module/hooks/layout-child.js.map +1 -0
  588. package/build-module/hooks/layout.js +21 -100
  589. package/build-module/hooks/layout.js.map +1 -1
  590. package/build-module/hooks/padding.js +2 -2
  591. package/build-module/hooks/padding.js.map +1 -1
  592. package/build-module/hooks/position.js +38 -59
  593. package/build-module/hooks/position.js.map +1 -1
  594. package/build-module/hooks/style.js +52 -85
  595. package/build-module/hooks/style.js.map +1 -1
  596. package/build-module/hooks/typography.js +26 -11
  597. package/build-module/hooks/typography.js.map +1 -1
  598. package/build-module/hooks/typography.native.js +43 -17
  599. package/build-module/hooks/typography.native.js.map +1 -1
  600. package/build-module/hooks/use-typography-props.js +9 -1
  601. package/build-module/hooks/use-typography-props.js.map +1 -1
  602. package/build-module/hooks/utils.js +194 -9
  603. package/build-module/hooks/utils.js.map +1 -1
  604. package/build-module/private-apis.js +2 -6
  605. package/build-module/private-apis.js.map +1 -1
  606. package/build-module/private-apis.native.js +0 -2
  607. package/build-module/private-apis.native.js.map +1 -1
  608. package/build-module/store/actions.js +0 -15
  609. package/build-module/store/actions.js.map +1 -1
  610. package/build-module/store/private-actions.js +52 -0
  611. package/build-module/store/private-actions.js.map +1 -1
  612. package/build-module/store/private-selectors.js +44 -1
  613. package/build-module/store/private-selectors.js.map +1 -1
  614. package/build-module/store/reducer.js +18 -2
  615. package/build-module/store/reducer.js.map +1 -1
  616. package/build-module/store/selectors.js +4 -65
  617. package/build-module/store/selectors.js.map +1 -1
  618. package/build-module/store/undo-ignore.js +5 -0
  619. package/build-module/store/undo-ignore.js.map +1 -0
  620. package/build-module/store/utils.js +56 -0
  621. package/build-module/store/utils.js.map +1 -0
  622. package/build-module/utils/get-px-from-css-unit.js +9 -0
  623. package/build-module/utils/get-px-from-css-unit.js.map +1 -0
  624. package/build-module/utils/index.js +1 -1
  625. package/build-module/utils/index.js.map +1 -1
  626. package/build-module/utils/object.js +37 -97
  627. package/build-module/utils/object.js.map +1 -1
  628. package/build-module/utils/selection.js +9 -1
  629. package/build-module/utils/selection.js.map +1 -1
  630. package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
  631. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  632. package/build-style/content-rtl.css +7 -6
  633. package/build-style/content.css +7 -6
  634. package/build-style/style-rtl.css +164 -301
  635. package/build-style/style.css +164 -301
  636. package/package.json +31 -31
  637. package/src/components/alignment-control/README.md +0 -5
  638. package/src/components/block-alignment-control/README.md +0 -5
  639. package/src/components/block-alignment-matrix-control/README.md +0 -10
  640. package/src/components/block-breadcrumb/README.md +0 -5
  641. package/src/components/block-canvas/index.js +29 -17
  642. package/src/components/block-canvas/style.scss +6 -0
  643. package/src/components/block-caption/README.md +2 -7
  644. package/src/components/block-card/README.md +0 -5
  645. package/src/components/block-card/index.js +6 -4
  646. package/src/components/block-card/style.scss +7 -3
  647. package/src/components/block-controls/hook.js +8 -30
  648. package/src/components/block-controls/test/index.js +3 -3
  649. package/src/components/block-draggable/draggable-chip.js +11 -1
  650. package/src/components/block-draggable/index.js +116 -4
  651. package/src/components/block-draggable/index.native.js +0 -5
  652. package/src/components/block-draggable/style.scss +35 -0
  653. package/src/components/block-draggable/test/helpers.native.js +8 -7
  654. package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  655. package/src/components/block-edit/context.js +3 -0
  656. package/src/components/block-edit/index.js +36 -10
  657. package/src/components/block-editing-mode/index.js +3 -3
  658. package/src/components/block-icon/README.md +0 -5
  659. package/src/components/block-info-slot-fill/index.js +6 -3
  660. package/src/components/block-inspector/README.md +0 -5
  661. package/src/components/block-inspector/index.js +3 -1
  662. package/src/components/block-inspector/style.scss +0 -4
  663. package/src/components/block-list/block-list-item-cell.native.js +5 -1
  664. package/src/components/block-list/block.js +309 -104
  665. package/src/components/block-list/block.native.js +69 -21
  666. package/src/components/block-list/content.scss +14 -10
  667. package/src/components/block-list/index.native.js +3 -5
  668. package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
  669. package/src/components/block-list/use-block-props/index.js +43 -86
  670. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
  671. package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
  672. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
  673. package/src/components/block-list/use-in-between-inserter.js +4 -1
  674. package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
  675. package/src/components/block-lock/toolbar.js +23 -34
  676. package/src/components/block-mover/README.md +0 -5
  677. package/src/components/block-mover/index.js +1 -1
  678. package/src/components/block-parent-selector/README.md +0 -5
  679. package/src/components/block-patterns-list/README.md +0 -5
  680. package/src/components/block-patterns-list/index.js +9 -6
  681. package/src/components/block-removal-warning-modal/index.js +7 -14
  682. package/src/components/block-rename/modal.js +7 -1
  683. package/src/components/block-settings/container.native.js +3 -5
  684. package/src/components/block-styles/index.js +1 -1
  685. package/src/components/block-styles/index.native.js +4 -2
  686. package/src/components/block-styles/style.scss +0 -11
  687. package/src/components/block-switcher/index.js +49 -59
  688. package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
  689. package/src/components/block-toolbar/README.md +0 -5
  690. package/src/components/block-toolbar/index.js +179 -95
  691. package/src/components/block-toolbar/style.scss +50 -66
  692. package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
  693. package/src/components/block-tools/block-toolbar-popover.js +84 -0
  694. package/src/components/block-tools/index.js +42 -29
  695. package/src/components/block-tools/style.scss +60 -172
  696. package/src/components/block-types-list/README.md +0 -5
  697. package/src/components/block-types-list/index.native.js +2 -1
  698. package/src/components/block-variation-picker/README.md +0 -5
  699. package/src/components/block-variation-picker/index.native.js +1 -1
  700. package/src/components/block-variation-transforms/README.md +0 -5
  701. package/src/components/block-variation-transforms/index.js +49 -3
  702. package/src/components/border-radius-control/linked-button.js +1 -1
  703. package/src/components/caption/README.md +0 -5
  704. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
  705. package/src/components/colors/utils.js +8 -1
  706. package/src/components/colors/with-colors.js +3 -1
  707. package/src/components/colors-gradients/control.js +49 -30
  708. package/src/components/colors-gradients/style.scss +0 -7
  709. package/src/components/contrast-checker/README.md +0 -4
  710. package/src/components/copy-handler/README.md +0 -10
  711. package/src/components/duotone-control/index.js +2 -5
  712. package/src/components/duotone-control/style.scss +1 -6
  713. package/src/components/font-sizes/utils.js +7 -1
  714. package/src/components/global-styles/border-panel.js +2 -1
  715. package/src/components/global-styles/color-panel.js +36 -26
  716. package/src/components/global-styles/dimensions-panel.js +4 -3
  717. package/src/components/global-styles/effects-panel.js +2 -1
  718. package/src/components/global-styles/filters-panel.js +6 -5
  719. package/src/components/global-styles/get-global-styles-changes.js +210 -0
  720. package/src/components/global-styles/hooks.js +5 -0
  721. package/src/components/global-styles/image-settings-panel.js +6 -0
  722. package/src/components/global-styles/index.js +1 -0
  723. package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
  724. package/src/components/global-styles/typography-panel.js +60 -47
  725. package/src/components/global-styles/use-global-styles-output.js +9 -5
  726. package/src/components/global-styles/utils.js +7 -0
  727. package/src/components/height-control/README.md +2 -7
  728. package/src/components/height-control/index.js +4 -0
  729. package/src/components/image-link-destinations/index.native.js +152 -0
  730. package/src/components/image-link-destinations/style.native.scss +16 -0
  731. package/src/components/image-size-control/index.js +5 -2
  732. package/src/components/index.native.js +3 -2
  733. package/src/components/inner-blocks/README.md +13 -2
  734. package/src/components/inner-blocks/index.js +68 -29
  735. package/src/components/inner-blocks/index.native.js +19 -7
  736. package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
  737. package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
  738. package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  739. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
  740. package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
  741. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
  742. package/src/components/inserter/block-patterns-tab/utils.js +11 -12
  743. package/src/components/inserter/hooks/use-block-types-state.js +9 -11
  744. package/src/components/inserter/hooks/use-patterns-state.js +2 -2
  745. package/src/components/inserter/index.js +0 -1
  746. package/src/components/inserter/library.js +2 -8
  747. package/src/components/inserter/media-tab/media-panel.js +1 -1
  748. package/src/components/inserter/menu.js +26 -36
  749. package/src/components/inserter/preview-panel.js +2 -2
  750. package/src/components/inserter/style.scss +21 -21
  751. package/src/components/inserter/tabs.js +34 -25
  752. package/src/components/inserter-button/README.md +62 -0
  753. package/src/components/inserter-button/index.native.js +116 -0
  754. package/src/components/inserter-button/sparkles.js +15 -0
  755. package/src/components/inserter-button/style.native.scss +72 -0
  756. package/src/components/inserter-draggable-blocks/index.js +18 -5
  757. package/src/components/inserter-list-item/index.js +6 -6
  758. package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
  759. package/src/components/inspector-controls/fill.js +6 -3
  760. package/src/components/inspector-controls/fill.native.js +6 -3
  761. package/src/components/inspector-controls-tabs/index.js +39 -28
  762. package/src/components/inspector-controls-tabs/style.scss +3 -2
  763. package/src/components/letter-spacing-control/README.md +0 -5
  764. package/src/components/line-height-control/README.md +0 -5
  765. package/src/components/link-control/style.scss +1 -1
  766. package/src/components/link-control/test/index.js +1 -1
  767. package/src/components/list-view/README.md +0 -5
  768. package/src/components/list-view/block-select-button.js +4 -0
  769. package/src/components/list-view/block.js +73 -2
  770. package/src/components/list-view/style.scss +6 -0
  771. package/src/components/media-upload-progress/constants.js +6 -0
  772. package/src/components/media-upload-progress/index.native.js +66 -14
  773. package/src/components/media-upload-progress/test/index.native.js +2 -2
  774. package/src/components/multi-selection-inspector/README.md +0 -5
  775. package/src/components/navigable-toolbar/README.md +2 -0
  776. package/src/components/navigable-toolbar/index.js +15 -13
  777. package/src/components/plain-text/index.native.js +6 -1
  778. package/src/components/preview-options/index.js +6 -86
  779. package/src/components/provider/index.js +1 -1
  780. package/src/components/provider/test/use-block-sync.js +20 -17
  781. package/src/components/provider/use-block-sync.js +6 -0
  782. package/src/components/rich-text/content.js +27 -20
  783. package/src/components/rich-text/get-rich-text-values.js +6 -1
  784. package/src/components/rich-text/index.js +23 -52
  785. package/src/components/rich-text/index.native.js +8 -25
  786. package/src/components/rich-text/native/get-format-colors.native.js +33 -40
  787. package/src/components/rich-text/native/index.native.js +22 -71
  788. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
  789. package/src/components/rich-text/native/test/index.native.js +72 -5
  790. package/src/components/rich-text/use-input-rules.js +8 -3
  791. package/src/components/rich-text/use-mark-persistent.js +1 -2
  792. package/src/components/rich-text/with-deprecations.js +51 -0
  793. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  794. package/src/components/text-decoration-control/README.md +40 -0
  795. package/src/components/text-transform-control/README.md +0 -4
  796. package/src/components/ungroup-button/README.md +0 -5
  797. package/src/components/unit-control/README.md +0 -4
  798. package/src/components/url-input/index.js +11 -11
  799. package/src/components/use-block-commands/index.js +18 -21
  800. package/src/components/use-block-drop-zone/index.js +181 -30
  801. package/src/components/use-moving-animation/index.js +107 -103
  802. package/src/components/use-on-block-drop/index.js +9 -24
  803. package/src/components/use-on-block-drop/test/index.js +12 -26
  804. package/src/components/use-resize-canvas/README.md +3 -7
  805. package/src/components/use-resize-canvas/index.js +4 -1
  806. package/src/components/use-settings/README.md +0 -4
  807. package/src/components/use-settings/index.js +15 -1
  808. package/src/components/writing-flow/index.js +0 -1
  809. package/src/components/writing-flow/use-drag-selection.js +18 -4
  810. package/src/components/writing-flow/use-selection-observer.js +99 -37
  811. package/src/components/writing-flow/use-tab-nav.js +7 -7
  812. package/src/hooks/align.js +16 -81
  813. package/src/hooks/align.native.js +1 -0
  814. package/src/hooks/anchor.js +14 -38
  815. package/src/hooks/aria-label.js +8 -5
  816. package/src/hooks/background.js +269 -32
  817. package/src/hooks/block-hooks.js +22 -51
  818. package/src/hooks/block-renaming.js +23 -37
  819. package/src/hooks/border.js +62 -124
  820. package/src/hooks/color.js +111 -138
  821. package/src/hooks/content-lock-ui.js +110 -122
  822. package/src/hooks/custom-class-name.js +9 -45
  823. package/src/hooks/custom-class-name.native.js +8 -5
  824. package/src/hooks/dimensions.js +14 -16
  825. package/src/hooks/duotone.js +70 -127
  826. package/src/hooks/font-family.js +14 -36
  827. package/src/hooks/font-size.js +67 -168
  828. package/src/hooks/index.js +58 -16
  829. package/src/hooks/index.native.js +22 -6
  830. package/src/hooks/layout-child.js +53 -0
  831. package/src/hooks/layout.js +17 -103
  832. package/src/hooks/padding.js +2 -2
  833. package/src/hooks/position.js +50 -90
  834. package/src/hooks/style.js +118 -193
  835. package/src/hooks/test/align.js +1 -178
  836. package/src/hooks/test/anchor.js +4 -9
  837. package/src/hooks/test/custom-class-name.js +3 -8
  838. package/src/hooks/test/style.js +4 -14
  839. package/src/hooks/typography.js +14 -16
  840. package/src/hooks/typography.native.js +31 -33
  841. package/src/hooks/use-typography-props.js +7 -1
  842. package/src/hooks/utils.js +261 -10
  843. package/src/private-apis.js +2 -6
  844. package/src/private-apis.native.js +0 -2
  845. package/src/store/actions.js +0 -15
  846. package/src/store/private-actions.js +48 -0
  847. package/src/store/private-selectors.js +56 -0
  848. package/src/store/reducer.js +20 -1
  849. package/src/store/selectors.js +10 -82
  850. package/src/store/undo-ignore.js +4 -0
  851. package/src/store/utils.js +74 -0
  852. package/src/style.scss +1 -2
  853. package/src/utils/get-px-from-css-unit.js +8 -0
  854. package/src/utils/index.js +1 -1
  855. package/src/utils/object.js +34 -104
  856. package/src/utils/selection.js +9 -2
  857. package/src/utils/test/object.js +1 -96
  858. package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
  859. package/build/components/block-list/block-list-block-context.js +0 -14
  860. package/build/components/block-list/block-list-block-context.js.map +0 -1
  861. package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
  862. package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  863. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
  864. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  865. package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
  866. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  867. package/build/components/block-tools/back-compat.js +0 -45
  868. package/build/components/block-tools/back-compat.js.map +0 -1
  869. package/build/components/block-tools/block-contextual-toolbar.js +0 -91
  870. package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
  871. package/build/components/block-tools/selected-block-tools.js +0 -113
  872. package/build/components/block-tools/selected-block-tools.js.map +0 -1
  873. package/build/components/inserter/hooks/use-debounced-input.js +0 -22
  874. package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
  875. package/build/components/use-display-block-controls/index.js +0 -39
  876. package/build/components/use-display-block-controls/index.js.map +0 -1
  877. package/build/components/use-display-block-controls/index.native.js +0 -39
  878. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  879. package/build/hooks/custom-fields.js +0 -120
  880. package/build/hooks/custom-fields.js.map +0 -1
  881. package/build/utils/parse-css-unit-to-px.js +0 -302
  882. package/build/utils/parse-css-unit-to-px.js.map +0 -1
  883. package/build/utils/use-should-contextual-toolbar-show.js +0 -63
  884. package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
  885. package/build-module/components/block-list/block-list-block-context.js +0 -6
  886. package/build-module/components/block-list/block-list-block-context.js.map +0 -1
  887. package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
  888. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  889. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
  890. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  891. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
  892. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  893. package/build-module/components/block-tools/back-compat.js +0 -35
  894. package/build-module/components/block-tools/back-compat.js.map +0 -1
  895. package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
  896. package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
  897. package/build-module/components/block-tools/selected-block-tools.js +0 -105
  898. package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
  899. package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
  900. package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
  901. package/build-module/components/use-display-block-controls/index.js +0 -32
  902. package/build-module/components/use-display-block-controls/index.js.map +0 -1
  903. package/build-module/components/use-display-block-controls/index.native.js +0 -32
  904. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  905. package/build-module/hooks/custom-fields.js +0 -118
  906. package/build-module/hooks/custom-fields.js.map +0 -1
  907. package/build-module/utils/parse-css-unit-to-px.js +0 -294
  908. package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
  909. package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
  910. package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
  911. package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
  912. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
  913. package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
  914. package/src/components/block-parent-selector/style.scss +0 -11
  915. package/src/components/block-tools/back-compat.js +0 -35
  916. package/src/components/block-tools/block-contextual-toolbar.js +0 -100
  917. package/src/components/block-tools/selected-block-tools.js +0 -127
  918. package/src/components/inserter/hooks/use-debounced-input.js +0 -18
  919. package/src/components/preview-options/README.md +0 -94
  920. package/src/components/preview-options/style.scss +0 -64
  921. package/src/components/use-display-block-controls/index.js +0 -36
  922. package/src/components/use-display-block-controls/index.native.js +0 -37
  923. package/src/hooks/custom-fields.js +0 -142
  924. package/src/hooks/test/color.js +0 -112
  925. package/src/utils/parse-css-unit-to-px.js +0 -329
  926. package/src/utils/test/parse-css-unit-to-px.js +0 -172
  927. package/src/utils/use-should-contextual-toolbar-show.js +0 -85
@@ -5,71 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = PreviewOptions;
8
- var _react = require("react");
9
- var _classnames = _interopRequireDefault(require("classnames"));
10
- var _compose = require("@wordpress/compose");
11
- var _components = require("@wordpress/components");
12
- var _i18n = require("@wordpress/i18n");
13
- var _icons = require("@wordpress/icons");
14
- /**
15
- * External dependencies
16
- */
17
-
8
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
18
9
  /**
19
10
  * WordPress dependencies
20
11
  */
21
12
 
22
- function PreviewOptions({
23
- children,
24
- viewLabel,
25
- className,
26
- isEnabled = true,
27
- deviceType,
28
- setDeviceType,
29
- label,
30
- showIconLabels
31
- }) {
32
- const isMobile = (0, _compose.useViewportMatch)('small', '<');
33
- if (isMobile) return null;
34
- const popoverProps = {
35
- className: (0, _classnames.default)(className, 'block-editor-post-preview__dropdown-content'),
36
- placement: 'bottom-end'
37
- };
38
- const toggleProps = {
39
- className: 'block-editor-post-preview__button-toggle',
40
- disabled: !isEnabled,
41
- __experimentalIsFocusable: !isEnabled,
42
- children: viewLabel,
43
- showTooltip: !showIconLabels
44
- };
45
- const menuProps = {
46
- 'aria-label': (0, _i18n.__)('View options')
47
- };
48
- const deviceIcons = {
49
- mobile: _icons.mobile,
50
- tablet: _icons.tablet,
51
- desktop: _icons.desktop
52
- };
53
- return (0, _react.createElement)(_components.DropdownMenu, {
54
- className: "block-editor-post-preview__dropdown",
55
- popoverProps: popoverProps,
56
- toggleProps: toggleProps,
57
- menuProps: menuProps,
58
- icon: deviceIcons[deviceType.toLowerCase()],
59
- label: label || (0, _i18n.__)('Preview'),
60
- disableOpenOnArrowDown: !isEnabled
61
- }, renderProps => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.MenuGroup, null, (0, _react.createElement)(_components.MenuItem, {
62
- className: "block-editor-post-preview__button-resize",
63
- onClick: () => setDeviceType('Desktop'),
64
- icon: deviceType === 'Desktop' && _icons.check
65
- }, (0, _i18n.__)('Desktop')), (0, _react.createElement)(_components.MenuItem, {
66
- className: "block-editor-post-preview__button-resize",
67
- onClick: () => setDeviceType('Tablet'),
68
- icon: deviceType === 'Tablet' && _icons.check
69
- }, (0, _i18n.__)('Tablet')), (0, _react.createElement)(_components.MenuItem, {
70
- className: "block-editor-post-preview__button-resize",
71
- onClick: () => setDeviceType('Mobile'),
72
- icon: deviceType === 'Mobile' && _icons.check
73
- }, (0, _i18n.__)('Mobile'))), children?.(renderProps)));
13
+ function PreviewOptions() {
14
+ (0, _deprecated.default)('wp.blockEditor.PreviewOptions', {
15
+ version: '6.5'
16
+ });
17
+ return null;
74
18
  }
75
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_components","_i18n","_icons","PreviewOptions","children","viewLabel","className","isEnabled","deviceType","setDeviceType","label","showIconLabels","isMobile","useViewportMatch","popoverProps","classnames","placement","toggleProps","disabled","__experimentalIsFocusable","showTooltip","menuProps","__","deviceIcons","mobile","tablet","desktop","_react","createElement","DropdownMenu","icon","toLowerCase","disableOpenOnArrowDown","renderProps","Fragment","MenuGroup","MenuItem","onClick","check"],"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet } from '@wordpress/icons';\n\nexport default function PreviewOptions( {\n\tchildren,\n\tviewLabel,\n\tclassName,\n\tisEnabled = true,\n\tdeviceType,\n\tsetDeviceType,\n\tlabel,\n\tshowIconLabels,\n} ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( isMobile ) return null;\n\n\tconst popoverProps = {\n\t\tclassName: classnames(\n\t\t\tclassName,\n\t\t\t'block-editor-post-preview__dropdown-content'\n\t\t),\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'block-editor-post-preview__button-toggle',\n\t\tdisabled: ! isEnabled,\n\t\t__experimentalIsFocusable: ! isEnabled,\n\t\tchildren: viewLabel,\n\t\tshowTooltip: ! showIconLabels,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tmobile,\n\t\ttablet,\n\t\tdesktop,\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-post-preview__dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ label || __( 'Preview' ) }\n\t\t\tdisableOpenOnArrowDown={ ! isEnabled }\n\t\t>\n\t\t\t{ ( renderProps ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ children?.( renderProps ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMe,SAASK,cAAcA,CAAE;EACvCC,QAAQ;EACRC,SAAS;EACTC,SAAS;EACTC,SAAS,GAAG,IAAI;EAChBC,UAAU;EACVC,aAAa;EACbC,KAAK;EACLC;AACD,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,yBAAgB,EAAE,OAAO,EAAE,GAAI,CAAC;EACjD,IAAKD,QAAQ,EAAG,OAAO,IAAI;EAE3B,MAAME,YAAY,GAAG;IACpBR,SAAS,EAAE,IAAAS,mBAAU,EACpBT,SAAS,EACT,6CACD,CAAC;IACDU,SAAS,EAAE;EACZ,CAAC;EACD,MAAMC,WAAW,GAAG;IACnBX,SAAS,EAAE,0CAA0C;IACrDY,QAAQ,EAAE,CAAEX,SAAS;IACrBY,yBAAyB,EAAE,CAAEZ,SAAS;IACtCH,QAAQ,EAAEC,SAAS;IACnBe,WAAW,EAAE,CAAET;EAChB,CAAC;EACD,MAAMU,SAAS,GAAG;IACjB,YAAY,EAAE,IAAAC,QAAE,EAAE,cAAe;EAClC,CAAC;EAED,MAAMC,WAAW,GAAG;IACnBC,MAAM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K,QAAQ,IAAI8B;EAAO,GAEvC,IAAAhB,QAAE,EAAE,QAAS,CACN,CACA,CAAC,EACVlB,QAAQ,GAAI6B,WAAY,CACzB,CAEU,CAAC;AAEjB"}
1
+ {"version":3,"names":["_deprecated","_interopRequireDefault","require","PreviewOptions","deprecated","version"],"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nexport default function PreviewOptions() {\n\tdeprecated( 'wp.blockEditor.PreviewOptions', {\n\t\tversion: '6.5',\n\t} );\n\treturn null;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,cAAcA,CAAA,EAAG;EACxC,IAAAC,mBAAU,EAAE,+BAA+B,EAAE;IAC5CC,OAAO,EAAE;EACV,CAAE,CAAC;EACH,OAAO,IAAI;AACZ"}
@@ -46,7 +46,9 @@ const ExperimentalBlockEditorProvider = (0, _withRegistryProvider.default)(props
46
46
 
47
47
  // Syncs the entity provider with changes in the block-editor store.
48
48
  (0, _useBlockSync.default)(props);
49
- return (0, _react.createElement)(_components.SlotFillProvider, null, (0, _react.createElement)(_keyboardShortcuts.default.Register, null), (0, _react.createElement)(_blockRefsProvider.BlockRefsProvider, null, children));
49
+ return (0, _react.createElement)(_components.SlotFillProvider, {
50
+ passthrough: true
51
+ }, (0, _react.createElement)(_keyboardShortcuts.default.Register, null), (0, _react.createElement)(_blockRefsProvider.BlockRefsProvider, null, children));
50
52
  });
51
53
  exports.ExperimentalBlockEditorProvider = ExperimentalBlockEditorProvider;
52
54
  const BlockEditorProvider = props => {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_components","_withRegistryProvider","_interopRequireDefault","_useBlockSync","_store","_blockRefsProvider","_lockUnlock","_keyboardShortcuts","ExperimentalBlockEditorProvider","withRegistryProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","unlock","useDispatch","blockEditorStore","useEffect","__internalIsInitialized","reset","useBlockSync","_react","createElement","SlotFillProvider","default","Register","BlockRefsProvider","exports","BlockEditorProvider","_default"],"sources":["@wordpress/block-editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst { children, settings, stripExperimentalSettings = false } = props;\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Syncs the entity provider with changes in the block-editor store.\n\t\tuseBlockSync( props );\n\n\t\treturn (\n\t\t\t<SlotFillProvider>\n\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t<BlockRefsProvider>{ children }</BlockRefsProvider>\n\t\t\t</SlotFillProvider>\n\t\t);\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\t{ ...props }\n\t\t\tstripExperimentalSettings={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BAAiB,QAAGhB,QAA6B,CACjC,CAAC;AAErB,CACD,CAAC;AAACiB,OAAA,CAAApB,+BAAA,GAAAA,+BAAA;AAEK,MAAMqB,mBAAmB,GAAKnB,KAAK,IAAM;EAC/C,OACC,IAAAY,MAAA,CAAAC,aAAA,EAACf,+BAA+B;IAAA,GAC1BE,KAAK;IACVG,yBAAyB,EAAG;EAAM,GAEhCH,KAAK,CAACC,QACwB,CAAC;AAEpC,CAAC;AAACiB,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAAA,IAAAC,QAAA,GAEaD,mBAAmB;AAAAD,OAAA,CAAAH,OAAA,GAAAK,QAAA"}
1
+ {"version":3,"names":["_data","require","_element","_components","_withRegistryProvider","_interopRequireDefault","_useBlockSync","_store","_blockRefsProvider","_lockUnlock","_keyboardShortcuts","ExperimentalBlockEditorProvider","withRegistryProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","unlock","useDispatch","blockEditorStore","useEffect","__internalIsInitialized","reset","useBlockSync","_react","createElement","SlotFillProvider","passthrough","default","Register","BlockRefsProvider","exports","BlockEditorProvider","_default"],"sources":["@wordpress/block-editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst { children, settings, stripExperimentalSettings = false } = props;\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Syncs the entity provider with changes in the block-editor store.\n\t\tuseBlockSync( props );\n\n\t\treturn (\n\t\t\t<SlotFillProvider passthrough>\n\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t<BlockRefsProvider>{ children }</BlockRefsProvider>\n\t\t\t</SlotFillProvider>\n\t\t);\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\t{ ...props }\n\t\t\tstripExperimentalSettings={ true }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n};\n\nexport default BlockEditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,qBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAL,sBAAA,CAAAJ,OAAA;AAfA;AACA;AACA;;AAKA;AACA;AACA;;AAQA;;AAEO,MAAMU,+BAA+B,GAAG,IAAAC,6BAAoB,EAChEC,KAAK,IAAM;EACZ,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,yBAAyB,GAAG;EAAM,CAAC,GAAGH,KAAK;EAEvE,MAAM;IAAEI;EAA6B,CAAC,GAAG,IAAAC,kBAAM,EAC9C,IAAAC,iBAAW,EAAEC,YAAiB,CAC/B,CAAC;EACD,IAAAC,kBAAS,EAAE,MAAM;IAChBJ,4BAA4B,CAC3B;MACC,GAAGF,QAAQ;MACXO,uBAAuB,EAAE;IAC1B,CAAC,EACD;MACCN,yBAAyB;MACzBO,KAAK,EAAE;IACR,CACD,CAAC;EACF,CAAC,EAAE,CACFR,QAAQ,EACRC,yBAAyB,EACzBC,4BAA4B,CAC3B,CAAC;;EAEH;EACA,IAAAO,qBAAY,EAAEX,KAAM,CAAC;EAErB,OACC,IAAAY,MAAA,CAAAC,aAAA,EAACvB,WAAA,CAAAwB,gBAAgB;IAACC,WAAW;EAAA,GAC5B,IAAAH,MAAA,CAAAC,aAAA,EAAChB,kBAAA,CAAAmB,OAAiB,CAACC,QAAQ,MAAE,CAAC,EAC9B,IAAAL,MAAA,CAAAC,aAAA,EAAClB,kBAAA,CAAAuB,iBAAiB,QAAGjB,QAA6B,CACjC,CAAC;AAErB,CACD,CAAC;AAACkB,OAAA,CAAArB,+BAAA,GAAAA,+BAAA;AAEK,MAAMsB,mBAAmB,GAAKpB,KAAK,IAAM;EAC/C,OACC,IAAAY,MAAA,CAAAC,aAAA,EAACf,+BAA+B;IAAA,GAC1BE,KAAK;IACVG,yBAAyB,EAAG;EAAM,GAEhCH,KAAK,CAACC,QACwB,CAAC;AAEpC,CAAC;AAACkB,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAAA,IAAAC,QAAA,GAEaD,mBAAmB;AAAAD,OAAA,CAAAH,OAAA,GAAAK,QAAA"}
@@ -8,6 +8,7 @@ var _element = require("@wordpress/element");
8
8
  var _data = require("@wordpress/data");
9
9
  var _blocks = require("@wordpress/blocks");
10
10
  var _store = require("../../store");
11
+ var _undoIgnore = require("../../store/undo-ignore");
11
12
  /**
12
13
  * WordPress dependencies
13
14
  */
@@ -239,12 +240,17 @@ function useBlockSync({
239
240
  // Inform the controlling entity that changes have been made to
240
241
  // the block-editor store they should be aware about.
241
242
  const updateParent = isPersistent ? onChangeRef.current : onInputRef.current;
243
+ const undoIgnore = _undoIgnore.undoIgnoreBlocks.has(blocks);
244
+ if (undoIgnore) {
245
+ _undoIgnore.undoIgnoreBlocks.delete(blocks);
246
+ }
242
247
  updateParent(blocks, {
243
248
  selection: {
244
249
  selectionStart: getSelectionStart(),
245
250
  selectionEnd: getSelectionEnd(),
246
251
  initialPosition: getSelectedBlocksInitialCaretPosition()
247
- }
252
+ },
253
+ undoIgnore
248
254
  });
249
255
  }
250
256
  previousAreBlocksDifferent = areBlocksDifferent;
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_blocks","_store","noop","useBlockSync","clientId","value","controlledBlocks","selection","controlledSelection","onChange","onInput","registry","useRegistry","resetBlocks","resetSelection","replaceInnerBlocks","setHasControlledInnerBlocks","__unstableMarkNextChangeAsNotPersistent","dispatch","blockEditorStore","getBlockName","getBlocks","getSelectionStart","getSelectionEnd","select","isControlled","useSelect","areInnerBlocksControlled","pendingChanges","useRef","incoming","outgoing","subscribed","setControlledBlocks","batch","storeBlocks","map","block","cloneBlock","current","unsetControlledBlocks","onInputRef","onChangeRef","useEffect","includes","length","selectionStart","selectionEnd","initialPosition","getSelectedBlocksInitialCaretPosition","isLastBlockChangePersistent","__unstableIsLastBlockChangeIgnored","blocks","isPersistent","previousAreBlocksDifferent","unsubscribe","subscribe","isStillControlled","newIsPersistent","newBlocks","areBlocksDifferent","didPersistenceChange","push","updateParent"],"sources":["@wordpress/block-editor/src/components/provider/use-block-sync.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * A function to call when the block value has been updated in the block-editor\n * store.\n *\n * @callback onBlockUpdate\n * @param {Object[]} blocks The updated blocks.\n * @param {Object} options The updated block options, such as selectionStart\n * and selectionEnd.\n */\n\n/**\n * useBlockSync is a side effect which handles bidirectional sync between the\n * block-editor store and a controlling data source which provides blocks. This\n * is most commonly used by the BlockEditorProvider to synchronize the contents\n * of the block-editor store with the root entity, like a post.\n *\n * Another example would be the template part block, which provides blocks from\n * a separate entity data source than a root entity. This hook syncs edits to\n * the template part in the block editor back to the entity and vice-versa.\n *\n * Here are some of its basic functions:\n * - Initalizes the block-editor store for the given clientID to the blocks\n * given via props.\n * - Adds incoming changes (like undo) to the block-editor store.\n * - Adds outgoing changes (like editing content) to the controlling entity,\n * determining if a change should be considered persistent or not.\n * - Handles edge cases and race conditions which occur in those operations.\n * - Ignores changes which happen to other entities (like nested inner block\n * controllers.\n * - Passes selection state from the block-editor store to the controlling entity.\n *\n * @param {Object} props Props for the block sync hook\n * @param {string} props.clientId The client ID of the inner block controller.\n * If none is passed, then it is assumed to be a\n * root controller rather than an inner block\n * controller.\n * @param {Object[]} props.value The control value for the blocks. This value\n * is used to initalize the block-editor store\n * and for resetting the blocks to incoming\n * changes like undo.\n * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.\n * @param {onBlockUpdate} props.onChange Function to call when a persistent\n * change has been made in the block-editor blocks\n * for the given clientId. For example, after\n * this function is called, an entity is marked\n * dirty because it has changes to save.\n * @param {onBlockUpdate} props.onInput Function to call when a non-persistent\n * change has been made in the block-editor blocks\n * for the given clientId. When this is called,\n * controlling sources do not become dirty.\n */\nexport default function useBlockSync( {\n\tclientId = null,\n\tvalue: controlledBlocks,\n\tselection: controlledSelection,\n\tonChange = noop,\n\tonInput = noop,\n} ) {\n\tconst registry = useRegistry();\n\n\tconst {\n\t\tresetBlocks,\n\t\tresetSelection,\n\t\treplaceInnerBlocks,\n\t\tsetHasControlledInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = registry.dispatch( blockEditorStore );\n\tconst { getBlockName, getBlocks, getSelectionStart, getSelectionEnd } =\n\t\tregistry.select( blockEditorStore );\n\tconst isControlled = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t! clientId ||\n\t\t\t\tselect( blockEditorStore ).areInnerBlocksControlled( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst pendingChanges = useRef( { incoming: null, outgoing: [] } );\n\tconst subscribed = useRef( false );\n\n\tconst setControlledBlocks = () => {\n\t\tif ( ! controlledBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't need to persist this change because we only replace\n\t\t// controlled inner blocks when the change was caused by an entity,\n\t\t// and so it would already be persisted.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\t// It is important to batch here because otherwise,\n\t\t\t// as soon as `setHasControlledInnerBlocks` is called\n\t\t\t// the effect to restore might be triggered\n\t\t\t// before the actual blocks get set properly in state.\n\t\t\tregistry.batch( () => {\n\t\t\t\tsetHasControlledInnerBlocks( clientId, true );\n\t\t\t\tconst storeBlocks = controlledBlocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock( block )\n\t\t\t\t);\n\t\t\t\tif ( subscribed.current ) {\n\t\t\t\t\tpendingChanges.current.incoming = storeBlocks;\n\t\t\t\t}\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks( clientId, storeBlocks );\n\t\t\t} );\n\t\t} else {\n\t\t\tif ( subscribed.current ) {\n\t\t\t\tpendingChanges.current.incoming = controlledBlocks;\n\t\t\t}\n\t\t\tresetBlocks( controlledBlocks );\n\t\t}\n\t};\n\n\t// Clean up the changes made by setControlledBlocks() when the component\n\t// containing useBlockSync() unmounts.\n\tconst unsetControlledBlocks = () => {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\tsetHasControlledInnerBlocks( clientId, false );\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceInnerBlocks( clientId, [] );\n\t\t} else {\n\t\t\tresetBlocks( [] );\n\t\t}\n\t};\n\n\t// Add a subscription to the block-editor registry to detect when changes\n\t// have been made. This lets us inform the data source of changes. This\n\t// is an effect so that the subscriber can run synchronously without\n\t// waiting for React renders for changes.\n\tconst onInputRef = useRef( onInput );\n\tconst onChangeRef = useRef( onChange );\n\tuseEffect( () => {\n\t\tonInputRef.current = onInput;\n\t\tonChangeRef.current = onChange;\n\t}, [ onInput, onChange ] );\n\n\t// Determine if blocks need to be reset when they change.\n\tuseEffect( () => {\n\t\tif ( pendingChanges.current.outgoing.includes( controlledBlocks ) ) {\n\t\t\t// Skip block reset if the value matches expected outbound sync\n\t\t\t// triggered by this component by a preceding change detection.\n\t\t\t// Only skip if the value matches expectation, since a reset should\n\t\t\t// still occur if the value is modified (not equal by reference),\n\t\t\t// to allow that the consumer may apply modifications to reflect\n\t\t\t// back on the editor.\n\t\t\tif (\n\t\t\t\tpendingChanges.current.outgoing[\n\t\t\t\t\tpendingChanges.current.outgoing.length - 1\n\t\t\t\t] === controlledBlocks\n\t\t\t) {\n\t\t\t\tpendingChanges.current.outgoing = [];\n\t\t\t}\n\t\t} else if ( getBlocks( clientId ) !== controlledBlocks ) {\n\t\t\t// Reset changing value in all other cases than the sync described\n\t\t\t// above. Since this can be reached in an update following an out-\n\t\t\t// bound sync, unset the outbound value to avoid considering it in\n\t\t\t// subsequent renders.\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\n\t\t\tif ( controlledSelection ) {\n\t\t\t\tresetSelection(\n\t\t\t\t\tcontrolledSelection.selectionStart,\n\t\t\t\t\tcontrolledSelection.selectionEnd,\n\t\t\t\t\tcontrolledSelection.initialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}, [ controlledBlocks, clientId ] );\n\n\tuseEffect( () => {\n\t\t// When the block becomes uncontrolled, it means its inner state has been reset\n\t\t// we need to take the blocks again from the external value property.\n\t\tif ( ! isControlled ) {\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\t\t}\n\t}, [ isControlled ] );\n\n\tuseEffect( () => {\n\t\tconst {\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisLastBlockChangePersistent,\n\t\t\t__unstableIsLastBlockChangeIgnored,\n\t\t\tareInnerBlocksControlled,\n\t\t} = registry.select( blockEditorStore );\n\n\t\tlet blocks = getBlocks( clientId );\n\t\tlet isPersistent = isLastBlockChangePersistent();\n\t\tlet previousAreBlocksDifferent = false;\n\n\t\tsubscribed.current = true;\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Sometimes, when changing block lists, lingering subscriptions\n\t\t\t// might trigger before they are cleaned up. If the block for which\n\t\t\t// the subscription runs is no longer in the store, this would clear\n\t\t\t// its parent entity's block list. To avoid this, we bail out if\n\t\t\t// the subscription is triggering for a block (`clientId !== null`)\n\t\t\t// and its block name can't be found because it's not on the list.\n\t\t\t// (`getBlockName( clientId ) === null`).\n\t\t\tif ( clientId !== null && getBlockName( clientId ) === null )\n\t\t\t\treturn;\n\n\t\t\t// When RESET_BLOCKS on parent blocks get called, the controlled blocks\n\t\t\t// can reset to uncontrolled, in these situations, it means we need to populate\n\t\t\t// the blocks again from the external blocks (the value property here)\n\t\t\t// and we should stop triggering onChange\n\t\t\tconst isStillControlled =\n\t\t\t\t! clientId || areInnerBlocksControlled( clientId );\n\t\t\tif ( ! isStillControlled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newIsPersistent = isLastBlockChangePersistent();\n\t\t\tconst newBlocks = getBlocks( clientId );\n\t\t\tconst areBlocksDifferent = newBlocks !== blocks;\n\t\t\tblocks = newBlocks;\n\t\t\tif (\n\t\t\t\tareBlocksDifferent &&\n\t\t\t\t( pendingChanges.current.incoming ||\n\t\t\t\t\t__unstableIsLastBlockChangeIgnored() )\n\t\t\t) {\n\t\t\t\tpendingChanges.current.incoming = null;\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Since we often dispatch an action to mark the previous action as\n\t\t\t// persistent, we need to make sure that the blocks changed on the\n\t\t\t// previous action before committing the change.\n\t\t\tconst didPersistenceChange =\n\t\t\t\tpreviousAreBlocksDifferent &&\n\t\t\t\t! areBlocksDifferent &&\n\t\t\t\tnewIsPersistent &&\n\t\t\t\t! isPersistent;\n\n\t\t\tif ( areBlocksDifferent || didPersistenceChange ) {\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\t// We know that onChange/onInput will update controlledBlocks.\n\t\t\t\t// We need to be aware that it was caused by an outgoing change\n\t\t\t\t// so that we do not treat it as an incoming change later on,\n\t\t\t\t// which would cause a block reset.\n\t\t\t\tpendingChanges.current.outgoing.push( blocks );\n\n\t\t\t\t// Inform the controlling entity that changes have been made to\n\t\t\t\t// the block-editor store they should be aware about.\n\t\t\t\tconst updateParent = isPersistent\n\t\t\t\t\t? onChangeRef.current\n\t\t\t\t\t: onInputRef.current;\n\t\t\t\tupdateParent( blocks, {\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tselectionStart: getSelectionStart(),\n\t\t\t\t\t\tselectionEnd: getSelectionEnd(),\n\t\t\t\t\t\tinitialPosition:\n\t\t\t\t\t\t\tgetSelectedBlocksInitialCaretPosition(),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\tpreviousAreBlocksDifferent = areBlocksDifferent;\n\t\t}, blockEditorStore );\n\n\t\treturn () => {\n\t\t\tsubscribed.current = false;\n\t\t\tunsubscribe();\n\t\t};\n\t}, [ registry, clientId ] );\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tunsetControlledBlocks();\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAMI,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,eAAe,CAAC,CAAC;YAC/ByB,eAAe,EACdC,qCAAqC,CAAC;UACxC;QACD,CAAE,CAAC;MACJ;MACAK,0BAA0B,GAAGM,kBAAkB;IAChD,CAAC,EAAEzC,YAAiB,CAAC;IAErB,OAAO,MAAM;MACZa,UAAU,CAACO,OAAO,GAAG,KAAK;MAC1BgB,WAAW,CAAC,CAAC;IACd,CAAC;EACF,CAAC,EAAE,CAAE5C,QAAQ,EAAEP,QAAQ,CAAG,CAAC;EAE3B,IAAAuC,kBAAS,EAAE,MAAM;IAChB,OAAO,MAAM;MACZH,qBAAqB,CAAC,CAAC;IACxB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
1
+ {"version":3,"names":["_element","require","_data","_blocks","_store","_undoIgnore","noop","useBlockSync","clientId","value","controlledBlocks","selection","controlledSelection","onChange","onInput","registry","useRegistry","resetBlocks","resetSelection","replaceInnerBlocks","setHasControlledInnerBlocks","__unstableMarkNextChangeAsNotPersistent","dispatch","blockEditorStore","getBlockName","getBlocks","getSelectionStart","getSelectionEnd","select","isControlled","useSelect","areInnerBlocksControlled","pendingChanges","useRef","incoming","outgoing","subscribed","setControlledBlocks","batch","storeBlocks","map","block","cloneBlock","current","unsetControlledBlocks","onInputRef","onChangeRef","useEffect","includes","length","selectionStart","selectionEnd","initialPosition","getSelectedBlocksInitialCaretPosition","isLastBlockChangePersistent","__unstableIsLastBlockChangeIgnored","blocks","isPersistent","previousAreBlocksDifferent","unsubscribe","subscribe","isStillControlled","newIsPersistent","newBlocks","areBlocksDifferent","didPersistenceChange","push","updateParent","undoIgnore","undoIgnoreBlocks","has","delete"],"sources":["@wordpress/block-editor/src/components/provider/use-block-sync.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { undoIgnoreBlocks } from '../../store/undo-ignore';\n\nconst noop = () => {};\n\n/**\n * A function to call when the block value has been updated in the block-editor\n * store.\n *\n * @callback onBlockUpdate\n * @param {Object[]} blocks The updated blocks.\n * @param {Object} options The updated block options, such as selectionStart\n * and selectionEnd.\n */\n\n/**\n * useBlockSync is a side effect which handles bidirectional sync between the\n * block-editor store and a controlling data source which provides blocks. This\n * is most commonly used by the BlockEditorProvider to synchronize the contents\n * of the block-editor store with the root entity, like a post.\n *\n * Another example would be the template part block, which provides blocks from\n * a separate entity data source than a root entity. This hook syncs edits to\n * the template part in the block editor back to the entity and vice-versa.\n *\n * Here are some of its basic functions:\n * - Initalizes the block-editor store for the given clientID to the blocks\n * given via props.\n * - Adds incoming changes (like undo) to the block-editor store.\n * - Adds outgoing changes (like editing content) to the controlling entity,\n * determining if a change should be considered persistent or not.\n * - Handles edge cases and race conditions which occur in those operations.\n * - Ignores changes which happen to other entities (like nested inner block\n * controllers.\n * - Passes selection state from the block-editor store to the controlling entity.\n *\n * @param {Object} props Props for the block sync hook\n * @param {string} props.clientId The client ID of the inner block controller.\n * If none is passed, then it is assumed to be a\n * root controller rather than an inner block\n * controller.\n * @param {Object[]} props.value The control value for the blocks. This value\n * is used to initalize the block-editor store\n * and for resetting the blocks to incoming\n * changes like undo.\n * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.\n * @param {onBlockUpdate} props.onChange Function to call when a persistent\n * change has been made in the block-editor blocks\n * for the given clientId. For example, after\n * this function is called, an entity is marked\n * dirty because it has changes to save.\n * @param {onBlockUpdate} props.onInput Function to call when a non-persistent\n * change has been made in the block-editor blocks\n * for the given clientId. When this is called,\n * controlling sources do not become dirty.\n */\nexport default function useBlockSync( {\n\tclientId = null,\n\tvalue: controlledBlocks,\n\tselection: controlledSelection,\n\tonChange = noop,\n\tonInput = noop,\n} ) {\n\tconst registry = useRegistry();\n\n\tconst {\n\t\tresetBlocks,\n\t\tresetSelection,\n\t\treplaceInnerBlocks,\n\t\tsetHasControlledInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = registry.dispatch( blockEditorStore );\n\tconst { getBlockName, getBlocks, getSelectionStart, getSelectionEnd } =\n\t\tregistry.select( blockEditorStore );\n\tconst isControlled = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t! clientId ||\n\t\t\t\tselect( blockEditorStore ).areInnerBlocksControlled( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst pendingChanges = useRef( { incoming: null, outgoing: [] } );\n\tconst subscribed = useRef( false );\n\n\tconst setControlledBlocks = () => {\n\t\tif ( ! controlledBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't need to persist this change because we only replace\n\t\t// controlled inner blocks when the change was caused by an entity,\n\t\t// and so it would already be persisted.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\t// It is important to batch here because otherwise,\n\t\t\t// as soon as `setHasControlledInnerBlocks` is called\n\t\t\t// the effect to restore might be triggered\n\t\t\t// before the actual blocks get set properly in state.\n\t\t\tregistry.batch( () => {\n\t\t\t\tsetHasControlledInnerBlocks( clientId, true );\n\t\t\t\tconst storeBlocks = controlledBlocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock( block )\n\t\t\t\t);\n\t\t\t\tif ( subscribed.current ) {\n\t\t\t\t\tpendingChanges.current.incoming = storeBlocks;\n\t\t\t\t}\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks( clientId, storeBlocks );\n\t\t\t} );\n\t\t} else {\n\t\t\tif ( subscribed.current ) {\n\t\t\t\tpendingChanges.current.incoming = controlledBlocks;\n\t\t\t}\n\t\t\tresetBlocks( controlledBlocks );\n\t\t}\n\t};\n\n\t// Clean up the changes made by setControlledBlocks() when the component\n\t// containing useBlockSync() unmounts.\n\tconst unsetControlledBlocks = () => {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\tsetHasControlledInnerBlocks( clientId, false );\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceInnerBlocks( clientId, [] );\n\t\t} else {\n\t\t\tresetBlocks( [] );\n\t\t}\n\t};\n\n\t// Add a subscription to the block-editor registry to detect when changes\n\t// have been made. This lets us inform the data source of changes. This\n\t// is an effect so that the subscriber can run synchronously without\n\t// waiting for React renders for changes.\n\tconst onInputRef = useRef( onInput );\n\tconst onChangeRef = useRef( onChange );\n\tuseEffect( () => {\n\t\tonInputRef.current = onInput;\n\t\tonChangeRef.current = onChange;\n\t}, [ onInput, onChange ] );\n\n\t// Determine if blocks need to be reset when they change.\n\tuseEffect( () => {\n\t\tif ( pendingChanges.current.outgoing.includes( controlledBlocks ) ) {\n\t\t\t// Skip block reset if the value matches expected outbound sync\n\t\t\t// triggered by this component by a preceding change detection.\n\t\t\t// Only skip if the value matches expectation, since a reset should\n\t\t\t// still occur if the value is modified (not equal by reference),\n\t\t\t// to allow that the consumer may apply modifications to reflect\n\t\t\t// back on the editor.\n\t\t\tif (\n\t\t\t\tpendingChanges.current.outgoing[\n\t\t\t\t\tpendingChanges.current.outgoing.length - 1\n\t\t\t\t] === controlledBlocks\n\t\t\t) {\n\t\t\t\tpendingChanges.current.outgoing = [];\n\t\t\t}\n\t\t} else if ( getBlocks( clientId ) !== controlledBlocks ) {\n\t\t\t// Reset changing value in all other cases than the sync described\n\t\t\t// above. Since this can be reached in an update following an out-\n\t\t\t// bound sync, unset the outbound value to avoid considering it in\n\t\t\t// subsequent renders.\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\n\t\t\tif ( controlledSelection ) {\n\t\t\t\tresetSelection(\n\t\t\t\t\tcontrolledSelection.selectionStart,\n\t\t\t\t\tcontrolledSelection.selectionEnd,\n\t\t\t\t\tcontrolledSelection.initialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}, [ controlledBlocks, clientId ] );\n\n\tuseEffect( () => {\n\t\t// When the block becomes uncontrolled, it means its inner state has been reset\n\t\t// we need to take the blocks again from the external value property.\n\t\tif ( ! isControlled ) {\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\t\t}\n\t}, [ isControlled ] );\n\n\tuseEffect( () => {\n\t\tconst {\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisLastBlockChangePersistent,\n\t\t\t__unstableIsLastBlockChangeIgnored,\n\t\t\tareInnerBlocksControlled,\n\t\t} = registry.select( blockEditorStore );\n\n\t\tlet blocks = getBlocks( clientId );\n\t\tlet isPersistent = isLastBlockChangePersistent();\n\t\tlet previousAreBlocksDifferent = false;\n\n\t\tsubscribed.current = true;\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Sometimes, when changing block lists, lingering subscriptions\n\t\t\t// might trigger before they are cleaned up. If the block for which\n\t\t\t// the subscription runs is no longer in the store, this would clear\n\t\t\t// its parent entity's block list. To avoid this, we bail out if\n\t\t\t// the subscription is triggering for a block (`clientId !== null`)\n\t\t\t// and its block name can't be found because it's not on the list.\n\t\t\t// (`getBlockName( clientId ) === null`).\n\t\t\tif ( clientId !== null && getBlockName( clientId ) === null )\n\t\t\t\treturn;\n\n\t\t\t// When RESET_BLOCKS on parent blocks get called, the controlled blocks\n\t\t\t// can reset to uncontrolled, in these situations, it means we need to populate\n\t\t\t// the blocks again from the external blocks (the value property here)\n\t\t\t// and we should stop triggering onChange\n\t\t\tconst isStillControlled =\n\t\t\t\t! clientId || areInnerBlocksControlled( clientId );\n\t\t\tif ( ! isStillControlled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newIsPersistent = isLastBlockChangePersistent();\n\t\t\tconst newBlocks = getBlocks( clientId );\n\t\t\tconst areBlocksDifferent = newBlocks !== blocks;\n\t\t\tblocks = newBlocks;\n\t\t\tif (\n\t\t\t\tareBlocksDifferent &&\n\t\t\t\t( pendingChanges.current.incoming ||\n\t\t\t\t\t__unstableIsLastBlockChangeIgnored() )\n\t\t\t) {\n\t\t\t\tpendingChanges.current.incoming = null;\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Since we often dispatch an action to mark the previous action as\n\t\t\t// persistent, we need to make sure that the blocks changed on the\n\t\t\t// previous action before committing the change.\n\t\t\tconst didPersistenceChange =\n\t\t\t\tpreviousAreBlocksDifferent &&\n\t\t\t\t! areBlocksDifferent &&\n\t\t\t\tnewIsPersistent &&\n\t\t\t\t! isPersistent;\n\n\t\t\tif ( areBlocksDifferent || didPersistenceChange ) {\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\t// We know that onChange/onInput will update controlledBlocks.\n\t\t\t\t// We need to be aware that it was caused by an outgoing change\n\t\t\t\t// so that we do not treat it as an incoming change later on,\n\t\t\t\t// which would cause a block reset.\n\t\t\t\tpendingChanges.current.outgoing.push( blocks );\n\n\t\t\t\t// Inform the controlling entity that changes have been made to\n\t\t\t\t// the block-editor store they should be aware about.\n\t\t\t\tconst updateParent = isPersistent\n\t\t\t\t\t? onChangeRef.current\n\t\t\t\t\t: onInputRef.current;\n\t\t\t\tconst undoIgnore = undoIgnoreBlocks.has( blocks );\n\t\t\t\tif ( undoIgnore ) {\n\t\t\t\t\tundoIgnoreBlocks.delete( blocks );\n\t\t\t\t}\n\t\t\t\tupdateParent( blocks, {\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tselectionStart: getSelectionStart(),\n\t\t\t\t\t\tselectionEnd: getSelectionEnd(),\n\t\t\t\t\t\tinitialPosition:\n\t\t\t\t\t\t\tgetSelectedBlocksInitialCaretPosition(),\n\t\t\t\t\t},\n\t\t\t\t\tundoIgnore,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tpreviousAreBlocksDifferent = areBlocksDifferent;\n\t\t}, blockEditorStore );\n\n\t\treturn () => {\n\t\t\tsubscribed.current = false;\n\t\t\tunsubscribe();\n\t\t};\n\t}, [ registry, clientId ] );\n\n\tuseEffect( () => {\n\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9B,cAAc,CAACW,OAAO,CAACR,QAAQ,CAAC+B,IAAI,CAAEV,MAAO,CAAC;;QAE9C;QACA;QACA,MAAMW,YAAY,GAAGV,YAAY,GAC9BX,WAAW,CAACH,OAAO,GACnBE,UAAU,CAACF,OAAO;QACrB,MAAMyB,UAAU,GAAGC,4BAAgB,CAACC,GAAG,CAAEd,MAAO,CAAC;QACjD,IAAKY,UAAU,EAAG;UACjBC,4BAAgB,CAACE,MAAM,CAAEf,MAAO,CAAC;QAClC;QACAW,YAAY,CAAEX,MAAM,EAAE;UACrB7C,SAAS,EAAE;YACVuC,cAAc,EAAExB,iBAAiB,CAAC,CAAC;YACnCyB,YAAY,EAAExB,eAAe,CAAC,CAAC;YAC/ByB,eAAe,EACdC,qCAAqC,CAAC;UACxC,CAAC;UACDe;QACD,CAAE,CAAC;MACJ;MACAV,0BAA0B,GAAGM,kBAAkB;IAChD,CAAC,EAAEzC,YAAiB,CAAC;IAErB,OAAO,MAAM;MACZa,UAAU,CAACO,OAAO,GAAG,KAAK;MAC1BgB,WAAW,CAAC,CAAC;IACd,CAAC;EACF,CAAC,EAAE,CAAE5C,QAAQ,EAAEP,QAAQ,CAAG,CAAC;EAE3B,IAAAuC,kBAAS,EAAE,MAAM;IAChB,OAAO,MAAM;MACZH,qBAAqB,CAAC,CAAC;IACxB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
@@ -4,11 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.Content = void 0;
7
+ exports.Content = Content;
8
8
  var _react = require("react");
9
9
  var _element = require("@wordpress/element");
10
10
  var _blocks = require("@wordpress/blocks");
11
11
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
12
+ var _ = _interopRequireDefault(require("./"));
12
13
  var _utils = require("./utils");
13
14
  /**
14
15
  * WordPress dependencies
@@ -18,37 +19,39 @@ var _utils = require("./utils");
18
19
  * Internal dependencies
19
20
  */
20
21
 
21
- const Content = ({
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+
26
+ function Content({
22
27
  value,
23
28
  tagName: Tag,
24
29
  multiline,
30
+ format,
25
31
  ...props
26
- }) => {
27
- // Handle deprecated `children` and `node` sources.
28
- if (Array.isArray(value)) {
32
+ }) {
33
+ if (_.default.isEmpty(value)) {
34
+ const MultilineTag = (0, _utils.getMultilineTag)(multiline);
35
+ value = MultilineTag ? (0, _react.createElement)(MultilineTag, null) : null;
36
+ } else if (Array.isArray(value)) {
29
37
  (0, _deprecated.default)('wp.blockEditor.RichText value prop as children type', {
30
38
  since: '6.1',
31
39
  version: '6.3',
32
40
  alternative: 'value prop as string',
33
41
  link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
34
42
  });
35
- value = _blocks.children.toHTML(value);
36
- }
37
- const MultilineTag = (0, _utils.getMultilineTag)(multiline);
38
- if (!value && MultilineTag) {
39
- value = `<${MultilineTag}></${MultilineTag}>`;
43
+ value = (0, _react.createElement)(_element.RawHTML, null, _blocks.children.toHTML(value));
44
+ } else if (typeof value === 'string') {
45
+ // To do: deprecate.
46
+ value = (0, _react.createElement)(_element.RawHTML, null, value);
47
+ } else {
48
+ // To do: create a toReactComponent method on RichTextData, which we
49
+ // might in the future also use for the editable tree. See
50
+ // https://github.com/WordPress/gutenberg/pull/41655.
51
+ value = (0, _react.createElement)(_element.RawHTML, null, value.toHTMLString());
40
52
  }
41
- const content = (0, _react.createElement)(_element.RawHTML, null, value);
42
- if (Tag) {
43
- const {
44
- format,
45
- ...restProps
46
- } = props;
47
- return (0, _react.createElement)(Tag, {
48
- ...restProps
49
- }, content);
50
- }
51
- return content;
52
- };
53
- exports.Content = Content;
53
+ return Tag ? (0, _react.createElement)(Tag, {
54
+ ...props
55
+ }, value) : value;
56
+ }
54
57
  //# sourceMappingURL=content.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blocks","_deprecated","_interopRequireDefault","_utils","Content","value","tagName","Tag","multiline","props","Array","isArray","deprecated","since","version","alternative","link","childrenSource","toHTML","MultilineTag","getMultilineTag","content","_react","createElement","RawHTML","format","restProps","exports"],"sources":["@wordpress/block-editor/src/components/rich-text/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\nimport { children as childrenSource } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { getMultilineTag } from './utils';\n\nexport const Content = ( { value, tagName: Tag, multiline, ...props } ) => {\n\t// Handle deprecated `children` and `node` sources.\n\tif ( Array.isArray( value ) ) {\n\t\tdeprecated( 'wp.blockEditor.RichText value prop as children type', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: 'value prop as string',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',\n\t\t} );\n\n\t\tvalue = childrenSource.toHTML( value );\n\t}\n\n\tconst MultilineTag = getMultilineTag( multiline );\n\n\tif ( ! value && MultilineTag ) {\n\t\tvalue = `<${ MultilineTag }></${ MultilineTag }>`;\n\t}\n\n\tconst content = <RawHTML>{ value }</RawHTML>;\n\n\tif ( Tag ) {\n\t\tconst { format, ...restProps } = props;\n\t\treturn <Tag { ...restProps }>{ content }</Tag>;\n\t}\n\n\treturn content;\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGO,MAAMK,OAAO,GAAGA,CAAE;EAAEC,KAAK;EAAEC,OAAO,EAAEC,GAAG;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,KAAM;EAC1E;EACA,IAAKC,KAAK,CAACC,OAAO,CAAEN,KAAM,CAAC,EAAG;IAC7B,IAAAO,mBAAU,EAAE,qDAAqD,EAAE;MAClEC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE,sBAAsB;MACnCC,IAAI,EAAE;IACP,CAAE,CAAC;IAEHX,KAAK,GAAGY,gBAAc,CAACC,MAAM,CAAEb,KAAM,CAAC;EACvC;EAEA,MAAMc,YAAY,GAAG,IAAAC,sBAAe,EAAEZ,SAAU,CAAC;EAEjD,IAAK,CAAEH,KAAK,IAAIc,YAAY,EAAG;IAC9Bd,KAAK,GAAI,IAAIc,YAAc,MAAMA,YAAc,GAAE;EAClD;EAEA,MAAME,OAAO,GAAG,IAAAC,MAAA,CAAAC,aAAA,EAACzB,QAAA,CAAA0B,OAAO,QAAGnB,KAAgB,CAAC;EAE5C,IAAKE,GAAG,EAAG;IACV,MAAM;MAAEkB,MAAM;MAAE,GAAGC;IAAU,CAAC,GAAGjB,KAAK;IACtC,OAAO,IAAAa,MAAA,CAAAC,aAAA,EAAChB,GAAG;MAAA,GAAMmB;IAAS,GAAKL,OAAc,CAAC;EAC/C;EAEA,OAAOA,OAAO;AACf,CAAC;AAACM,OAAA,CAAAvB,OAAA,GAAAA,OAAA"}
1
+ {"version":3,"names":["_element","require","_blocks","_deprecated","_interopRequireDefault","_","_utils","Content","value","tagName","Tag","multiline","format","props","RichText","isEmpty","MultilineTag","getMultilineTag","_react","createElement","Array","isArray","deprecated","since","version","alternative","link","RawHTML","childrenSource","toHTML","toHTMLString"],"sources":["@wordpress/block-editor/src/components/rich-text/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\nimport { children as childrenSource } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport RichText from './';\n\n/**\n * Internal dependencies\n */\nimport { getMultilineTag } from './utils';\n\nexport function Content( {\n\tvalue,\n\ttagName: Tag,\n\tmultiline,\n\tformat,\n\t...props\n} ) {\n\tif ( RichText.isEmpty( value ) ) {\n\t\tconst MultilineTag = getMultilineTag( multiline );\n\t\tvalue = MultilineTag ? <MultilineTag /> : null;\n\t} else if ( Array.isArray( value ) ) {\n\t\tdeprecated( 'wp.blockEditor.RichText value prop as children type', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: 'value prop as string',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',\n\t\t} );\n\t\tvalue = <RawHTML>{ childrenSource.toHTML( value ) }</RawHTML>;\n\t} else if ( typeof value === 'string' ) {\n\t\t// To do: deprecate.\n\t\tvalue = <RawHTML>{ value }</RawHTML>;\n\t} else {\n\t\t// To do: create a toReactComponent method on RichTextData, which we\n\t\t// might in the future also use for the editable tree. See\n\t\t// https://github.com/WordPress/gutenberg/pull/41655.\n\t\tvalue = <RawHTML>{ value.toHTMLString() }</RawHTML>;\n\t}\n\n\treturn Tag ? <Tag { ...props }>{ value }</Tag> : value;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA,IAAAI,CAAA,GAAAD,sBAAA,CAAAH,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAfA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAGO,SAASM,OAAOA,CAAE;EACxBC,KAAK;EACLC,OAAO,EAAEC,GAAG;EACZC,SAAS;EACTC,MAAM;EACN,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKC,SAAQ,CAACC,OAAO,CAAEP,KAAM,CAAC,EAAG;IAChC,MAAMQ,YAAY,GAAG,IAAAC,sBAAe,EAAEN,SAAU,CAAC;IACjDH,KAAK,GAAGQ,YAAY,GAAG,IAAAE,MAAA,CAAAC,aAAA,EAACH,YAAY,MAAE,CAAC,GAAG,IAAI;EAC/C,CAAC,MAAM,IAAKI,KAAK,CAACC,OAAO,CAAEb,KAAM,CAAC,EAAG;IACpC,IAAAc,mBAAU,EAAE,qDAAqD,EAAE;MAClEC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE,sBAAsB;MACnCC,IAAI,EAAE;IACP,CAAE,CAAC;IACHlB,KAAK,GAAG,IAAAU,MAAA,CAAAC,aAAA,EAACnB,QAAA,CAAA2B,OAAO,QAAGC,gBAAc,CAACC,MAAM,CAAErB,KAAM,CAAY,CAAC;EAC9D,CAAC,MAAM,IAAK,OAAOA,KAAK,KAAK,QAAQ,EAAG;IACvC;IACAA,KAAK,GAAG,IAAAU,MAAA,CAAAC,aAAA,EAACnB,QAAA,CAAA2B,OAAO,QAAGnB,KAAgB,CAAC;EACrC,CAAC,MAAM;IACN;IACA;IACA;IACAA,KAAK,GAAG,IAAAU,MAAA,CAAAC,aAAA,EAACnB,QAAA,CAAA2B,OAAO,QAAGnB,KAAK,CAACsB,YAAY,CAAC,CAAY,CAAC;EACpD;EAEA,OAAOpB,GAAG,GAAG,IAAAQ,MAAA,CAAAC,aAAA,EAACT,GAAG;IAAA,GAAMG;EAAK,GAAKL,KAAY,CAAC,GAAGA,KAAK;AACvD"}
@@ -8,6 +8,7 @@ exports.getRichTextValues = getRichTextValues;
8
8
  var _react = require("react");
9
9
  var _element = require("@wordpress/element");
10
10
  var _blocks = require("@wordpress/blocks");
11
+ var _richText = require("@wordpress/rich-text");
11
12
  var _innerBlocks = _interopRequireDefault(require("../inner-blocks"));
12
13
  var _content = require("./content");
13
14
  /**
@@ -88,6 +89,6 @@ function getRichTextValues(blocks = []) {
88
89
  const values = [];
89
90
  addValuesForBlocks(values, blocks);
90
91
  _blocks.__unstableGetBlockProps.skipFilters = false;
91
- return values;
92
+ return values.map(value => value instanceof _richText.RichTextData ? value : _richText.RichTextData.fromHTMLString(value));
92
93
  }
93
94
  //# sourceMappingURL=get-rich-text-values.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blocks","_innerBlocks","_interopRequireDefault","_content","addValuesForElement","element","values","innerBlocks","undefined","Array","isArray","addValuesForElements","type","props","StrictMode","Fragment","children","RawHTML","InnerBlocks","Content","addValuesForBlocks","push","value","el","prototype","render","args","i","length","blocks","name","attributes","saveElement","getSaveElement","_react","createElement","default","getRichTextValues","getBlockProps","skipFilters"],"sources":["@wordpress/block-editor/src/components/rich-text/get-rich-text-values.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RawHTML, StrictMode, Fragment } from '@wordpress/element';\nimport {\n\tgetSaveElement,\n\t__unstableGetBlockProps as getBlockProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport InnerBlocks from '../inner-blocks';\nimport { Content } from './content';\n\n/*\n * This function is similar to `@wordpress/element`'s `renderToString` function,\n * except that it does not render the elements to a string, but instead collects\n * the values of all rich text `Content` elements.\n */\nfunction addValuesForElement( element, values, innerBlocks ) {\n\tif ( null === element || undefined === element || false === element ) {\n\t\treturn;\n\t}\n\n\tif ( Array.isArray( element ) ) {\n\t\treturn addValuesForElements( element, values, innerBlocks );\n\t}\n\n\tswitch ( typeof element ) {\n\t\tcase 'string':\n\t\tcase 'number':\n\t\t\treturn;\n\t}\n\n\tconst { type, props } = element;\n\n\tswitch ( type ) {\n\t\tcase StrictMode:\n\t\tcase Fragment:\n\t\t\treturn addValuesForElements( props.children, values, innerBlocks );\n\t\tcase RawHTML:\n\t\t\treturn;\n\t\tcase InnerBlocks.Content:\n\t\t\treturn addValuesForBlocks( values, innerBlocks );\n\t\tcase Content:\n\t\t\tvalues.push( props.value );\n\t\t\treturn;\n\t}\n\n\tswitch ( typeof type ) {\n\t\tcase 'string':\n\t\t\tif ( typeof props.children !== 'undefined' ) {\n\t\t\t\treturn addValuesForElements(\n\t\t\t\t\tprops.children,\n\t\t\t\t\tvalues,\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn;\n\t\tcase 'function':\n\t\t\tconst el =\n\t\t\t\ttype.prototype && typeof type.prototype.render === 'function'\n\t\t\t\t\t? new type( props ).render()\n\t\t\t\t\t: type( props );\n\t\t\treturn addValuesForElement( el, values, innerBlocks );\n\t}\n}\n\nfunction addValuesForElements( children, ...args ) {\n\tchildren = Array.isArray( children ) ? children : [ children ];\n\n\tfor ( let i = 0; i < children.length; i++ ) {\n\t\taddValuesForElement( children[ i ], ...args );\n\t}\n}\n\nfunction addValuesForBlocks( values, blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tconst { name, attributes, innerBlocks } = blocks[ i ];\n\t\tconst saveElement = getSaveElement(\n\t\t\tname,\n\t\t\tattributes,\n\t\t\t// Instead of letting save elements use `useInnerBlocksProps.save`,\n\t\t\t// force them to use InnerBlocks.Content instead so we can intercept\n\t\t\t// a single component.\n\t\t\t<InnerBlocks.Content />\n\t\t);\n\t\taddValuesForElement( saveElement, values, innerBlocks );\n\t}\n}\n\nexport function getRichTextValues( blocks = [] ) {\n\tgetBlockProps.skipFilters = true;\n\tconst values = [];\n\taddValuesForBlocks( values, blocks );\n\tgetBlockProps.skipFilters = false;\n\treturn values;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA,SAASK,mBAAmBA,CAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAW,EAAG;EAC5D,IAAK,IAAI,KAAKF,OAAO,IAAIG,SAAS,KAAKH,OAAO,IAAI,KAAK,KAAKA,OAAO,EAAG;IACrE;EACD;EAEA,IAAKI,KAAK,CAACC,OAAO,CAAEL,OAAQ,CAAC,EAAG;IAC/B,OAAOM,oBAAoB,CAAEN,OAAO,E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M,EAAED,CAAC,EAAE,EAAG;IAC3CvB,mBAAmB,CAAEY,QAAQ,CAAEW,CAAC,CAAE,EAAE,GAAGD,IAAK,CAAC;EAC9C;AACD;AAEA,SAASN,kBAAkBA,CAAEd,MAAM,EAAEuB,MAAM,EAAG;EAC7C,KAAM,IAAIF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGE,MAAM,CAACD,MAAM,EAAED,CAAC,EAAE,EAAG;IACzC,MAAM;MAAEG,IAAI;MAAEC,UAAU;MAAExB;IAAY,CAAC,GAAGsB,MAAM,CAAEF,CAAC,CAAE;IACrD,MAAMK,WAAW,GAAG,IAAAC,sBAAc,EACjCH,IAAI,EACJC,UAAU;IACV;IACA;IACA;IACA,IAAAG,MAAA,CAAAC,aAAA,EAAClC,YAAA,CAAAmC,OAAW,CAACjB,OAAO,MAAE,CACvB,CAAC;IACDf,mBAAmB,CAAE4B,WAAW,EAAE1B,MAAM,EAAEC,WAAY,CAAC;EACxD;AACD;AAEO,SAAS8B,iBAAiBA,CAAER,MAAM,GAAG,EAAE,EAAG;EAChDS,+BAAa,CAACC,WAAW,GAAG,IAAI;EAChC,MAAMjC,MAAM,GAAG,EAAE;EACjBc,kBAAkB,CAAEd,MAAM,EAAEuB,MAAO,CAAC;EACpCS,+BAAa,CAACC,WAAW,GAAG,KAAK;EACjC,OAAOjC,MAAM;AACd"}
1
+ {"version":3,"names":["_element","require","_blocks","_richText","_innerBlocks","_interopRequireDefault","_content","addValuesForElement","element","values","innerBlocks","undefined","Array","isArray","addValuesForElements","type","props","StrictMode","Fragment","children","RawHTML","InnerBlocks","Content","addValuesForBlocks","push","value","el","prototype","render","args","i","length","blocks","name","attributes","saveElement","getSaveElement","_react","createElement","default","getRichTextValues","getBlockProps","skipFilters","map","RichTextData","fromHTMLString"],"sources":["@wordpress/block-editor/src/components/rich-text/get-rich-text-values.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RawHTML, StrictMode, Fragment } from '@wordpress/element';\nimport {\n\tgetSaveElement,\n\t__unstableGetBlockProps as getBlockProps,\n} from '@wordpress/blocks';\nimport { RichTextData } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport InnerBlocks from '../inner-blocks';\nimport { Content } from './content';\n\n/*\n * This function is similar to `@wordpress/element`'s `renderToString` function,\n * except that it does not render the elements to a string, but instead collects\n * the values of all rich text `Content` elements.\n */\nfunction addValuesForElement( element, values, innerBlocks ) {\n\tif ( null === element || undefined === element || false === element ) {\n\t\treturn;\n\t}\n\n\tif ( Array.isArray( element ) ) {\n\t\treturn addValuesForElements( element, values, innerBlocks );\n\t}\n\n\tswitch ( typeof element ) {\n\t\tcase 'string':\n\t\tcase 'number':\n\t\t\treturn;\n\t}\n\n\tconst { type, props } = element;\n\n\tswitch ( type ) {\n\t\tcase StrictMode:\n\t\tcase Fragment:\n\t\t\treturn addValuesForElements( props.children, values, innerBlocks );\n\t\tcase RawHTML:\n\t\t\treturn;\n\t\tcase InnerBlocks.Content:\n\t\t\treturn addValuesForBlocks( values, innerBlocks );\n\t\tcase Content:\n\t\t\tvalues.push( props.value );\n\t\t\treturn;\n\t}\n\n\tswitch ( typeof type ) {\n\t\tcase 'string':\n\t\t\tif ( typeof props.children !== 'undefined' ) {\n\t\t\t\treturn addValuesForElements(\n\t\t\t\t\tprops.children,\n\t\t\t\t\tvalues,\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn;\n\t\tcase 'function':\n\t\t\tconst el =\n\t\t\t\ttype.prototype && typeof type.prototype.render === 'function'\n\t\t\t\t\t? new type( props ).render()\n\t\t\t\t\t: type( props );\n\t\t\treturn addValuesForElement( el, values, innerBlocks );\n\t}\n}\n\nfunction addValuesForElements( children, ...args ) {\n\tchildren = Array.isArray( children ) ? children : [ children ];\n\n\tfor ( let i = 0; i < children.length; i++ ) {\n\t\taddValuesForElement( children[ i ], ...args );\n\t}\n}\n\nfunction addValuesForBlocks( values, blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tconst { name, attributes, innerBlocks } = blocks[ i ];\n\t\tconst saveElement = getSaveElement(\n\t\t\tname,\n\t\t\tattributes,\n\t\t\t// Instead of letting save elements use `useInnerBlocksProps.save`,\n\t\t\t// force them to use InnerBlocks.Content instead so we can intercept\n\t\t\t// a single component.\n\t\t\t<InnerBlocks.Content />\n\t\t);\n\t\taddValuesForElement( saveElement, values, innerBlocks );\n\t}\n}\n\nexport function getRichTextValues( blocks = [] ) {\n\tgetBlockProps.skipFilters = true;\n\tconst values = [];\n\taddValuesForBlocks( values, blocks );\n\tgetBlockProps.skipFilters = false;\n\treturn values.map( ( value ) =>\n\t\tvalue instanceof RichTextData\n\t\t\t? value\n\t\t\t: RichTextData.fromHTMLString( value )\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA,SAASM,mBAAmBA,CAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAW,EAAG;EAC5D,IAAK,IAAI,KAAKF,OAAO,IAAIG,SAAS,KAAKH,OAAO,IAAI,KAAK,KAAKA,OAAO,EAAG;IACrE;EACD;EAEA,IAAKI,KAAK,CAACC,OAAO,CAAEL,OAAQ,CAAC,EAAG;IAC/B,OAAOM,oBAAoB,CAAEN,OAAO,EAAEC,MAAM,EAAEC,WAAY,CAAC;EAC5D;EAEA,QAAS,OAAOF,OAAO;IACtB,KAAK,QAAQ;IACb,KAAK,QAAQ;MACZ;EACF;EAEA,MAAM;IAAEO,IAAI;IAAEC;EAAM,CAAC,GAAGR,OAAO;EAE/B,QAASO,IAAI;IACZ,KAAKE,mBAAU;IACf,KAAKC,iBAAQ;MACZ,O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AACD,MAAM,EAAED,CAAC,EAAE,EAAG;IACzC,MAAM;MAAEG,IAAI;MAAEC,UAAU;MAAExB;IAAY,CAAC,GAAGsB,MAAM,CAAEF,CAAC,CAAE;IACrD,MAAMK,WAAW,GAAG,IAAAC,sBAAc,EACjCH,IAAI,EACJC,UAAU;IACV;IACA;IACA;IACA,IAAAG,MAAA,CAAAC,aAAA,EAAClC,YAAA,CAAAmC,OAAW,CAACjB,OAAO,MAAE,CACvB,CAAC;IACDf,mBAAmB,CAAE4B,WAAW,EAAE1B,MAAM,EAAEC,WAAY,CAAC;EACxD;AACD;AAEO,SAAS8B,iBAAiBA,CAAER,MAAM,GAAG,EAAE,EAAG;EAChDS,+BAAa,CAACC,WAAW,GAAG,IAAI;EAChC,MAAMjC,MAAM,GAAG,EAAE;EACjBc,kBAAkB,CAAEd,MAAM,EAAEuB,MAAO,CAAC;EACpCS,+BAAa,CAACC,WAAW,GAAG,KAAK;EACjC,OAAOjC,MAAM,CAACkC,GAAG,CAAIlB,KAAK,IACzBA,KAAK,YAAYmB,sBAAY,GAC1BnB,KAAK,GACLmB,sBAAY,CAACC,cAAc,CAAEpB,KAAM,CACvC,CAAC;AACF"}
@@ -28,10 +28,8 @@ var _react = require("react");
28
28
  var _classnames = _interopRequireDefault(require("classnames"));
29
29
  var _element = require("@wordpress/element");
30
30
  var _data = require("@wordpress/data");
31
- var _blocks = require("@wordpress/blocks");
32
31
  var _compose = require("@wordpress/compose");
33
32
  var _richText = require("@wordpress/rich-text");
34
- var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
35
33
  var _components = require("@wordpress/components");
36
34
  var _autocomplete = require("../autocomplete");
37
35
  var _blockEdit = require("../block-edit");
@@ -53,7 +51,7 @@ var _useFirefoxCompat = require("./use-firefox-compat");
53
51
  var _formatEdit = _interopRequireDefault(require("./format-edit"));
54
52
  var _utils = require("./utils");
55
53
  var _content = require("./content");
56
- var _multiline = _interopRequireDefault(require("./multiline"));
54
+ var _withDeprecations = require("./with-deprecations");
57
55
  var _shortcut = require("./shortcut");
58
56
  var _toolbarButton = require("./toolbar-button");
59
57
  var _inputEvent = require("./input-event");
@@ -135,9 +133,17 @@ function RichTextWrapper({
135
133
  props = removeNativeProps(props);
136
134
  const anchorRef = (0, _element.useRef)();
137
135
  const {
138
- clientId
136
+ clientId,
137
+ isSelected: isBlockSelected
139
138
  } = (0, _blockEdit.useBlockEditContext)();
140
139
  const selector = select => {
140
+ // Avoid subscribing to the block editor store if the block is not
141
+ // selected.
142
+ if (!isBlockSelected) {
143
+ return {
144
+ isSelected: false
145
+ };
146
+ }
141
147
  const {
142
148
  getSelectionStart,
143
149
  getSelectionEnd
@@ -156,14 +162,11 @@ function RichTextWrapper({
156
162
  isSelected
157
163
  };
158
164
  };
159
- // This selector must run on every render so the right selection state is
160
- // retrieved from the store on merge.
161
- // To do: fix this somehow.
162
165
  const {
163
166
  selectionStart,
164
167
  selectionEnd,
165
168
  isSelected
166
- } = (0, _data.useSelect)(selector);
169
+ } = (0, _data.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]);
167
170
  const {
168
171
  getSelectionStart,
169
172
  getSelectionEnd,
@@ -305,7 +308,11 @@ function RichTextWrapper({
305
308
  "aria-label": placeholder,
306
309
  ...props,
307
310
  ...autocompleteProps,
308
- ref: (0, _compose.useMergeRefs)([forwardedRef, autocompleteProps.ref, props.ref, richTextRef, (0, _useBeforeInputRules.useBeforeInputRules)({
311
+ ref: (0, _compose.useMergeRefs)([
312
+ // Rich text ref must be first because its focus listener
313
+ // must be set up before any other ref calls .focus() on
314
+ // mount.
315
+ richTextRef, forwardedRef, autocompleteProps.ref, props.ref, (0, _useBeforeInputRules.useBeforeInputRules)({
309
316
  value,
310
317
  onChange
311
318
  }), (0, _useInputRules.useInputRules)({
@@ -350,36 +357,11 @@ function RichTextWrapper({
350
357
  // tabIndex because Safari will focus the element. However,
351
358
  // Safari will correctly ignore nested contentEditable elements.
352
359
  ,
353
- tabIndex: props.tabIndex === 0 ? null : props.tabIndex
360
+ tabIndex: props.tabIndex === 0 ? null : props.tabIndex,
361
+ "data-wp-block-attribute-key": identifier
354
362
  }));
355
363
  }
356
- const ForwardedRichTextWrapper = (0, _element.forwardRef)(RichTextWrapper);
357
- function RichTextSwitcher(props, ref) {
358
- let value = props.value;
359
- let onChange = props.onChange;
360
-
361
- // Handle deprecated format.
362
- if (Array.isArray(value)) {
363
- (0, _deprecated.default)('wp.blockEditor.RichText value prop as children type', {
364
- since: '6.1',
365
- version: '6.3',
366
- alternative: 'value prop as string',
367
- link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
368
- });
369
- value = _blocks.children.toHTML(props.value);
370
- onChange = newValue => props.onChange(_blocks.children.fromDOM((0, _richText.__unstableCreateElement)(document, newValue).childNodes));
371
- }
372
- const Component = props.multiline ? _multiline.default : ForwardedRichTextWrapper;
373
- const instanceId = (0, _compose.useInstanceId)(RichTextSwitcher);
374
- return (0, _react.createElement)(Component, {
375
- ...props,
376
- identifier: props.identifier || instanceId,
377
- value: value,
378
- onChange: onChange,
379
- ref: ref
380
- });
381
- }
382
- const ForwardedRichTextContainer = (0, _element.forwardRef)(RichTextSwitcher);
364
+ const ForwardedRichTextContainer = (0, _withDeprecations.withDeprecations)((0, _element.forwardRef)(RichTextWrapper));
383
365
  ForwardedRichTextContainer.Content = _content.Content;
384
366
  ForwardedRichTextContainer.isEmpty = value => {
385
367
  return !value || value.length === 0;