@wordpress/block-editor 10.3.0 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +0 -1
  3. package/build/components/alignment-control/ui.js +1 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-alignment-control/constants.js +1 -1
  6. package/build/components/block-alignment-control/constants.js.map +1 -1
  7. package/build/components/block-alignment-matrix-control/index.js +1 -1
  8. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  9. package/build/components/block-compare/index.js +1 -3
  10. package/build/components/block-compare/index.js.map +1 -1
  11. package/build/components/block-edit/index.js +4 -2
  12. package/build/components/block-edit/index.js.map +1 -1
  13. package/build/components/block-list/block.js +3 -1
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-lock/menu-item.js +1 -1
  16. package/build/components/block-lock/menu-item.js.map +1 -1
  17. package/build/components/block-lock/modal.js +16 -9
  18. package/build/components/block-lock/modal.js.map +1 -1
  19. package/build/components/block-popover/inbetween.js +2 -1
  20. package/build/components/block-popover/inbetween.js.map +1 -1
  21. package/build/components/block-popover/index.js +2 -1
  22. package/build/components/block-popover/index.js.map +1 -1
  23. package/build/components/block-preview/index.js +2 -4
  24. package/build/components/block-preview/index.js.map +1 -1
  25. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -8
  26. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  27. package/build/components/block-styles/utils.js +3 -3
  28. package/build/components/block-styles/utils.js.map +1 -1
  29. package/build/components/block-switcher/index.js +21 -12
  30. package/build/components/block-switcher/index.js.map +1 -1
  31. package/build/components/block-switcher/preview-block-popover.js +1 -1
  32. package/build/components/block-switcher/preview-block-popover.js.map +1 -1
  33. package/build/components/block-tools/insertion-point.js +12 -2
  34. package/build/components/block-tools/insertion-point.js.map +1 -1
  35. package/build/components/block-tools/selected-block-popover.js +27 -4
  36. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  37. package/build/components/block-vertical-alignment-control/ui.js +1 -1
  38. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  39. package/build/components/border-radius-control/all-input-control.js +2 -1
  40. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  41. package/build/components/border-radius-control/index.js +2 -1
  42. package/build/components/border-radius-control/index.js.map +1 -1
  43. package/build/components/border-radius-control/input-controls.js +2 -1
  44. package/build/components/border-radius-control/input-controls.js.map +1 -1
  45. package/build/components/colors/with-colors.js +4 -3
  46. package/build/components/colors/with-colors.js.map +1 -1
  47. package/build/components/duotone-control/index.js +1 -1
  48. package/build/components/duotone-control/index.js.map +1 -1
  49. package/build/components/font-sizes/fluid-utils.js +24 -40
  50. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  51. package/build/components/font-sizes/with-font-sizes.js +8 -6
  52. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  53. package/build/components/iframe/index.js +1 -1
  54. package/build/components/iframe/index.js.map +1 -1
  55. package/build/components/image-editor/constants.js +1 -1
  56. package/build/components/image-editor/constants.js.map +1 -1
  57. package/build/components/index.js +9 -0
  58. package/build/components/index.js.map +1 -1
  59. package/build/components/inner-blocks/index.js +10 -4
  60. package/build/components/inner-blocks/index.js.map +1 -1
  61. package/build/components/inserter/hooks/use-insertion-point.js +2 -7
  62. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  63. package/build/components/inserter/reusable-blocks-tab.js +4 -1
  64. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  65. package/build/components/inserter/search-items.js +23 -2
  66. package/build/components/inserter/search-items.js.map +1 -1
  67. package/build/components/line-height-control/index.js +2 -1
  68. package/build/components/line-height-control/index.js.map +1 -1
  69. package/build/components/link-control/index.js +18 -34
  70. package/build/components/link-control/index.js.map +1 -1
  71. package/build/components/link-control/search-input.js +1 -1
  72. package/build/components/link-control/search-input.js.map +1 -1
  73. package/build/components/link-control/use-internal-input-value.js +26 -0
  74. package/build/components/link-control/use-internal-input-value.js.map +1 -0
  75. package/build/components/list-view/block.js +5 -3
  76. package/build/components/list-view/block.js.map +1 -1
  77. package/build/components/list-view/branch.js +9 -3
  78. package/build/components/list-view/branch.js.map +1 -1
  79. package/build/components/list-view/drop-indicator.js +2 -1
  80. package/build/components/list-view/drop-indicator.js.map +1 -1
  81. package/build/components/media-replace-flow/index.js +1 -1
  82. package/build/components/media-replace-flow/index.js.map +1 -1
  83. package/build/components/off-canvas-editor/block-contents.js +100 -0
  84. package/build/components/off-canvas-editor/block-contents.js.map +1 -0
  85. package/build/components/off-canvas-editor/block-select-button.js +119 -0
  86. package/build/components/off-canvas-editor/block-select-button.js.map +1 -0
  87. package/build/components/off-canvas-editor/block.js +292 -0
  88. package/build/components/off-canvas-editor/block.js.map +1 -0
  89. package/build/components/off-canvas-editor/branch.js +181 -0
  90. package/build/components/off-canvas-editor/branch.js.map +1 -0
  91. package/build/components/off-canvas-editor/context.js +19 -0
  92. package/build/components/off-canvas-editor/context.js.map +1 -0
  93. package/build/components/off-canvas-editor/drop-indicator.js +118 -0
  94. package/build/components/off-canvas-editor/drop-indicator.js.map +1 -0
  95. package/build/components/off-canvas-editor/expander.js +41 -0
  96. package/build/components/off-canvas-editor/expander.js.map +1 -0
  97. package/build/components/off-canvas-editor/index.js +204 -0
  98. package/build/components/off-canvas-editor/index.js.map +1 -0
  99. package/build/components/off-canvas-editor/leaf.js +60 -0
  100. package/build/components/off-canvas-editor/leaf.js.map +1 -0
  101. package/build/components/off-canvas-editor/use-block-selection.js +139 -0
  102. package/build/components/off-canvas-editor/use-block-selection.js.map +1 -0
  103. package/build/components/off-canvas-editor/use-list-view-client-ids.js +33 -0
  104. package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  105. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +235 -0
  106. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  107. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +60 -0
  108. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  109. package/build/components/off-canvas-editor/utils.js +60 -0
  110. package/build/components/off-canvas-editor/utils.js.map +1 -0
  111. package/build/components/rich-text/format-toolbar/index.js +1 -1
  112. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  113. package/build/components/rich-text/format-toolbar-container.js +1 -1
  114. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  115. package/build/components/rich-text/use-paste-handler.js +1 -1
  116. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  117. package/build/components/spacing-sizes-control/all-input-control.js +6 -2
  118. package/build/components/spacing-sizes-control/all-input-control.js.map +1 -1
  119. package/build/components/spacing-sizes-control/axial-input-controls.js +6 -2
  120. package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
  121. package/build/components/spacing-sizes-control/index.js +6 -2
  122. package/build/components/spacing-sizes-control/index.js.map +1 -1
  123. package/build/components/spacing-sizes-control/input-controls.js +6 -2
  124. package/build/components/spacing-sizes-control/input-controls.js.map +1 -1
  125. package/build/components/spacing-sizes-control/spacing-input-control.js +12 -5
  126. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  127. package/build/components/url-input/index.js +1 -1
  128. package/build/components/url-input/index.js.map +1 -1
  129. package/build/components/url-popover/index.js +31 -2
  130. package/build/components/url-popover/index.js.map +1 -1
  131. package/build/components/use-setting/index.js +1 -1
  132. package/build/components/use-setting/index.js.map +1 -1
  133. package/build/hooks/border.js +1 -0
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/color-panel.js +17 -1
  136. package/build/hooks/color-panel.js.map +1 -1
  137. package/build/hooks/color.js +1 -1
  138. package/build/hooks/color.js.map +1 -1
  139. package/build/hooks/content-lock-ui.js +13 -6
  140. package/build/hooks/content-lock-ui.js.map +1 -1
  141. package/build/hooks/dimensions.js +72 -13
  142. package/build/hooks/dimensions.js.map +1 -1
  143. package/build/hooks/font-size.js +1 -0
  144. package/build/hooks/font-size.js.map +1 -1
  145. package/build/hooks/layout.js +5 -4
  146. package/build/hooks/layout.js.map +1 -1
  147. package/build/hooks/margin.js +26 -18
  148. package/build/hooks/margin.js.map +1 -1
  149. package/build/hooks/min-height.js +145 -0
  150. package/build/hooks/min-height.js.map +1 -0
  151. package/build/hooks/padding.js +22 -13
  152. package/build/hooks/padding.js.map +1 -1
  153. package/build/hooks/style.js +3 -2
  154. package/build/hooks/style.js.map +1 -1
  155. package/build/hooks/utils.js +7 -6
  156. package/build/hooks/utils.js.map +1 -1
  157. package/build/layouts/constrained.js +0 -1
  158. package/build/layouts/constrained.js.map +1 -1
  159. package/build/layouts/flex.js +23 -22
  160. package/build/layouts/flex.js.map +1 -1
  161. package/build/store/actions.js +30 -0
  162. package/build/store/actions.js.map +1 -1
  163. package/build/store/array.js +1 -7
  164. package/build/store/array.js.map +1 -1
  165. package/build/store/reducer.js +46 -14
  166. package/build/store/reducer.js.map +1 -1
  167. package/build/store/selectors.js +62 -31
  168. package/build/store/selectors.js.map +1 -1
  169. package/build-module/components/alignment-control/ui.js +1 -1
  170. package/build-module/components/alignment-control/ui.js.map +1 -1
  171. package/build-module/components/block-alignment-control/constants.js +1 -1
  172. package/build-module/components/block-alignment-control/constants.js.map +1 -1
  173. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  174. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  175. package/build-module/components/block-compare/index.js +2 -3
  176. package/build-module/components/block-compare/index.js.map +1 -1
  177. package/build-module/components/block-edit/index.js +4 -2
  178. package/build-module/components/block-edit/index.js.map +1 -1
  179. package/build-module/components/block-list/block.js +3 -1
  180. package/build-module/components/block-list/block.js.map +1 -1
  181. package/build-module/components/block-lock/menu-item.js +2 -2
  182. package/build-module/components/block-lock/menu-item.js.map +1 -1
  183. package/build-module/components/block-lock/modal.js +17 -10
  184. package/build-module/components/block-lock/modal.js.map +1 -1
  185. package/build-module/components/block-popover/inbetween.js +2 -1
  186. package/build-module/components/block-popover/inbetween.js.map +1 -1
  187. package/build-module/components/block-popover/index.js +2 -1
  188. package/build-module/components/block-popover/index.js.map +1 -1
  189. package/build-module/components/block-preview/index.js +2 -3
  190. package/build-module/components/block-preview/index.js.map +1 -1
  191. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -7
  192. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  193. package/build-module/components/block-styles/utils.js +3 -3
  194. package/build-module/components/block-styles/utils.js.map +1 -1
  195. package/build-module/components/block-switcher/index.js +21 -11
  196. package/build-module/components/block-switcher/index.js.map +1 -1
  197. package/build-module/components/block-switcher/preview-block-popover.js +1 -1
  198. package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
  199. package/build-module/components/block-tools/insertion-point.js +12 -2
  200. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  201. package/build-module/components/block-tools/selected-block-popover.js +27 -5
  202. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  203. package/build-module/components/block-vertical-alignment-control/ui.js +1 -1
  204. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  205. package/build-module/components/border-radius-control/all-input-control.js +2 -1
  206. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  207. package/build-module/components/border-radius-control/index.js +2 -1
  208. package/build-module/components/border-radius-control/index.js.map +1 -1
  209. package/build-module/components/border-radius-control/input-controls.js +2 -1
  210. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  211. package/build-module/components/colors/with-colors.js +5 -4
  212. package/build-module/components/colors/with-colors.js.map +1 -1
  213. package/build-module/components/duotone-control/index.js +1 -1
  214. package/build-module/components/duotone-control/index.js.map +1 -1
  215. package/build-module/components/font-sizes/fluid-utils.js +24 -40
  216. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  217. package/build-module/components/font-sizes/with-font-sizes.js +9 -7
  218. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  219. package/build-module/components/iframe/index.js +1 -1
  220. package/build-module/components/iframe/index.js.map +1 -1
  221. package/build-module/components/image-editor/constants.js +1 -1
  222. package/build-module/components/image-editor/constants.js.map +1 -1
  223. package/build-module/components/index.js +1 -0
  224. package/build-module/components/index.js.map +1 -1
  225. package/build-module/components/inner-blocks/index.js +10 -4
  226. package/build-module/components/inner-blocks/index.js.map +1 -1
  227. package/build-module/components/inserter/hooks/use-insertion-point.js +2 -6
  228. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  229. package/build-module/components/inserter/reusable-blocks-tab.js +3 -1
  230. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  231. package/build-module/components/inserter/search-items.js +23 -3
  232. package/build-module/components/inserter/search-items.js.map +1 -1
  233. package/build-module/components/line-height-control/index.js +2 -1
  234. package/build-module/components/line-height-control/index.js.map +1 -1
  235. package/build-module/components/link-control/index.js +17 -34
  236. package/build-module/components/link-control/index.js.map +1 -1
  237. package/build-module/components/link-control/search-input.js +1 -1
  238. package/build-module/components/link-control/search-input.js.map +1 -1
  239. package/build-module/components/link-control/use-internal-input-value.js +18 -0
  240. package/build-module/components/link-control/use-internal-input-value.js.map +1 -0
  241. package/build-module/components/list-view/block.js +5 -3
  242. package/build-module/components/list-view/block.js.map +1 -1
  243. package/build-module/components/list-view/branch.js +9 -3
  244. package/build-module/components/list-view/branch.js.map +1 -1
  245. package/build-module/components/list-view/drop-indicator.js +2 -1
  246. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  247. package/build-module/components/media-replace-flow/index.js +1 -1
  248. package/build-module/components/media-replace-flow/index.js.map +1 -1
  249. package/build-module/components/off-canvas-editor/block-contents.js +85 -0
  250. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -0
  251. package/build-module/components/off-canvas-editor/block-select-button.js +101 -0
  252. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -0
  253. package/build-module/components/off-canvas-editor/block.js +268 -0
  254. package/build-module/components/off-canvas-editor/block.js.map +1 -0
  255. package/build-module/components/off-canvas-editor/branch.js +165 -0
  256. package/build-module/components/off-canvas-editor/branch.js.map +1 -0
  257. package/build-module/components/off-canvas-editor/context.js +7 -0
  258. package/build-module/components/off-canvas-editor/context.js.map +1 -0
  259. package/build-module/components/off-canvas-editor/drop-indicator.js +111 -0
  260. package/build-module/components/off-canvas-editor/drop-indicator.js.map +1 -0
  261. package/build-module/components/off-canvas-editor/expander.js +32 -0
  262. package/build-module/components/off-canvas-editor/expander.js.map +1 -0
  263. package/build-module/components/off-canvas-editor/index.js +181 -0
  264. package/build-module/components/off-canvas-editor/index.js.map +1 -0
  265. package/build-module/components/off-canvas-editor/leaf.js +45 -0
  266. package/build-module/components/off-canvas-editor/leaf.js.map +1 -0
  267. package/build-module/components/off-canvas-editor/use-block-selection.js +124 -0
  268. package/build-module/components/off-canvas-editor/use-block-selection.js.map +1 -0
  269. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +24 -0
  270. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  271. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +220 -0
  272. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  273. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +50 -0
  274. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  275. package/build-module/components/off-canvas-editor/utils.js +44 -0
  276. package/build-module/components/off-canvas-editor/utils.js.map +1 -0
  277. package/build-module/components/rich-text/format-toolbar/index.js +1 -1
  278. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  279. package/build-module/components/rich-text/format-toolbar-container.js +1 -1
  280. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  281. package/build-module/components/rich-text/use-paste-handler.js +1 -1
  282. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  283. package/build-module/components/spacing-sizes-control/all-input-control.js +6 -2
  284. package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -1
  285. package/build-module/components/spacing-sizes-control/axial-input-controls.js +6 -2
  286. package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
  287. package/build-module/components/spacing-sizes-control/index.js +6 -2
  288. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  289. package/build-module/components/spacing-sizes-control/input-controls.js +6 -2
  290. package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -1
  291. package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -5
  292. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  293. package/build-module/components/url-input/index.js +1 -1
  294. package/build-module/components/url-input/index.js.map +1 -1
  295. package/build-module/components/url-popover/index.js +30 -3
  296. package/build-module/components/url-popover/index.js.map +1 -1
  297. package/build-module/components/use-setting/index.js +1 -1
  298. package/build-module/components/use-setting/index.js.map +1 -1
  299. package/build-module/hooks/border.js +1 -0
  300. package/build-module/hooks/border.js.map +1 -1
  301. package/build-module/hooks/color-panel.js +17 -1
  302. package/build-module/hooks/color-panel.js.map +1 -1
  303. package/build-module/hooks/color.js +1 -1
  304. package/build-module/hooks/color.js.map +1 -1
  305. package/build-module/hooks/content-lock-ui.js +15 -8
  306. package/build-module/hooks/content-lock-ui.js.map +1 -1
  307. package/build-module/hooks/dimensions.js +67 -12
  308. package/build-module/hooks/dimensions.js.map +1 -1
  309. package/build-module/hooks/font-size.js +1 -0
  310. package/build-module/hooks/font-size.js.map +1 -1
  311. package/build-module/hooks/layout.js +6 -5
  312. package/build-module/hooks/layout.js.map +1 -1
  313. package/build-module/hooks/margin.js +27 -19
  314. package/build-module/hooks/margin.js.map +1 -1
  315. package/build-module/hooks/min-height.js +122 -0
  316. package/build-module/hooks/min-height.js.map +1 -0
  317. package/build-module/hooks/padding.js +23 -14
  318. package/build-module/hooks/padding.js.map +1 -1
  319. package/build-module/hooks/style.js +4 -3
  320. package/build-module/hooks/style.js.map +1 -1
  321. package/build-module/hooks/utils.js +7 -7
  322. package/build-module/hooks/utils.js.map +1 -1
  323. package/build-module/layouts/constrained.js +0 -1
  324. package/build-module/layouts/constrained.js.map +1 -1
  325. package/build-module/layouts/flex.js +24 -23
  326. package/build-module/layouts/flex.js.map +1 -1
  327. package/build-module/store/actions.js +26 -0
  328. package/build-module/store/actions.js.map +1 -1
  329. package/build-module/store/array.js +1 -6
  330. package/build-module/store/array.js.map +1 -1
  331. package/build-module/store/reducer.js +44 -14
  332. package/build-module/store/reducer.js.map +1 -1
  333. package/build-module/store/selectors.js +59 -31
  334. package/build-module/store/selectors.js.map +1 -1
  335. package/build-style/style-rtl.css +88 -88
  336. package/build-style/style.css +84 -84
  337. package/package.json +29 -28
  338. package/src/components/alignment-control/README.md +1 -1
  339. package/src/components/alignment-control/ui.js +1 -1
  340. package/src/components/block-alignment-control/constants.js +1 -1
  341. package/src/components/block-alignment-control/test/index.native.js +4 -4
  342. package/src/components/block-alignment-matrix-control/index.js +1 -1
  343. package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +13 -11
  344. package/src/components/block-breadcrumb/test/index.js +1 -1
  345. package/src/components/block-compare/index.js +3 -2
  346. package/src/components/block-draggable/test/helpers.native.js +3 -3
  347. package/src/components/block-draggable/test/index.native.js +27 -27
  348. package/src/components/block-edit/index.js +2 -1
  349. package/src/components/block-list/block.js +2 -0
  350. package/src/components/block-list/style.scss +11 -6
  351. package/src/components/block-lock/menu-item.js +5 -2
  352. package/src/components/block-lock/modal.js +19 -36
  353. package/src/components/block-lock/style.scss +8 -17
  354. package/src/components/block-mover/stories/index.js +1 -1
  355. package/src/components/block-mover/style.scss +35 -1
  356. package/src/components/block-popover/inbetween.js +1 -0
  357. package/src/components/block-popover/index.js +1 -0
  358. package/src/components/block-popover/style.scss +1 -5
  359. package/src/components/block-preview/index.js +8 -3
  360. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -7
  361. package/src/components/block-styles/utils.js +3 -3
  362. package/src/components/block-switcher/index.js +21 -11
  363. package/src/components/block-switcher/preview-block-popover.js +1 -1
  364. package/src/components/block-tools/insertion-point.js +10 -1
  365. package/src/components/block-tools/selected-block-popover.js +80 -34
  366. package/src/components/block-tools/style.scss +15 -0
  367. package/src/components/block-variation-picker/README.md +1 -1
  368. package/src/components/block-vertical-alignment-control/ui.js +1 -1
  369. package/src/components/border-radius-control/all-input-control.js +1 -0
  370. package/src/components/border-radius-control/index.js +1 -0
  371. package/src/components/border-radius-control/input-controls.js +1 -0
  372. package/src/components/border-radius-control/style.scss +15 -24
  373. package/src/components/color-palette/test/__snapshots__/control.js.snap +85 -83
  374. package/src/components/color-palette/test/control.js +1 -1
  375. package/src/components/colors/with-colors.js +13 -23
  376. package/src/components/default-block-appender/style.scss +1 -0
  377. package/src/components/duotone-control/index.js +1 -1
  378. package/src/components/font-sizes/fluid-utils.js +37 -64
  379. package/src/components/font-sizes/test/fluid-utils.js +5 -5
  380. package/src/components/font-sizes/with-font-sizes.js +15 -13
  381. package/src/components/iframe/index.js +1 -1
  382. package/src/components/image-editor/constants.js +1 -1
  383. package/src/components/index.js +1 -0
  384. package/src/components/inner-blocks/index.js +11 -4
  385. package/src/components/inner-blocks/test/index.js +4 -0
  386. package/src/components/inserter/hooks/use-insertion-point.js +3 -11
  387. package/src/components/inserter/reusable-blocks-tab.js +4 -2
  388. package/src/components/inserter/search-items.js +23 -3
  389. package/src/components/inserter/style.scss +8 -7
  390. package/src/components/inserter/test/reusable-blocks-tab.js +14 -57
  391. package/src/components/inserter/test/search-items.js +6 -0
  392. package/src/components/inserter-list-item/style.scss +2 -0
  393. package/src/components/letter-spacing-control/README.md +55 -0
  394. package/src/components/line-height-control/index.js +1 -0
  395. package/src/components/link-control/README.md +3 -3
  396. package/src/components/link-control/index.js +23 -39
  397. package/src/components/link-control/search-input.js +1 -1
  398. package/src/components/link-control/test/index.js +272 -241
  399. package/src/components/link-control/use-internal-input-value.js +22 -0
  400. package/src/components/list-view/block.js +4 -3
  401. package/src/components/list-view/branch.js +11 -6
  402. package/src/components/list-view/drop-indicator.js +1 -0
  403. package/src/components/list-view/style.scss +1 -36
  404. package/src/components/media-replace-flow/index.js +1 -1
  405. package/src/components/media-replace-flow/test/index.js +69 -51
  406. package/src/components/off-canvas-editor/README.md +5 -0
  407. package/src/components/off-canvas-editor/block-contents.js +89 -0
  408. package/src/components/off-canvas-editor/block-select-button.js +113 -0
  409. package/src/components/off-canvas-editor/block.js +335 -0
  410. package/src/components/off-canvas-editor/branch.js +210 -0
  411. package/src/components/off-canvas-editor/context.js +8 -0
  412. package/src/components/off-canvas-editor/drop-indicator.js +126 -0
  413. package/src/components/off-canvas-editor/expander.js +26 -0
  414. package/src/components/off-canvas-editor/index.js +216 -0
  415. package/src/components/off-canvas-editor/leaf.js +48 -0
  416. package/src/components/off-canvas-editor/style.scss +397 -0
  417. package/src/components/off-canvas-editor/test/utils.js +50 -0
  418. package/src/components/off-canvas-editor/use-block-selection.js +169 -0
  419. package/src/components/off-canvas-editor/use-list-view-client-ids.js +29 -0
  420. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +260 -0
  421. package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +58 -0
  422. package/src/components/off-canvas-editor/utils.js +58 -0
  423. package/src/components/responsive-block-control/test/index.js +69 -92
  424. package/src/components/rich-text/format-toolbar/index.js +1 -1
  425. package/src/components/rich-text/format-toolbar-container.js +1 -1
  426. package/src/components/rich-text/use-paste-handler.js +1 -1
  427. package/src/components/spacing-sizes-control/all-input-control.js +4 -0
  428. package/src/components/spacing-sizes-control/axial-input-controls.js +4 -0
  429. package/src/components/spacing-sizes-control/index.js +4 -0
  430. package/src/components/spacing-sizes-control/input-controls.js +4 -0
  431. package/src/components/spacing-sizes-control/spacing-input-control.js +10 -1
  432. package/src/components/spacing-sizes-control/style.scss +1 -0
  433. package/src/components/url-input/index.js +1 -1
  434. package/src/components/url-popover/README.md +12 -3
  435. package/src/components/url-popover/index.js +33 -3
  436. package/src/components/use-setting/index.js +7 -1
  437. package/src/hooks/border.js +1 -0
  438. package/src/hooks/color-panel.js +13 -1
  439. package/src/hooks/color.js +2 -0
  440. package/src/hooks/content-lock-ui.js +46 -34
  441. package/src/hooks/dimensions.js +106 -19
  442. package/src/hooks/font-size.js +1 -0
  443. package/src/hooks/layout.js +8 -11
  444. package/src/hooks/margin.js +23 -17
  445. package/src/hooks/min-height.js +121 -0
  446. package/src/hooks/padding.js +23 -19
  447. package/src/hooks/style.js +10 -2
  448. package/src/hooks/test/align.js +96 -72
  449. package/src/hooks/test/style.js +4 -0
  450. package/src/hooks/test/use-typography-props.js +1 -1
  451. package/src/hooks/utils.js +5 -6
  452. package/src/layouts/constrained.js +0 -1
  453. package/src/layouts/flex.js +44 -39
  454. package/src/store/actions.js +26 -0
  455. package/src/store/array.js +1 -6
  456. package/src/store/reducer.js +50 -40
  457. package/src/store/selectors.js +43 -29
  458. package/src/store/test/actions.js +18 -0
  459. package/src/store/test/reducer.js +40 -0
  460. package/src/store/test/selectors.js +20 -1
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useListViewClientIds;
7
+
8
+ var _data = require("@wordpress/data");
9
+
10
+ var _store = require("../../store");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+ function useListViewClientIds(blocks) {
20
+ return (0, _data.useSelect)(select => {
21
+ const {
22
+ getDraggedBlockClientIds,
23
+ getSelectedBlockClientIds,
24
+ __unstableGetClientIdsTree
25
+ } = select(_store.store);
26
+ return {
27
+ selectedClientIds: getSelectedBlockClientIds(),
28
+ draggedClientIds: getDraggedBlockClientIds(),
29
+ clientIdsTree: blocks ? blocks : __unstableGetClientIdsTree()
30
+ };
31
+ }, [blocks]);
32
+ }
33
+ //# sourceMappingURL=use-list-view-client-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","select","getDraggedBlockClientIds","getSelectedBlockClientIds","__unstableGetClientIdsTree","blockEditorStore","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,oBAAT,CAA+BC,MAA/B,EAAwC;AACtD,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,YAAF,CAJV;AAMA,WAAO;AACNC,MAAAA,iBAAiB,EAAEH,yBAAyB,EADtC;AAENI,MAAAA,gBAAgB,EAAEL,wBAAwB,EAFpC;AAGNM,MAAAA,aAAa,EAAER,MAAM,GAAGA,MAAH,GAAYI,0BAA0B;AAHrD,KAAP;AAKA,GAbK,EAcN,CAAEJ,MAAF,CAdM,CAAP;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useListViewClientIds( blocks ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetClientIdsTree,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree: blocks ? blocks : __unstableGetClientIdsTree(),\n\t\t\t};\n\t\t},\n\t\t[ blocks ]\n\t);\n}\n"]}
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = useListViewDropZone;
9
+
10
+ var _data = require("@wordpress/data");
11
+
12
+ var _element = require("@wordpress/element");
13
+
14
+ var _compose = require("@wordpress/compose");
15
+
16
+ var _math = require("../../utils/math");
17
+
18
+ var _useOnBlockDrop = _interopRequireDefault(require("../use-on-block-drop"));
19
+
20
+ var _store = require("../../store");
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+
30
+ /** @typedef {import('../../utils/math').WPPoint} WPPoint */
31
+
32
+ /**
33
+ * The type of a drag event.
34
+ *
35
+ * @typedef {'default'|'file'|'html'} WPDragEventType
36
+ */
37
+
38
+ /**
39
+ * An array representing data for blocks in the DOM used by drag and drop.
40
+ *
41
+ * @typedef {Object} WPListViewDropZoneBlocks
42
+ * @property {string} clientId The client id for the block.
43
+ * @property {string} rootClientId The root client id for the block.
44
+ * @property {number} blockIndex The block's index.
45
+ * @property {Element} element The DOM element representing the block.
46
+ * @property {number} innerBlockCount The number of inner blocks the block has.
47
+ * @property {boolean} isDraggedBlock Whether the block is currently being dragged.
48
+ * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.
49
+ * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.
50
+ */
51
+
52
+ /**
53
+ * An object containing details of a drop target.
54
+ *
55
+ * @typedef {Object} WPListViewDropZoneTarget
56
+ * @property {string} blockIndex The insertion index.
57
+ * @property {string} rootClientId The root client id for the block.
58
+ * @property {string|undefined} clientId The client id for the block.
59
+ * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.
60
+ * 'inside' refers to nesting as an inner block.
61
+ */
62
+
63
+ /**
64
+ * Determines whether the user positioning the dragged block to nest as an
65
+ * inner block.
66
+ *
67
+ * Presently this is determined by whether the cursor is on the right hand side
68
+ * of the block.
69
+ *
70
+ * @param {WPPoint} point The point representing the cursor position when dragging.
71
+ * @param {DOMRect} rect The rectangle.
72
+ */
73
+ function isNestingGesture(point, rect) {
74
+ const blockCenterX = rect.left + rect.width / 2;
75
+ return point.x > blockCenterX;
76
+ } // Block navigation is always a vertical list, so only allow dropping
77
+ // to the above or below a block.
78
+
79
+
80
+ const ALLOWED_DROP_EDGES = ['top', 'bottom'];
81
+ /**
82
+ * Given blocks data and the cursor position, compute the drop target.
83
+ *
84
+ * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
85
+ * @param {WPPoint} position The point representing the cursor position when dragging.
86
+ *
87
+ * @return {WPListViewDropZoneTarget} An object containing data about the drop target.
88
+ */
89
+
90
+ function getListViewDropTarget(blocksData, position) {
91
+ let candidateEdge;
92
+ let candidateBlockData;
93
+ let candidateDistance;
94
+ let candidateRect;
95
+
96
+ for (const blockData of blocksData) {
97
+ if (blockData.isDraggedBlock) {
98
+ continue;
99
+ }
100
+
101
+ const rect = blockData.element.getBoundingClientRect();
102
+ const [distance, edge] = (0, _math.getDistanceToNearestEdge)(position, rect, ALLOWED_DROP_EDGES);
103
+ const isCursorWithinBlock = (0, _math.isPointContainedByRect)(position, rect);
104
+
105
+ if (candidateDistance === undefined || distance < candidateDistance || isCursorWithinBlock) {
106
+ candidateDistance = distance;
107
+ const index = blocksData.indexOf(blockData);
108
+ const previousBlockData = blocksData[index - 1]; // If dragging near the top of a block and the preceding block
109
+ // is at the same level, use the preceding block as the candidate
110
+ // instead, as later it makes determining a nesting drop easier.
111
+
112
+ if (edge === 'top' && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) {
113
+ candidateBlockData = previousBlockData;
114
+ candidateEdge = 'bottom';
115
+ candidateRect = previousBlockData.element.getBoundingClientRect();
116
+ } else {
117
+ candidateBlockData = blockData;
118
+ candidateEdge = edge;
119
+ candidateRect = rect;
120
+ } // If the mouse position is within the block, break early
121
+ // as the user would intend to drop either before or after
122
+ // this block.
123
+ //
124
+ // This solves an issue where some rows in the list view
125
+ // tree overlap slightly due to sub-pixel rendering.
126
+
127
+
128
+ if (isCursorWithinBlock) {
129
+ break;
130
+ }
131
+ }
132
+ }
133
+
134
+ if (!candidateBlockData) {
135
+ return;
136
+ }
137
+
138
+ const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether
139
+ // they might be trying to nest the block as a child.
140
+ // If the block already has inner blocks, this should always be treated
141
+ // as nesting since the next block in the tree will be the first child.
142
+
143
+ if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 || isNestingGesture(position, candidateRect))) {
144
+ return {
145
+ rootClientId: candidateBlockData.clientId,
146
+ blockIndex: 0,
147
+ dropPosition: 'inside'
148
+ };
149
+ } // If dropping as a sibling, but block cannot be inserted in
150
+ // this context, return early.
151
+
152
+
153
+ if (!candidateBlockData.canInsertDraggedBlocksAsSibling) {
154
+ return;
155
+ }
156
+
157
+ const offset = isDraggingBelow ? 1 : 0;
158
+ return {
159
+ rootClientId: candidateBlockData.rootClientId,
160
+ clientId: candidateBlockData.clientId,
161
+ blockIndex: candidateBlockData.blockIndex + offset,
162
+ dropPosition: candidateEdge
163
+ };
164
+ }
165
+ /**
166
+ * A react hook for implementing a drop zone in list view.
167
+ *
168
+ * @return {WPListViewDropZoneTarget} The drop target.
169
+ */
170
+
171
+
172
+ function useListViewDropZone() {
173
+ const {
174
+ getBlockRootClientId,
175
+ getBlockIndex,
176
+ getBlockCount,
177
+ getDraggedBlockClientIds,
178
+ canInsertBlocks
179
+ } = (0, _data.useSelect)(_store.store);
180
+ const [target, setTarget] = (0, _element.useState)();
181
+ const {
182
+ rootClientId: targetRootClientId,
183
+ blockIndex: targetBlockIndex
184
+ } = target || {};
185
+ const onBlockDrop = (0, _useOnBlockDrop.default)(targetRootClientId, targetBlockIndex);
186
+ const draggedBlockClientIds = getDraggedBlockClientIds();
187
+ const throttled = (0, _compose.useThrottle)((0, _element.useCallback)((event, currentTarget) => {
188
+ const position = {
189
+ x: event.clientX,
190
+ y: event.clientY
191
+ };
192
+ const isBlockDrag = !!(draggedBlockClientIds !== null && draggedBlockClientIds !== void 0 && draggedBlockClientIds.length);
193
+ const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]'));
194
+ const blocksData = blockElements.map(blockElement => {
195
+ const clientId = blockElement.dataset.block;
196
+ const rootClientId = getBlockRootClientId(clientId);
197
+ return {
198
+ clientId,
199
+ rootClientId,
200
+ blockIndex: getBlockIndex(clientId),
201
+ element: blockElement,
202
+ isDraggedBlock: isBlockDrag ? draggedBlockClientIds.includes(clientId) : false,
203
+ innerBlockCount: getBlockCount(clientId),
204
+ canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true,
205
+ canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true
206
+ };
207
+ });
208
+ const newTarget = getListViewDropTarget(blocksData, position);
209
+
210
+ if (newTarget) {
211
+ setTarget(newTarget);
212
+ }
213
+ }, [draggedBlockClientIds]), 200);
214
+ const ref = (0, _compose.__experimentalUseDropZone)({
215
+ onDrop: onBlockDrop,
216
+
217
+ onDragOver(event) {
218
+ // `currentTarget` is only available while the event is being
219
+ // handled, so get it now and pass it to the thottled function.
220
+ // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
221
+ throttled(event, event.currentTarget);
222
+ },
223
+
224
+ onDragEnd() {
225
+ throttled.cancel();
226
+ setTarget(null);
227
+ }
228
+
229
+ });
230
+ return {
231
+ ref,
232
+ target
233
+ };
234
+ }
235
+ //# sourceMappingURL=use-list-view-drop-zone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/use-list-view-drop-zone.js"],"names":["isNestingGesture","point","rect","blockCenterX","left","width","x","ALLOWED_DROP_EDGES","getListViewDropTarget","blocksData","position","candidateEdge","candidateBlockData","candidateDistance","candidateRect","blockData","isDraggedBlock","element","getBoundingClientRect","distance","edge","isCursorWithinBlock","undefined","index","indexOf","previousBlockData","rootClientId","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","clientId","blockIndex","dropPosition","canInsertDraggedBlocksAsSibling","offset","useListViewDropZone","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","blockEditorStore","target","setTarget","targetRootClientId","targetBlockIndex","onBlockDrop","draggedBlockClientIds","throttled","event","currentTarget","clientX","y","clientY","isBlockDrag","length","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","includes","newTarget","ref","onDrop","onDragOver","onDragEnd","cancel"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAQA;;AAIA;;AACA;;AAlBA;AACA;AACA;;AAQA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,KAA3B,EAAkCC,IAAlC,EAAyC;AACxC,QAAMC,YAAY,GAAGD,IAAI,CAACE,IAAL,GAAYF,IAAI,CAACG,KAAL,GAAa,CAA9C;AACA,SAAOJ,KAAK,CAACK,CAAN,GAAUH,YAAjB;AACA,C,CAED;AACA;;;AACA,MAAMI,kBAAkB,GAAG,CAAE,KAAF,EAAS,QAAT,CAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,qBAAT,CAAgCC,UAAhC,EAA4CC,QAA5C,EAAuD;AACtD,MAAIC,aAAJ;AACA,MAAIC,kBAAJ;AACA,MAAIC,iBAAJ;AACA,MAAIC,aAAJ;;AAEA,OAAM,MAAMC,SAAZ,IAAyBN,UAAzB,EAAsC;AACrC,QAAKM,SAAS,CAACC,cAAf,EAAgC;AAC/B;AACA;;AAED,UAAMd,IAAI,GAAGa,SAAS,CAACE,OAAV,CAAkBC,qBAAlB,EAAb;AACA,UAAM,CAAEC,QAAF,EAAYC,IAAZ,IAAqB,oCAC1BV,QAD0B,EAE1BR,IAF0B,EAG1BK,kBAH0B,CAA3B;AAMA,UAAMc,mB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CAAZ;AAcA,SAAO;AAAEuB,IAAAA,GAAF;AAAOxB,IAAAA;AAAP,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlocks\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Presently this is determined by whether the cursor is on the right hand side\n * of the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n */\nfunction isNestingGesture( point, rect ) {\n\tconst blockCenterX = rect.left + rect.width / 2;\n\treturn point.x > blockCenterX;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n *\n * @return {WPListViewDropZoneTarget} An object containing data about the drop target.\n */\nfunction getListViewDropTarget( blocksData, position ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\n\tfor ( const blockData of blocksData ) {\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, this should always be treated\n\t// as nesting since the next block in the tree will be the first child.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( candidateBlockData.innerBlockCount > 0 ||\n\t\t\tisNestingGesture( position, candidateRect ) )\n\t) {\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tblockIndex: 0,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone() {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag\n\t\t\t\t\t\t\t? draggedBlockClientIds.includes( clientId )\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget( blocksData, position );\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ draggedBlockClientIds ]\n\t\t),\n\t\t200\n\t);\n\n\tconst ref = useDropZone( {\n\t\tonDrop: onBlockDrop,\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tsetTarget( null );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useListViewExpandSelectedItem;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _data = require("@wordpress/data");
11
+
12
+ var _store = require("../../store");
13
+
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+ function useListViewExpandSelectedItem(_ref) {
22
+ let {
23
+ firstSelectedBlockClientId,
24
+ setExpandedState
25
+ } = _ref;
26
+ const [selectedTreeId, setSelectedTreeId] = (0, _element.useState)(null);
27
+ const {
28
+ selectedBlockParentClientIds
29
+ } = (0, _data.useSelect)(select => {
30
+ const {
31
+ getBlockParents
32
+ } = select(_store.store);
33
+ return {
34
+ selectedBlockParentClientIds: getBlockParents(firstSelectedBlockClientId, false)
35
+ };
36
+ }, [firstSelectedBlockClientId]);
37
+ const parentClientIds = Array.isArray(selectedBlockParentClientIds) && selectedBlockParentClientIds.length ? selectedBlockParentClientIds : null; // Expand tree when a block is selected.
38
+
39
+ (0, _element.useEffect)(() => {
40
+ // If the selectedTreeId is the same as the selected block,
41
+ // it means that the block was selected using the block list tree.
42
+ if (selectedTreeId === firstSelectedBlockClientId) {
43
+ return;
44
+ } // If the selected block has parents, get the top-level parent.
45
+
46
+
47
+ if (parentClientIds) {
48
+ // If the selected block has parents,
49
+ // expand the tree branch.
50
+ setExpandedState({
51
+ type: 'expand',
52
+ clientIds: selectedBlockParentClientIds
53
+ });
54
+ }
55
+ }, [firstSelectedBlockClientId]);
56
+ return {
57
+ setSelectedTreeId
58
+ };
59
+ }
60
+ //# sourceMappingURL=use-list-view-expand-selected-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/use-list-view-expand-selected-item.js"],"names":["useListViewExpandSelectedItem","firstSelectedBlockClientId","setExpandedState","selectedTreeId","setSelectedTreeId","selectedBlockParentClientIds","select","getBlockParents","blockEditorStore","parentClientIds","Array","isArray","length","type","clientIds"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,6BAAT,OAGX;AAAA,MAHmD;AACtDC,IAAAA,0BADsD;AAEtDC,IAAAA;AAFsD,GAGnD;AACH,QAAM,CAAEC,cAAF,EAAkBC,iBAAlB,IAAwC,uBAAU,IAAV,CAA9C;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAmC,qBACtCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,YAAF,CAAlC;AACA,WAAO;AACNH,MAAAA,4BAA4B,EAAEE,eAAe,CAC5CN,0BAD4C,EAE5C,KAF4C;AADvC,KAAP;AAMA,GATuC,EAUxC,CAAEA,0BAAF,CAVwC,CAAzC;AAaA,QAAMQ,eAAe,GACpBC,KAAK,CAACC,OAAN,CAAeN,4BAAf,KACAA,4BAA4B,CAACO,MAD7B,GAEGP,4BAFH,GAGG,IAJJ,CAfG,CAqBH;;AACA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKF,cAAc,KAAKF,0BAAxB,EAAqD;AACpD;AACA,KALe,CAOhB;;;AACA,QAAKQ,eAAL,EAAuB;AACtB;AACA;AACAP,MAAAA,gBAAgB,CAAE;AACjBW,QAAAA,IAAI,EAAE,QADW;AAEjBC,QAAAA,SAAS,EAAET;AAFM,OAAF,CAAhB;AAIA;AACD,GAhBD,EAgBG,CAAEJ,0BAAF,CAhBH;AAkBA,SAAO;AACNG,IAAAA;AADM,GAAP;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useListViewExpandSelectedItem( {\n\tfirstSelectedBlockClientId,\n\tsetExpandedState,\n} ) {\n\tconst [ selectedTreeId, setSelectedTreeId ] = useState( null );\n\tconst { selectedBlockParentClientIds } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tselectedBlockParentClientIds: getBlockParents(\n\t\t\t\t\tfirstSelectedBlockClientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ firstSelectedBlockClientId ]\n\t);\n\n\tconst parentClientIds =\n\t\tArray.isArray( selectedBlockParentClientIds ) &&\n\t\tselectedBlockParentClientIds.length\n\t\t\t? selectedBlockParentClientIds\n\t\t\t: null;\n\n\t// Expand tree when a block is selected.\n\tuseEffect( () => {\n\t\t// If the selectedTreeId is the same as the selected block,\n\t\t// it means that the block was selected using the block list tree.\n\t\tif ( selectedTreeId === firstSelectedBlockClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the selected block has parents, get the top-level parent.\n\t\tif ( parentClientIds ) {\n\t\t\t// If the selected block has parents,\n\t\t\t// expand the tree branch.\n\t\t\tsetExpandedState( {\n\t\t\t\ttype: 'expand',\n\t\t\t\tclientIds: selectedBlockParentClientIds,\n\t\t\t} );\n\t\t}\n\t}, [ firstSelectedBlockClientId ] );\n\n\treturn {\n\t\tsetSelectedTreeId,\n\t};\n}\n"]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBlockPositionDescription = void 0;
7
+ exports.getCommonDepthClientIds = getCommonDepthClientIds;
8
+ exports.isClientIdSelected = void 0;
9
+
10
+ var _i18n = require("@wordpress/i18n");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ const getBlockPositionDescription = (position, siblingCount, level) => (0, _i18n.sprintf)(
16
+ /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
17
+ (0, _i18n.__)('Block %1$d of %2$d, Level %3$d'), position, siblingCount, level);
18
+ /**
19
+ * Returns true if the client ID occurs within the block selection or multi-selection,
20
+ * or false otherwise.
21
+ *
22
+ * @param {string} clientId Block client ID.
23
+ * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs.
24
+ *
25
+ * @return {boolean} Whether the block is in multi-selection set.
26
+ */
27
+
28
+
29
+ exports.getBlockPositionDescription = getBlockPositionDescription;
30
+
31
+ const isClientIdSelected = (clientId, selectedBlockClientIds) => Array.isArray(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId;
32
+ /**
33
+ * From a start and end clientId of potentially different nesting levels,
34
+ * return the nearest-depth ids that have a common level of depth in the
35
+ * nesting hierarchy. For multiple block selection, this ensure that the
36
+ * selection is always at the same nesting level, and not split across
37
+ * separate levels.
38
+ *
39
+ * @param {string} startId The first id of a selection.
40
+ * @param {string} endId The end id of a selection, usually one that has been clicked on.
41
+ * @param {string[]} startParents An array of ancestor ids for the start id, in descending order.
42
+ * @param {string[]} endParents An array of ancestor ids for the end id, in descending order.
43
+ * @return {Object} An object containing the start and end ids.
44
+ */
45
+
46
+
47
+ exports.isClientIdSelected = isClientIdSelected;
48
+
49
+ function getCommonDepthClientIds(startId, endId, startParents, endParents) {
50
+ const startPath = [...startParents, startId];
51
+ const endPath = [...endParents, endId];
52
+ const depth = Math.min(startPath.length, endPath.length) - 1;
53
+ const start = startPath[depth];
54
+ const end = endPath[depth];
55
+ return {
56
+ start,
57
+ end
58
+ };
59
+ }
60
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/utils.js"],"names":["getBlockPositionDescription","position","siblingCount","level","isClientIdSelected","clientId","selectedBlockClientIds","Array","isArray","length","indexOf","getCommonDepthClientIds","startId","endId","startParents","endParents","startPath","endPath","depth","Math","min","start","end"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,2BAA2B,GAAG,CAAEC,QAAF,EAAYC,YAAZ,EAA0BC,KAA1B,KAC1C;AACC;AACA,cAAI,gCAAJ,CAFD,EAGCF,QAHD,EAICC,YAJD,EAKCC,KALD,CADM;AASP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,kBAAkB,GAAG,CAAEC,QAAF,EAAYC,sBAAZ,KACjCC,KAAK,CAACC,OAAN,CAAeF,sBAAf,KAA2CA,sBAAsB,CAACG,MAAlE,GACGH,sBAAsB,CAACI,OAAvB,CAAgCL,QAAhC,MAA+C,CAAC,CADnD,GAEGC,sBAAsB,KAAKD,QAHxB;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASM,uBAAT,CACNC,OADM,EAENC,KAFM,EAGNC,YAHM,EAINC,UAJM,EAKL;AACD,QAAMC,SAAS,GAAG,CAAE,GAAGF,YAAL,EAAmBF,OAAnB,CAAlB;AACA,QAAMK,OAAO,GAAG,CAAE,GAAGF,UAAL,EAAiBF,KAAjB,CAAhB;AACA,QAAMK,KAAK,GAAGC,IAAI,CAACC,GAAL,CAAUJ,SAAS,CAACP,MAApB,EAA4BQ,OAAO,CAACR,MAApC,IAA+C,CAA7D;AACA,QAAMY,KAAK,GAAGL,SAAS,CAAEE,KAAF,CAAvB;AACA,QAAMI,GAAG,GAAGL,OAAO,CAAEC,KAAF,CAAnB;AAEA,SAAO;AACNG,IAAAA,KADM;AAENC,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\nexport const getBlockPositionDescription = ( position, siblingCount, level ) =>\n\tsprintf(\n\t\t/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */\n\t\t__( 'Block %1$d of %2$d, Level %3$d' ),\n\t\tposition,\n\t\tsiblingCount,\n\t\tlevel\n\t);\n\n/**\n * Returns true if the client ID occurs within the block selection or multi-selection,\n * or false otherwise.\n *\n * @param {string} clientId Block client ID.\n * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs.\n *\n * @return {boolean} Whether the block is in multi-selection set.\n */\nexport const isClientIdSelected = ( clientId, selectedBlockClientIds ) =>\n\tArray.isArray( selectedBlockClientIds ) && selectedBlockClientIds.length\n\t\t? selectedBlockClientIds.indexOf( clientId ) !== -1\n\t\t: selectedBlockClientIds === clientId;\n\n/**\n * From a start and end clientId of potentially different nesting levels,\n * return the nearest-depth ids that have a common level of depth in the\n * nesting hierarchy. For multiple block selection, this ensure that the\n * selection is always at the same nesting level, and not split across\n * separate levels.\n *\n * @param {string} startId The first id of a selection.\n * @param {string} endId The end id of a selection, usually one that has been clicked on.\n * @param {string[]} startParents An array of ancestor ids for the start id, in descending order.\n * @param {string[]} endParents An array of ancestor ids for the end id, in descending order.\n * @return {Object} An object containing the start and end ids.\n */\nexport function getCommonDepthClientIds(\n\tstartId,\n\tendId,\n\tstartParents,\n\tendParents\n) {\n\tconst startPath = [ ...startParents, startId ];\n\tconst endPath = [ ...endParents, endId ];\n\tconst depth = Math.min( startPath.length, endPath.length ) - 1;\n\tconst start = startPath[ depth ];\n\tconst end = endPath[ depth ];\n\n\treturn {\n\t\tstart,\n\t\tend,\n\t};\n}\n"]}
@@ -28,7 +28,7 @@ var _icons = require("@wordpress/icons");
28
28
  */
29
29
  const POPOVER_PROPS = {
30
30
  position: 'bottom right',
31
- isAlternate: true
31
+ variant: 'toolbar'
32
32
  };
33
33
 
34
34
  const FormatToolbar = () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/format-toolbar/index.js"],"names":["POPOVER_PROPS","position","isAlternate","FormatToolbar","map","format","fills","length","allProps","props","hasActive","some","isActive","toggleProps","chevronDown","className","describedBy"],"mappings":";;;;;;;;;;;AAIA;;AACA;;AAMA;;AACA;;AACA;;AAbA;AACA;AACA;;AAKA;AACA;AACA;AAMA,MAAMA,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAE,cADW;AAErBC,EAAAA,WAAW,EAAE;AAFQ,CAAtB;;AAKA,MAAMC,aAAa,GAAG,MAAM;AAC3B,SACC,qDACG,CAAE,MAAF,EAAU,QAAV,EAAoB,MAApB,EAA6BC,GAA7B,CAAoCC,MAAF,IACnC,4BAAC,gBAAD;AACC,IAAA,IAAI,EAAI,4BAA4BA,MAAQ,EAD7C;AAEC,IAAA,GAAG,EAAGA;AAFP,IADC,CADH,EAOC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC;AAAX,KACKC,KAAF,IAAa;AACd,QAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB;AACrB,aAAO,IAAP;AACA;;AAED,UAAMC,QAAQ,GAAGF,KAAK,CAACF,GAAN,CAAW;AAAA,UAAE,CAAE;AAAEK,QAAAA;AAAF,OAAF,CAAF;AAAA,aAAqBA,KAArB;AAAA,KAAX,CAAjB;AACA,UAAMC,SAAS,GAAGF,QAAQ,CAACG,IAAT,CACjB;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aAAoBA,QAApB;AAAA,KADiB,CAAlB;AAIA,WACC,4BAAC,uBAAD,QACKC,WAAF,IACD,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAGC;AACP;AAFD;AAGC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAHT;AAIC,MAAA,WAAW,EAAG,EACb,GAAGD,WADU;AAEbE,QAAAA,SAAS,EAAE,yBACVF,WAAW,CAACE,SADF,EAEV;AAAE,wBAAcL;AAAhB,SAFU,CAFE;AAMbM,QAAAA,WAAW,EAAE,cACZ,2BADY;AANA,OAJf;AAcC,MAAA,QAAQ,EAAG,qBACVV,KAAK,CAACF,GAAN,CAAW;AAAA,YAAE,CAAE;AAAEK,UAAAA;AAAF,SAAF,CAAF;AAAA,eAAqBA,KAArB;AAAA,OAAX,CADU,EAEV,OAFU,CAdZ;AAkBC,MAAA,YAAY,EAAGT;AAlBhB,MAFF,CADD;AA0BA,GArCF,CAPD,CADD;AAiDA,CAlDD;;eAoDeG,a","sourcesContent":["/**\n * External dependencies\n */\n\nimport { orderBy } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarItem, DropdownMenu, Slot } from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n\tisAlternate: true,\n};\n\nconst FormatToolbar = () => {\n\treturn (\n\t\t<>\n\t\t\t{ [ 'bold', 'italic', 'link' ].map( ( format ) => (\n\t\t\t\t<Slot\n\t\t\t\t\tname={ `RichText.ToolbarControls.${ format }` }\n\t\t\t\t\tkey={ format }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t<Slot name=\"RichText.ToolbarControls\">\n\t\t\t\t{ ( fills ) => {\n\t\t\t\t\tif ( ! fills.length ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst allProps = fills.map( ( [ { props } ] ) => props );\n\t\t\t\t\tconst hasActive = allProps.some(\n\t\t\t\t\t\t( { isActive } ) => isActive\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolbarItem>\n\t\t\t\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'More' ) }\n\t\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t\t\t\t\ttoggleProps.className,\n\t\t\t\t\t\t\t\t\t\t\t{ 'is-pressed': hasActive }\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tdescribedBy: __(\n\t\t\t\t\t\t\t\t\t\t\t'Displays more block tools'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tcontrols={ orderBy(\n\t\t\t\t\t\t\t\t\t\tfills.map( ( [ { props } ] ) => props ),\n\t\t\t\t\t\t\t\t\t\t'title'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolbarItem>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Slot>\n\t\t</>\n\t);\n};\n\nexport default FormatToolbar;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/format-toolbar/index.js"],"names":["POPOVER_PROPS","position","variant","FormatToolbar","map","format","fills","length","allProps","props","hasActive","some","isActive","toggleProps","chevronDown","className","describedBy"],"mappings":";;;;;;;;;;;AAIA;;AACA;;AAMA;;AACA;;AACA;;AAbA;AACA;AACA;;AAKA;AACA;AACA;AAMA,MAAMA,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAE,cADW;AAErBC,EAAAA,OAAO,EAAE;AAFY,CAAtB;;AAKA,MAAMC,aAAa,GAAG,MAAM;AAC3B,SACC,qDACG,CAAE,MAAF,EAAU,QAAV,EAAoB,MAApB,EAA6BC,GAA7B,CAAoCC,MAAF,IACnC,4BAAC,gBAAD;AACC,IAAA,IAAI,EAAI,4BAA4BA,MAAQ,EAD7C;AAEC,IAAA,GAAG,EAAGA;AAFP,IADC,CADH,EAOC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC;AAAX,KACKC,KAAF,IAAa;AACd,QAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB;AACrB,aAAO,IAAP;AACA;;AAED,UAAMC,QAAQ,GAAGF,KAAK,CAACF,GAAN,CAAW;AAAA,UAAE,CAAE;AAAEK,QAAAA;AAAF,OAAF,CAAF;AAAA,aAAqBA,KAArB;AAAA,KAAX,CAAjB;AACA,UAAMC,SAAS,GAAGF,QAAQ,CAACG,IAAT,CACjB;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aAAoBA,QAApB;AAAA,KADiB,CAAlB;AAIA,WACC,4BAAC,uBAAD,QACKC,WAAF,IACD,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAGC;AACP;AAFD;AAGC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAHT;AAIC,MAAA,WAAW,EAAG,EACb,GAAGD,WADU;AAEbE,QAAAA,SAAS,EAAE,yBACVF,WAAW,CAACE,SADF,EAEV;AAAE,wBAAcL;AAAhB,SAFU,CAFE;AAMbM,QAAAA,WAAW,EAAE,cACZ,2BADY;AANA,OAJf;AAcC,MAAA,QAAQ,EAAG,qBACVV,KAAK,CAACF,GAAN,CAAW;AAAA,YAAE,CAAE;AAAEK,UAAAA;AAAF,SAAF,CAAF;AAAA,eAAqBA,KAArB;AAAA,OAAX,CADU,EAEV,OAFU,CAdZ;AAkBC,MAAA,YAAY,EAAGT;AAlBhB,MAFF,CADD;AA0BA,GArCF,CAPD,CADD;AAiDA,CAlDD;;eAoDeG,a","sourcesContent":["/**\n * External dependencies\n */\n\nimport { orderBy } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarItem, DropdownMenu, Slot } from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n\tvariant: 'toolbar',\n};\n\nconst FormatToolbar = () => {\n\treturn (\n\t\t<>\n\t\t\t{ [ 'bold', 'italic', 'link' ].map( ( format ) => (\n\t\t\t\t<Slot\n\t\t\t\t\tname={ `RichText.ToolbarControls.${ format }` }\n\t\t\t\t\tkey={ format }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t<Slot name=\"RichText.ToolbarControls\">\n\t\t\t\t{ ( fills ) => {\n\t\t\t\t\tif ( ! fills.length ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst allProps = fills.map( ( [ { props } ] ) => props );\n\t\t\t\t\tconst hasActive = allProps.some(\n\t\t\t\t\t\t( { isActive } ) => isActive\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolbarItem>\n\t\t\t\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'More' ) }\n\t\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t\t\t\t\ttoggleProps.className,\n\t\t\t\t\t\t\t\t\t\t\t{ 'is-pressed': hasActive }\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tdescribedBy: __(\n\t\t\t\t\t\t\t\t\t\t\t'Displays more block tools'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tcontrols={ orderBy(\n\t\t\t\t\t\t\t\t\t\tfills.map( ( [ { props } ] ) => props ),\n\t\t\t\t\t\t\t\t\t\t'title'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolbarItem>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Slot>\n\t\t</>\n\t);\n};\n\nexport default FormatToolbar;\n"]}
@@ -56,7 +56,7 @@ function InlineToolbar(_ref2) {
56
56
  popoverAnchor
57
57
  } = _ref2;
58
58
  return (0, _element.createElement)(_components.Popover, {
59
- position: "top center",
59
+ placement: "top",
60
60
  focusOnMount: false,
61
61
  anchor: popoverAnchor,
62
62
  className: "block-editor-rich-text__inline-format-toolbar",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/format-toolbar-container.js"],"names":["InlineSelectionToolbar","value","editableContentElement","activeFormats","lastFormat","length","lastFormatType","type","settings","select","richTextStore","getFormatType","popoverAnchor","InlineToolbar","FormatToolbarContainer","inline","hasInlineToolbar","blockEditorStore","getSettings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAWA;AACA;AACA;AAMA,SAASA,sBAAT,OAII;AAAA,MAJ6B;AAChCC,IAAAA,KADgC;AAEhCC,IAAAA,sBAFgC;AAGhCC,IAAAA;AAHgC,GAI7B;AACH,QAAMC,UAAU,GAAGD,aAAa,CAAEA,aAAa,CAACE,MAAd,GAAuB,CAAzB,CAAhC;AACA,QAAMC,cAAc,GAAGF,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEG,IAAnC;AACA,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IAAcA,MAAM,CAAEC,eAAF,CAAN,CAAwBC,aAAxB,CAAuCL,cAAvC,CADE,EAEhB,CAAEA,cAAF,CAFgB,CAAjB;AAIA,QAAMM,aAAa,GAAG,yBAAW;AAChCV,IAAAA,sBADgC;AAEhCD,IAAAA,KAFgC;AAGhCO,IAAAA;AAHgC,GAAX,CAAtB;AAMA,SAAO,4BAAC,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**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Popover, ToolbarGroup } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tisCollapsed,\n\tgetActiveFormats,\n\tuseAnchor,\n\tstore as richTextStore,\n} from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport FormatToolbar from './format-toolbar';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { store as blockEditorStore } from '../../store';\n\nfunction InlineSelectionToolbar( {\n\tvalue,\n\teditableContentElement,\n\tactiveFormats,\n} ) {\n\tconst lastFormat = activeFormats[ activeFormats.length - 1 ];\n\tconst lastFormatType = lastFormat?.type;\n\tconst settings = useSelect(\n\t\t( select ) => select( richTextStore ).getFormatType( lastFormatType ),\n\t\t[ lastFormatType ]\n\t);\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement,\n\t\tvalue,\n\t\tsettings,\n\t} );\n\n\treturn <InlineToolbar popoverAnchor={ popoverAnchor } />;\n}\n\nfunction InlineToolbar( { popoverAnchor } ) {\n\treturn (\n\t\t<Popover\n\t\t\tposition=\"top center\"\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tclassName=\"block-editor-rich-text__inline-format-toolbar\"\n\t\t\t__unstableSlotName=\"block-toolbar\"\n\t\t>\n\t\t\t<NavigableToolbar\n\t\t\t\tclassName=\"block-editor-rich-text__inline-format-toolbar-group\"\n\t\t\t\t/* translators: accessibility text for the inline format toolbar */\n\t\t\t\taria-label={ __( 'Format tools' ) }\n\t\t\t>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<FormatToolbar />\n\t\t\t\t</ToolbarGroup>\n\t\t\t</NavigableToolbar>\n\t\t</Popover>\n\t);\n}\n\nconst FormatToolbarContainer = ( {\n\tinline,\n\teditableContentElement,\n\tvalue,\n} ) => {\n\tconst hasInlineToolbar = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().hasInlineToolbar,\n\t\t[]\n\t);\n\n\tif ( inline ) {\n\t\treturn <InlineToolbar popoverAnchor={ editableContentElement } />;\n\t}\n\n\tif ( hasInlineToolbar ) {\n\t\tconst activeFormats = getActiveFormats( value );\n\n\t\tif ( isCollapsed( value ) && ! activeFormats.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<InlineSelectionToolbar\n\t\t\t\teditableContentElement={ editableContentElement }\n\t\t\t\tvalue={ value }\n\t\t\t\tactiveFormats={ activeFormats }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// Render regular toolbar.\n\treturn (\n\t\t<BlockControls group=\"inline\">\n\t\t\t<FormatToolbar />\n\t\t</BlockControls>\n\t);\n};\n\nexport default FormatToolbarContainer;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/format-toolbar-container.js"],"names":["InlineSelectionToolbar","value","editableContentElement","activeFormats","lastFormat","length","lastFormatType","type","settings","select","richTextStore","getFormatType","popoverAnchor","InlineToolbar","FormatToolbarContainer","inline","hasInlineToolbar","blockEditorStore","getSettings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAWA;AACA;AACA;AAMA,SAASA,sBAAT,OAII;AAAA,MAJ6B;AAChCC,IAAAA,KADgC;AAEhCC,IAAAA,sBAFgC;AAGhCC,IAAAA;AAHgC,GAI7B;AACH,QAAMC,UAAU,GAAGD,aAAa,CAAEA,aAAa,CAACE,MAAd,GAAuB,CAAzB,CAAhC;AACA,QAAMC,cAAc,GAAGF,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEG,IAAnC;AACA,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IAAcA,MAAM,CAAEC,eAAF,CAAN,CAAwBC,aAAxB,CAAuCL,cAAvC,CADE,EAEhB,CAAEA,cAAF,CAFgB,CAAjB;AAIA,QAAMM,aAAa,GAAG,yBAAW;AAChCV,IAAAA,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,KAAK,EAAC;AAArB,KACC,4BAAC,sBAAD,OADD,CADD;AAKA,CApCD;;eAsCeW,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Popover, ToolbarGroup } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tisCollapsed,\n\tgetActiveFormats,\n\tuseAnchor,\n\tstore as richTextStore,\n} from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport FormatToolbar from './format-toolbar';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { store as blockEditorStore } from '../../store';\n\nfunction InlineSelectionToolbar( {\n\tvalue,\n\teditableContentElement,\n\tactiveFormats,\n} ) {\n\tconst lastFormat = activeFormats[ activeFormats.length - 1 ];\n\tconst lastFormatType = lastFormat?.type;\n\tconst settings = useSelect(\n\t\t( select ) => select( richTextStore ).getFormatType( lastFormatType ),\n\t\t[ lastFormatType ]\n\t);\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement,\n\t\tvalue,\n\t\tsettings,\n\t} );\n\n\treturn <InlineToolbar popoverAnchor={ popoverAnchor } />;\n}\n\nfunction InlineToolbar( { popoverAnchor } ) {\n\treturn (\n\t\t<Popover\n\t\t\tplacement=\"top\"\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tclassName=\"block-editor-rich-text__inline-format-toolbar\"\n\t\t\t__unstableSlotName=\"block-toolbar\"\n\t\t>\n\t\t\t<NavigableToolbar\n\t\t\t\tclassName=\"block-editor-rich-text__inline-format-toolbar-group\"\n\t\t\t\t/* translators: accessibility text for the inline format toolbar */\n\t\t\t\taria-label={ __( 'Format tools' ) }\n\t\t\t>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<FormatToolbar />\n\t\t\t\t</ToolbarGroup>\n\t\t\t</NavigableToolbar>\n\t\t</Popover>\n\t);\n}\n\nconst FormatToolbarContainer = ( {\n\tinline,\n\teditableContentElement,\n\tvalue,\n} ) => {\n\tconst hasInlineToolbar = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().hasInlineToolbar,\n\t\t[]\n\t);\n\n\tif ( inline ) {\n\t\treturn <InlineToolbar popoverAnchor={ editableContentElement } />;\n\t}\n\n\tif ( hasInlineToolbar ) {\n\t\tconst activeFormats = getActiveFormats( value );\n\n\t\tif ( isCollapsed( value ) && ! activeFormats.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<InlineSelectionToolbar\n\t\t\t\teditableContentElement={ editableContentElement }\n\t\t\t\tvalue={ value }\n\t\t\t\tactiveFormats={ activeFormats }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// Render regular toolbar.\n\treturn (\n\t\t<BlockControls group=\"inline\">\n\t\t\t<FormatToolbar />\n\t\t</BlockControls>\n\t);\n};\n\nexport default FormatToolbarContainer;\n"]}
@@ -246,7 +246,7 @@ function usePasteHandler(props) {
246
246
  }
247
247
  /**
248
248
  * Normalizes a given string of HTML to remove the Windows-specific "Fragment"
249
- * comments and any preceeding and trailing content.
249
+ * comments and any preceding and trailing content.
250
250
  *
251
251
  * @param {string} html the html to be normalized
252
252
  * @return {string} the normalized html
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/use-paste-handler.js"],"names":["adjustLines","value","isMultiline","LINE_SEPARATOR","RegExp","usePasteHandler","props","propsRef","current","element","_onPaste","event","isSelected","disableFormats","onChange","formatTypes","tagName","onReplace","onSplit","onSplitMiddle","__unstableEmbedURLOnPaste","multilineTag","preserveWhiteSpace","pastePlainText","clipboardData","plainText","html","getData","error1","error2","removeWindowsFragments","removeCharsetMetaTag","preventDefault","window","console","log","transformed","reduce","accumlator","__unstablePasteRule","files","isInternal","pastedMultilineTag","undefined","pastedValue","multilineWrapperTags","activeFormats","text","length","content","HTML","mode","pastedBlocks","trim","valueToInsert","addEventListener","removeEventListener","startStr","startIdx","indexOf","substring","endStr","endIdx","metaTag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;AACA,SAASK,oBAAT,CAA+BL,IAA/B,EAAsC;AACrC,QAAMqC,OAAO,GAAI,wBAAjB;;AAEA,MAAKrC,IAAI,CAACsC,UAAL,CAAiBD,OAAjB,CAAL,EAAkC;AACjC,WAAOrC,IAAI,CAACuC,KAAL,CAAYF,OAAO,CAACf,MAApB,CAAP;AACA;;AAED,SAAOtB,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport { pasteHandler } from '@wordpress/blocks';\nimport {\n\tisEmpty,\n\tinsert,\n\tcreate,\n\treplace,\n\t__UNSTABLE_LINE_SEPARATOR as LINE_SEPARATOR,\n} from '@wordpress/rich-text';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { filePasteHandler } from './file-paste-handler';\nimport { addActiveFormats, isShortcode } from './utils';\nimport { splitValue } from './split-value';\nimport { shouldDismissPastedFiles } from '../../utils/pasting';\n\n/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */\n\n/**\n * Replaces line separators with line breaks if not multiline.\n * Replaces line breaks with line separators if multiline.\n *\n * @param {RichTextValue} value Value to adjust.\n * @param {boolean} isMultiline Whether to adjust to multiline or not.\n *\n * @return {RichTextValue} Adjusted value.\n */\nfunction adjustLines( value, isMultiline ) {\n\tif ( isMultiline ) {\n\t\treturn replace( value, /\\n+/g, LINE_SEPARATOR );\n\t}\n\n\treturn replace( value, new RegExp( LINE_SEPARATOR, 'g' ), '\\n' );\n}\n\nexport function usePasteHandler( props ) {\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction _onPaste( event ) {\n\t\t\tconst {\n\t\t\t\tisSelected,\n\t\t\t\tdisableFormats,\n\t\t\t\tonChange,\n\t\t\t\tvalue,\n\t\t\t\tformatTypes,\n\t\t\t\ttagName,\n\t\t\t\tonReplace,\n\t\t\t\tonSplit,\n\t\t\t\tonSplitMiddle,\n\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\tmultilineTag,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t\tpastePlainText,\n\t\t\t} = propsRef.current;\n\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { clipboardData } = event;\n\n\t\t\tlet plainText = '';\n\t\t\tlet html = '';\n\n\t\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t\t// arguments first, then fallback to `Text` if they fail.\n\t\t\ttry {\n\t\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t\t} catch ( error1 ) {\n\t\t\t\ttry {\n\t\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t\t} catch ( error2 ) {\n\t\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t\t// behaviour.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove Windows-specific metadata appended within copied HTML text.\n\t\t\thtml = removeWindowsFragments( html );\n\n\t\t\t// Strip meta tag.\n\t\t\thtml = removeCharsetMetaTag( html );\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\t\tif ( disableFormats ) {\n\t\t\t\tonChange( insert( value, plainText ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst transformed = formatTypes.reduce(\n\t\t\t\t( accumlator, { __unstablePasteRule } ) => {\n\t\t\t\t\t// Only allow one transform.\n\t\t\t\t\tif ( __unstablePasteRule && accumlator === value ) {\n\t\t\t\t\t\taccumlator = __unstablePasteRule( value, {\n\t\t\t\t\t\t\thtml,\n\t\t\t\t\t\t\tplainText,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn accumlator;\n\t\t\t\t},\n\t\t\t\tvalue\n\t\t\t);\n\n\t\t\tif ( transformed !== value ) {\n\t\t\t\tonChange( transformed );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst files = [ ...getFilesFromDataTransfer( clipboardData ) ];\n\t\t\tconst isInternal = clipboardData.getData( 'rich-text' ) === 'true';\n\n\t\t\t// If the data comes from a rich text instance, we can directly use it\n\t\t\t// without filtering the data. The filters are only meant for externally\n\t\t\t// pasted content and remove inline styles.\n\t\t\tif ( isInternal ) {\n\t\t\t\tconst pastedMultilineTag =\n\t\t\t\t\tclipboardData.getData( 'rich-text-multi-line-tag' ) ||\n\t\t\t\t\tundefined;\n\t\t\t\tlet pastedValue = create( {\n\t\t\t\t\thtml,\n\t\t\t\t\tmultilineTag: pastedMultilineTag,\n\t\t\t\t\tmultilineWrapperTags:\n\t\t\t\t\t\tpastedMultilineTag === 'li'\n\t\t\t\t\t\t\t? [ 'ul', 'ol' ]\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\t\t\t\tpastedValue = adjustLines( pastedValue, !! multilineTag );\n\t\t\t\taddActiveFormats( pastedValue, value.activeFormats );\n\t\t\t\tonChange( insert( value, pastedValue ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( pastePlainText ) {\n\t\t\t\tonChange( insert( value, create( { text: plainText } ) ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Process any attached files, unless we infer that the files in\n\t\t\t// question are redundant \"screenshots\" of the actual HTML payload,\n\t\t\t// as created by certain office-type programs.\n\t\t\t//\n\t\t\t// @see shouldDismissPastedFiles\n\t\t\tif (\n\t\t\t\tfiles?.length &&\n\t\t\t\t! shouldDismissPastedFiles( files, html, plainText )\n\t\t\t) {\n\t\t\t\tconst content = pasteHandler( {\n\t\t\t\t\tHTML: filePasteHandler( files ),\n\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\ttagName,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\twindow.console.log( 'Received items:\\n\\n', files );\n\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: content,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet mode = onReplace && onSplit ? 'AUTO' : 'INLINE';\n\n\t\t\t// Force the blocks mode when the user is pasting\n\t\t\t// on a new line & the content resembles a shortcode.\n\t\t\t// Otherwise it's going to be detected as inline\n\t\t\t// and the shortcode won't be replaced.\n\t\t\tif (\n\t\t\t\tmode === 'AUTO' &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisShortcode( plainText )\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t__unstableEmbedURLOnPaste &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisURL( plainText.trim() )\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tconst content = pasteHandler( {\n\t\t\t\tHTML: html,\n\t\t\t\tplainText,\n\t\t\t\tmode,\n\t\t\t\ttagName,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tlet valueToInsert = create( { html: content } );\n\n\t\t\t\t// If the content should be multiline, we should process text\n\t\t\t\t// separated by a line break as separate lines.\n\t\t\t\tvalueToInsert = adjustLines( valueToInsert, !! multilineTag );\n\n\t\t\t\taddActiveFormats( valueToInsert, value.activeFormats );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else if ( content.length > 0 ) {\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content, content.length - 1, -1 );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: content,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'paste', _onPaste );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'paste', _onPaste );\n\t\t};\n\t}, [] );\n}\n\n/**\n * Normalizes a given string of HTML to remove the Windows-specific \"Fragment\"\n * comments and any preceeding and trailing content.\n *\n * @param {string} html the html to be normalized\n * @return {string} the normalized html\n */\nfunction removeWindowsFragments( html ) {\n\tconst startStr = '<!--StartFragment-->';\n\tconst startIdx = html.indexOf( startStr );\n\tif ( startIdx > -1 ) {\n\t\thtml = html.substring( startIdx + startStr.length );\n\t} else {\n\t\t// No point looking for EndFragment\n\t\treturn html;\n\t}\n\n\tconst endStr = '<!--EndFragment-->';\n\tconst endIdx = html.indexOf( endStr );\n\tif ( endIdx > -1 ) {\n\t\thtml = html.substring( 0, endIdx );\n\t}\n\n\treturn html;\n}\n\n/**\n * Removes the charset meta tag inserted by Chromium.\n * See:\n * - https://github.com/WordPress/gutenberg/issues/33585\n * - https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4\n *\n * @param {string} html the html to be stripped of the meta tag.\n * @return {string} the cleaned html\n */\nfunction removeCharsetMetaTag( html ) {\n\tconst metaTag = `<meta charset='utf-8'>`;\n\n\tif ( html.startsWith( metaTag ) ) {\n\t\treturn html.slice( metaTag.length );\n\t}\n\n\treturn html;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/use-paste-handler.js"],"names":["adjustLines","value","isMultiline","LINE_SEPARATOR","RegExp","usePasteHandler","props","propsRef","current","element","_onPaste","event","isSelected","disableFormats","onChange","formatTypes","tagName","onReplace","onSplit","onSplitMiddle","__unstableEmbedURLOnPaste","multilineTag","preserveWhiteSpace","pastePlainText","clipboardData","plainText","html","getData","error1","error2","removeWindowsFragments","removeCharsetMetaTag","preventDefault","window","console","log","transformed","reduce","accumlator","__unstablePasteRule","files","isInternal","pastedMultilineTag","undefined","pastedValue","multilineWrapperTags","activeFormats","text","length","content","HTML","mode","pastedBlocks","trim","valueToInsert","addEventListener","removeEventListener","startStr","startIdx","indexOf","substring","endStr","endIdx","metaTag","startsWith","slice"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AAKA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAcA;AACA;AACA;;AAMA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAT,CAAsBC,KAAtB,EAA6BC,WAA7B,EAA2C;AAC1C,MAAKA,WAAL,EAAmB;AAClB,WAAO,uBAASD,KAAT,EAAgB,MAAhB,EAAwBE,mCAAxB,CAAP;AACA;;AAED,SAAO,uBAASF,KAAT,EAAgB,IAAIG,MAAJ,CAAYD,mCAAZ,EAA4B,GAA5B,CAAhB,EAAmD,IAAnD,CAAP;AACA;;AAEM,SAASE,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,QAAMC,QAAQ,GAAG,qBAAQD,KAAR,CAAjB;AACAC,EAAAA,QAAQ,CAACC,OAAT,GAAmBF,KAAnB;AACA,SAAO,2BAAgBG,OAAF,IAAe;AACnC,aAASC,QAAT,CAAmBC,KAAnB,EAA2B;AAC1B,YAAM;AACLC,QAAAA,UADK;AAELC,QAAAA,cAFK;AAGLC,QAAAA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C,OAAL,CAAcF,QAAd,CAAjB;;AACA,MAAKC,QAAQ,GAAG,CAAC,CAAjB,EAAqB;AACpBhC,IAAAA,IAAI,GAAGA,IAAI,CAACkC,SAAL,CAAgBF,QAAQ,GAAGD,QAAQ,CAACT,MAApC,CAAP;AACA,GAFD,MAEO;AACN;AACA,WAAOtB,IAAP;AACA;;AAED,QAAMmC,MAAM,GAAG,oBAAf;AACA,QAAMC,MAAM,GAAGpC,IAAI,CAACiC,OAAL,CAAcE,MAAd,CAAf;;AACA,MAAKC,MAAM,GAAG,CAAC,CAAf,EAAmB;AAClBpC,IAAAA,IAAI,GAAGA,IAAI,CAACkC,SAAL,CAAgB,CAAhB,EAAmBE,MAAnB,CAAP;AACA;;AAED,SAAOpC,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASK,oBAAT,CAA+BL,IAA/B,EAAsC;AACrC,QAAMqC,OAAO,GAAI,wBAAjB;;AAEA,MAAKrC,IAAI,CAACsC,UAAL,CAAiBD,OAAjB,CAAL,EAAkC;AACjC,WAAOrC,IAAI,CAACuC,KAAL,CAAYF,OAAO,CAACf,MAApB,CAAP;AACA;;AAED,SAAOtB,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport { pasteHandler } from '@wordpress/blocks';\nimport {\n\tisEmpty,\n\tinsert,\n\tcreate,\n\treplace,\n\t__UNSTABLE_LINE_SEPARATOR as LINE_SEPARATOR,\n} from '@wordpress/rich-text';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { filePasteHandler } from './file-paste-handler';\nimport { addActiveFormats, isShortcode } from './utils';\nimport { splitValue } from './split-value';\nimport { shouldDismissPastedFiles } from '../../utils/pasting';\n\n/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */\n\n/**\n * Replaces line separators with line breaks if not multiline.\n * Replaces line breaks with line separators if multiline.\n *\n * @param {RichTextValue} value Value to adjust.\n * @param {boolean} isMultiline Whether to adjust to multiline or not.\n *\n * @return {RichTextValue} Adjusted value.\n */\nfunction adjustLines( value, isMultiline ) {\n\tif ( isMultiline ) {\n\t\treturn replace( value, /\\n+/g, LINE_SEPARATOR );\n\t}\n\n\treturn replace( value, new RegExp( LINE_SEPARATOR, 'g' ), '\\n' );\n}\n\nexport function usePasteHandler( props ) {\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction _onPaste( event ) {\n\t\t\tconst {\n\t\t\t\tisSelected,\n\t\t\t\tdisableFormats,\n\t\t\t\tonChange,\n\t\t\t\tvalue,\n\t\t\t\tformatTypes,\n\t\t\t\ttagName,\n\t\t\t\tonReplace,\n\t\t\t\tonSplit,\n\t\t\t\tonSplitMiddle,\n\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\tmultilineTag,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t\tpastePlainText,\n\t\t\t} = propsRef.current;\n\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { clipboardData } = event;\n\n\t\t\tlet plainText = '';\n\t\t\tlet html = '';\n\n\t\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t\t// arguments first, then fallback to `Text` if they fail.\n\t\t\ttry {\n\t\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t\t} catch ( error1 ) {\n\t\t\t\ttry {\n\t\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t\t} catch ( error2 ) {\n\t\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t\t// behaviour.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove Windows-specific metadata appended within copied HTML text.\n\t\t\thtml = removeWindowsFragments( html );\n\n\t\t\t// Strip meta tag.\n\t\t\thtml = removeCharsetMetaTag( html );\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\t\tif ( disableFormats ) {\n\t\t\t\tonChange( insert( value, plainText ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst transformed = formatTypes.reduce(\n\t\t\t\t( accumlator, { __unstablePasteRule } ) => {\n\t\t\t\t\t// Only allow one transform.\n\t\t\t\t\tif ( __unstablePasteRule && accumlator === value ) {\n\t\t\t\t\t\taccumlator = __unstablePasteRule( value, {\n\t\t\t\t\t\t\thtml,\n\t\t\t\t\t\t\tplainText,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn accumlator;\n\t\t\t\t},\n\t\t\t\tvalue\n\t\t\t);\n\n\t\t\tif ( transformed !== value ) {\n\t\t\t\tonChange( transformed );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst files = [ ...getFilesFromDataTransfer( clipboardData ) ];\n\t\t\tconst isInternal = clipboardData.getData( 'rich-text' ) === 'true';\n\n\t\t\t// If the data comes from a rich text instance, we can directly use it\n\t\t\t// without filtering the data. The filters are only meant for externally\n\t\t\t// pasted content and remove inline styles.\n\t\t\tif ( isInternal ) {\n\t\t\t\tconst pastedMultilineTag =\n\t\t\t\t\tclipboardData.getData( 'rich-text-multi-line-tag' ) ||\n\t\t\t\t\tundefined;\n\t\t\t\tlet pastedValue = create( {\n\t\t\t\t\thtml,\n\t\t\t\t\tmultilineTag: pastedMultilineTag,\n\t\t\t\t\tmultilineWrapperTags:\n\t\t\t\t\t\tpastedMultilineTag === 'li'\n\t\t\t\t\t\t\t? [ 'ul', 'ol' ]\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\t\t\t\tpastedValue = adjustLines( pastedValue, !! multilineTag );\n\t\t\t\taddActiveFormats( pastedValue, value.activeFormats );\n\t\t\t\tonChange( insert( value, pastedValue ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( pastePlainText ) {\n\t\t\t\tonChange( insert( value, create( { text: plainText } ) ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Process any attached files, unless we infer that the files in\n\t\t\t// question are redundant \"screenshots\" of the actual HTML payload,\n\t\t\t// as created by certain office-type programs.\n\t\t\t//\n\t\t\t// @see shouldDismissPastedFiles\n\t\t\tif (\n\t\t\t\tfiles?.length &&\n\t\t\t\t! shouldDismissPastedFiles( files, html, plainText )\n\t\t\t) {\n\t\t\t\tconst content = pasteHandler( {\n\t\t\t\t\tHTML: filePasteHandler( files ),\n\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\ttagName,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\twindow.console.log( 'Received items:\\n\\n', files );\n\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: content,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet mode = onReplace && onSplit ? 'AUTO' : 'INLINE';\n\n\t\t\t// Force the blocks mode when the user is pasting\n\t\t\t// on a new line & the content resembles a shortcode.\n\t\t\t// Otherwise it's going to be detected as inline\n\t\t\t// and the shortcode won't be replaced.\n\t\t\tif (\n\t\t\t\tmode === 'AUTO' &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisShortcode( plainText )\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t__unstableEmbedURLOnPaste &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisURL( plainText.trim() )\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tconst content = pasteHandler( {\n\t\t\t\tHTML: html,\n\t\t\t\tplainText,\n\t\t\t\tmode,\n\t\t\t\ttagName,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tlet valueToInsert = create( { html: content } );\n\n\t\t\t\t// If the content should be multiline, we should process text\n\t\t\t\t// separated by a line break as separate lines.\n\t\t\t\tvalueToInsert = adjustLines( valueToInsert, !! multilineTag );\n\n\t\t\t\taddActiveFormats( valueToInsert, value.activeFormats );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else if ( content.length > 0 ) {\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content, content.length - 1, -1 );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: content,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'paste', _onPaste );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'paste', _onPaste );\n\t\t};\n\t}, [] );\n}\n\n/**\n * Normalizes a given string of HTML to remove the Windows-specific \"Fragment\"\n * comments and any preceding and trailing content.\n *\n * @param {string} html the html to be normalized\n * @return {string} the normalized html\n */\nfunction removeWindowsFragments( html ) {\n\tconst startStr = '<!--StartFragment-->';\n\tconst startIdx = html.indexOf( startStr );\n\tif ( startIdx > -1 ) {\n\t\thtml = html.substring( startIdx + startStr.length );\n\t} else {\n\t\t// No point looking for EndFragment\n\t\treturn html;\n\t}\n\n\tconst endStr = '<!--EndFragment-->';\n\tconst endIdx = html.indexOf( endStr );\n\tif ( endIdx > -1 ) {\n\t\thtml = html.substring( 0, endIdx );\n\t}\n\n\treturn html;\n}\n\n/**\n * Removes the charset meta tag inserted by Chromium.\n * See:\n * - https://github.com/WordPress/gutenberg/issues/33585\n * - https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4\n *\n * @param {string} html the html to be stripped of the meta tag.\n * @return {string} the cleaned html\n */\nfunction removeCharsetMetaTag( html ) {\n\tconst metaTag = `<meta charset='utf-8'>`;\n\n\tif ( html.startsWith( metaTag ) ) {\n\t\treturn html.slice( metaTag.length );\n\t}\n\n\treturn html;\n}\n"]}
@@ -29,7 +29,9 @@ function AllInputControl(_ref) {
29
29
  sides,
30
30
  spacingSizes,
31
31
  type,
32
- minimumCustomValue
32
+ minimumCustomValue,
33
+ onMouseOver,
34
+ onMouseOut
33
35
  } = _ref;
34
36
  const allValue = (0, _utils.getAllRawValue)(values);
35
37
  const hasValues = (0, _utils.isValuesDefined)(values);
@@ -47,7 +49,9 @@ function AllInputControl(_ref) {
47
49
  spacingSizes: spacingSizes,
48
50
  isMixed: isMixed,
49
51
  type: type,
50
- minimumCustomValue: minimumCustomValue
52
+ minimumCustomValue: minimumCustomValue,
53
+ onMouseOver: onMouseOver,
54
+ onMouseOut: onMouseOut
51
55
  });
52
56
  }
53
57
  //# sourceMappingURL=all-input-control.js.map