@wordpress/block-editor 8.1.2 → 8.3.0-next.e230fbab09.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 (591) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -26
  3. package/build/autocompleters/link.js +78 -0
  4. package/build/autocompleters/link.js.map +1 -0
  5. package/build/components/autocomplete/index.js +3 -1
  6. package/build/components/autocomplete/index.js.map +1 -1
  7. package/build/components/block-actions/index.js +1 -1
  8. package/build/components/block-actions/index.js.map +1 -1
  9. package/build/components/block-breadcrumb/index.js +4 -2
  10. package/build/components/block-breadcrumb/index.js.map +1 -1
  11. package/build/components/block-compare/index.js +2 -2
  12. package/build/components/block-compare/index.js.map +1 -1
  13. package/build/components/block-controls/index.js +1 -1
  14. package/build/components/block-controls/index.js.map +1 -1
  15. package/build/components/block-draggable/index.js +1 -1
  16. package/build/components/block-draggable/index.js.map +1 -1
  17. package/build/components/block-edit/edit.js +1 -1
  18. package/build/components/block-edit/edit.js.map +1 -1
  19. package/build/components/block-list/block-html.js +1 -1
  20. package/build/components/block-list/block-html.js.map +1 -1
  21. package/build/components/block-list/block-invalid-warning.js +1 -1
  22. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  23. package/build/components/block-list/block-list-item.native.js +4 -4
  24. package/build/components/block-list/block-list-item.native.js.map +1 -1
  25. package/build/components/block-list/block-selection-button.native.js +4 -3
  26. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  27. package/build/components/block-list/block.js +17 -3
  28. package/build/components/block-list/block.js.map +1 -1
  29. package/build/components/block-list/block.native.js +6 -6
  30. package/build/components/block-list/block.native.js.map +1 -1
  31. package/build/components/block-list/index.native.js +5 -5
  32. package/build/components/block-list/index.native.js.map +1 -1
  33. package/build/components/block-list/use-block-props/use-block-class-names.js +1 -1
  34. package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  35. package/build/components/block-list/use-block-props/use-focus-first-element.js +3 -0
  36. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  37. package/build/components/block-list/use-block-props/use-multi-selection.js +25 -27
  38. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  39. package/build/components/block-media-update-progress/index.native.js +4 -4
  40. package/build/components/block-media-update-progress/index.native.js.map +1 -1
  41. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  42. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  43. package/build/components/block-mobile-toolbar/index.native.js +1 -1
  44. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  45. package/build/components/block-mover/mover-description.js +4 -4
  46. package/build/components/block-mover/mover-description.js.map +1 -1
  47. package/build/components/block-mover/mover-description.native.js +5 -5
  48. package/build/components/block-mover/mover-description.native.js.map +1 -1
  49. package/build/components/block-settings/container.native.js +1 -5
  50. package/build/components/block-settings/container.native.js.map +1 -1
  51. package/build/components/block-settings-menu/block-settings-dropdown.js +7 -12
  52. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  53. package/build/components/block-styles/preview.native.js +1 -1
  54. package/build/components/block-styles/preview.native.js.map +1 -1
  55. package/build/components/block-switcher/index.js +2 -1
  56. package/build/components/block-switcher/index.js.map +1 -1
  57. package/build/components/block-switcher/use-transformed-patterns.js +0 -1
  58. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  59. package/build/components/block-title/index.js +7 -62
  60. package/build/components/block-title/index.js.map +1 -1
  61. package/build/components/block-title/use-block-display-title.js +94 -0
  62. package/build/components/block-title/use-block-display-title.js.map +1 -0
  63. package/build/components/block-toolbar/utils.js +9 -1
  64. package/build/components/block-toolbar/utils.js.map +1 -1
  65. package/build/components/block-tools/block-popover.js +1 -1
  66. package/build/components/block-tools/block-popover.js.map +1 -1
  67. package/build/components/block-tools/block-selection-button.js +2 -1
  68. package/build/components/block-tools/block-selection-button.js.map +1 -1
  69. package/build/components/block-types-list/index.native.js +1 -1
  70. package/build/components/block-types-list/index.native.js.map +1 -1
  71. package/build/components/border-radius-control/index.js +2 -2
  72. package/build/components/border-radius-control/index.js.map +1 -1
  73. package/build/components/border-radius-control/utils.js +10 -6
  74. package/build/components/border-radius-control/utils.js.map +1 -1
  75. package/build/components/contrast-checker/index.js +3 -3
  76. package/build/components/contrast-checker/index.js.map +1 -1
  77. package/build/components/convert-to-group-buttons/index.js +1 -1
  78. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  79. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
  80. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  81. package/build/components/copy-handler/index.js +3 -3
  82. package/build/components/copy-handler/index.js.map +1 -1
  83. package/build/components/font-sizes/with-font-sizes.js +3 -3
  84. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  85. package/build/components/index.js +9 -0
  86. package/build/components/index.js.map +1 -1
  87. package/build/components/index.native.js +38 -1
  88. package/build/components/index.native.js.map +1 -1
  89. package/build/components/inserter/block-patterns-tab.js +4 -4
  90. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  91. package/build/components/inserter/block-types-tab.js +1 -1
  92. package/build/components/inserter/block-types-tab.js.map +1 -1
  93. package/build/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  94. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  95. package/build/components/inserter/index.js +3 -3
  96. package/build/components/inserter/index.js.map +1 -1
  97. package/build/components/inserter/index.native.js +7 -7
  98. package/build/components/inserter/index.native.js.map +1 -1
  99. package/build/components/inserter/menu.js.map +1 -1
  100. package/build/components/inserter/menu.native.js +3 -3
  101. package/build/components/inserter/menu.native.js.map +1 -1
  102. package/build/components/inserter/quick-inserter.js +20 -8
  103. package/build/components/inserter/quick-inserter.js.map +1 -1
  104. package/build/components/inserter/search-items.js +1 -1
  105. package/build/components/inserter/search-items.js.map +1 -1
  106. package/build/components/inserter/search-results.js +28 -11
  107. package/build/components/inserter/search-results.js.map +1 -1
  108. package/build/components/keyboard-shortcuts/index.js +1 -1
  109. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  110. package/build/components/letter-spacing-control/index.js +3 -3
  111. package/build/components/letter-spacing-control/index.js.map +1 -1
  112. package/build/components/line-height-control/index.js +63 -45
  113. package/build/components/line-height-control/index.js.map +1 -1
  114. package/build/components/line-height-control/index.native.js +3 -1
  115. package/build/components/line-height-control/index.native.js.map +1 -1
  116. package/build/components/link-control/index.js +2 -2
  117. package/build/components/link-control/index.js.map +1 -1
  118. package/build/components/link-control/search-input.js +1 -1
  119. package/build/components/link-control/search-input.js.map +1 -1
  120. package/build/components/link-control/search-results.js +2 -2
  121. package/build/components/link-control/search-results.js.map +1 -1
  122. package/build/components/link-control/use-rich-url-data.js +1 -1
  123. package/build/components/link-control/use-rich-url-data.js.map +1 -1
  124. package/build/components/link-control/use-search-handler.js +2 -2
  125. package/build/components/link-control/use-search-handler.js.map +1 -1
  126. package/build/components/list-view/block-contents.js +8 -4
  127. package/build/components/list-view/block-contents.js.map +1 -1
  128. package/build/components/list-view/block-select-button.js +2 -2
  129. package/build/components/list-view/block-select-button.js.map +1 -1
  130. package/build/components/list-view/block.js +20 -9
  131. package/build/components/list-view/block.js.map +1 -1
  132. package/build/components/list-view/branch.js +2 -1
  133. package/build/components/list-view/branch.js.map +1 -1
  134. package/build/components/list-view/index.js +49 -41
  135. package/build/components/list-view/index.js.map +1 -1
  136. package/build/components/list-view/use-block-selection.js +139 -0
  137. package/build/components/list-view/use-block-selection.js.map +1 -0
  138. package/build/components/list-view/use-list-view-expand-selected-item.js +60 -0
  139. package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
  140. package/build/components/list-view/utils.js +29 -1
  141. package/build/components/list-view/utils.js.map +1 -1
  142. package/build/components/media-placeholder/index.native.js +7 -5
  143. package/build/components/media-placeholder/index.native.js.map +1 -1
  144. package/build/components/media-replace-flow/index.js +20 -24
  145. package/build/components/media-replace-flow/index.js.map +1 -1
  146. package/build/components/media-upload/index.native.js +4 -3
  147. package/build/components/media-upload/index.native.js.map +1 -1
  148. package/build/components/media-upload-progress/index.native.js +2 -2
  149. package/build/components/media-upload-progress/index.native.js.map +1 -1
  150. package/build/components/navigable-toolbar/index.js +3 -3
  151. package/build/components/navigable-toolbar/index.js.map +1 -1
  152. package/build/components/plain-text/index.native.js +3 -3
  153. package/build/components/plain-text/index.native.js.map +1 -1
  154. package/build/components/rich-text/format-toolbar-container.js +2 -2
  155. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  156. package/build/components/rich-text/format-toolbar-container.native.js +1 -1
  157. package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
  158. package/build/components/rich-text/index.js +7 -12
  159. package/build/components/rich-text/index.js.map +1 -1
  160. package/build/components/rich-text/index.native.js +3 -3
  161. package/build/components/rich-text/index.native.js.map +1 -1
  162. package/build/components/rich-text/use-paste-handler.js +7 -12
  163. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  164. package/build/components/url-input/index.js +11 -11
  165. package/build/components/url-input/index.js.map +1 -1
  166. package/build/components/use-moving-animation/index.js +1 -1
  167. package/build/components/use-moving-animation/index.js.map +1 -1
  168. package/build/components/use-on-block-drop/index.js +2 -2
  169. package/build/components/use-on-block-drop/index.js.map +1 -1
  170. package/build/components/writing-flow/index.js +1 -0
  171. package/build/components/writing-flow/index.js.map +1 -1
  172. package/build/components/writing-flow/use-multi-selection.js +22 -24
  173. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  174. package/build/components/writing-flow/use-select-all.js +3 -2
  175. package/build/components/writing-flow/use-select-all.js.map +1 -1
  176. package/build/components/writing-flow/use-tab-nav.js +4 -3
  177. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  178. package/build/hooks/align.js +1 -1
  179. package/build/hooks/align.js.map +1 -1
  180. package/build/hooks/anchor.js +1 -1
  181. package/build/hooks/anchor.js.map +1 -1
  182. package/build/hooks/border.js +2 -14
  183. package/build/hooks/border.js.map +1 -1
  184. package/build/hooks/color.js +2 -2
  185. package/build/hooks/color.js.map +1 -1
  186. package/build/hooks/custom-class-name.js +40 -0
  187. package/build/hooks/custom-class-name.js.map +1 -1
  188. package/build/hooks/duotone.js +22 -4
  189. package/build/hooks/duotone.js.map +1 -1
  190. package/build/hooks/generated-class-name.js +3 -3
  191. package/build/hooks/generated-class-name.js.map +1 -1
  192. package/build/hooks/line-height.js +2 -0
  193. package/build/hooks/line-height.js.map +1 -1
  194. package/build/hooks/lock.js +1 -1
  195. package/build/hooks/lock.js.map +1 -1
  196. package/build/hooks/style.js +32 -13
  197. package/build/hooks/style.js.map +1 -1
  198. package/build/layouts/flow.js +7 -5
  199. package/build/layouts/flow.js.map +1 -1
  200. package/build/store/actions.js +55 -48
  201. package/build/store/actions.js.map +1 -1
  202. package/build/store/defaults.js +2 -1
  203. package/build/store/defaults.js.map +1 -1
  204. package/build/store/index.js +1 -2
  205. package/build/store/index.js.map +1 -1
  206. package/build/store/reducer.js +13 -13
  207. package/build/store/reducer.js.map +1 -1
  208. package/build/store/selectors.js +6 -6
  209. package/build/store/selectors.js.map +1 -1
  210. package/build/utils/index.js +0 -14
  211. package/build/utils/index.js.map +1 -1
  212. package/build/utils/parse-css-unit-to-px.js +3 -3
  213. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  214. package/build/utils/pasting.js +91 -0
  215. package/build/utils/pasting.js.map +1 -0
  216. package/build/utils/transform-styles/ast/parse.js +5 -5
  217. package/build/utils/transform-styles/ast/parse.js.map +1 -1
  218. package/build/utils/transform-styles/transforms/url-rewrite.js +2 -2
  219. package/build/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  220. package/build-module/autocompleters/link.js +64 -0
  221. package/build-module/autocompleters/link.js.map +1 -0
  222. package/build-module/components/autocomplete/index.js +2 -1
  223. package/build-module/components/autocomplete/index.js.map +1 -1
  224. package/build-module/components/block-actions/index.js +1 -1
  225. package/build-module/components/block-actions/index.js.map +1 -1
  226. package/build-module/components/block-breadcrumb/index.js +4 -2
  227. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  228. package/build-module/components/block-compare/index.js +2 -2
  229. package/build-module/components/block-compare/index.js.map +1 -1
  230. package/build-module/components/block-controls/index.js +1 -1
  231. package/build-module/components/block-controls/index.js.map +1 -1
  232. package/build-module/components/block-draggable/index.js +1 -1
  233. package/build-module/components/block-draggable/index.js.map +1 -1
  234. package/build-module/components/block-edit/edit.js +1 -1
  235. package/build-module/components/block-edit/edit.js.map +1 -1
  236. package/build-module/components/block-list/block-html.js +1 -1
  237. package/build-module/components/block-list/block-html.js.map +1 -1
  238. package/build-module/components/block-list/block-invalid-warning.js +1 -1
  239. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  240. package/build-module/components/block-list/block-list-item.native.js +4 -4
  241. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  242. package/build-module/components/block-list/block-selection-button.native.js +4 -3
  243. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  244. package/build-module/components/block-list/block.js +18 -4
  245. package/build-module/components/block-list/block.js.map +1 -1
  246. package/build-module/components/block-list/block.native.js +7 -7
  247. package/build-module/components/block-list/block.native.js.map +1 -1
  248. package/build-module/components/block-list/index.native.js +5 -5
  249. package/build-module/components/block-list/index.native.js.map +1 -1
  250. package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -1
  251. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  252. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +2 -0
  253. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  254. package/build-module/components/block-list/use-block-props/use-multi-selection.js +23 -28
  255. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  256. package/build-module/components/block-media-update-progress/index.native.js +4 -4
  257. package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
  258. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  259. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  260. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  261. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  262. package/build-module/components/block-mover/mover-description.js +4 -4
  263. package/build-module/components/block-mover/mover-description.js.map +1 -1
  264. package/build-module/components/block-mover/mover-description.native.js +5 -5
  265. package/build-module/components/block-mover/mover-description.native.js.map +1 -1
  266. package/build-module/components/block-settings/container.native.js +2 -6
  267. package/build-module/components/block-settings/container.native.js.map +1 -1
  268. package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -13
  269. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  270. package/build-module/components/block-styles/preview.native.js +1 -1
  271. package/build-module/components/block-styles/preview.native.js.map +1 -1
  272. package/build-module/components/block-switcher/index.js +2 -1
  273. package/build-module/components/block-switcher/index.js.map +1 -1
  274. package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
  275. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  276. package/build-module/components/block-title/index.js +7 -58
  277. package/build-module/components/block-title/index.js.map +1 -1
  278. package/build-module/components/block-title/use-block-display-title.js +80 -0
  279. package/build-module/components/block-title/use-block-display-title.js.map +1 -0
  280. package/build-module/components/block-toolbar/utils.js +9 -1
  281. package/build-module/components/block-toolbar/utils.js.map +1 -1
  282. package/build-module/components/block-tools/block-popover.js +1 -1
  283. package/build-module/components/block-tools/block-popover.js.map +1 -1
  284. package/build-module/components/block-tools/block-selection-button.js +2 -1
  285. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  286. package/build-module/components/block-types-list/index.native.js +1 -1
  287. package/build-module/components/block-types-list/index.native.js.map +1 -1
  288. package/build-module/components/border-radius-control/index.js +3 -3
  289. package/build-module/components/border-radius-control/index.js.map +1 -1
  290. package/build-module/components/border-radius-control/utils.js +11 -7
  291. package/build-module/components/border-radius-control/utils.js.map +1 -1
  292. package/build-module/components/contrast-checker/index.js +3 -3
  293. package/build-module/components/contrast-checker/index.js.map +1 -1
  294. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  295. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  296. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
  297. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  298. package/build-module/components/copy-handler/index.js +2 -2
  299. package/build-module/components/copy-handler/index.js.map +1 -1
  300. package/build-module/components/font-sizes/with-font-sizes.js +3 -3
  301. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  302. package/build-module/components/index.js +1 -0
  303. package/build-module/components/index.js.map +1 -1
  304. package/build-module/components/index.native.js +5 -4
  305. package/build-module/components/index.native.js.map +1 -1
  306. package/build-module/components/inserter/block-patterns-tab.js +4 -4
  307. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  308. package/build-module/components/inserter/block-types-tab.js +1 -1
  309. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  310. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  311. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  312. package/build-module/components/inserter/index.js +3 -3
  313. package/build-module/components/inserter/index.js.map +1 -1
  314. package/build-module/components/inserter/index.native.js +7 -7
  315. package/build-module/components/inserter/index.native.js.map +1 -1
  316. package/build-module/components/inserter/menu.js.map +1 -1
  317. package/build-module/components/inserter/menu.native.js +3 -3
  318. package/build-module/components/inserter/menu.native.js.map +1 -1
  319. package/build-module/components/inserter/quick-inserter.js +20 -8
  320. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  321. package/build-module/components/inserter/search-items.js +1 -1
  322. package/build-module/components/inserter/search-items.js.map +1 -1
  323. package/build-module/components/inserter/search-results.js +28 -11
  324. package/build-module/components/inserter/search-results.js.map +1 -1
  325. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  326. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  327. package/build-module/components/letter-spacing-control/index.js +3 -3
  328. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  329. package/build-module/components/line-height-control/index.js +61 -45
  330. package/build-module/components/line-height-control/index.js.map +1 -1
  331. package/build-module/components/line-height-control/index.native.js +3 -1
  332. package/build-module/components/line-height-control/index.native.js.map +1 -1
  333. package/build-module/components/link-control/index.js +2 -2
  334. package/build-module/components/link-control/index.js.map +1 -1
  335. package/build-module/components/link-control/search-input.js +1 -1
  336. package/build-module/components/link-control/search-input.js.map +1 -1
  337. package/build-module/components/link-control/search-results.js +2 -2
  338. package/build-module/components/link-control/search-results.js.map +1 -1
  339. package/build-module/components/link-control/use-rich-url-data.js +1 -1
  340. package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
  341. package/build-module/components/link-control/use-search-handler.js +2 -2
  342. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  343. package/build-module/components/list-view/block-contents.js +8 -4
  344. package/build-module/components/list-view/block-contents.js.map +1 -1
  345. package/build-module/components/list-view/block-select-button.js +2 -2
  346. package/build-module/components/list-view/block-select-button.js.map +1 -1
  347. package/build-module/components/list-view/block.js +20 -9
  348. package/build-module/components/list-view/block.js.map +1 -1
  349. package/build-module/components/list-view/branch.js +2 -1
  350. package/build-module/components/list-view/branch.js.map +1 -1
  351. package/build-module/components/list-view/index.js +46 -42
  352. package/build-module/components/list-view/index.js.map +1 -1
  353. package/build-module/components/list-view/use-block-selection.js +123 -0
  354. package/build-module/components/list-view/use-block-selection.js.map +1 -0
  355. package/build-module/components/list-view/use-list-view-expand-selected-item.js +50 -0
  356. package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
  357. package/build-module/components/list-view/utils.js +25 -0
  358. package/build-module/components/list-view/utils.js.map +1 -1
  359. package/build-module/components/media-placeholder/index.native.js +7 -5
  360. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  361. package/build-module/components/media-replace-flow/index.js +22 -27
  362. package/build-module/components/media-replace-flow/index.js.map +1 -1
  363. package/build-module/components/media-upload/index.native.js +4 -3
  364. package/build-module/components/media-upload/index.native.js.map +1 -1
  365. package/build-module/components/media-upload-progress/index.native.js +2 -2
  366. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  367. package/build-module/components/navigable-toolbar/index.js +3 -3
  368. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  369. package/build-module/components/plain-text/index.native.js +3 -3
  370. package/build-module/components/plain-text/index.native.js.map +1 -1
  371. package/build-module/components/rich-text/format-toolbar-container.js +2 -2
  372. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  373. package/build-module/components/rich-text/format-toolbar-container.native.js +1 -1
  374. package/build-module/components/rich-text/format-toolbar-container.native.js.map +1 -1
  375. package/build-module/components/rich-text/index.js +7 -12
  376. package/build-module/components/rich-text/index.js.map +1 -1
  377. package/build-module/components/rich-text/index.native.js +3 -3
  378. package/build-module/components/rich-text/index.native.js.map +1 -1
  379. package/build-module/components/rich-text/use-paste-handler.js +6 -12
  380. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  381. package/build-module/components/url-input/index.js +11 -11
  382. package/build-module/components/url-input/index.js.map +1 -1
  383. package/build-module/components/use-moving-animation/index.js +1 -1
  384. package/build-module/components/use-moving-animation/index.js.map +1 -1
  385. package/build-module/components/use-on-block-drop/index.js +2 -2
  386. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  387. package/build-module/components/writing-flow/index.js +1 -0
  388. package/build-module/components/writing-flow/index.js.map +1 -1
  389. package/build-module/components/writing-flow/use-multi-selection.js +21 -21
  390. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  391. package/build-module/components/writing-flow/use-select-all.js +3 -2
  392. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  393. package/build-module/components/writing-flow/use-tab-nav.js +4 -3
  394. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  395. package/build-module/hooks/align.js +1 -1
  396. package/build-module/hooks/align.js.map +1 -1
  397. package/build-module/hooks/anchor.js +1 -1
  398. package/build-module/hooks/anchor.js.map +1 -1
  399. package/build-module/hooks/border.js +2 -14
  400. package/build-module/hooks/border.js.map +1 -1
  401. package/build-module/hooks/color.js +2 -2
  402. package/build-module/hooks/color.js.map +1 -1
  403. package/build-module/hooks/custom-class-name.js +38 -0
  404. package/build-module/hooks/custom-class-name.js.map +1 -1
  405. package/build-module/hooks/duotone.js +23 -5
  406. package/build-module/hooks/duotone.js.map +1 -1
  407. package/build-module/hooks/generated-class-name.js +3 -3
  408. package/build-module/hooks/generated-class-name.js.map +1 -1
  409. package/build-module/hooks/line-height.js +2 -0
  410. package/build-module/hooks/line-height.js.map +1 -1
  411. package/build-module/hooks/lock.js +1 -1
  412. package/build-module/hooks/lock.js.map +1 -1
  413. package/build-module/hooks/style.js +31 -13
  414. package/build-module/hooks/style.js.map +1 -1
  415. package/build-module/layouts/flow.js +7 -5
  416. package/build-module/layouts/flow.js.map +1 -1
  417. package/build-module/store/actions.js +52 -45
  418. package/build-module/store/actions.js.map +1 -1
  419. package/build-module/store/defaults.js +2 -1
  420. package/build-module/store/defaults.js.map +1 -1
  421. package/build-module/store/index.js +1 -2
  422. package/build-module/store/index.js.map +1 -1
  423. package/build-module/store/reducer.js +13 -13
  424. package/build-module/store/reducer.js.map +1 -1
  425. package/build-module/store/selectors.js +6 -6
  426. package/build-module/store/selectors.js.map +1 -1
  427. package/build-module/utils/index.js +0 -1
  428. package/build-module/utils/index.js.map +1 -1
  429. package/build-module/utils/parse-css-unit-to-px.js +3 -3
  430. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  431. package/build-module/utils/pasting.js +80 -0
  432. package/build-module/utils/pasting.js.map +1 -0
  433. package/build-module/utils/transform-styles/ast/parse.js +5 -5
  434. package/build-module/utils/transform-styles/ast/parse.js.map +1 -1
  435. package/build-module/utils/transform-styles/transforms/url-rewrite.js +2 -2
  436. package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  437. package/build-style/style-rtl.css +10 -12
  438. package/build-style/style.css +10 -12
  439. package/package.json +27 -26
  440. package/src/autocompleters/link.js +62 -0
  441. package/src/autocompleters/style.scss +8 -0
  442. package/src/components/alignment-control/test/index.js +2 -2
  443. package/src/components/autocomplete/index.js +2 -0
  444. package/src/components/block-actions/index.js +1 -1
  445. package/src/components/block-alignment-control/test/index.js +1 -1
  446. package/src/components/block-breadcrumb/index.js +5 -2
  447. package/src/components/block-compare/index.js +2 -2
  448. package/src/components/block-controls/index.js +1 -1
  449. package/src/components/block-draggable/index.js +1 -1
  450. package/src/components/block-draggable/stories/index.js +1 -1
  451. package/src/components/block-edit/edit.js +1 -1
  452. package/src/components/block-list/block-html.js +1 -1
  453. package/src/components/block-list/block-invalid-warning.js +1 -1
  454. package/src/components/block-list/block-list-item.native.js +4 -4
  455. package/src/components/block-list/block-selection-button.native.js +3 -3
  456. package/src/components/block-list/block.js +28 -4
  457. package/src/components/block-list/block.native.js +7 -6
  458. package/src/components/block-list/index.native.js +5 -5
  459. package/src/components/block-list/style.scss +3 -1
  460. package/src/components/block-list/use-block-props/use-block-class-names.js +1 -1
  461. package/src/components/block-list/use-block-props/use-focus-first-element.js +3 -0
  462. package/src/components/block-list/use-block-props/use-multi-selection.js +22 -30
  463. package/src/components/block-media-update-progress/index.native.js +4 -4
  464. package/src/components/block-media-update-progress/test/index.native.js +2 -2
  465. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  466. package/src/components/block-mobile-toolbar/index.native.js +2 -2
  467. package/src/components/block-mover/mover-description.js +4 -4
  468. package/src/components/block-mover/mover-description.native.js +5 -5
  469. package/src/components/block-settings/container.native.js +5 -6
  470. package/src/components/block-settings-menu/block-settings-dropdown.js +7 -8
  471. package/src/components/block-styles/preview.native.js +1 -1
  472. package/src/components/block-switcher/index.js +4 -1
  473. package/src/components/block-switcher/use-transformed-patterns.js +0 -1
  474. package/src/components/block-title/README.md +17 -1
  475. package/src/components/block-title/index.js +7 -62
  476. package/src/components/block-title/test/index.js +21 -3
  477. package/src/components/block-title/use-block-display-title.js +83 -0
  478. package/src/components/block-toolbar/utils.js +12 -2
  479. package/src/components/block-tools/block-popover.js +1 -1
  480. package/src/components/block-tools/block-selection-button.js +4 -1
  481. package/src/components/block-types-list/index.native.js +1 -1
  482. package/src/components/border-radius-control/index.js +5 -3
  483. package/src/components/border-radius-control/test/utils.js +10 -10
  484. package/src/components/border-radius-control/utils.js +10 -8
  485. package/src/components/contrast-checker/index.js +3 -3
  486. package/src/components/convert-to-group-buttons/index.js +1 -1
  487. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -6
  488. package/src/components/copy-handler/index.js +2 -2
  489. package/src/components/font-sizes/with-font-sizes.js +3 -3
  490. package/src/components/image-size-control/test/index.js +1 -1
  491. package/src/components/index.js +1 -0
  492. package/src/components/index.native.js +11 -4
  493. package/src/components/inserter/block-patterns-tab.js +13 -17
  494. package/src/components/inserter/block-types-tab.js +1 -1
  495. package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  496. package/src/components/inserter/index.js +3 -3
  497. package/src/components/inserter/index.native.js +7 -7
  498. package/src/components/inserter/menu.js +1 -1
  499. package/src/components/inserter/menu.native.js +3 -3
  500. package/src/components/inserter/quick-inserter.js +32 -10
  501. package/src/components/inserter/search-items.js +1 -1
  502. package/src/components/inserter/search-results.js +55 -43
  503. package/src/components/inserter/test/fixtures/index.native.js +1 -1
  504. package/src/components/inserter/test/reusable-blocks-tab.js +2 -2
  505. package/src/components/justify-content-control/README.md +1 -1
  506. package/src/components/keyboard-shortcuts/index.js +1 -1
  507. package/src/components/letter-spacing-control/index.js +1 -1
  508. package/src/components/line-height-control/README.md +13 -2
  509. package/src/components/line-height-control/index.js +66 -43
  510. package/src/components/line-height-control/index.native.js +2 -0
  511. package/src/components/line-height-control/stories/index.js +33 -0
  512. package/src/components/line-height-control/test/index.js +61 -0
  513. package/src/components/link-control/index.js +2 -2
  514. package/src/components/link-control/search-input.js +1 -1
  515. package/src/components/link-control/search-results.js +2 -2
  516. package/src/components/link-control/test/index.js +142 -144
  517. package/src/components/link-control/use-rich-url-data.js +1 -1
  518. package/src/components/link-control/use-search-handler.js +2 -2
  519. package/src/components/list-view/README.md +2 -2
  520. package/src/components/list-view/block-contents.js +10 -3
  521. package/src/components/list-view/block-select-button.js +1 -2
  522. package/src/components/list-view/block.js +30 -10
  523. package/src/components/list-view/branch.js +1 -0
  524. package/src/components/list-view/index.js +56 -30
  525. package/src/components/list-view/test/utils.js +50 -0
  526. package/src/components/list-view/use-block-selection.js +163 -0
  527. package/src/components/list-view/use-list-view-expand-selected-item.js +58 -0
  528. package/src/components/list-view/utils.js +31 -0
  529. package/src/components/media-placeholder/index.native.js +11 -9
  530. package/src/components/media-replace-flow/README.md +7 -0
  531. package/src/components/media-replace-flow/index.js +20 -26
  532. package/src/components/media-replace-flow/test/index.js +100 -0
  533. package/src/components/media-upload/index.native.js +3 -2
  534. package/src/components/media-upload-progress/index.native.js +2 -2
  535. package/src/components/navigable-toolbar/index.js +3 -3
  536. package/src/components/plain-text/index.native.js +3 -3
  537. package/src/components/responsive-block-control/test/index.js +6 -6
  538. package/src/components/rich-text/format-toolbar-container.js +2 -2
  539. package/src/components/rich-text/format-toolbar-container.native.js +1 -1
  540. package/src/components/rich-text/index.js +7 -14
  541. package/src/components/rich-text/index.native.js +3 -3
  542. package/src/components/rich-text/use-paste-handler.js +7 -14
  543. package/src/components/url-input/index.js +11 -11
  544. package/src/components/use-block-drop-zone/test/index.js +1 -1
  545. package/src/components/use-moving-animation/index.js +1 -1
  546. package/src/components/use-on-block-drop/index.js +2 -2
  547. package/src/components/writing-flow/index.js +1 -0
  548. package/src/components/writing-flow/use-multi-selection.js +17 -20
  549. package/src/components/writing-flow/use-select-all.js +6 -2
  550. package/src/components/writing-flow/use-tab-nav.js +6 -3
  551. package/src/hooks/align.js +1 -1
  552. package/src/hooks/anchor.js +1 -1
  553. package/src/hooks/border.js +8 -19
  554. package/src/hooks/color.js +2 -2
  555. package/src/hooks/custom-class-name.js +45 -0
  556. package/src/hooks/duotone.js +27 -3
  557. package/src/hooks/generated-class-name.js +3 -3
  558. package/src/hooks/line-height.js +2 -0
  559. package/src/hooks/lock.js +1 -1
  560. package/src/hooks/style.js +31 -13
  561. package/src/hooks/test/align.js +1 -1
  562. package/src/hooks/typography.scss +0 -4
  563. package/src/layouts/flow.js +10 -5
  564. package/src/store/actions.js +24 -14
  565. package/src/store/defaults.js +2 -2
  566. package/src/store/index.js +0 -1
  567. package/src/store/reducer.js +13 -12
  568. package/src/store/selectors.js +6 -6
  569. package/src/store/test/actions.js +2 -2
  570. package/src/store/test/reducer.js +10 -1
  571. package/src/store/test/selectors.js +1 -1
  572. package/src/style.scss +0 -1
  573. package/src/utils/index.js +0 -1
  574. package/src/utils/parse-css-unit-to-px.js +3 -3
  575. package/src/utils/pasting.js +77 -0
  576. package/src/utils/test/parse-css-unit-to-px.js +5 -5
  577. package/src/utils/test/pasting.js +84 -0
  578. package/src/utils/transform-styles/ast/parse.js +5 -5
  579. package/src/utils/transform-styles/transforms/url-rewrite.js +2 -2
  580. package/build/utils/get-paste-event-data.js +0 -56
  581. package/build/utils/get-paste-event-data.js.map +0 -1
  582. package/build/utils/theme.js +0 -63
  583. package/build/utils/theme.js.map +0 -1
  584. package/build-module/utils/get-paste-event-data.js +0 -47
  585. package/build-module/utils/get-paste-event-data.js.map +0 -1
  586. package/build-module/utils/theme.js +0 -53
  587. package/build-module/utils/theme.js.map +0 -1
  588. package/src/components/line-height-control/style.scss +0 -8
  589. package/src/components/writing-flow/test/use-multi-selection.js +0 -36
  590. package/src/utils/get-paste-event-data.js +0 -42
  591. package/src/utils/theme.js +0 -48
@@ -216,7 +216,7 @@ function updateParentInnerBlocksInTree(
216
216
  controlledParents.add( current );
217
217
  break;
218
218
  } else {
219
- // else continue traversing up through parents.
219
+ // Else continue traversing up through parents.
220
220
  uncontrolledParents.add( current );
221
221
  current = state.parents[ current ];
222
222
  }
@@ -611,7 +611,7 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
611
611
  const subTree = buildBlockTree( newState, action.blocks );
612
612
  newState.tree = {
613
613
  ...subTree,
614
- // Root
614
+ // Root.
615
615
  '': {
616
616
  innerBlocks: action.blocks.map(
617
617
  ( subBlock ) => subTree[ subBlock.clientId ]
@@ -712,7 +712,7 @@ const withSaveReusableBlock = ( reducer ) => ( state, action ) => {
712
712
  if ( state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS' ) {
713
713
  const { id, updatedId } = action;
714
714
 
715
- // If a temporary reusable block is saved, we swap the temporary id with the final one
715
+ // If a temporary reusable block is saved, we swap the temporary id with the final one.
716
716
  if ( id === updatedId ) {
717
717
  return state;
718
718
  }
@@ -769,10 +769,10 @@ const withResetControlledBlocks = ( reducer ) => ( state, action ) => {
769
769
  */
770
770
  export const blocks = flow(
771
771
  combineReducers,
772
- withSaveReusableBlock, // needs to be before withBlockCache
773
- withBlockTree, // needs to be before withInnerBlocksRemoveCascade
772
+ withSaveReusableBlock, // Needs to be before withBlockCache.
773
+ withBlockTree, // Needs to be before withInnerBlocksRemoveCascade.
774
774
  withInnerBlocksRemoveCascade,
775
- withReplaceInnerBlocks, // needs to be after withInnerBlocksRemoveCascade
775
+ withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade.
776
776
  withBlockReset,
777
777
  withPersistentBlockChange,
778
778
  withIgnoredBlockChange,
@@ -788,7 +788,7 @@ export const blocks = flow(
788
788
  };
789
789
 
790
790
  case 'UPDATE_BLOCK':
791
- // Ignore updates if block isn't known
791
+ // Ignore updates if block isn't known.
792
792
  if ( ! state[ action.clientId ] ) {
793
793
  return state;
794
794
  }
@@ -947,7 +947,7 @@ export const blocks = flow(
947
947
  } = action;
948
948
  const { index = state[ toRootClientId ].length } = action;
949
949
 
950
- // Moving inside the same parent block
950
+ // Moving inside the same parent block.
951
951
  if ( fromRootClientId === toRootClientId ) {
952
952
  const subState = state[ toRootClientId ];
953
953
  const fromIndex = subState.indexOf( clientIds[ 0 ] );
@@ -962,7 +962,7 @@ export const blocks = flow(
962
962
  };
963
963
  }
964
964
 
965
- // Moving from a parent block to another
965
+ // Moving from a parent block to another.
966
966
  return {
967
967
  ...state,
968
968
  [ fromRootClientId ]: without(
@@ -1068,10 +1068,10 @@ export const blocks = flow(
1068
1068
 
1069
1069
  case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
1070
1070
  return flow( [
1071
- // Remove inner block ordering for removed blocks
1071
+ // Remove inner block ordering for removed blocks.
1072
1072
  ( nextState ) => omit( nextState, action.removedClientIds ),
1073
1073
 
1074
- // Remove deleted blocks from other blocks' orderings
1074
+ // Remove deleted blocks from other blocks' orderings.
1075
1075
  ( nextState ) =>
1076
1076
  mapValues( nextState, ( subState ) =>
1077
1077
  without( subState, ...action.removedClientIds )
@@ -1380,7 +1380,7 @@ export function isSelectionEnabled( state = true, action ) {
1380
1380
  }
1381
1381
 
1382
1382
  /**
1383
- * Reducer returning the intial block selection.
1383
+ * Reducer returning the initial block selection.
1384
1384
  *
1385
1385
  * Currently this in only used to restore the selection after block deletion and
1386
1386
  * pasting new content.This reducer should eventually be removed in favour of setting
@@ -1399,6 +1399,7 @@ export function initialPosition( state = null, action ) {
1399
1399
  return action.initialPosition;
1400
1400
  } else if (
1401
1401
  [
1402
+ 'MULTI_SELECT',
1402
1403
  'SELECT_BLOCK',
1403
1404
  'RESET_SELECTION',
1404
1405
  'INSERT_BLOCKS',
@@ -44,7 +44,7 @@ import { symbol } from '@wordpress/icons';
44
44
  * text value. See `wp.richText.create`.
45
45
  */
46
46
 
47
- // Module constants
47
+ // Module constants.
48
48
  const MILLISECONDS_PER_HOUR = 3600 * 1000;
49
49
  const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
50
50
  const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
@@ -1359,7 +1359,7 @@ export function canRemoveBlock( state, clientId, rootClientId = null ) {
1359
1359
  return ! parentIsLocked;
1360
1360
  }
1361
1361
 
1362
- // when remove is true, it means we cannot remove it.
1362
+ // When remove is true, it means we cannot remove it.
1363
1363
  return ! lock?.remove;
1364
1364
  }
1365
1365
 
@@ -1400,7 +1400,7 @@ export function canMoveBlock( state, clientId, rootClientId = null ) {
1400
1400
  return ! parentIsLocked;
1401
1401
  }
1402
1402
 
1403
- // when move is true, it means we cannot move it.
1403
+ // When move is true, it means we cannot move it.
1404
1404
  return ! lock?.move;
1405
1405
  }
1406
1406
 
@@ -1554,7 +1554,7 @@ const buildBlockTypeItem = ( state, { buildScope = 'inserter' } ) => (
1554
1554
  keywords: blockType.keywords,
1555
1555
  variations: inserterVariations,
1556
1556
  example: blockType.example,
1557
- utility: 1, // deprecated
1557
+ utility: 1, // Deprecated.
1558
1558
  };
1559
1559
  };
1560
1560
 
@@ -1654,7 +1654,7 @@ export const getInserterItems = createSelector(
1654
1654
  category: 'reusable',
1655
1655
  keywords: [],
1656
1656
  isDisabled: false,
1657
- utility: 1, // deprecated
1657
+ utility: 1, // Deprecated.
1658
1658
  frecency,
1659
1659
  };
1660
1660
  };
@@ -1675,7 +1675,7 @@ export const getInserterItems = createSelector(
1675
1675
 
1676
1676
  const items = blockTypeInserterItems.reduce( ( accumulator, item ) => {
1677
1677
  const { variations = [] } = item;
1678
- // Exclude any block type item that is to be replaced by a default variation
1678
+ // Exclude any block type item that is to be replaced by a default variation.
1679
1679
  if ( ! variations.some( ( { isDefault } ) => isDefault ) ) {
1680
1680
  accumulator.push( item );
1681
1681
  }
@@ -151,7 +151,7 @@ describe( 'actions', () => {
151
151
  const end = 'end';
152
152
  const select = {
153
153
  getBlockRootClientId() {
154
- return 'parent'; // for all client IDs
154
+ return 'parent'; // For all client IDs.
155
155
  },
156
156
  getSelectedBlockCount() {
157
157
  return 0;
@@ -165,6 +165,7 @@ describe( 'actions', () => {
165
165
  type: 'MULTI_SELECT',
166
166
  start,
167
167
  end,
168
+ initialPosition: 0,
168
169
  } );
169
170
  } );
170
171
 
@@ -1166,7 +1167,6 @@ describe( 'actions', () => {
1166
1167
  actions,
1167
1168
  selectors,
1168
1169
  reducer,
1169
- __experimentalUseThunks: true,
1170
1170
  } );
1171
1171
 
1172
1172
  registerBlockType( 'core/test-block', defaultBlockSettings );
@@ -630,7 +630,7 @@ describe( 'state', () => {
630
630
  controlledInnerBlocks: {},
631
631
  } );
632
632
 
633
- // the block object of the parent should be updated
633
+ // The block object of the parent should be updated.
634
634
  expect( state.tree.chicken ).not.toBe(
635
635
  existingState.tree.chicken
636
636
  );
@@ -2187,6 +2187,15 @@ describe( 'state', () => {
2187
2187
 
2188
2188
  expect( state ).toBe( -1 );
2189
2189
  } );
2190
+
2191
+ it( 'should allow setting null value in multi selection', () => {
2192
+ const state = initialPosition( undefined, {
2193
+ type: 'MULTI_SELECT',
2194
+ initialPosition: null,
2195
+ } );
2196
+
2197
+ expect( state ).toBe( null );
2198
+ } );
2190
2199
  } );
2191
2200
 
2192
2201
  describe( 'isMultiSelecting()', () => {
@@ -3074,7 +3074,7 @@ describe( 'selectors', () => {
3074
3074
  } );
3075
3075
 
3076
3076
  it( 'should return empty object if settings for the blocks don’t exist', () => {
3077
- // Does not include target Block clientIds
3077
+ // Does not include target Block clientIds.
3078
3078
  const state = {
3079
3079
  blockListSettings: {
3080
3080
  'test-2-dummy-clientId': {
package/src/style.scss CHANGED
@@ -36,7 +36,6 @@
36
36
  @import "./components/inner-blocks/style.scss";
37
37
  @import "./components/inserter-list-item/style.scss";
38
38
  @import "./components/justify-content-control/style.scss";
39
- @import "./components/line-height-control/style.scss";
40
39
  @import "./components/link-control/style.scss";
41
40
  @import "./components/list-view/style.scss";
42
41
  @import "./components/media-replace-flow/style.scss";
@@ -1,4 +1,3 @@
1
1
  export { default as transformStyles } from './transform-styles';
2
- export * from './theme';
3
2
  export * from './block-variation-transforms';
4
3
  export { default as getPxFromCssUnit } from './parse-css-unit-to-px';
@@ -86,7 +86,7 @@ function parseUnitFunction( cssUnit ) {
86
86
  cssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );
87
87
  }
88
88
 
89
- // if the unit hasn't been modified or we have a single value break free.
89
+ // If the unit hasn't been modified or we have a single value break free.
90
90
  if ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {
91
91
  break;
92
92
  }
@@ -123,7 +123,7 @@ function evalMathExpression( cssUnit ) {
123
123
  const parsedUnit = parseUnit( getPxFromCssUnit( unit ) );
124
124
  if ( ! parseFloat( parsedUnit.value ) ) {
125
125
  errorFound = true;
126
- // end early since we are dealing with a null value.
126
+ // End early since we are dealing with a null value.
127
127
  break;
128
128
  }
129
129
  cssUnit = cssUnit.replace( unit, parsedUnit.value );
@@ -171,7 +171,7 @@ function convertParsedUnitToPx( parsedUnit, options ) {
171
171
  ? setOptions.fontSize
172
172
  : setOptions.width ) * ONE_PERCENT,
173
173
  ch: 8, // The advance measure (width) of the glyph "0" of the element's font. Approximate
174
- ex: 7.15625, // x-height of the element's font. Approximate
174
+ ex: 7.15625, // X-height of the element's font. Approximate.
175
175
  lh: setOptions.lineHeight,
176
176
  };
177
177
 
@@ -0,0 +1,77 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createBlobURL } from '@wordpress/blob';
5
+ import { getFilesFromDataTransfer } from '@wordpress/dom';
6
+
7
+ export function getPasteEventData( { clipboardData } ) {
8
+ let plainText = '';
9
+ let html = '';
10
+
11
+ // IE11 only supports `Text` as an argument for `getData` and will
12
+ // otherwise throw an invalid argument error, so we try the standard
13
+ // arguments first, then fallback to `Text` if they fail.
14
+ try {
15
+ plainText = clipboardData.getData( 'text/plain' );
16
+ html = clipboardData.getData( 'text/html' );
17
+ } catch ( error1 ) {
18
+ try {
19
+ html = clipboardData.getData( 'Text' );
20
+ } catch ( error2 ) {
21
+ // Some browsers like UC Browser paste plain text by default and
22
+ // don't support clipboardData at all, so allow default
23
+ // behaviour.
24
+ return;
25
+ }
26
+ }
27
+
28
+ const files = getFilesFromDataTransfer(
29
+ clipboardData
30
+ ).filter( ( { type } ) => /^image\/(?:jpe?g|png|gif|webp)$/.test( type ) );
31
+
32
+ if (
33
+ files.length &&
34
+ ! shouldDismissPastedFiles( files, html, plainText )
35
+ ) {
36
+ html = files
37
+ .map( ( file ) => `<img src="${ createBlobURL( file ) }">` )
38
+ .join( '' );
39
+ plainText = '';
40
+ }
41
+
42
+ return { html, plainText };
43
+ }
44
+
45
+ /**
46
+ * Given a collection of DataTransfer files and HTML and plain text strings,
47
+ * determine whether the files are to be dismissed in favor of the HTML.
48
+ *
49
+ * Certain office-type programs, like Microsoft Word or Apple Numbers,
50
+ * will, upon copy, generate a screenshot of the content being copied and
51
+ * attach it to the clipboard alongside the actual rich text that the user
52
+ * sought to copy. In those cases, we should let Gutenberg handle the rich text
53
+ * content and not the screenshot, since this allows Gutenberg to insert
54
+ * meaningful blocks, like paragraphs, lists or even tables.
55
+ *
56
+ * @param {File[]} files File objects obtained from a paste event
57
+ * @param {string} html HTML content obtained from a paste event
58
+ * @return {boolean} True if the files should be dismissed
59
+ */
60
+ export function shouldDismissPastedFiles( files, html /*, plainText */ ) {
61
+ // The question is only relevant when there is actual HTML content and when
62
+ // there is exactly one image file.
63
+ if (
64
+ html &&
65
+ files?.length === 1 &&
66
+ files[ 0 ].type.indexOf( 'image/' ) === 0
67
+ ) {
68
+ // A single <img> tag found in the HTML source suggests that the
69
+ // content being pasted revolves around an image. Sometimes there are
70
+ // other elements found, like <figure>, but we assume that the user's
71
+ // intention is to paste the actual image file.
72
+ const IMAGE_TAG = /<\s*img\b/gi;
73
+ return html.match( IMAGE_TAG )?.length !== 1;
74
+ }
75
+
76
+ return false;
77
+ }
@@ -9,7 +9,7 @@ import {
9
9
  jest.useRealTimers();
10
10
 
11
11
  describe( 'getPxFromCssUnit', () => {
12
- // Absolute units
12
+ // Absolute units.
13
13
  describe( 'absolute unites should return px values', () => {
14
14
  const testData = [
15
15
  [ '25px', '25px' ],
@@ -19,7 +19,7 @@ describe( 'getPxFromCssUnit', () => {
19
19
  [ '1in', '96px' ],
20
20
  [ '12pt', '16px' ],
21
21
  [ '1pc', '16px' ],
22
- [ '40Q', '38px' ], // 40 Q should be 1 cm
22
+ [ '40Q', '38px' ], // 40 Q should be 1 cm.
23
23
  ];
24
24
 
25
25
  test.each( testData )(
@@ -87,7 +87,7 @@ describe( 'getPxFromCssUnit', () => {
87
87
  );
88
88
  } );
89
89
 
90
- // Function units
90
+ // Function units.
91
91
 
92
92
  describe( 'function unites should return px values', () => {
93
93
  const settings = {
@@ -120,7 +120,7 @@ describe( 'getPxFromCssUnit', () => {
120
120
  [ 123.456, '123px' ],
121
121
  [ 'abc', null ],
122
122
  [ 'console.log("howdy"); + 10px', null ],
123
- [ 'calc(12vw * 10px', null ], // missing closing bracket
123
+ [ 'calc(12vw * 10px', null ], // Missing closing bracket.
124
124
  ];
125
125
 
126
126
  test.each( testData )(
@@ -159,7 +159,7 @@ describe( 'getPxFromCssUnit', () => {
159
159
 
160
160
  const startM = Date.now();
161
161
  i = 0;
162
- // the memoized Version should be at 10X better then the non default one.
162
+ // The memoized Version should be at 10X better then the non default one.
163
163
  while ( i < intervals * 10 ) {
164
164
  memoizedGetPxFromCssUnit( 'max(25px, 35px)', { width: 201 } );
165
165
  i++;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { shouldDismissPastedFiles } from '../pasting';
5
+
6
+ const mocks = {
7
+ pngImageFile: { type: 'image/png' },
8
+ jpgImageFile: { type: 'image/jpg' },
9
+ documentFile: { type: 'application/zip' },
10
+ };
11
+
12
+ describe( 'shouldDismissPastedFiles', () => {
13
+ it( 'should return false when no HTML is present', () => {
14
+ expect(
15
+ shouldDismissPastedFiles( [ mocks.pngImageFile ], '', '' )
16
+ ).toBe( false );
17
+ } );
18
+ it( 'should return false when file is not an image', () => {
19
+ expect(
20
+ shouldDismissPastedFiles( [ mocks.documentFile ], '', '' )
21
+ ).toBe( false );
22
+ } );
23
+ it( 'should return false when multiple images are present', () => {
24
+ expect(
25
+ shouldDismissPastedFiles(
26
+ [ mocks.pngImageFile, mocks.jpgImageFile ],
27
+ '',
28
+ ''
29
+ )
30
+ ).toBe( false );
31
+ } );
32
+ it( 'should return false when the HTML contains a single image', () => {
33
+ expect(
34
+ shouldDismissPastedFiles(
35
+ [ mocks.pngImageFile ],
36
+ '<img src="path.png">',
37
+ ''
38
+ )
39
+ ).toBe( false );
40
+ } );
41
+ it( 'should return true when the HTML contains more than one image', () => {
42
+ expect(
43
+ shouldDismissPastedFiles(
44
+ [ mocks.pngImageFile ],
45
+ '<img src="1.png"><br><img src="2.png">',
46
+ ''
47
+ )
48
+ ).toBe( true );
49
+ } );
50
+
51
+ /*
52
+ * REAL-WORLD SCENARIOS
53
+ */
54
+
55
+ it( 'should return false when pasting an image from Google Photos', () => {
56
+ expect(
57
+ shouldDismissPastedFiles(
58
+ [ mocks.pngImageFile ],
59
+ '<img src="https://lh3.googleusercontent.com/ab/SOMESTRING?authuser=0">',
60
+ 'https://lh3.googleusercontent.com/ab/SOMESTRING?authuser=0'
61
+ )
62
+ ).toBe( false );
63
+ } );
64
+
65
+ it( 'should return false when pasting an image from Apple Numbers', () => {
66
+ expect(
67
+ shouldDismissPastedFiles(
68
+ [ mocks.pngImageFile ],
69
+ '<figure><img src="blob:..."></figure>',
70
+ ''
71
+ )
72
+ ).toBe( false );
73
+ } );
74
+
75
+ it( 'should return true when pasting a table from Apple Numbers', () => {
76
+ expect(
77
+ shouldDismissPastedFiles(
78
+ [ mocks.pngImageFile ],
79
+ '<meta charset="UTF-8"><table>Some table text</table>',
80
+ 'Some table text'
81
+ )
82
+ ).toBe( true );
83
+ } );
84
+ } );
@@ -240,7 +240,7 @@ export default function ( css, options ) {
240
240
  function declaration() {
241
241
  const pos = position();
242
242
 
243
- // prop
243
+ // prop.
244
244
  let prop = match( /^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/ );
245
245
  if ( ! prop ) {
246
246
  return;
@@ -252,7 +252,7 @@ export default function ( css, options ) {
252
252
  return error( "property missing ':'" );
253
253
  }
254
254
 
255
- // val
255
+ // val.
256
256
  const val = match(
257
257
  /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/
258
258
  );
@@ -281,7 +281,7 @@ export default function ( css, options ) {
281
281
  }
282
282
  comments( decls );
283
283
 
284
- // declarations
284
+ // declarations.
285
285
  let decl;
286
286
  // eslint-disable-next-line no-cond-assign
287
287
  while ( ( decl = declaration() ) ) {
@@ -491,7 +491,7 @@ export default function ( css, options ) {
491
491
  }
492
492
  let decls = comments();
493
493
 
494
- // declarations
494
+ // declarations.
495
495
  let decl;
496
496
  // eslint-disable-next-line no-cond-assign
497
497
  while ( ( decl = declaration() ) ) {
@@ -558,7 +558,7 @@ export default function ( css, options ) {
558
558
  }
559
559
  let decls = comments();
560
560
 
561
- // declarations
561
+ // declarations.
562
562
  let decl;
563
563
  // eslint-disable-next-line no-cond-assign
564
564
  while ( ( decl = declaration() ) ) {
@@ -28,7 +28,7 @@ function isAbsolutePath( filePath ) {
28
28
  * @return {boolean} is valid.
29
29
  */
30
30
  function isValidURL( meta ) {
31
- // ignore hashes or data uris
31
+ // Ignore hashes or data uris.
32
32
  if (
33
33
  meta.value.indexOf( 'data:' ) === 0 ||
34
34
  meta.value.indexOf( '#' ) === 0
@@ -40,7 +40,7 @@ function isValidURL( meta ) {
40
40
  return false;
41
41
  }
42
42
 
43
- // do not handle the http/https urls if `includeRemote` is false
43
+ // Do not handle the http/https urls if `includeRemote` is false.
44
44
  if ( isRemotePath( meta.value ) ) {
45
45
  return false;
46
46
  }
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPasteEventData = getPasteEventData;
7
-
8
- var _blob = require("@wordpress/blob");
9
-
10
- var _dom = require("@wordpress/dom");
11
-
12
- /**
13
- * WordPress dependencies
14
- */
15
- function getPasteEventData(_ref) {
16
- let {
17
- clipboardData
18
- } = _ref;
19
- let plainText = '';
20
- let html = ''; // IE11 only supports `Text` as an argument for `getData` and will
21
- // otherwise throw an invalid argument error, so we try the standard
22
- // arguments first, then fallback to `Text` if they fail.
23
-
24
- try {
25
- plainText = clipboardData.getData('text/plain');
26
- html = clipboardData.getData('text/html');
27
- } catch (error1) {
28
- try {
29
- html = clipboardData.getData('Text');
30
- } catch (error2) {
31
- // Some browsers like UC Browser paste plain text by default and
32
- // don't support clipboardData at all, so allow default
33
- // behaviour.
34
- return;
35
- }
36
- }
37
-
38
- const files = (0, _dom.getFilesFromDataTransfer)(clipboardData).filter(_ref2 => {
39
- let {
40
- type
41
- } = _ref2;
42
- return /^image\/(?:jpe?g|png|gif|webp)$/.test(type);
43
- }); // Only process files if no HTML is present.
44
- // A pasted file may have the URL as plain text.
45
-
46
- if (files.length && !html) {
47
- html = files.map(file => `<img src="${(0, _blob.createBlobURL)(file)}">`).join('');
48
- plainText = '';
49
- }
50
-
51
- return {
52
- html,
53
- plainText
54
- };
55
- }
56
- //# sourceMappingURL=get-paste-event-data.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/utils/get-paste-event-data.js"],"names":["getPasteEventData","clipboardData","plainText","html","getData","error1","error2","files","filter","type","test","length","map","file","join"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIO,SAASA,iBAAT,OAAgD;AAAA,MAApB;AAAEC,IAAAA;AAAF,GAAoB;AACtD,MAAIC,SAAS,GAAG,EAAhB;AACA,MAAIC,IAAI,GAAG,EAAX,CAFsD,CAItD;AACA;AACA;;AACA,MAAI;AACHD,IAAAA,SAAS,GAAGD,aAAa,CAACG,OAAd,CAAuB,YAAvB,CAAZ;AACAD,IAAAA,IAAI,GAAGF,aAAa,CAACG,OAAd,CAAuB,WAAvB,CAAP;AACA,GAHD,CAGE,OAAQC,MAAR,EAAiB;AAClB,QAAI;AACHF,MAAAA,IAAI,GAAGF,aAAa,CAACG,OAAd,CAAuB,MAAvB,CAAP;AACA,KAFD,CAEE,OAAQE,MAAR,EAAiB;AAClB;AACA;AACA;AACA;AACA;AACD;;AAED,QAAMC,KAAK,GAAG,mCACbN,aADa,EAEZO,MAFY,CAEJ;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgB,kCAAkCC,IAAlC,CAAwCD,IAAxC,CAAhB;AAAA,GAFI,CAAd,CArBsD,CAyBtD;AACA;;AACA,MAAKF,KAAK,CAACI,MAAN,IAAgB,CAAER,IAAvB,EAA8B;AAC7BA,IAAAA,IAAI,GAAGI,KAAK,CACVK,GADK,CACEC,IAAF,IAAa,aAAa,yBAAeA,IAAf,CAAuB,IADjD,EAELC,IAFK,CAEC,EAFD,CAAP;AAGAZ,IAAAA,SAAS,GAAG,EAAZ;AACA;;AAED,SAAO;AAAEC,IAAAA,IAAF;AAAQD,IAAAA;AAAR,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlobURL } from '@wordpress/blob';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\nexport function getPasteEventData( { clipboardData } ) {\n\tlet plainText = '';\n\tlet html = '';\n\n\t// IE11 only supports `Text` as an argument for `getData` and will\n\t// otherwise throw an invalid argument error, so we try the standard\n\t// arguments first, then fallback to `Text` if they fail.\n\ttry {\n\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\thtml = clipboardData.getData( 'text/html' );\n\t} catch ( error1 ) {\n\t\ttry {\n\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t} catch ( error2 ) {\n\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t// behaviour.\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst files = getFilesFromDataTransfer(\n\t\tclipboardData\n\t).filter( ( { type } ) => /^image\\/(?:jpe?g|png|gif|webp)$/.test( type ) );\n\n\t// Only process files if no HTML is present.\n\t// A pasted file may have the URL as plain text.\n\tif ( files.length && ! html ) {\n\t\thtml = files\n\t\t\t.map( ( file ) => `<img src=\"${ createBlobURL( file ) }\">` )\n\t\t\t.join( '' );\n\t\tplainText = '';\n\t}\n\n\treturn { html, plainText };\n}\n"]}
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.validateThemeColors = validateThemeColors;
7
- exports.validateThemeGradients = validateThemeGradients;
8
-
9
- var _defaults = require("../store/defaults");
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
-
15
- /**
16
- * Given an array of theme colors checks colors for validity
17
- *
18
- * @param {Array} colors The array of theme colors
19
- *
20
- * @return {Array} The array of valid theme colors or the default colors
21
- */
22
- function validateThemeColors(colors) {
23
- if (colors === undefined) {
24
- colors = _defaults.SETTINGS_DEFAULTS.colors;
25
- } else {
26
- const validColors = colors.filter(c => c.color);
27
-
28
- if (validColors.length === 0) {
29
- colors = _defaults.SETTINGS_DEFAULTS.colors;
30
- } else if (validColors.length < colors.length) {
31
- // Filter out invalid colors
32
- colors = validColors;
33
- }
34
- }
35
-
36
- return colors;
37
- }
38
- /**
39
- * Given an array of theme gradients checks gradients for validity
40
- *
41
- * @param {Array} gradients The array of theme gradients
42
- *
43
- * @return {Array} The array of valid theme gradients or the default gradients
44
- */
45
-
46
-
47
- function validateThemeGradients(gradients) {
48
- if (gradients === undefined) {
49
- gradients = _defaults.SETTINGS_DEFAULTS.gradients;
50
- } else {
51
- const validGradients = gradients.filter(c => c.gradient);
52
-
53
- if (validGradients.length === 0) {
54
- gradients = _defaults.SETTINGS_DEFAULTS.gradients;
55
- } else if (validGradients.length < gradients.length) {
56
- // Filter out invalid gradients
57
- gradients = validGradients;
58
- }
59
- }
60
-
61
- return gradients;
62
- }
63
- //# sourceMappingURL=theme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/utils/theme.js"],"names":["validateThemeColors","colors","undefined","SETTINGS_DEFAULTS","validColors","filter","c","color","length","validateThemeGradients","gradients","validGradients","gradient"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,MAA9B,EAAuC;AAC7C,MAAKA,MAAM,KAAKC,SAAhB,EAA4B;AAC3BD,IAAAA,MAAM,GAAGE,4BAAkBF,MAA3B;AACA,GAFD,MAEO;AACN,UAAMG,WAAW,GAAGH,MAAM,CAACI,MAAP,CAAiBC,CAAF,IAASA,CAAC,CAACC,KAA1B,CAApB;;AACA,QAAKH,WAAW,CAACI,MAAZ,KAAuB,CAA5B,EAAgC;AAC/BP,MAAAA,MAAM,GAAGE,4BAAkBF,MAA3B;AACA,KAFD,MAEO,IAAKG,WAAW,CAACI,MAAZ,GAAqBP,MAAM,CAACO,MAAjC,EAA0C;AAChD;AACAP,MAAAA,MAAM,GAAGG,WAAT;AACA;AACD;;AACD,SAAOH,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASQ,sBAAT,CAAiCC,SAAjC,EAA6C;AACnD,MAAKA,SAAS,KAAKR,SAAnB,EAA+B;AAC9BQ,IAAAA,SAAS,GAAGP,4BAAkBO,SAA9B;AACA,GAFD,MAEO;AACN,UAAMC,cAAc,GAAGD,SAAS,CAACL,MAAV,CAAoBC,CAAF,IAASA,CAAC,CAACM,QAA7B,CAAvB;;AACA,QAAKD,cAAc,CAACH,MAAf,KAA0B,CAA/B,EAAmC;AAClCE,MAAAA,SAAS,GAAGP,4BAAkBO,SAA9B;AACA,KAFD,MAEO,IAAKC,cAAc,CAACH,MAAf,GAAwBE,SAAS,CAACF,MAAvC,EAAgD;AACtD;AACAE,MAAAA,SAAS,GAAGC,cAAZ;AACA;AACD;;AACD,SAAOD,SAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { SETTINGS_DEFAULTS } from '../store/defaults';\n\n/**\n * Given an array of theme colors checks colors for validity\n *\n * @param {Array} colors The array of theme colors\n *\n * @return {Array} The array of valid theme colors or the default colors\n */\nexport function validateThemeColors( colors ) {\n\tif ( colors === undefined ) {\n\t\tcolors = SETTINGS_DEFAULTS.colors;\n\t} else {\n\t\tconst validColors = colors.filter( ( c ) => c.color );\n\t\tif ( validColors.length === 0 ) {\n\t\t\tcolors = SETTINGS_DEFAULTS.colors;\n\t\t} else if ( validColors.length < colors.length ) {\n\t\t\t// Filter out invalid colors\n\t\t\tcolors = validColors;\n\t\t}\n\t}\n\treturn colors;\n}\n\n/**\n * Given an array of theme gradients checks gradients for validity\n *\n * @param {Array} gradients The array of theme gradients\n *\n * @return {Array} The array of valid theme gradients or the default gradients\n */\nexport function validateThemeGradients( gradients ) {\n\tif ( gradients === undefined ) {\n\t\tgradients = SETTINGS_DEFAULTS.gradients;\n\t} else {\n\t\tconst validGradients = gradients.filter( ( c ) => c.gradient );\n\t\tif ( validGradients.length === 0 ) {\n\t\t\tgradients = SETTINGS_DEFAULTS.gradients;\n\t\t} else if ( validGradients.length < gradients.length ) {\n\t\t\t// Filter out invalid gradients\n\t\t\tgradients = validGradients;\n\t\t}\n\t}\n\treturn gradients;\n}\n"]}