@wordpress/block-editor 12.21.0 → 12.23.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 (408) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -0
  3. package/build/components/block-actions/index.js +2 -4
  4. package/build/components/block-actions/index.js.map +1 -1
  5. package/build/components/block-heading-level-dropdown/index.js +5 -5
  6. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  7. package/build/components/block-heading-level-dropdown/index.native.js +5 -4
  8. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  9. package/build/components/block-list/block-crash-boundary.native.js +49 -0
  10. package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
  11. package/build/components/block-list/block-crash-warning.native.js +24 -0
  12. package/build/components/block-list/block-crash-warning.native.js.map +1 -0
  13. package/build/components/block-list/block.js +11 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +7 -2
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-mover/button.js +4 -1
  18. package/build/components/block-mover/button.js.map +1 -1
  19. package/build/components/block-mover/index.js +5 -1
  20. package/build/components/block-mover/index.js.map +1 -1
  21. package/build/components/block-patterns-list/index.js +4 -1
  22. package/build/components/block-patterns-list/index.js.map +1 -1
  23. package/build/components/block-settings/container.native.js +2 -1
  24. package/build/components/block-settings/container.native.js.map +1 -1
  25. package/build/components/block-settings-menu/block-settings-dropdown.js +36 -32
  26. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  27. package/build/components/block-settings-menu-controls/index.js +1 -3
  28. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  29. package/build/components/block-switcher/index.js +4 -3
  30. package/build/components/block-switcher/index.js.map +1 -1
  31. package/build/components/block-toolbar/index.js +8 -5
  32. package/build/components/block-toolbar/index.js.map +1 -1
  33. package/build/components/block-toolbar/shuffle.js +19 -10
  34. package/build/components/block-toolbar/shuffle.js.map +1 -1
  35. package/build/components/block-tools/block-selection-button.js +48 -8
  36. package/build/components/block-tools/block-selection-button.js.map +1 -1
  37. package/build/components/block-tools/index.js +14 -2
  38. package/build/components/block-tools/index.js.map +1 -1
  39. package/build/components/child-layout-control/index.js +108 -11
  40. package/build/components/child-layout-control/index.js.map +1 -1
  41. package/build/components/convert-to-group-buttons/toolbar.js +11 -0
  42. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  43. package/build/components/global-styles/advanced-panel.js +9 -2
  44. package/build/components/global-styles/advanced-panel.js.map +1 -1
  45. package/build/components/global-styles/background-panel.js +444 -0
  46. package/build/components/global-styles/background-panel.js.map +1 -0
  47. package/build/components/global-styles/color-panel.js +2 -1
  48. package/build/components/global-styles/color-panel.js.map +1 -1
  49. package/build/components/global-styles/dimensions-panel.js +8 -33
  50. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  51. package/build/components/global-styles/get-global-styles-changes.js +3 -0
  52. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  53. package/build/components/global-styles/hooks.js +1 -1
  54. package/build/components/global-styles/hooks.js.map +1 -1
  55. package/build/components/global-styles/index.js +13 -0
  56. package/build/components/global-styles/index.js.map +1 -1
  57. package/build/components/global-styles/use-global-styles-output.js +16 -15
  58. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build/components/global-styles/utils.js +2 -3
  60. package/build/components/global-styles/utils.js.map +1 -1
  61. package/build/components/iframe/index.js +43 -34
  62. package/build/components/iframe/index.js.map +1 -1
  63. package/build/components/inserter/block-patterns-explorer/index.js +3 -6
  64. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  65. package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  66. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  67. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  68. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  69. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  70. package/build/components/inserter/library.js +2 -0
  71. package/build/components/inserter/library.js.map +1 -1
  72. package/build/components/inserter/menu.js +11 -11
  73. package/build/components/inserter/menu.js.map +1 -1
  74. package/build/components/inserter/mobile-tab-navigation.js +1 -1
  75. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  76. package/build/components/inserter/search-items.js +36 -15
  77. package/build/components/inserter/search-items.js.map +1 -1
  78. package/build/components/inserter/search-results.js +2 -3
  79. package/build/components/inserter/search-results.js.map +1 -1
  80. package/build/components/inserter/tabs.js +1 -2
  81. package/build/components/inserter/tabs.js.map +1 -1
  82. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
  83. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  84. package/build/components/keyboard-shortcuts/index.js +11 -0
  85. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  86. package/build/components/list-view/block-select-button.js +18 -12
  87. package/build/components/list-view/block-select-button.js.map +1 -1
  88. package/build/components/list-view/block.js +4 -11
  89. package/build/components/list-view/block.js.map +1 -1
  90. package/build/components/list-view/index.js +17 -2
  91. package/build/components/list-view/index.js.map +1 -1
  92. package/build/components/list-view/use-list-view-collapse-items.js +47 -0
  93. package/build/components/list-view/use-list-view-collapse-items.js.map +1 -0
  94. package/build/components/list-view/utils.js +5 -3
  95. package/build/components/list-view/utils.js.map +1 -1
  96. package/build/components/rich-text/index.js +14 -11
  97. package/build/components/rich-text/index.js.map +1 -1
  98. package/build/components/rich-text/index.native.js +17 -11
  99. package/build/components/rich-text/index.native.js.map +1 -1
  100. package/build/components/rich-text/native/get-format-colors.native.js +1 -1
  101. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  102. package/build/components/rich-text/native/index.native.js +2 -2
  103. package/build/components/rich-text/native/index.native.js.map +1 -1
  104. package/build/components/rich-text/with-deprecations.js +0 -3
  105. package/build/components/rich-text/with-deprecations.js.map +1 -1
  106. package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  107. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  108. package/build/components/url-popover/image-url-input-ui.js +50 -36
  109. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  110. package/build/components/use-block-display-information/index.js +4 -6
  111. package/build/components/use-block-display-information/index.js.map +1 -1
  112. package/build/components/use-moving-animation/index.js +4 -0
  113. package/build/components/use-moving-animation/index.js.map +1 -1
  114. package/build/components/warning/index.native.js +9 -4
  115. package/build/components/warning/index.native.js.map +1 -1
  116. package/build/hooks/anchor.js +9 -10
  117. package/build/hooks/anchor.js.map +1 -1
  118. package/build/hooks/background.js +85 -402
  119. package/build/hooks/background.js.map +1 -1
  120. package/build/hooks/index.js +9 -1
  121. package/build/hooks/index.js.map +1 -1
  122. package/build/hooks/layout-child.js +28 -6
  123. package/build/hooks/layout-child.js.map +1 -1
  124. package/build/hooks/layout.js +21 -10
  125. package/build/hooks/layout.js.map +1 -1
  126. package/build/hooks/position.js +1 -1
  127. package/build/hooks/position.js.map +1 -1
  128. package/build/hooks/use-zoom-out.js +47 -0
  129. package/build/hooks/use-zoom-out.js.map +1 -0
  130. package/build/index.js +7 -0
  131. package/build/index.js.map +1 -1
  132. package/build/private-apis.js +6 -1
  133. package/build/private-apis.js.map +1 -1
  134. package/build/private-apis.native.js +5 -1
  135. package/build/private-apis.native.js.map +1 -1
  136. package/build/store/private-actions.js +13 -0
  137. package/build/store/private-actions.js.map +1 -1
  138. package/build/store/private-keys.js +2 -1
  139. package/build/store/private-keys.js.map +1 -1
  140. package/build/store/private-selectors.js +24 -3
  141. package/build/store/private-selectors.js.map +1 -1
  142. package/build/store/reducer.js +53 -26
  143. package/build/store/reducer.js.map +1 -1
  144. package/build/store/selectors.js +34 -32
  145. package/build/store/selectors.js.map +1 -1
  146. package/build/store/utils.js +7 -1
  147. package/build/store/utils.js.map +1 -1
  148. package/build/utils/transform-styles/index.js +2 -1
  149. package/build/utils/transform-styles/index.js.map +1 -1
  150. package/build-module/components/block-actions/index.js +2 -4
  151. package/build-module/components/block-actions/index.js.map +1 -1
  152. package/build-module/components/block-heading-level-dropdown/index.js +5 -5
  153. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  154. package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
  155. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  156. package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
  157. package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
  158. package/build-module/components/block-list/block-crash-warning.native.js +15 -0
  159. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
  160. package/build-module/components/block-list/block.js +11 -3
  161. package/build-module/components/block-list/block.js.map +1 -1
  162. package/build-module/components/block-list/block.native.js +7 -2
  163. package/build-module/components/block-list/block.native.js.map +1 -1
  164. package/build-module/components/block-mover/button.js +4 -1
  165. package/build-module/components/block-mover/button.js.map +1 -1
  166. package/build-module/components/block-mover/index.js +5 -1
  167. package/build-module/components/block-mover/index.js.map +1 -1
  168. package/build-module/components/block-patterns-list/index.js +4 -1
  169. package/build-module/components/block-patterns-list/index.js.map +1 -1
  170. package/build-module/components/block-settings/container.native.js +3 -2
  171. package/build-module/components/block-settings/container.native.js.map +1 -1
  172. package/build-module/components/block-settings-menu/block-settings-dropdown.js +37 -33
  173. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  174. package/build-module/components/block-settings-menu-controls/index.js +1 -3
  175. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  176. package/build-module/components/block-switcher/index.js +4 -3
  177. package/build-module/components/block-switcher/index.js.map +1 -1
  178. package/build-module/components/block-toolbar/index.js +8 -5
  179. package/build-module/components/block-toolbar/index.js.map +1 -1
  180. package/build-module/components/block-toolbar/shuffle.js +19 -10
  181. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  182. package/build-module/components/block-tools/block-selection-button.js +50 -10
  183. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  184. package/build-module/components/block-tools/index.js +14 -2
  185. package/build-module/components/block-tools/index.js.map +1 -1
  186. package/build-module/components/child-layout-control/index.js +109 -12
  187. package/build-module/components/child-layout-control/index.js.map +1 -1
  188. package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
  189. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  190. package/build-module/components/global-styles/advanced-panel.js +9 -2
  191. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  192. package/build-module/components/global-styles/background-panel.js +430 -0
  193. package/build-module/components/global-styles/background-panel.js.map +1 -0
  194. package/build-module/components/global-styles/color-panel.js +2 -1
  195. package/build-module/components/global-styles/color-panel.js.map +1 -1
  196. package/build-module/components/global-styles/dimensions-panel.js +9 -34
  197. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  198. package/build-module/components/global-styles/get-global-styles-changes.js +3 -0
  199. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  200. package/build-module/components/global-styles/hooks.js +1 -1
  201. package/build-module/components/global-styles/hooks.js.map +1 -1
  202. package/build-module/components/global-styles/index.js +1 -0
  203. package/build-module/components/global-styles/index.js.map +1 -1
  204. package/build-module/components/global-styles/use-global-styles-output.js +17 -16
  205. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  206. package/build-module/components/global-styles/utils.js +1 -2
  207. package/build-module/components/global-styles/utils.js.map +1 -1
  208. package/build-module/components/iframe/index.js +43 -34
  209. package/build-module/components/iframe/index.js.map +1 -1
  210. package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
  211. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  212. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  213. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  214. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  216. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  217. package/build-module/components/inserter/library.js +2 -0
  218. package/build-module/components/inserter/library.js.map +1 -1
  219. package/build-module/components/inserter/menu.js +11 -11
  220. package/build-module/components/inserter/menu.js.map +1 -1
  221. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  222. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  223. package/build-module/components/inserter/search-items.js +33 -15
  224. package/build-module/components/inserter/search-items.js.map +1 -1
  225. package/build-module/components/inserter/search-results.js +2 -3
  226. package/build-module/components/inserter/search-results.js.map +1 -1
  227. package/build-module/components/inserter/tabs.js +1 -2
  228. package/build-module/components/inserter/tabs.js.map +1 -1
  229. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
  230. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  231. package/build-module/components/keyboard-shortcuts/index.js +11 -0
  232. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  233. package/build-module/components/list-view/block-select-button.js +19 -13
  234. package/build-module/components/list-view/block-select-button.js.map +1 -1
  235. package/build-module/components/list-view/block.js +6 -13
  236. package/build-module/components/list-view/block.js.map +1 -1
  237. package/build-module/components/list-view/index.js +17 -2
  238. package/build-module/components/list-view/index.js.map +1 -1
  239. package/build-module/components/list-view/use-list-view-collapse-items.js +40 -0
  240. package/build-module/components/list-view/use-list-view-collapse-items.js.map +1 -0
  241. package/build-module/components/list-view/utils.js +2 -1
  242. package/build-module/components/list-view/utils.js.map +1 -1
  243. package/build-module/components/rich-text/index.js +15 -12
  244. package/build-module/components/rich-text/index.js.map +1 -1
  245. package/build-module/components/rich-text/index.native.js +16 -11
  246. package/build-module/components/rich-text/index.native.js.map +1 -1
  247. package/build-module/components/rich-text/native/get-format-colors.native.js +1 -1
  248. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  249. package/build-module/components/rich-text/native/index.native.js +2 -2
  250. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  251. package/build-module/components/rich-text/with-deprecations.js +0 -3
  252. package/build-module/components/rich-text/with-deprecations.js.map +1 -1
  253. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  254. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  255. package/build-module/components/url-popover/image-url-input-ui.js +50 -36
  256. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  257. package/build-module/components/use-block-display-information/index.js +5 -7
  258. package/build-module/components/use-block-display-information/index.js.map +1 -1
  259. package/build-module/components/use-moving-animation/index.js +4 -0
  260. package/build-module/components/use-moving-animation/index.js.map +1 -1
  261. package/build-module/components/warning/index.native.js +9 -4
  262. package/build-module/components/warning/index.native.js.map +1 -1
  263. package/build-module/hooks/anchor.js +10 -11
  264. package/build-module/hooks/anchor.js.map +1 -1
  265. package/build-module/hooks/background.js +82 -397
  266. package/build-module/hooks/background.js.map +1 -1
  267. package/build-module/hooks/index.js +3 -1
  268. package/build-module/hooks/index.js.map +1 -1
  269. package/build-module/hooks/layout-child.js +28 -6
  270. package/build-module/hooks/layout-child.js.map +1 -1
  271. package/build-module/hooks/layout.js +21 -10
  272. package/build-module/hooks/layout.js.map +1 -1
  273. package/build-module/hooks/position.js +1 -1
  274. package/build-module/hooks/position.js.map +1 -1
  275. package/build-module/hooks/use-zoom-out.js +41 -0
  276. package/build-module/hooks/use-zoom-out.js.map +1 -0
  277. package/build-module/index.js +1 -1
  278. package/build-module/index.js.map +1 -1
  279. package/build-module/private-apis.js +7 -2
  280. package/build-module/private-apis.js.map +1 -1
  281. package/build-module/private-apis.native.js +5 -1
  282. package/build-module/private-apis.native.js.map +1 -1
  283. package/build-module/store/private-actions.js +12 -0
  284. package/build-module/store/private-actions.js.map +1 -1
  285. package/build-module/store/private-keys.js +1 -0
  286. package/build-module/store/private-keys.js.map +1 -1
  287. package/build-module/store/private-selectors.js +22 -4
  288. package/build-module/store/private-selectors.js.map +1 -1
  289. package/build-module/store/reducer.js +52 -26
  290. package/build-module/store/reducer.js.map +1 -1
  291. package/build-module/store/selectors.js +35 -33
  292. package/build-module/store/selectors.js.map +1 -1
  293. package/build-module/store/utils.js +6 -1
  294. package/build-module/store/utils.js.map +1 -1
  295. package/build-module/utils/transform-styles/index.js +2 -1
  296. package/build-module/utils/transform-styles/index.js.map +1 -1
  297. package/build-style/content-rtl.css +18 -1
  298. package/build-style/content.css +18 -1
  299. package/build-style/style-rtl.css +92 -99
  300. package/build-style/style.css +92 -99
  301. package/package.json +31 -31
  302. package/src/components/block-actions/index.js +2 -8
  303. package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
  304. package/src/components/block-heading-level-dropdown/README.md +5 -5
  305. package/src/components/block-heading-level-dropdown/index.js +5 -5
  306. package/src/components/block-heading-level-dropdown/index.native.js +5 -4
  307. package/src/components/block-list/block-crash-boundary.native.js +43 -0
  308. package/src/components/block-list/block-crash-warning.native.js +19 -0
  309. package/src/components/block-list/block.js +19 -3
  310. package/src/components/block-list/block.native.js +14 -7
  311. package/src/components/block-list/content.scss +16 -0
  312. package/src/components/block-mover/button.js +4 -1
  313. package/src/components/block-mover/index.js +8 -1
  314. package/src/components/block-patterns-list/index.js +22 -17
  315. package/src/components/block-preview/style.scss +28 -0
  316. package/src/components/block-settings/container.native.js +5 -1
  317. package/src/components/block-settings-menu/block-settings-dropdown.js +49 -58
  318. package/src/components/block-settings-menu-controls/README.md +0 -9
  319. package/src/components/block-settings-menu-controls/index.js +1 -6
  320. package/src/components/block-switcher/index.js +5 -3
  321. package/src/components/block-switcher/style.scss +1 -1
  322. package/src/components/block-toolbar/index.js +25 -20
  323. package/src/components/block-toolbar/shuffle.js +20 -14
  324. package/src/components/block-toolbar/style.scss +1 -1
  325. package/src/components/block-toolbar/test/index.native.js +1 -7
  326. package/src/components/block-tools/block-selection-button.js +66 -9
  327. package/src/components/block-tools/index.js +18 -1
  328. package/src/components/button-block-appender/content.scss +5 -1
  329. package/src/components/child-layout-control/index.js +147 -35
  330. package/src/components/convert-to-group-buttons/toolbar.js +13 -1
  331. package/src/components/default-block-appender/content.scss +2 -2
  332. package/src/components/global-styles/advanced-panel.js +8 -2
  333. package/src/components/global-styles/background-panel.js +591 -0
  334. package/src/components/global-styles/color-panel.js +2 -1
  335. package/src/components/global-styles/dimensions-panel.js +9 -34
  336. package/src/components/global-styles/get-global-styles-changes.js +3 -0
  337. package/src/components/global-styles/hooks.js +1 -0
  338. package/src/components/global-styles/index.js +4 -0
  339. package/src/components/global-styles/style.scss +78 -1
  340. package/src/{hooks/test/background.js → components/global-styles/test/background-panel.js} +36 -1
  341. package/src/components/global-styles/test/get-global-styles-changes.js +22 -3
  342. package/src/components/global-styles/test/use-global-styles-output.js +40 -9
  343. package/src/components/global-styles/use-global-styles-output.js +30 -17
  344. package/src/components/global-styles/utils.js +1 -18
  345. package/src/components/iframe/index.js +79 -53
  346. package/src/components/inserter/block-patterns-explorer/index.js +2 -9
  347. package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
  348. package/src/components/inserter/block-patterns-tab/index.js +1 -0
  349. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
  350. package/src/components/inserter/library.js +4 -0
  351. package/src/components/inserter/menu.js +12 -11
  352. package/src/components/inserter/mobile-tab-navigation.js +1 -1
  353. package/src/components/inserter/search-items.js +37 -15
  354. package/src/components/inserter/search-results.js +1 -2
  355. package/src/components/inserter/style.scss +6 -12
  356. package/src/components/inserter/tabs.js +1 -2
  357. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
  358. package/src/components/keyboard-shortcuts/index.js +11 -0
  359. package/src/components/link-control/style.scss +0 -5
  360. package/src/components/list-view/block-select-button.js +15 -19
  361. package/src/components/list-view/block.js +12 -21
  362. package/src/components/list-view/index.js +18 -1
  363. package/src/components/list-view/style.scss +38 -28
  364. package/src/components/list-view/use-list-view-collapse-items.js +33 -0
  365. package/src/components/list-view/utils.js +4 -1
  366. package/src/components/rich-text/README.md +6 -0
  367. package/src/components/rich-text/index.js +30 -13
  368. package/src/components/rich-text/index.native.js +14 -11
  369. package/src/components/rich-text/native/get-format-colors.native.js +1 -1
  370. package/src/components/rich-text/native/index.native.js +2 -2
  371. package/src/components/rich-text/with-deprecations.js +0 -3
  372. package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  373. package/src/components/url-popover/image-url-input-ui.js +68 -51
  374. package/src/components/use-block-display-information/index.js +8 -10
  375. package/src/components/use-moving-animation/index.js +1 -0
  376. package/src/components/warning/index.native.js +19 -15
  377. package/src/hooks/anchor.js +43 -61
  378. package/src/hooks/background.js +100 -516
  379. package/src/hooks/index.js +3 -0
  380. package/src/hooks/layout-child.js +44 -8
  381. package/src/hooks/layout.js +22 -18
  382. package/src/hooks/position.js +1 -1
  383. package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
  384. package/src/hooks/test/anchor.native.js +32 -0
  385. package/src/hooks/use-zoom-out.js +36 -0
  386. package/src/index.js +1 -0
  387. package/src/private-apis.js +13 -1
  388. package/src/private-apis.native.js +4 -0
  389. package/src/store/private-actions.js +12 -0
  390. package/src/store/private-keys.js +1 -0
  391. package/src/store/private-selectors.js +54 -27
  392. package/src/store/reducer.js +63 -41
  393. package/src/store/selectors.js +195 -180
  394. package/src/store/test/private-actions.js +10 -0
  395. package/src/store/test/private-selectors.js +13 -0
  396. package/src/store/test/reducer.js +26 -0
  397. package/src/store/test/selectors.js +90 -199
  398. package/src/store/utils.js +13 -0
  399. package/src/style.scss +0 -2
  400. package/src/utils/transform-styles/index.js +2 -1
  401. package/tsconfig.json +1 -0
  402. package/build/utils/calculate-scale.js +0 -17
  403. package/build/utils/calculate-scale.js.map +0 -1
  404. package/build-module/utils/calculate-scale.js +0 -11
  405. package/build-module/utils/calculate-scale.js.map +0 -1
  406. package/src/hooks/anchor.scss +0 -4
  407. package/src/hooks/background.scss +0 -75
  408. package/src/utils/calculate-scale.js +0 -20
@@ -37,7 +37,8 @@ const ImageURLInputUI = ({
37
37
  rel,
38
38
  showLightboxSetting,
39
39
  lightboxEnabled,
40
- onSetLightbox
40
+ onSetLightbox,
41
+ resetLightbox
41
42
  }) => {
42
43
  const [isOpen, setIsOpen] = (0, _element.useState)(false);
43
44
  // Use internal state instead of a ref to make sure that the component
@@ -198,8 +199,52 @@ const ImageURLInputUI = ({
198
199
  onChange: onSetLinkClass
199
200
  }));
200
201
  const linkEditorValue = urlInput !== null ? urlInput : url;
201
- const showLinkEditor = (!linkEditorValue && !lightboxEnabled) === true;
202
+ const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting;
203
+ const showLinkEditor = !linkEditorValue && hideLightboxPanel;
202
204
  const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title;
205
+ const PopoverChildren = () => {
206
+ if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) {
207
+ return (0, _react.createElement)("div", {
208
+ className: "block-editor-url-popover__expand-on-click"
209
+ }, (0, _react.createElement)(_icons.Icon, {
210
+ icon: _icons.fullscreen
211
+ }), (0, _react.createElement)("div", {
212
+ className: "text"
213
+ }, (0, _react.createElement)("p", null, (0, _i18n.__)('Expand on click')), (0, _react.createElement)("p", {
214
+ className: "description"
215
+ }, (0, _i18n.__)('Scales the image with a lightbox effect'))), (0, _react.createElement)(_components.Button, {
216
+ icon: _icons.linkOff,
217
+ label: (0, _i18n.__)('Disable expand on click'),
218
+ onClick: () => {
219
+ onSetLightbox(false);
220
+ },
221
+ size: "compact"
222
+ }));
223
+ } else if (!url || isEditingLink) {
224
+ return (0, _react.createElement)(_index.default.LinkEditor, {
225
+ className: "block-editor-format-toolbar__link-container-content",
226
+ value: linkEditorValue,
227
+ onChangeInputValue: setUrlInput,
228
+ onSubmit: onSubmitLinkChange(),
229
+ autocompleteRef: autocompleteRef
230
+ });
231
+ } else if (url && !isEditingLink) {
232
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkViewer, {
233
+ className: "block-editor-format-toolbar__link-container-content",
234
+ url: url,
235
+ onEditLinkClick: startEditLink,
236
+ urlLabel: urlLabel
237
+ }), (0, _react.createElement)(_components.Button, {
238
+ icon: _icons.linkOff,
239
+ label: (0, _i18n.__)('Remove link'),
240
+ onClick: () => {
241
+ onLinkRemove();
242
+ resetLightbox();
243
+ },
244
+ size: "compact"
245
+ }));
246
+ }
247
+ };
203
248
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarButton, {
204
249
  icon: _icons.link,
205
250
  className: "components-toolbar__control",
@@ -207,13 +252,13 @@ const ImageURLInputUI = ({
207
252
  "aria-expanded": isOpen,
208
253
  onClick: openLinkUI,
209
254
  ref: setPopoverAnchor,
210
- isActive: !!url || lightboxEnabled
255
+ isActive: !!url || lightboxEnabled && showLightboxSetting
211
256
  }), isOpen && (0, _react.createElement)(_index.default, {
212
257
  ref: wrapperRef,
213
258
  anchor: popoverAnchor,
214
259
  onFocusOutside: onFocusOutside(),
215
260
  onClose: closeLinkUI,
216
- renderSettings: !lightboxEnabled ? () => advancedOptions : null,
261
+ renderSettings: hideLightboxPanel ? () => advancedOptions : null,
217
262
  additionalControls: showLinkEditor && (0, _react.createElement)(_components.NavigableMenu, null, getLinkDestinations().map(link => (0, _react.createElement)(_components.MenuItem, {
218
263
  key: link.linkDestination,
219
264
  icon: link.icon,
@@ -240,38 +285,7 @@ const ImageURLInputUI = ({
240
285
  }
241
286
  }, (0, _i18n.__)('Expand on click'))),
242
287
  offset: 13
243
- }, (!url || isEditingLink) && !lightboxEnabled && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkEditor, {
244
- className: "block-editor-format-toolbar__link-container-content",
245
- value: linkEditorValue,
246
- onChangeInputValue: setUrlInput,
247
- onSubmit: onSubmitLinkChange(),
248
- autocompleteRef: autocompleteRef
249
- })), url && !isEditingLink && !lightboxEnabled && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkViewer, {
250
- className: "block-editor-format-toolbar__link-container-content",
251
- url: url,
252
- onEditLinkClick: startEditLink,
253
- urlLabel: urlLabel
254
- }), (0, _react.createElement)(_components.Button, {
255
- icon: _icons.linkOff,
256
- label: (0, _i18n.__)('Remove link'),
257
- onClick: onLinkRemove,
258
- size: "compact"
259
- })), !url && !isEditingLink && lightboxEnabled && (0, _react.createElement)("div", {
260
- className: "block-editor-url-popover__expand-on-click"
261
- }, (0, _react.createElement)(_icons.Icon, {
262
- icon: _icons.fullscreen
263
- }), (0, _react.createElement)("div", {
264
- className: "text"
265
- }, (0, _react.createElement)("p", null, (0, _i18n.__)('Expand on click')), (0, _react.createElement)("p", {
266
- className: "description"
267
- }, (0, _i18n.__)('Scales the image with a lightbox effect'))), (0, _react.createElement)(_components.Button, {
268
- icon: _icons.linkOff,
269
- label: (0, _i18n.__)('Disable expand on click'),
270
- onClick: () => {
271
- onSetLightbox(false);
272
- },
273
- size: "compact"
274
- }))));
288
+ }, PopoverChildren()));
275
289
  };
276
290
  exports.__experimentalImageURLInputUI = ImageURLInputUI;
277
291
  //# sourceMappingURL=image-url-input-ui.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_dom","_components","_icons","_index","_interopRequireDefault","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","isOpen","setIsOpen","useState","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","useRef","wrapperRef","useEffect","current","nextFocusTarget","focus","focusable","find","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","__","icon","image","page","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","_react","createElement","__experimentalVStack","spacing","ToggleControl","__nextHasNoMarginBottom","label","onChange","checked","TextControl","linkEditorValue","showLinkEditor","urlLabel","Fragment","ToolbarButton","linkIcon","className","onClick","ref","isActive","default","anchor","onClose","renderSettings","additionalControls","NavigableMenu","map","link","MenuItem","key","iconPosition","fullscreen","info","offset","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","Button","linkOff","size","Icon","exports","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToolbarButton,\n\tNavigableMenu,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\tconst wrapperRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperRef.current )[ 0 ] ||\n\t\t\twrapperRef.current;\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, url, lightboxEnabled ] );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst showLinkEditor = ( ! linkEditorValue && ! lightboxEnabled ) === true;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={ !! url || lightboxEnabled }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tref={ wrapperRef }\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\t! lightboxEnabled ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ url && ! isEditingLink && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! url && ! isEditingLink && lightboxEnabled && (\n\t\t\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t\t\t<Icon icon={ fullscreen } />\n\t\t\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Scales the image with a lightbox effect'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonSetLightbox( false );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,MAAA,GAAAJ,OAAA;AAYA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AA3BA;AACA;AACA;;AAsBA;AACA;AACA;;AAGA,MAAMO,qBAAqB,GAAG,MAAM;AACpC,MAAMC,uBAAuB,GAAG,QAAQ;AACxC,MAAMC,sBAAsB,GAAG,OAAO;AACtC,MAAMC,2BAA2B,GAAG,YAAY;AAChD,MAAMC,WAAW,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE;AAEhD,MAAMC,eAAe,GAAGA,CAAE;EACzBC,eAAe;EACfC,WAAW;EACXC,GAAG;EACHC,SAAS,GAAG,OAAO;EACnBC,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVC,SAAS;EACTC,GAAG;EACHC,mBAAmB;EACnBC,eAAe;EACfC;AACD,CAAC,KAAM;EACN,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAC/C;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAF,iBAAQ,EAAE,IAAK,CAAC;EAC5D,MAAMG,UAAU,GAAGA,CAAA,KAAM;IACxBJ,SAAS,CAAE,IAAK,CAAC;EAClB,CAAC;EAED,MAAM,CAAEK,aAAa,EAAEC,gBAAgB,CAAE,GA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CAAE,KAAM,CAAC;IACvB,CAAG;IACHyG,IAAI,EAAC;EAAS,CACd,CACG,CAEK,CAEZ,CAAC;AAEL,CAAC;AAACE,OAAA,CAAAC,6BAAA,GAAAxH,eAAA"}
1
+ {"version":3,"names":["_i18n","require","_element","_dom","_components","_icons","_index","_interopRequireDefault","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","resetLightbox","isOpen","setIsOpen","useState","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","useRef","wrapperRef","useEffect","current","nextFocusTarget","focus","focusable","find","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","__","icon","image","page","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","_react","createElement","__experimentalVStack","spacing","ToggleControl","__nextHasNoMarginBottom","label","onChange","checked","TextControl","linkEditorValue","hideLightboxPanel","showLinkEditor","urlLabel","PopoverChildren","className","Icon","fullscreen","Button","linkOff","onClick","size","default","LinkEditor","onChangeInputValue","onSubmit","Fragment","LinkViewer","onEditLinkClick","ToolbarButton","linkIcon","ref","isActive","anchor","onClose","renderSettings","additionalControls","NavigableMenu","map","link","MenuItem","key","iconPosition","info","offset","exports","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToolbarButton,\n\tNavigableMenu,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n\tresetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\tconst wrapperRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperRef.current )[ 0 ] ||\n\t\t\twrapperRef.current;\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, url, lightboxEnabled ] );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst hideLightboxPanel =\n\t\t! lightboxEnabled || ( lightboxEnabled && ! showLightboxSetting );\n\tconst showLinkEditor = ! linkEditorValue && hideLightboxPanel;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\tconst PopoverChildren = () => {\n\t\tif (\n\t\t\tlightboxEnabled &&\n\t\t\tshowLightboxSetting &&\n\t\t\t! url &&\n\t\t\t! isEditingLink\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t<Icon icon={ fullscreen } />\n\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t{ __( 'Scales the image with a lightbox effect' ) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonSetLightbox( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else if ( ! url || isEditingLink ) {\n\t\t\treturn (\n\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t/>\n\t\t\t);\n\t\t} else if ( url && ! isEditingLink ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonLinkRemove();\n\t\t\t\t\t\t\tresetLightbox();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={\n\t\t\t\t\t!! url || ( lightboxEnabled && showLightboxSetting )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tref={ wrapperRef }\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\thideLightboxPanel ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t>\n\t\t\t\t\t{ PopoverChildren() }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,MAAA,GAAAJ,OAAA;AAYA,IAAAK,MAAA,GAAAC,sBAAA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B,cAAc,IACb,IAAAZ,MAAA,CAAAC,aAAA,EAACvF,WAAA,CAAA2H,aAAa,QACXzD,mBAAmB,CAAC,CAAC,CAAC0D,GAAG,CAAIC,IAAI,IAClC,IAAAvC,MAAA,CAAAC,aAAA,EAACvF,WAAA,CAAA8H,QAAQ;MACRC,GAAG,EAAGF,IAAI,CAACnH,eAAiB;MAC5BkE,IAAI,EAAGiD,IAAI,CAACjD,IAAM;MAClBoD,YAAY,EAAC,MAAM;MACnBtB,OAAO,EAAGA,CAAA,KAAM;QACf1E,WAAW,CAAE,IAAK,CAAC;QACnB+C,SAAS,CAAE8C,IAAI,CAACjH,GAAI,CAAC;QACrB+B,YAAY,CAAC,CAAC;MACf;IAAG,GAEDkF,IAAI,CAACnD,KACE,CACT,CAAC,EACDvD,mBAAmB,IACpB,IAAAmE,MAAA,CAAAC,aAAA,EAACvF,WAAA,CAAA8H,QAAQ;MACRC,GAAG,EAAC,iBAAiB;MACrB1B,SAAS,EAAC,2CAA2C;MACrDzB,IAAI,EAAG2B,iBAAY;MACnB0B,IAAI,EAAG,IAAAtD,QAAE,EACR,yCACD,CAAG;MACHqD,YAAY,EAAC,MAAM;MACnBtB,OAAO,EAAGA,CAAA,KAAM;QACf1E,WAAW,CAAE,IAAK,CAAC;QACnBrB,WAAW,CAAE;UACZD,eAAe,EACdN,qBAAqB;UACtBgE,IAAI,EAAE;QACP,CAAE,CAAC;QACH/C,aAAa,CAAE,IAAK,CAAC;QACrBsB,YAAY,CAAC,CAAC;MACf;IAAG,GAED,IAAAgC,QAAE,EAAE,iBAAkB,CACf,CAEG,CAEhB;IACDuD,MAAM,EAAG;EAAI,GAEX9B,eAAe,CAAC,CACP,CAEZ,CAAC;AAEL,CAAC;AAAC+B,OAAA,CAAAC,6BAAA,GAAA3H,eAAA"}
@@ -68,8 +68,7 @@ function useBlockDisplayInformation(clientId) {
68
68
  if (!clientId) return null;
69
69
  const {
70
70
  getBlockName,
71
- getBlockAttributes,
72
- __experimentalGetReusableBlockTitle
71
+ getBlockAttributes
73
72
  } = select(_store.store);
74
73
  const {
75
74
  getBlockType,
@@ -80,10 +79,9 @@ function useBlockDisplayInformation(clientId) {
80
79
  if (!blockType) return null;
81
80
  const attributes = getBlockAttributes(clientId);
82
81
  const match = getActiveBlockVariation(blockName, attributes);
83
- const isReusable = (0, _blocks.isReusableBlock)(blockType);
84
- const resusableTitle = isReusable ? __experimentalGetReusableBlockTitle(attributes.ref) : undefined;
85
- const title = resusableTitle || blockType.title;
86
- const isSynced = isReusable || (0, _blocks.isTemplatePart)(blockType);
82
+ const isSynced = (0, _blocks.isReusableBlock)(blockType) || (0, _blocks.isTemplatePart)(blockType);
83
+ const syncedTitle = isSynced ? (0, _blocks.__experimentalGetBlockLabel)(blockType, attributes) : undefined;
84
+ const title = syncedTitle || blockType.title;
87
85
  const positionLabel = getPositionTypeLabel(attributes);
88
86
  const blockTypeInfo = {
89
87
  isSynced,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blocks","_i18n","_store","getPositionTypeLabel","attributes","positionType","style","position","type","__","useBlockDisplayInformation","clientId","useSelect","select","getBlockName","getBlockAttributes","__experimentalGetReusableBlockTitle","blockEditorStore","getBlockType","getActiveBlockVariation","blocksStore","blockName","blockType","match","isReusable","isReusableBlock","resusableTitle","ref","undefined","title","isSynced","isTemplatePart","positionLabel","blockTypeInfo","icon","description","anchor","name","metadata"],"sources":["@wordpress/block-editor/src/components/use-block-display-information/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n * @property {name} name A custom, human readable name for the block.\n */\n\n/**\n * Get the display label for a block's position type.\n *\n * @param {Object} attributes Block attributes.\n * @return {string} The position type label.\n */\nfunction getPositionTypeLabel( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\n\tif ( positionType === 'sticky' ) {\n\t\treturn __( 'Sticky' );\n\t}\n\n\tif ( positionType === 'fixed' ) {\n\t\treturn __( 'Fixed' );\n\t}\n\n\treturn null;\n}\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) return null;\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\t__experimentalGetReusableBlockTitle,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) return null;\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isReusable = isReusableBlock( blockType );\n\t\t\tconst resusableTitle = isReusable\n\t\t\t\t? __experimentalGetReusableBlockTitle( attributes.ref )\n\t\t\t\t: undefined;\n\t\t\tconst title = resusableTitle || blockType.title;\n\t\t\tconst isSynced = isReusable || isTemplatePart( blockType );\n\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t\tif ( ! match ) return blockTypeInfo;\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,oBAAoBA,CAAEC,UAAU,EAAG;EAC3C,MAAMC,YAAY,GAAGD,UAAU,EAAEE,KAAK,EAAEC,QAAQ,EAAEC,IAAI;EAEtD,IAAKH,YAAY,KAAK,QAAQ,EAAG;IAChC,OAAO,IAAAI,QAAE,EAAE,QAAS,CAAC;EACtB;EAEA,IAAKJ,YAAY,KAAK,OAAO,EAAG;IAC/B,OAAO,IAAAI,QAAE,EAAE,OAAQ,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,EAAED;IAC7B,CAAC;IACD,IAAK,CAAEd,KAAK,EAAG,OAAOU,aAAa;IAEnC,OAAO;MACNH,QAAQ;MACRD,KAAK,EAAEN,KAAK,CAACM,KAAK,IAAIP,SAAS,CAACO,KAAK;MACrCK,IAAI,EAAEX,KAAK,CAACW,IAAI,IAAIZ,SAAS,CAACY,IAAI;MAClCC,WAAW,EAAEZ,KAAK,CAACY,WAAW,IAAIb,SAAS,CAACa,WAAW;MACvDC,MAAM,EAAEhC,UAAU,EAAEgC,MAAM;MAC1BJ,aAAa;MACb3B,YAAY,EAAED,UAAU,EAAEE,KAAK,EAAEC,QAAQ,EAAEC,IAAI;MAC/C6B,IAAI,EAAEjC,UAAU,EAAEkC,QAAQ,EAAED;IAC7B,CAAC;EACF,CAAC,EACD,CAAE1B,QAAQ,CACX,CAAC;AACF"}
1
+ {"version":3,"names":["_data","require","_blocks","_i18n","_store","getPositionTypeLabel","attributes","positionType","style","position","type","__","useBlockDisplayInformation","clientId","useSelect","select","getBlockName","getBlockAttributes","blockEditorStore","getBlockType","getActiveBlockVariation","blocksStore","blockName","blockType","match","isSynced","isReusableBlock","isTemplatePart","syncedTitle","getBlockLabel","undefined","title","positionLabel","blockTypeInfo","icon","description","anchor","name","metadata"],"sources":["@wordpress/block-editor/src/components/use-block-display-information/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n\t__experimentalGetBlockLabel as getBlockLabel,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n * @property {name} name A custom, human readable name for the block.\n */\n\n/**\n * Get the display label for a block's position type.\n *\n * @param {Object} attributes Block attributes.\n * @return {string} The position type label.\n */\nfunction getPositionTypeLabel( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\n\tif ( positionType === 'sticky' ) {\n\t\treturn __( 'Sticky' );\n\t}\n\n\tif ( positionType === 'fixed' ) {\n\t\treturn __( 'Fixed' );\n\t}\n\n\treturn null;\n}\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) return null;\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) return null;\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isSynced =\n\t\t\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\t\t\tconst syncedTitle = isSynced\n\t\t\t\t? getBlockLabel( blockType, attributes )\n\t\t\t\t: undefined;\n\t\t\tconst title = syncedTitle || blockType.title;\n\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t\tif ( ! match ) return blockTypeInfo;\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAfA;AACA;AACA;;AAUA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,oBAAoBA,CAAEC,UAAU,EAAG;EAC3C,MAAMC,YAAY,GAAGD,UAAU,EAAEE,KAAK,EAAEC,QAAQ,EAAEC,IAAI;EAEtD,IAAKH,YAAY,KAAK,QAAQ,EAAG;IAChC,OAAO,IAAAI,QAAE,EAAE,QAAS,CAAC;EACtB;EAEA,IAAKJ,YAAY,KAAK,OAAO,EAAG;IAC/B,OAAO,IAAAI,QAAE,EAAE,OAAQ,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEe,SAASC,0BAA0BA,CAAEC,QAAQ,EAAG;EAC9D,OAAO,IAAAC,eAAS,EACbC,MAAM,IAAM;IACb,IAAK,CAAEF,QAAQ,EAAG,OAAO,I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AAEV,KAAK,CAACU,IAAI,IAAIX,SAAS,CAACW,IAAI;MAClCC,WAAW,EAAEX,KAAK,CAACW,WAAW,IAAIZ,SAAS,CAACY,WAAW;MACvDC,MAAM,EAAE9B,UAAU,EAAE8B,MAAM;MAC1BJ,aAAa;MACbzB,YAAY,EAAED,UAAU,EAAEE,KAAK,EAAEC,QAAQ,EAAEC,IAAI;MAC/C2B,IAAI,EAAE/B,UAAU,EAAEgC,QAAQ,EAAED;IAC7B,CAAC;EACF,CAAC,EACD,CAAExB,QAAQ,CACX,CAAC;AACF"}
@@ -148,6 +148,10 @@ function useMovingAnimation({
148
148
  });
149
149
  return () => {
150
150
  controller.stop();
151
+ controller.set({
152
+ x: 0,
153
+ y: 0
154
+ });
151
155
  };
152
156
  }, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected]);
153
157
  return ref;
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAE;EAAEC,wBAAwB;EAAEC;AAAS,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAM;IACLC,QAAQ;IACRC,mBAAmB;IACnBC,eAAe;IACfC,yBAAyB;IACzBC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;;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AAC,GAAGO,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACjB,GAAG,GAAGsD,WAAW,CAACtD,GAAI,CAAC;IAEtDqC,UAAU,CAACkB,KAAK,CAAE;MAAEhB,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE,CAAC;MAAEgB,IAAI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;IAClB,CAAC;EACF,CAAC,EAAE,CACFxC,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxD,kBAAkB"}
1
+ {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAE;EAAEC,wBAAwB;EAAEC;AAAS,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAM;IACLC,QAAQ;IACRC,mBAAmB;IACnBC,eAAe;IACfC,yBAAyB;IACzBC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;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CAAC,GAAGO,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACjB,GAAG,GAAGsD,WAAW,CAACtD,GAAI,CAAC;IAEtDqC,UAAU,CAACkB,KAAK,CAAE;MAAEhB,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE,CAAC;MAAEgB,IAAI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;MACjBpB,UAAU,CAACqB,GAAG,CAAE;QAAEnB,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAE,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,CACFvB,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEczD,kBAAkB"}
@@ -24,20 +24,25 @@ var _style = _interopRequireDefault(require("./style.scss"));
24
24
  */
25
25
 
26
26
  function Warning({
27
+ actions,
27
28
  title,
28
29
  message,
29
30
  icon,
30
31
  iconClass,
31
32
  preferredColorScheme,
32
33
  getStylesFromColorScheme,
34
+ containerStyle: extraContainerStyle,
35
+ titleStyle: extraTitleStyle,
36
+ messageStyle: extraMessageStyle,
33
37
  ...viewProps
34
38
  }) {
35
39
  icon = icon && (0, _blocks.normalizeIconObject)(icon);
36
40
  const internalIconClass = 'warning-icon' + '-' + preferredColorScheme;
37
- const titleStyle = getStylesFromColorScheme(_style.default.title, _style.default.titleDark);
38
- const messageStyle = getStylesFromColorScheme(_style.default.message, _style.default.messageDark);
41
+ const containerStyle = [getStylesFromColorScheme(_style.default.container, _style.default.containerDark), extraContainerStyle];
42
+ const titleStyle = [getStylesFromColorScheme(_style.default.title, _style.default.titleDark), extraTitleStyle];
43
+ const messageStyle = [getStylesFromColorScheme(_style.default.message, _style.default.messageDark), extraMessageStyle];
39
44
  return (0, _react.createElement)(_reactNative.View, {
40
- style: getStylesFromColorScheme(_style.default.container, _style.default.containerDark),
45
+ style: containerStyle,
41
46
  ...viewProps
42
47
  }, icon && (0, _react.createElement)(_reactNative.View, {
43
48
  style: _style.default.icon
@@ -48,7 +53,7 @@ function Warning({
48
53
  style: titleStyle
49
54
  }, title), message && (0, _react.createElement)(_reactNative.Text, {
50
55
  style: messageStyle
51
- }, message));
56
+ }, message), actions);
52
57
  }
53
58
  var _default = exports.default = (0, _compose.withPreferredColorScheme)(Warning);
54
59
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_components","_compose","_blocks","_style","_interopRequireDefault","Warning","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","viewProps","normalizeIconObject","internalIconClass","titleStyle","styles","titleDark","messageStyle","messageDark","_react","createElement","View","style","container","containerDark","Icon","className","src","Text","_default","exports","default","withPreferredColorScheme"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.title,\n\t\tstyles.titleDark\n\t);\n\tconst messageStyle = getStylesFromColorScheme(\n\t\tstyles.message,\n\t\tstyles.messageDark\n\t);\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.container,\n\t\t\t\tstyles.containerDark\n\t\t\t) }\n\t\t\t{ ...viewProps }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,OAAOA,CAAE;EACjBC,KAAK;EACLC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,oBAAoB;EACpBC,wBAAwB;EACxB,GAAGC;AACJ,CAAC,EAAG;EACHJ,IAAI,GAAGA,IAAI,IAAI,IAAAK,2BAAmB,EAAEL,IAAK,CAAC;EAC1C,MAAMM,iBAAiB,GAAG,cAAc,GAAG,GAAG,GAAGJ,oBAAoB;EACrE,MAAMK,UAAU,GAAGJ,wBAAwB,CAC1CK,cAAM,CAACV,KAAK,EACZU,cAAM,CAACC,SACR,CAAC;EACD,MAAMC,YAAY,GAAGP,wBAAwB,CAC5CK,cAAM,CAACT,OAAO,EACdS,cAAM,CAACG,WACR,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAAwB,IAAI;IACJC,KAAK,EAAGZ,wBAAwB,CAC/BK,cAAM,CAACQ,SAAS,EAChBR,cAAM,CAACS,aACR,CAAG;IAAA,GACEb;EAAS,GAEZJ,IAAI,IACL,IAAAY,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAAwB,IAAI;IAACC,KAAK,EAAGP,cAAM,CAACR;EAAM,GAC1B,IAAAY,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAA0B,IAAI;IACJC,SAAS,EAAGlB,SAAS,IAAIK,iBAAmB;IAC5CN,IAAI,EAAGA,IAAI,IAAIA,IAAI,CAACoB,GAAG,GAAGpB,IAAI,CAACoB,GAAG,GAAGpB;EAAM,CAC3C,CACI,CACN,EACCF,KAAK,IAAI,IAAAc,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAA+B,IAAI;IAACN,KAAK,EAAGR;EAAY,GAAGT,KAAa,CAAC,EACpDC,OAAO,IAAI,IAAAa,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAA+B,IAAI;IAACN,KAAK,EAAGL;EAAc,GAAGX,OAAe,CACtD,CAAC;AAET;AAAC,IAAAuB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,iCAAwB,EAAE5B,OAAQ,CAAC"}
1
+ {"version":3,"names":["_reactNative","require","_components","_compose","_blocks","_style","_interopRequireDefault","Warning","actions","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","containerStyle","extraContainerStyle","titleStyle","extraTitleStyle","messageStyle","extraMessageStyle","viewProps","normalizeIconObject","internalIconClass","styles","container","containerDark","titleDark","messageDark","_react","createElement","View","style","Icon","className","src","Text","_default","exports","default","withPreferredColorScheme"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\tactions,\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\tcontainerStyle: extraContainerStyle,\n\ttitleStyle: extraTitleStyle,\n\tmessageStyle: extraMessageStyle,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\n\tconst containerStyle = [\n\t\tgetStylesFromColorScheme( styles.container, styles.containerDark ),\n\t\textraContainerStyle,\n\t];\n\tconst titleStyle = [\n\t\tgetStylesFromColorScheme( styles.title, styles.titleDark ),\n\t\textraTitleStyle,\n\t];\n\tconst messageStyle = [\n\t\tgetStylesFromColorScheme( styles.message, styles.messageDark ),\n\t\textraMessageStyle,\n\t];\n\n\treturn (\n\t\t<View style={ containerStyle } { ...viewProps }>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t\t{ actions }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,OAAOA,CAAE;EACjBC,OAAO;EACPC,KAAK;EACLC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,oBAAoB;EACpBC,wBAAwB;EACxBC,cAAc,EAAEC,mBAAmB;EACnCC,UAAU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OAAe,CAAC,EAC1DF,OACG,CAAC;AAET;AAAC,IAAA6B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,iCAAwB,EAAEjC,OAAQ,CAAC"}
@@ -59,20 +59,24 @@ function addAttribute(settings) {
59
59
  return settings;
60
60
  }
61
61
  function BlockEditAnchorControlPure({
62
- name: blockName,
63
62
  anchor,
64
63
  setAttributes
65
64
  }) {
66
65
  const blockEditingMode = (0, _blockEditingMode.useBlockEditingMode)();
66
+ if (blockEditingMode !== 'default') {
67
+ return null;
68
+ }
67
69
  const isWeb = _element.Platform.OS === 'web';
68
- const textControl = (0, _react.createElement)(_components.TextControl, {
70
+ return (0, _react.createElement)(_components2.InspectorControls, {
71
+ group: "advanced"
72
+ }, (0, _react.createElement)(_components.TextControl, {
69
73
  __nextHasNoMarginBottom: true,
70
74
  __next40pxDefaultSize: true,
71
75
  className: "html-anchor-control",
72
76
  label: (0, _i18n.__)('HTML anchor'),
73
- help: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), isWeb && (0, _react.createElement)(_components.ExternalLink, {
77
+ help: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'), isWeb && (0, _react.createElement)(_react.Fragment, null, ' ', (0, _react.createElement)(_components.ExternalLink, {
74
78
  href: (0, _i18n.__)('https://wordpress.org/documentation/article/page-jumps/')
75
- }, (0, _i18n.__)('Learn more about anchors'))),
79
+ }, (0, _i18n.__)('Learn more about anchors')))),
76
80
  value: anchor || '',
77
81
  placeholder: !isWeb ? (0, _i18n.__)('Add an anchor') : null,
78
82
  onChange: nextValue => {
@@ -83,12 +87,7 @@ function BlockEditAnchorControlPure({
83
87
  },
84
88
  autoCapitalize: "none",
85
89
  autoComplete: "off"
86
- });
87
- return (0, _react.createElement)(_react.Fragment, null, isWeb && blockEditingMode === 'default' && (0, _react.createElement)(_components2.InspectorControls, {
88
- group: "advanced"
89
- }, textControl), !isWeb && blockName === 'core/heading' && (0, _react.createElement)(_components2.InspectorControls, null, (0, _react.createElement)(_components.PanelBody, {
90
- title: (0, _i18n.__)('Heading settings')
91
- }, textControl)));
90
+ }));
92
91
  }
93
92
  var _default = exports.default = {
94
93
  addSaveProps,
@@ -1 +1 @@
1
- {"version":3,"names":["_hooks","require","_components","_i18n","_blocks","_element","_components2","_blockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","hasBlockSupport","BlockEditAnchorControlPure","name","blockName","setAttributes","blockEditingMode","useBlockEditingMode","isWeb","Platform","OS","textControl","_react","createElement","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","__","help","Fragment","ExternalLink","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","InspectorControls","group","PanelBody","title","_default","exports","default","addSaveProps","edit","attributeKeys","hasSupport","extraProps","blockType","id","addFilter"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( {\n\tname: blockName,\n\tanchor,\n\tsetAttributes,\n} ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst isWeb = Platform.OS === 'web';\n\tconst textControl = (\n\t\t<TextControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"html-anchor-control\"\n\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\thelp={\n\t\t\t\t<>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tvalue={ anchor || '' }\n\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tanchor: nextValue,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tautoCapitalize=\"none\"\n\t\t\tautoComplete=\"off\"\n\t\t/>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isWeb && blockEditingMode === 'default' && (\n\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t{ textControl }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ /*\n\t\t\t * We plan to remove scoping anchors to 'core/heading' to support\n\t\t\t * anchors for all eligble blocks. Additionally we plan to explore\n\t\t\t * leveraging InspectorAdvancedControls instead of a custom\n\t\t\t * PanelBody title. https://github.com/WordPress/gutenberg/issues/28363\n\t\t\t */ }\n\t\t\t{ ! isWeb && blockName === 'core/heading' && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Heading settings' ) }>\n\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,YAAA,GA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CAAC;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASmC,YAAYA,CAAEI,UAAU,EAAEC,SAAS,EAAE5C,UAAU,EAAG;EACjE,IAAK,IAAAE,uBAAe,EAAE0C,SAAS,EAAE,QAAS,CAAC,EAAG;IAC7CD,UAAU,CAACE,EAAE,GAAG7C,UAAU,CAACC,MAAM,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,MAAM;EACpE;EAEA,OAAO0C,UAAU;AAClB;AAEA,IAAAG,gBAAS,EAAE,0BAA0B,EAAE,uBAAuB,EAAEjD,YAAa,CAAC"}
1
+ {"version":3,"names":["_hooks","require","_components","_i18n","_blocks","_element","_components2","_blockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","hasBlockSupport","BlockEditAnchorControlPure","setAttributes","blockEditingMode","useBlockEditingMode","isWeb","Platform","OS","_react","createElement","InspectorControls","group","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","__","help","Fragment","ExternalLink","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","_default","exports","default","addSaveProps","edit","attributeKeys","hasSupport","name","extraProps","blockType","id","addFilter"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( { anchor, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst isWeb = Platform.OS === 'web';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\thelp={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tvalue={ anchor || '' }\n\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA,MAAMO,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAAG;EACrBC,IAAI,EAAE,QAAQ;E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