@wordpress/block-editor 12.5.0 → 12.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +0 -4
  3. package/build/components/block-draggable/index.js +6 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-draggable/index.native.js +2 -2
  6. package/build/components/block-draggable/index.native.js.map +1 -1
  7. package/build/components/block-edit/edit.js +25 -13
  8. package/build/components/block-edit/edit.js.map +1 -1
  9. package/build/components/block-list/block-outline.native.js +14 -18
  10. package/build/components/block-list/block-outline.native.js.map +1 -1
  11. package/build/components/block-list/block.native.js +21 -42
  12. package/build/components/block-list/block.native.js.map +1 -1
  13. package/build/components/block-mover/index.native.js +1 -1
  14. package/build/components/block-mover/index.native.js.map +1 -1
  15. package/build/components/block-removal-warning-modal/index.js +1 -4
  16. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  17. package/build/components/block-settings/button.native.js +2 -2
  18. package/build/components/block-settings/button.native.js.map +1 -1
  19. package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +7 -5
  20. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  21. package/build/components/block-toolbar/index.js +4 -3
  22. package/build/components/block-toolbar/index.js.map +1 -1
  23. package/build/components/block-toolbar/index.native.js +62 -3
  24. package/build/components/block-toolbar/index.native.js.map +1 -1
  25. package/build/components/colors-gradients/control.js +4 -2
  26. package/build/components/colors-gradients/control.js.map +1 -1
  27. package/build/components/global-styles/color-panel.js +21 -15
  28. package/build/components/global-styles/color-panel.js.map +1 -1
  29. package/build/components/global-styles/dimensions-panel.js +13 -2
  30. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  31. package/build/components/global-styles/get-block-css-selector.js +4 -8
  32. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  33. package/build/components/global-styles/hooks.js +13 -23
  34. package/build/components/global-styles/hooks.js.map +1 -1
  35. package/build/components/global-styles/typography-panel.js +18 -3
  36. package/build/components/global-styles/typography-panel.js.map +1 -1
  37. package/build/components/global-styles/use-global-styles-output.js +12 -18
  38. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  39. package/build/components/global-styles/utils.js +6 -6
  40. package/build/components/global-styles/utils.js.map +1 -1
  41. package/build/components/iframe/index.js +36 -48
  42. package/build/components/iframe/index.js.map +1 -1
  43. package/build/components/iframe/use-compatibility-styles.js +5 -0
  44. package/build/components/iframe/use-compatibility-styles.js.map +1 -1
  45. package/build/components/index.js +1 -10
  46. package/build/components/index.js.map +1 -1
  47. package/build/components/inner-blocks/index.js +3 -1
  48. package/build/components/inner-blocks/index.js.map +1 -1
  49. package/build/components/inner-blocks/index.native.js +3 -1
  50. package/build/components/inner-blocks/index.native.js.map +1 -1
  51. package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
  52. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  53. package/build/components/inserter/index.js +2 -4
  54. package/build/components/inserter/index.js.map +1 -1
  55. package/build/components/inserter/index.native.js +21 -32
  56. package/build/components/inserter/index.native.js.map +1 -1
  57. package/build/components/inserter/reusable-block-rename-hint.js +23 -3
  58. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
  59. package/build/components/link-control/index.js +4 -1
  60. package/build/components/link-control/index.js.map +1 -1
  61. package/build/components/link-control/search-item.js +1 -1
  62. package/build/components/link-control/search-item.js.map +1 -1
  63. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  64. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  65. package/build/components/media-placeholder/index.native.js +65 -31
  66. package/build/components/media-placeholder/index.native.js.map +1 -1
  67. package/build/components/preview-options/index.js +2 -2
  68. package/build/components/preview-options/index.js.map +1 -1
  69. package/build/components/rich-text/content.js +0 -36
  70. package/build/components/rich-text/content.js.map +1 -1
  71. package/build/components/rich-text/get-rich-text-values.js +118 -0
  72. package/build/components/rich-text/get-rich-text-values.js.map +1 -0
  73. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  74. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  75. package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
  76. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  77. package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
  78. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  79. package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
  80. package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  81. package/build/components/spacing-sizes-control/utils.js +1 -1
  82. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  83. package/build/components/use-block-display-information/index.js +7 -3
  84. package/build/components/use-block-display-information/index.js.map +1 -1
  85. package/build/components/use-block-drop-zone/index.native.js +49 -8
  86. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  87. package/build/components/use-setting/index.js +5 -9
  88. package/build/components/use-setting/index.js.map +1 -1
  89. package/build/hooks/margin.js +1 -1
  90. package/build/hooks/margin.js.map +1 -1
  91. package/build/hooks/padding.js +1 -1
  92. package/build/hooks/padding.js.map +1 -1
  93. package/build/hooks/utils.js +1 -7
  94. package/build/hooks/utils.js.map +1 -1
  95. package/build/private-apis.js +7 -3
  96. package/build/private-apis.js.map +1 -1
  97. package/build/store/actions.js +1 -1
  98. package/build/store/actions.js.map +1 -1
  99. package/build/store/private-selectors.js +5 -6
  100. package/build/store/private-selectors.js.map +1 -1
  101. package/build/store/reducer.js +0 -1
  102. package/build/store/reducer.js.map +1 -1
  103. package/build/store/selectors.js +19 -8
  104. package/build/store/selectors.js.map +1 -1
  105. package/build/utils/object.js +38 -2
  106. package/build/utils/object.js.map +1 -1
  107. package/build-module/components/block-draggable/index.js +6 -3
  108. package/build-module/components/block-draggable/index.js.map +1 -1
  109. package/build-module/components/block-draggable/index.native.js +2 -2
  110. package/build-module/components/block-draggable/index.native.js.map +1 -1
  111. package/build-module/components/block-edit/edit.js +27 -10
  112. package/build-module/components/block-edit/edit.js.map +1 -1
  113. package/build-module/components/block-list/block-outline.native.js +14 -18
  114. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  115. package/build-module/components/block-list/block.native.js +24 -43
  116. package/build-module/components/block-list/block.native.js.map +1 -1
  117. package/build-module/components/block-mover/index.native.js +3 -3
  118. package/build-module/components/block-mover/index.native.js.map +1 -1
  119. package/build-module/components/block-removal-warning-modal/index.js +1 -4
  120. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  121. package/build-module/components/block-settings/button.native.js +3 -3
  122. package/build-module/components/block-settings/button.native.js.map +1 -1
  123. package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +9 -7
  124. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  125. package/build-module/components/block-toolbar/index.js +4 -3
  126. package/build-module/components/block-toolbar/index.js.map +1 -1
  127. package/build-module/components/block-toolbar/index.native.js +60 -4
  128. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  129. package/build-module/components/colors-gradients/control.js +3 -2
  130. package/build-module/components/colors-gradients/control.js.map +1 -1
  131. package/build-module/components/global-styles/color-panel.js +21 -15
  132. package/build-module/components/global-styles/color-panel.js.map +1 -1
  133. package/build-module/components/global-styles/dimensions-panel.js +13 -2
  134. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  135. package/build-module/components/global-styles/get-block-css-selector.js +4 -8
  136. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  137. package/build-module/components/global-styles/hooks.js +12 -22
  138. package/build-module/components/global-styles/hooks.js.map +1 -1
  139. package/build-module/components/global-styles/typography-panel.js +18 -3
  140. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  141. package/build-module/components/global-styles/use-global-styles-output.js +13 -18
  142. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  143. package/build-module/components/global-styles/utils.js +5 -5
  144. package/build-module/components/global-styles/utils.js.map +1 -1
  145. package/build-module/components/iframe/index.js +37 -49
  146. package/build-module/components/iframe/index.js.map +1 -1
  147. package/build-module/components/iframe/use-compatibility-styles.js +5 -0
  148. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
  149. package/build-module/components/index.js +0 -5
  150. package/build-module/components/index.js.map +1 -1
  151. package/build-module/components/inner-blocks/index.js +3 -1
  152. package/build-module/components/inner-blocks/index.js.map +1 -1
  153. package/build-module/components/inner-blocks/index.native.js +3 -1
  154. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  155. package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
  156. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  157. package/build-module/components/inserter/index.js +2 -4
  158. package/build-module/components/inserter/index.js.map +1 -1
  159. package/build-module/components/inserter/index.native.js +22 -33
  160. package/build-module/components/inserter/index.native.js.map +1 -1
  161. package/build-module/components/inserter/reusable-block-rename-hint.js +22 -3
  162. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
  163. package/build-module/components/link-control/index.js +4 -1
  164. package/build-module/components/link-control/index.js.map +1 -1
  165. package/build-module/components/link-control/search-item.js +1 -1
  166. package/build-module/components/link-control/search-item.js.map +1 -1
  167. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  168. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  169. package/build-module/components/media-placeholder/index.native.js +66 -33
  170. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  171. package/build-module/components/preview-options/index.js +2 -2
  172. package/build-module/components/preview-options/index.js.map +1 -1
  173. package/build-module/components/rich-text/content.js +1 -36
  174. package/build-module/components/rich-text/content.js.map +1 -1
  175. package/build-module/components/rich-text/get-rich-text-values.js +105 -0
  176. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
  177. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  178. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  179. package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
  180. package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  181. package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
  182. package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  183. package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
  184. package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  185. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  186. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  187. package/build-module/components/use-block-display-information/index.js +7 -3
  188. package/build-module/components/use-block-display-information/index.js.map +1 -1
  189. package/build-module/components/use-block-drop-zone/index.native.js +50 -8
  190. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  191. package/build-module/components/use-setting/index.js +5 -9
  192. package/build-module/components/use-setting/index.js.map +1 -1
  193. package/build-module/hooks/margin.js +1 -1
  194. package/build-module/hooks/margin.js.map +1 -1
  195. package/build-module/hooks/padding.js +1 -1
  196. package/build-module/hooks/padding.js.map +1 -1
  197. package/build-module/hooks/utils.js +2 -7
  198. package/build-module/hooks/utils.js.map +1 -1
  199. package/build-module/private-apis.js +5 -2
  200. package/build-module/private-apis.js.map +1 -1
  201. package/build-module/store/actions.js +2 -2
  202. package/build-module/store/actions.js.map +1 -1
  203. package/build-module/store/private-selectors.js +3 -3
  204. package/build-module/store/private-selectors.js.map +1 -1
  205. package/build-module/store/reducer.js +0 -1
  206. package/build-module/store/reducer.js.map +1 -1
  207. package/build-module/store/selectors.js +16 -6
  208. package/build-module/store/selectors.js.map +1 -1
  209. package/build-module/utils/object.js +34 -2
  210. package/build-module/utils/object.js.map +1 -1
  211. package/build-style/content-rtl.css +2 -1
  212. package/build-style/content.css +2 -1
  213. package/build-style/style-rtl.css +7 -1
  214. package/build-style/style.css +7 -1
  215. package/package.json +32 -32
  216. package/src/components/block-controls/README.md +89 -0
  217. package/src/components/block-draggable/index.js +13 -4
  218. package/src/components/block-draggable/index.native.js +7 -3
  219. package/src/components/block-draggable/test/index.native.js +0 -54
  220. package/src/components/block-edit/edit.js +26 -9
  221. package/src/components/block-edit/test/edit.js +1 -1
  222. package/src/components/block-list/block-outline.native.js +26 -25
  223. package/src/components/block-list/block.native.js +24 -38
  224. package/src/components/block-list/block.native.scss +18 -40
  225. package/src/components/block-list/style.native.scss +3 -3
  226. package/src/components/block-mover/index.native.js +3 -3
  227. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
  228. package/src/components/block-removal-warning-modal/index.js +0 -3
  229. package/src/components/block-settings/button.native.js +12 -6
  230. package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
  231. package/src/components/block-toolbar/index.js +2 -3
  232. package/src/components/block-toolbar/index.native.js +86 -6
  233. package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
  234. package/src/components/block-toolbar/test/index.native.js +42 -0
  235. package/src/components/button-block-appender/styles.native.scss +2 -2
  236. package/src/components/caption/README.md +49 -0
  237. package/src/components/colors-gradients/control.js +3 -2
  238. package/src/components/global-styles/color-panel.js +23 -16
  239. package/src/components/global-styles/dimensions-panel.js +8 -2
  240. package/src/components/global-styles/get-block-css-selector.js +5 -9
  241. package/src/components/global-styles/hooks.js +20 -26
  242. package/src/components/global-styles/typography-panel.js +17 -5
  243. package/src/components/global-styles/use-global-styles-output.js +36 -18
  244. package/src/components/global-styles/utils.js +15 -6
  245. package/src/components/iframe/index.js +30 -56
  246. package/src/components/iframe/use-compatibility-styles.js +5 -0
  247. package/src/components/index.js +0 -5
  248. package/src/components/inner-blocks/README.md +10 -0
  249. package/src/components/inner-blocks/index.js +4 -0
  250. package/src/components/inner-blocks/index.native.js +4 -0
  251. package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
  252. package/src/components/inserter/index.js +2 -3
  253. package/src/components/inserter/index.native.js +17 -36
  254. package/src/components/inserter/reusable-block-rename-hint.js +18 -1
  255. package/src/components/inserter/style.native.scss +10 -15
  256. package/src/components/link-control/index.js +4 -1
  257. package/src/components/link-control/search-item.js +1 -1
  258. package/src/components/link-control/style.scss +8 -1
  259. package/src/components/link-control/test/index.js +26 -0
  260. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  261. package/src/components/media-placeholder/index.native.js +108 -59
  262. package/src/components/media-placeholder/styles.native.scss +59 -24
  263. package/src/components/preview-options/README.md +18 -17
  264. package/src/components/preview-options/index.js +2 -2
  265. package/src/components/rich-text/content.js +1 -46
  266. package/src/components/rich-text/get-rich-text-values.js +105 -0
  267. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  268. package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
  269. package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
  270. package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
  271. package/src/components/spacing-sizes-control/utils.js +1 -1
  272. package/src/components/text-transform-control/README.md +44 -0
  273. package/src/components/use-block-display-information/index.js +12 -5
  274. package/src/components/use-block-drop-zone/index.native.js +65 -28
  275. package/src/components/use-setting/index.js +8 -8
  276. package/src/hooks/margin.js +4 -1
  277. package/src/hooks/padding.js +4 -1
  278. package/src/hooks/utils.js +5 -7
  279. package/src/private-apis.js +7 -1
  280. package/src/store/actions.js +1 -2
  281. package/src/store/private-selectors.js +3 -6
  282. package/src/store/reducer.js +0 -1
  283. package/src/store/selectors.js +33 -5
  284. package/src/store/test/actions.js +3 -0
  285. package/src/store/test/private-selectors.js +5 -5
  286. package/src/store/test/reducer.js +14 -7
  287. package/src/store/test/selectors.js +1 -1
  288. package/src/utils/object.js +32 -2
  289. package/src/utils/test/object.js +36 -0
  290. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  291. package/build/components/block-mobile-toolbar/index.native.js +0 -135
  292. package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
  293. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  294. package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
  295. package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
  296. package/src/components/block-mobile-toolbar/index.native.js +0 -127
  297. package/src/components/block-mobile-toolbar/style.native.scss +0 -16
  298. /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["classnames","Button","Spinner","Notice","TextControl","__","useRef","useState","useEffect","focus","ENTER","isShallowEqualObjects","LinkControlSettingsDrawer","LinkControlSearchInput","LinkPreview","LinkSettings","useCreatePage","useInternalValue","ViewerFill","DEFAULT_LINK_SETTINGS","noop","LinkControl","searchInputPlaceholder","value","settings","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","settingsKeys","map","id","settingsOpen","setSettingsOpen","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","valueHasChanges","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","current","nextFocusTarget","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showSettings","showActions","showTextControl","isEditing","isDisabled"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAA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,mBAAF,IACD,cAAC,yBAAD;AACC,IAAA,YAAY,EAAGxC,YADhB;AAEC,IAAA,eAAe,EAAGC;AAFnB,KAIC,cAAC,YAAD;AACC,IAAA,KAAK,EAAGC,oBADT;AAEC,IAAA,QAAQ,EAAG5B,QAFZ;AAGC,IAAA,QAAQ,EAAGgC,oCAAoC,CAC9CT,YAD8C;AAHhD,IAJD,CAFF,CA3EF,EA6FGkD,WAAW,IACZ;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAGG,UAAU,GAAGhF,IAAH,GAAUiE,YAF/B;AAGC,IAAA,SAAS,EAAC,0CAHX;AAIC,qBAAgBe;AAJjB,KAMG/F,EAAE,CAAE,MAAF,CANL,CADD,EASC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,UAAhB;AAA2B,IAAA,OAAO,EAAGwF;AAArC,KACGxF,EAAE,CAAE,QAAF,CADL,CATD,CA9FF,EA6GGoC,mBAAmB,IAAIA,mBAAmB,EA7G7C,CADD;AAiHA;;AAEDpB,WAAW,CAACH,UAAZ,GAAyBA,UAAzB;AAEA,eAAeG,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t\t// Todo: bug if the missing dep is introduced. Will need a fix.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetSettingsOpen( false );\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not overide any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue =\n\t\tpropInputValue || internalControlValue?.url || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\tconst isDisabled = ! valueHasChanges || currentInputIsEmpty;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalURLInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ settingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpen }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ handleCancel }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["classnames","Button","Spinner","Notice","TextControl","__","useRef","useState","useEffect","focus","ENTER","isShallowEqualObjects","LinkControlSettingsDrawer","LinkControlSearchInput","LinkPreview","LinkSettings","useCreatePage","useInternalValue","ViewerFill","DEFAULT_LINK_SETTINGS","noop","LinkControl","searchInputPlaceholder","value","settings","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","settingsKeys","map","id","settingsOpen","setSettingsOpen","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","valueHasChanges","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","current","nextFocusTarget","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showSettings","showActions","showTextControl","isEditing","isDisabled"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,OAAjB,EAA0BC,MAA1B,EAAkCC,WAAlC,QAAqD,uBAArD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,qBAAT,QAAsC,6BAAtC;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,mBAAtC;AACA,OAAOC,sBAAP,MAAmC,gBAAnC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,YAAP,MAAyB,YAAzB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,gBAAP,MAA6B,sBAA7B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,YAF/B;AAGC,IAAA,SAAS,EAAC,0CAHX;AAIC,qBAAgBe;AAJjB,KAMG/F,EAAE,CAAE,MAAF,CANL,CADD,EASC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,UAAhB;AAA2B,IAAA,OAAO,EAAGwF;AAArC,KACGxF,EAAE,CAAE,QAAF,CADL,CATD,CAjGF,EAgHGoC,mBAAmB,IAAIA,mBAAmB,EAhH7C,CADD;AAoHA;;AAEDpB,WAAW,CAACH,UAAZ,GAAyBA,UAAzB;AAEA,eAAeG,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t\t// Todo: bug if the missing dep is introduced. Will need a fix.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetSettingsOpen( false );\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not overide any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue =\n\t\tpropInputValue || internalControlValue?.url || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\tconst isDisabled = ! valueHasChanges || currentInputIsEmpty;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalURLInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ settingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpen }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ handleCancel }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
@@ -46,7 +46,7 @@ export const LinkControlSearchItem = ({
46
46
  isURL = false,
47
47
  shouldShowType = false
48
48
  }) => {
49
- const info = isURL ? __('Press ENTER to add this link') : filterURLForDisplay(safeDecodeURI(suggestion?.url));
49
+ const info = isURL ? __('Press ENTER to add this link') : filterURLForDisplay(safeDecodeURI(suggestion?.url), 24);
50
50
  return createElement(MenuItem, { ...itemProps,
51
51
  info: info,
52
52
  iconPosition: "left",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["__","MenuItem","TextHighlight","Icon","globe","page","tag","postList","category","file","__unstableStripHTML","stripHTML","safeDecodeURI","filterURLForDisplay","ICONS_MAP","post","post_tag","attachment","SearchItemIcon","isURL","suggestion","icon","type","LinkControlSearchItem","itemProps","searchTerm","onCl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E,8BAAF,CADa,GAEfa,mBAAmB,CAAED,aAAa,CAAEQ,UAAU,EAAES,GAAd,CAAf,CAFtB;AAIA,SACC,cAAC,QAAD,OACML,SADN;AAEC,IAAA,IAAI,EAAGI,IAFR;AAGC,IAAA,YAAY,EAAC,MAHd;AAIC,IAAA,IAAI,EACH,cAAC,cAAD;AAAgB,MAAA,UAAU,EAAGR,UAA7B;AAA0C,MAAA,KAAK,EAAGD;AAAlD,MALF;AAOC,IAAA,OAAO,EAAGO,OAPX;AAQC,IAAA,QAAQ,EAAGC,cAAc,IAAIG,iBAAiB,CAAEV,UAAF,CAR/C;AASC,IAAA,SAAS,EAAC;AATX,KAWC,cAAC,aAAD,CACC;AADD;AAEC,IAAA,IAAI,EAAGT,SAAS,CAAES,UAAU,CAACW,KAAb,CAFjB;AAGC,IAAA,SAAS,EAAGN;AAHb,IAXD,CADD;AAmBA,CA/BM;;AAiCP,SAASK,iBAAT,CAA4BV,UAA5B,EAAyC;AACxC,MAAKA,UAAU,CAACY,WAAhB,EAA8B;AAC7B,WAAO,YAAP;AACA,GAHuC,CAKxC;;;AACA,SAAOZ,UAAU,CAACE,IAAX,KAAoB,UAApB,GAAiC,KAAjC,GAAyCF,UAAU,CAACE,IAA3D;AACA;;AAED,eAAeC,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tsearchTerm,\n\tonClick,\n\tisURL = false,\n\tshouldShowType = false,\n} ) => {\n\tconst info = isURL\n\t\t? __( 'Press ENTER to add this link' )\n\t\t: filterURLForDisplay( safeDecodeURI( suggestion?.url ) );\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\tinfo={ info }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={\n\t\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t\tshortcut={ shouldShowType && getVisualTypeName( suggestion ) }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t>\n\t\t\t<TextHighlight\n\t\t\t\t// The component expects a plain text string.\n\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\thighlight={ searchTerm }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["__","MenuItem","TextHighlight","Icon","globe","page","tag","postList","category","file","__unstableStripHTML","stripHTML","safeDecodeURI","filterURLForDisplay","ICONS_MAP","post","post_tag","attachment","SearchItemIcon","isURL","suggestion","icon","type","LinkControlSearchItem","itemProps","searchTerm","onClick","shouldShowType","info","url","getVisual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,mBAAmB,CAAED,aAAa,CAAEQ,UAAU,EAAES,GAAd,CAAf,EAAoC,EAApC,CAFtB;AAIA,SACC,cAAC,QAAD,OACML,SADN;AAEC,IAAA,IAAI,EAAGI,IAFR;AAGC,IAAA,YAAY,EAAC,MAHd;AAIC,IAAA,IAAI,EACH,cAAC,cAAD;AAAgB,MAAA,UAAU,EAAGR,UAA7B;AAA0C,MAAA,KAAK,EAAGD;AAAlD,MALF;AAOC,IAAA,OAAO,EAAGO,OAPX;AAQC,IAAA,QAAQ,EAAGC,cAAc,IAAIG,iBAAiB,CAAEV,UAAF,CAR/C;AASC,IAAA,SAAS,EAAC;AATX,KAWC,cAAC,aAAD,CACC;AADD;AAEC,IAAA,IAAI,EAAGT,SAAS,CAAES,UAAU,CAACW,KAAb,CAFjB;AAGC,IAAA,SAAS,EAAGN;AAHb,IAXD,CADD;AAmBA,CA/BM;;AAiCP,SAASK,iBAAT,CAA4BV,UAA5B,EAAyC;AACxC,MAAKA,UAAU,CAACY,WAAhB,EAA8B;AAC7B,WAAO,YAAP;AACA,GAHuC,CAKxC;;;AACA,SAAOZ,UAAU,CAACE,IAAX,KAAoB,UAApB,GAAiC,KAAjC,GAAyCF,UAAU,CAACE,IAA3D;AACA;;AAED,eAAeC,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tsearchTerm,\n\tonClick,\n\tisURL = false,\n\tshouldShowType = false,\n} ) => {\n\tconst info = isURL\n\t\t? __( 'Press ENTER to add this link' )\n\t\t: filterURLForDisplay( safeDecodeURI( suggestion?.url ), 24 );\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\tinfo={ info }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={\n\t\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t\tshortcut={ shouldShowType && getVisualTypeName( suggestion ) }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t>\n\t\t\t<TextHighlight\n\t\t\t\t// The component expects a plain text string.\n\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\thighlight={ searchTerm }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"]}
@@ -16,12 +16,12 @@ export default function useListViewClientIds({
16
16
  const {
17
17
  getDraggedBlockClientIds,
18
18
  getSelectedBlockClientIds,
19
- getListViewClientIdsTree
19
+ getEnabledClientIdsTree
20
20
  } = unlock(select(blockEditorStore));
21
21
  return {
22
22
  selectedClientIds: getSelectedBlockClientIds(),
23
23
  draggedClientIds: getDraggedBlockClientIds(),
24
- clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getListViewClientIdsTree(rootClientId)
24
+ clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getEnabledClientIdsTree(rootClientId)
25
25
  };
26
26
  }, [blocks, rootClientId]);
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useSelect","store","blockEditorStore","unlock","useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getListViewClientIdsTree","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":"AAAA;AACA;AACA;AAEA,SAASA,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,eAAe,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAON,SAAS,CACbO,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIFP,MAAM,CAAEI,MAAM,CAAEL,gBAAF,CAAR,CAJV;AAMA,WAAO;AACNS,MAAAA,iBAAiB,EAAEF,yBAAyB,EADtC;AAENG,MAAAA,gBAAgB,EAAEJ,wBAAwB,EAFpC;AAGNK,MAAAA,aAAa,EACZR,MADY,aACZA,MADY,cACZA,MADY,GACFK,wBAAwB,CAAEJ,YAAF;AAJ7B,KAAP;AAMA,GAdc,EAef,CAAED,MAAF,EAAUC,YAAV,CAfe,CAAhB;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetListViewClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getListViewClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useSelect","store","blockEditorStore","unlock","useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getEnabledClientIdsTree","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":"AAAA;AACA;AACA;AAEA,SAASA,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,eAAe,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAON,SAAS,CACbO,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIFP,MAAM,CAAEI,MAAM,CAAEL,gBAAF,CAAR,CAJV;AAMA,WAAO;AACNS,MAAAA,iBAAiB,EAAEF,yBAAyB,EADtC;AAENG,MAAAA,gBAAgB,EAAEJ,wBAAwB,EAFpC;AAGNK,MAAAA,aAAa,EACZR,MADY,aACZA,MADY,cACZA,MADY,GACFK,uBAAuB,CAAEJ,YAAF;AAJ5B,KAAP;AAMA,GAdc,EAef,CAAED,MAAF,EAAUC,YAAV,CAfe,CAAhB;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetEnabledClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getEnabledClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
@@ -3,31 +3,41 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { View, Text, TouchableWithoutFeedback } from 'react-native';
6
+ import { View, Text, TouchableOpacity } from 'react-native';
7
+ import { sentenceCase } from 'change-case';
7
8
  /**
8
9
  * WordPress dependencies
9
10
  */
10
11
 
11
12
  import { __, sprintf } from '@wordpress/i18n';
12
13
  import { MediaUpload, MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO, MEDIA_TYPE_AUDIO } from '@wordpress/block-editor';
13
- import { withPreferredColorScheme } from '@wordpress/compose';
14
- import { useRef } from '@wordpress/element';
14
+ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
15
+ import { cloneElement, useCallback, useRef } from '@wordpress/element';
15
16
  import { Icon, plusCircleFilled } from '@wordpress/icons';
16
17
  /**
17
18
  * Internal dependencies
18
19
  */
19
20
 
20
21
  import styles from './styles.scss';
22
+ import { useBlockEditContext } from '../block-edit/context';
21
23
 
22
24
  const isMediaEqual = (media1, media2) => media1.id === media2.id || media1.url === media2.url; // Remove duplicates after gallery append.
23
25
 
24
26
 
25
27
  const dedupMedia = media => media.reduce((dedupedMedia, mediaItem) => dedupedMedia.some(item => isMediaEqual(item, mediaItem)) ? dedupedMedia : [...dedupedMedia, mediaItem], []);
26
28
 
29
+ const hitSlop = {
30
+ top: 22,
31
+ bottom: 22,
32
+ left: 22,
33
+ right: 22
34
+ };
35
+
27
36
  function MediaPlaceholder(props) {
28
37
  const {
29
38
  addToGallery,
30
39
  allowedTypes = [],
40
+ className = '',
31
41
  labels = {},
32
42
  icon,
33
43
  onSelect,
@@ -35,7 +45,6 @@ function MediaPlaceholder(props) {
35
45
  __experimentalOnlyMediaLibrary,
36
46
  isAppender,
37
47
  disableMediaButtons,
38
- getStylesFromColorScheme,
39
48
  multiple,
40
49
  value = [],
41
50
  children,
@@ -47,7 +56,12 @@ function MediaPlaceholder(props) {
47
56
  } = props; // Use ref to keep media array current for callbacks during rerenders.
48
57
 
49
58
  const mediaRef = useRef(value);
50
- mediaRef.current = value; // Append and deduplicate media array for gallery use case.
59
+ mediaRef.current = value;
60
+ const blockEditContext = useBlockEditContext();
61
+ const onButtonPress = useCallback(open => event => {
62
+ onFocus?.(event);
63
+ open();
64
+ }, [onFocus]); // Append and deduplicate media array for gallery use case.
51
65
 
52
66
  const setMedia = multiple && addToGallery ? selected => onSelect(dedupMedia([...mediaRef.current, ...selected])) : onSelect;
53
67
  const isOneType = allowedTypes.length === 1;
@@ -92,36 +106,65 @@ function MediaPlaceholder(props) {
92
106
  accessibilityHint = __('Double tap to select an audio file');
93
107
  }
94
108
 
95
- const emptyStateTitleStyle = getStylesFromColorScheme(styles.emptyStateTitle, styles.emptyStateTitleDark);
96
- const addMediaButtonStyle = getStylesFromColorScheme(styles.addMediaButton, styles.addMediaButtonDark);
97
-
98
- const renderContent = () => {
109
+ const titleStyles = usePreferredColorSchemeStyle(styles['media-placeholder__header-title'], styles['media-placeholder__header-title--dark']);
110
+ const addMediaButtonStyle = usePreferredColorSchemeStyle(styles.addMediaButton, styles.addMediaButtonDark);
111
+ const buttonStyles = usePreferredColorSchemeStyle(styles['media-placeholder__button'], styles['media-placeholder__button--dark']);
112
+ const emptyStateDescriptionStyles = usePreferredColorSchemeStyle(styles.emptyStateDescription, styles.emptyStateDescriptionDark);
113
+ const iconStyles = usePreferredColorSchemeStyle(styles['media-placeholder__header-icon'], styles['media-placeholder__header-icon--dark']);
114
+ const placeholderIcon = cloneElement(icon, {
115
+ fill: iconStyles.fill
116
+ });
117
+ const accessibilityLabel = sprintf(
118
+ /* translators: accessibility text for the media block empty state. %s: media type */
119
+ __('%s block. Empty'), placeholderTitle);
120
+
121
+ const renderContent = open => {
99
122
  if (isAppender === undefined || !isAppender) {
100
123
  return createElement(Fragment, null, createElement(View, {
101
- style: styles.modalIcon
102
- }, icon), createElement(Text, {
103
- style: emptyStateTitleStyle
104
- }, placeholderTitle), children, createElement(Text, {
105
- style: styles.emptyStateDescription
106
- }, instructions));
124
+ style: styles['media-placeholder__header']
125
+ }, createElement(View, {
126
+ style: iconStyles
127
+ }, placeholderIcon), createElement(Text, {
128
+ style: titleStyles
129
+ }, placeholderTitle)), children, createElement(TouchableOpacity, {
130
+ activeOpacity: 0.5,
131
+ accessibilityLabel: accessibilityLabel,
132
+ style: buttonStyles,
133
+ accessibilityRole: 'button',
134
+ accessibilityHint: accessibilityHint,
135
+ hitSlop: hitSlop,
136
+ onPress: onButtonPress(open)
137
+ }, createElement(Text, {
138
+ style: emptyStateDescriptionStyles
139
+ }, sentenceCase(instructions))));
107
140
  } else if (isAppender && !disableMediaButtons) {
108
- return createElement(View, {
141
+ return createElement(TouchableOpacity, {
142
+ activeOpacity: 0.5,
143
+ accessibilityLabel: accessibilityLabel,
144
+ style: styles['media-placeholder__appender'],
145
+ accessibilityRole: 'button',
146
+ accessibilityHint: accessibilityHint,
147
+ hitSlop: hitSlop,
148
+ onPress: onButtonPress(open)
149
+ }, createElement(View, {
109
150
  testID: "media-placeholder-appender-icon"
110
151
  }, createElement(Icon, {
111
152
  icon: plusCircleFilled,
112
153
  style: addMediaButtonStyle,
113
154
  color: addMediaButtonStyle.color,
114
155
  size: addMediaButtonStyle.size
115
- }));
156
+ })));
116
157
  }
117
158
  };
118
159
 
160
+ const appenderStyle = usePreferredColorSchemeStyle(styles.appender, styles.appenderDark);
161
+ const containerSelectedStyle = usePreferredColorSchemeStyle(styles['media-placeholder__container-selected'], styles['media-placeholder__container-selected--dark']);
162
+ const containerStyle = [usePreferredColorSchemeStyle(styles['media-placeholder__container'], styles['media-placeholder__container--dark']), blockEditContext?.isSelected && !className.includes('no-block-outline') && containerSelectedStyle];
163
+
119
164
  if (isAppender && disableMediaButtons) {
120
165
  return null;
121
166
  }
122
167
 
123
- const appenderStyle = getStylesFromColorScheme(styles.appender, styles.appenderDark);
124
- const emptyStateContainerStyle = getStylesFromColorScheme(styles.emptyStateContainer, styles.emptyStateContainerDark);
125
168
  return createElement(View, {
126
169
  style: {
127
170
  flex: 1
@@ -138,26 +181,16 @@ function MediaPlaceholder(props) {
138
181
  open,
139
182
  getMediaOptions
140
183
  }) => {
141
- return createElement(TouchableWithoutFeedback, {
142
- accessibilityLabel: sprintf(
143
- /* translators: accessibility text for the media block empty state. %s: media type */
144
- __('%s block. Empty'), placeholderTitle),
145
- accessibilityRole: 'button',
146
- accessibilityHint: accessibilityHint,
147
- onPress: event => {
148
- onFocus?.(event);
149
- open();
150
- }
151
- }, createElement(View, {
152
- style: [[emptyStateContainerStyle, height && {
184
+ return createElement(View, {
185
+ style: [[containerStyle, height && {
153
186
  height
154
187
  }, backgroundColor && {
155
188
  backgroundColor
156
189
  }], isAppender && appenderStyle]
157
- }, getMediaOptions(), !hideContent && renderContent()));
190
+ }, getMediaOptions(), !hideContent && renderContent(open));
158
191
  }
159
192
  }));
160
193
  }
161
194
 
162
- export default withPreferredColorScheme(MediaPlaceholder);
195
+ export default MediaPlaceholder;
163
196
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/media-placeholder/index.native.js"],"names":["View","Text","TouchableWithoutFeedback","__","sprintf","MediaUpload","MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","withPreferredColorScheme","useRef","Icon","plusCircleFilled","styles","isMediaEqual","media1","media2","id","url","dedupMedia","media","reduce","dedupedMedia","mediaItem","some","item","MediaPlaceholder","props","addToGallery","allowedTypes","labels","icon","onSelect","onFocus","__experimentalOnlyMediaLibrary","isAppender","disableMediaButtons","getStylesFromColorScheme","multiple","value","children","height","backgroundColor","hideContent","autoOpenMediaUpload","onSelectURL","mediaRef","current","setMedia","selected","isOneType","length","isImage","includes","isVideo","isAudio","placeholderTitle","title","undefined","instructions","accessibilityHint","emptyStateTitleStyle","emptyStateTitle","emptyStateTitleDark","addMediaButtonStyle","addMediaButton","addMediaButtonDark","renderContent","modalIcon","emptyStateDescription","color","size","appenderStyle","appender","appenderDark","emptyStateContainerStyle","emptyStateContainer","emptyStateContainerDark","flex","open","getMediaOptions","event"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,IAAf,EAAqBC,wBAArB,QAAqD,cAArD;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,WADD,EAECC,gBAFD,EAGCC,gBAHD,EAICC,gBAJD,QAKO,yBALP;AAMA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,IAAT,EAAeC,gBAAf,QAAuC,kBAAvC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,eAAnB;;AAEA,MAAMC,YAAY,GAAG,CAAEC,MAAF,EAAUC,MAAV,KACpBD,MAAM,CAACE,EAAP,KAAcD,MAAM,CAACC,EAArB,IAA2BF,MAAM,CAACG,GAAP,KAAeF,MAAM,CAACE,GADlD,C,CAGA;;;AACA,MAAMC,UAAU,GAAKC,KAAF,IAClBA,KAAK,CAACC,MAAN,CACC,CAAEC,YAAF,EAAgBC,SAAhB,KACCD,YAAY,CAACE,IAAb,CAAqBC,IAAF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AAC,WAAD;AACC,IAAA,YAAY,EAAGjD,YADhB;AAEC,IAAA,QAAQ,EAAGmB,QAFZ;AAGC,IAAA,WAAW,EAAGH,WAHf;AAIC,IAAA,8BAA8B,EAC7BX,8BALF;AAOC,IAAA,QAAQ,EAAGI,QAPZ;AAQC,IAAA,gBAAgB,EAAG,KARpB;AASC,IAAA,QAAQ,EAAGM,mBATZ;AAUC,IAAA,MAAM,EAAG,CAAE;AAAEmC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAF,KAAiC;AACzC,aACC,cAAC,wBAAD;AACC,QAAA,kBAAkB,EAAG5E,OAAO;AAC3B;AACAD,QAAAA,EAAE,CAAE,iBAAF,CAFyB,EAG3BqD,gBAH2B,CAD7B;AAMC,QAAA,iBAAiB,EAAG,QANrB;AAOC,QAAA,iBAAiB,EAAGI,iBAPrB;AAQC,QAAA,OAAO,EAAKqB,KAAF,IAAa;AACtBhD,UAAAA,OAAO,GAAIgD,KAAJ,CAAP;AACAF,UAAAA,IAAI;AACJ;AAXF,SAaC,cAAC,IAAD;AACC,QAAA,KAAK,EAAG,CACP,CACCJ,wBADD,EAEClC,MAAM,IAAI;AAAEA,UAAAA;AAAF,SAFX,EAGCC,eAAe,IAAI;AAAEA,UAAAA;AAAF,SAHpB,CADO,EAMPP,UAAU,IAAIqC,aANP;AADT,SAUGQ,eAAe,EAVlB,EAWG,CAAErC,WAAF,IAAiBwB,aAAa,EAXjC,CAbD,CADD;AA6BA;AAxCF,IADD,CADD;AA8CA;;AAED,eAAe1D,wBAAwB,CAAEiB,gBAAF,CAAvC","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMediaUpload,\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n} from '@wordpress/block-editor';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\nimport { Icon, plusCircleFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nconst isMediaEqual = ( media1, media2 ) =>\n\tmedia1.id === media2.id || media1.url === media2.url;\n\n// Remove duplicates after gallery append.\nconst dedupMedia = ( media ) =>\n\tmedia.reduce(\n\t\t( dedupedMedia, mediaItem ) =>\n\t\t\tdedupedMedia.some( ( item ) => isMediaEqual( item, mediaItem ) )\n\t\t\t\t? dedupedMedia\n\t\t\t\t: [ ...dedupedMedia, mediaItem ],\n\t\t[]\n\t);\n\nfunction MediaPlaceholder( props ) {\n\tconst {\n\t\taddToGallery,\n\t\tallowedTypes = [],\n\t\tlabels = {},\n\t\ticon,\n\t\tonSelect,\n\t\tonFocus,\n\t\t__experimentalOnlyMediaLibrary,\n\t\tisAppender,\n\t\tdisableMediaButtons,\n\t\tgetStylesFromColorScheme,\n\t\tmultiple,\n\t\tvalue = [],\n\t\tchildren,\n\t\theight,\n\t\tbackgroundColor,\n\t\thideContent,\n\t\tautoOpenMediaUpload,\n\t\tonSelectURL,\n\t} = props;\n\n\t// Use ref to keep media array current for callbacks during rerenders.\n\tconst mediaRef = useRef( value );\n\tmediaRef.current = value;\n\n\t// Append and deduplicate media array for gallery use case.\n\tconst setMedia =\n\t\tmultiple && addToGallery\n\t\t\t? ( selected ) =>\n\t\t\t\t\tonSelect(\n\t\t\t\t\t\tdedupMedia( [ ...mediaRef.current, ...selected ] )\n\t\t\t\t\t)\n\t\t\t: onSelect;\n\n\tconst isOneType = allowedTypes.length === 1;\n\tconst isImage = isOneType && allowedTypes.includes( MEDIA_TYPE_IMAGE );\n\tconst isVideo = isOneType && allowedTypes.includes( MEDIA_TYPE_VIDEO );\n\tconst isAudio = isOneType && allowedTypes.includes( MEDIA_TYPE_AUDIO );\n\n\tlet placeholderTitle = labels.title;\n\tif ( placeholderTitle === undefined ) {\n\t\tplaceholderTitle = __( 'Media' );\n\t\tif ( isImage ) {\n\t\t\tplaceholderTitle = __( 'Image' );\n\t\t} else if ( isVideo ) {\n\t\t\tplaceholderTitle = __( 'Video' );\n\t\t} else if ( isAudio ) {\n\t\t\tplaceholderTitle = __( 'Audio' );\n\t\t}\n\t}\n\n\tlet instructions = labels.instructions;\n\tif ( instructions === undefined ) {\n\t\tif ( isImage ) {\n\t\t\tinstructions = __( 'ADD IMAGE' );\n\t\t} else if ( isVideo ) {\n\t\t\tinstructions = __( 'ADD VIDEO' );\n\t\t} else if ( isAudio ) {\n\t\t\tinstructions = __( 'ADD AUDIO' );\n\t\t} else {\n\t\t\tinstructions = __( 'ADD IMAGE OR VIDEO' );\n\t\t}\n\t}\n\n\tlet accessibilityHint = __( 'Double tap to select' );\n\tif ( isImage ) {\n\t\taccessibilityHint = __( 'Double tap to select an image' );\n\t} else if ( isVideo ) {\n\t\taccessibilityHint = __( 'Double tap to select a video' );\n\t} else if ( isAudio ) {\n\t\taccessibilityHint = __( 'Double tap to select an audio file' );\n\t}\n\n\tconst emptyStateTitleStyle = getStylesFromColorScheme(\n\t\tstyles.emptyStateTitle,\n\t\tstyles.emptyStateTitleDark\n\t);\n\tconst addMediaButtonStyle = getStylesFromColorScheme(\n\t\tstyles.addMediaButton,\n\t\tstyles.addMediaButtonDark\n\t);\n\n\tconst renderContent = () => {\n\t\tif ( isAppender === undefined || ! isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<View style={ styles.modalIcon }>{ icon }</View>\n\t\t\t\t\t<Text style={ emptyStateTitleStyle }>\n\t\t\t\t\t\t{ placeholderTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<Text style={ styles.emptyStateDescription }>\n\t\t\t\t\t\t{ instructions }\n\t\t\t\t\t</Text>\n\t\t\t\t</>\n\t\t\t);\n\t\t} else if ( isAppender && ! disableMediaButtons ) {\n\t\t\treturn (\n\t\t\t\t<View testID=\"media-placeholder-appender-icon\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ plusCircleFilled }\n\t\t\t\t\t\tstyle={ addMediaButtonStyle }\n\t\t\t\t\t\tcolor={ addMediaButtonStyle.color }\n\t\t\t\t\t\tsize={ addMediaButtonStyle.size }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t};\n\n\tif ( isAppender && disableMediaButtons ) {\n\t\treturn null;\n\t}\n\n\tconst appenderStyle = getStylesFromColorScheme(\n\t\tstyles.appender,\n\t\tstyles.appenderDark\n\t);\n\tconst emptyStateContainerStyle = getStylesFromColorScheme(\n\t\tstyles.emptyStateContainer,\n\t\tstyles.emptyStateContainerDark\n\t);\n\n\treturn (\n\t\t<View style={ { flex: 1 } }>\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tonSelect={ setMedia }\n\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t__experimentalOnlyMediaLibrary={\n\t\t\t\t\t__experimentalOnlyMediaLibrary\n\t\t\t\t}\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tisReplacingMedia={ false }\n\t\t\t\tautoOpen={ autoOpenMediaUpload }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\taccessibilityLabel={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: accessibility text for the media block empty state. %s: media type */\n\t\t\t\t\t\t\t\t__( '%s block. Empty' ),\n\t\t\t\t\t\t\t\tplaceholderTitle\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus?.( event );\n\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\temptyStateContainerStyle,\n\t\t\t\t\t\t\t\t\t\theight && { height },\n\t\t\t\t\t\t\t\t\t\tbackgroundColor && { backgroundColor },\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tisAppender && appenderStyle,\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ getMediaOptions() }\n\t\t\t\t\t\t\t\t{ ! hideContent && renderContent() }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( MediaPlaceholder );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/media-placeholder/index.native.js"],"names":["View","Text","TouchableOpacity","sentenceCase","__","sprintf","MediaUpload","MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","usePreferredColorSchemeStyle","cloneElement","useCallback","useRef","Icon","plusCircleFilled","styles","useBlockEditContext","isMediaEqual","media1","media2","id","url","dedupMedia","media","reduce","dedupedMedia","mediaItem","some","item","hitSlop","top","bottom","left","right","MediaPlaceholder","props","addToGallery","allowedTypes","className","labels","icon","onSelect","onFocus","__experimentalOnlyMediaLibrary","isAppender","disableMediaButtons","multiple","value","children","height","backgroundColor","hideContent","autoOpenMediaUpload","onSelectURL","mediaRef","current","blockEditContext","onButtonPress","open","event","setMedia","selected","isOneType","length","isImage","includes","isVideo","isAudio","placeholderTitle","title","undefined","instructions","accessibilityHint","titleStyles","addMediaButtonStyle","addMediaButton","addMediaButtonDark","buttonStyles","emptyStateDescriptionStyles","emptyStateDescription","emptyStateDescriptionDark","iconStyles","placeholderIcon","fill","accessibilityLabel","renderContent","color","size","appenderStyle","appender","appenderDark","containerSelectedStyle","containerStyle","isSelected","flex","getMediaOptions"],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AAvB;;AAUA,MAAK/C,UAAU,IAAIC,mBAAnB,EAAyC;AACxC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAG;AAAEiD,MAAAA,IAAI,EAAE;AAAR;AAAd,KACC,cAAC,WAAD;AACC,IAAA,YAAY,EAAGzD,YADhB;AAEC,IAAA,QAAQ,EAAGuB,QAFZ;AAGC,IAAA,WAAW,EAAGP,WAHf;AAIC,IAAA,8BAA8B,EAC7BV,8BALF;AAOC,IAAA,QAAQ,EAAGG,QAPZ;AAQC,IAAA,gBAAgB,EAAG,KARpB;AASC,IAAA,QAAQ,EAAGM,mBATZ;AAUC,IAAA,MAAM,EAAG,CAAE;AAAEM,MAAAA,IAAF;AAAQqC,MAAAA;AAAR,KAAF,KAAiC;AACzC,aACC,cAAC,IAAD;AACC,QAAA,KAAK,EAAG,CACP,CACCH,cADD,EAEC3C,MAAM,IAAI;AAAEA,UAAAA;AAAF,SAFX,EAGCC,eAAe,IAAI;AAAEA,UAAAA;AAAF,SAHpB,CADO,EAMPN,UAAU,IAAI4C,aANP;AADT,SAUGO,eAAe,EAVlB,EAWG,CAAE5C,WAAF,IAAiBkC,aAAa,CAAE3B,IAAF,CAXjC,CADD;AAeA;AA1BF,IADD,CADD;AAgCA;;AAED,eAAexB,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableOpacity } from 'react-native';\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMediaUpload,\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n} from '@wordpress/block-editor';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { cloneElement, useCallback, useRef } from '@wordpress/element';\nimport { Icon, plusCircleFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport { useBlockEditContext } from '../block-edit/context';\n\nconst isMediaEqual = ( media1, media2 ) =>\n\tmedia1.id === media2.id || media1.url === media2.url;\n\n// Remove duplicates after gallery append.\nconst dedupMedia = ( media ) =>\n\tmedia.reduce(\n\t\t( dedupedMedia, mediaItem ) =>\n\t\t\tdedupedMedia.some( ( item ) => isMediaEqual( item, mediaItem ) )\n\t\t\t\t? dedupedMedia\n\t\t\t\t: [ ...dedupedMedia, mediaItem ],\n\t\t[]\n\t);\n\nconst hitSlop = { top: 22, bottom: 22, left: 22, right: 22 };\n\nfunction MediaPlaceholder( props ) {\n\tconst {\n\t\taddToGallery,\n\t\tallowedTypes = [],\n\t\tclassName = '',\n\t\tlabels = {},\n\t\ticon,\n\t\tonSelect,\n\t\tonFocus,\n\t\t__experimentalOnlyMediaLibrary,\n\t\tisAppender,\n\t\tdisableMediaButtons,\n\t\tmultiple,\n\t\tvalue = [],\n\t\tchildren,\n\t\theight,\n\t\tbackgroundColor,\n\t\thideContent,\n\t\tautoOpenMediaUpload,\n\t\tonSelectURL,\n\t} = props;\n\n\t// Use ref to keep media array current for callbacks during rerenders.\n\tconst mediaRef = useRef( value );\n\tmediaRef.current = value;\n\n\tconst blockEditContext = useBlockEditContext();\n\n\tconst onButtonPress = useCallback(\n\t\t( open ) => ( event ) => {\n\t\t\tonFocus?.( event );\n\t\t\topen();\n\t\t},\n\t\t[ onFocus ]\n\t);\n\n\t// Append and deduplicate media array for gallery use case.\n\tconst setMedia =\n\t\tmultiple && addToGallery\n\t\t\t? ( selected ) =>\n\t\t\t\t\tonSelect(\n\t\t\t\t\t\tdedupMedia( [ ...mediaRef.current, ...selected ] )\n\t\t\t\t\t)\n\t\t\t: onSelect;\n\n\tconst isOneType = allowedTypes.length === 1;\n\tconst isImage = isOneType && allowedTypes.includes( MEDIA_TYPE_IMAGE );\n\tconst isVideo = isOneType && allowedTypes.includes( MEDIA_TYPE_VIDEO );\n\tconst isAudio = isOneType && allowedTypes.includes( MEDIA_TYPE_AUDIO );\n\n\tlet placeholderTitle = labels.title;\n\tif ( placeholderTitle === undefined ) {\n\t\tplaceholderTitle = __( 'Media' );\n\t\tif ( isImage ) {\n\t\t\tplaceholderTitle = __( 'Image' );\n\t\t} else if ( isVideo ) {\n\t\t\tplaceholderTitle = __( 'Video' );\n\t\t} else if ( isAudio ) {\n\t\t\tplaceholderTitle = __( 'Audio' );\n\t\t}\n\t}\n\n\tlet instructions = labels.instructions;\n\tif ( instructions === undefined ) {\n\t\tif ( isImage ) {\n\t\t\tinstructions = __( 'ADD IMAGE' );\n\t\t} else if ( isVideo ) {\n\t\t\tinstructions = __( 'ADD VIDEO' );\n\t\t} else if ( isAudio ) {\n\t\t\tinstructions = __( 'ADD AUDIO' );\n\t\t} else {\n\t\t\tinstructions = __( 'ADD IMAGE OR VIDEO' );\n\t\t}\n\t}\n\n\tlet accessibilityHint = __( 'Double tap to select' );\n\tif ( isImage ) {\n\t\taccessibilityHint = __( 'Double tap to select an image' );\n\t} else if ( isVideo ) {\n\t\taccessibilityHint = __( 'Double tap to select a video' );\n\t} else if ( isAudio ) {\n\t\taccessibilityHint = __( 'Double tap to select an audio file' );\n\t}\n\n\tconst titleStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__header-title' ],\n\t\tstyles[ 'media-placeholder__header-title--dark' ]\n\t);\n\tconst addMediaButtonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.addMediaButton,\n\t\tstyles.addMediaButtonDark\n\t);\n\tconst buttonStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__button' ],\n\t\tstyles[ 'media-placeholder__button--dark' ]\n\t);\n\tconst emptyStateDescriptionStyles = usePreferredColorSchemeStyle(\n\t\tstyles.emptyStateDescription,\n\t\tstyles.emptyStateDescriptionDark\n\t);\n\tconst iconStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__header-icon' ],\n\t\tstyles[ 'media-placeholder__header-icon--dark' ]\n\t);\n\tconst placeholderIcon = cloneElement( icon, {\n\t\tfill: iconStyles.fill,\n\t} );\n\tconst accessibilityLabel = sprintf(\n\t\t/* translators: accessibility text for the media block empty state. %s: media type */\n\t\t__( '%s block. Empty' ),\n\t\tplaceholderTitle\n\t);\n\n\tconst renderContent = ( open ) => {\n\t\tif ( isAppender === undefined || ! isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<View style={ styles[ 'media-placeholder__header' ] }>\n\t\t\t\t\t\t<View style={ iconStyles }>{ placeholderIcon }</View>\n\t\t\t\t\t\t<Text style={ titleStyles }>{ placeholderTitle }</Text>\n\t\t\t\t\t</View>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tactiveOpacity={ 0.5 }\n\t\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\thitSlop={ hitSlop }\n\t\t\t\t\t\tonPress={ onButtonPress( open ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text style={ emptyStateDescriptionStyles }>\n\t\t\t\t\t\t\t{ sentenceCase( instructions ) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t</>\n\t\t\t);\n\t\t} else if ( isAppender && ! disableMediaButtons ) {\n\t\t\treturn (\n\t\t\t\t<TouchableOpacity\n\t\t\t\t\tactiveOpacity={ 0.5 }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\tstyle={ styles[ 'media-placeholder__appender' ] }\n\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\thitSlop={ hitSlop }\n\t\t\t\t\tonPress={ onButtonPress( open ) }\n\t\t\t\t>\n\t\t\t\t\t<View testID=\"media-placeholder-appender-icon\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ plusCircleFilled }\n\t\t\t\t\t\t\tstyle={ addMediaButtonStyle }\n\t\t\t\t\t\t\tcolor={ addMediaButtonStyle.color }\n\t\t\t\t\t\t\tsize={ addMediaButtonStyle.size }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableOpacity>\n\t\t\t);\n\t\t}\n\t};\n\n\tconst appenderStyle = usePreferredColorSchemeStyle(\n\t\tstyles.appender,\n\t\tstyles.appenderDark\n\t);\n\tconst containerSelectedStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__container-selected' ],\n\t\tstyles[ 'media-placeholder__container-selected--dark' ]\n\t);\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'media-placeholder__container' ],\n\t\t\tstyles[ 'media-placeholder__container--dark' ]\n\t\t),\n\t\tblockEditContext?.isSelected &&\n\t\t\t! className.includes( 'no-block-outline' ) &&\n\t\t\tcontainerSelectedStyle,\n\t];\n\n\tif ( isAppender && disableMediaButtons ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<View style={ { flex: 1 } }>\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tonSelect={ setMedia }\n\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t__experimentalOnlyMediaLibrary={\n\t\t\t\t\t__experimentalOnlyMediaLibrary\n\t\t\t\t}\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tisReplacingMedia={ false }\n\t\t\t\tautoOpen={ autoOpenMediaUpload }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tcontainerStyle,\n\t\t\t\t\t\t\t\t\theight && { height },\n\t\t\t\t\t\t\t\t\tbackgroundColor && { backgroundColor },\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tisAppender && appenderStyle,\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ getMediaOptions() }\n\t\t\t\t\t\t\t{ ! hideContent && renderContent( open ) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</View>\n\t);\n}\n\nexport default MediaPlaceholder;\n"]}
@@ -47,7 +47,7 @@ export default function PreviewOptions({
47
47
  menuProps: menuProps,
48
48
  icon: deviceIcons[deviceType.toLowerCase()],
49
49
  label: label || __('Preview')
50
- }, () => createElement(Fragment, null, createElement(MenuGroup, null, createElement(MenuItem, {
50
+ }, renderProps => createElement(Fragment, null, createElement(MenuGroup, null, createElement(MenuItem, {
51
51
  className: "block-editor-post-preview__button-resize",
52
52
  onClick: () => setDeviceType('Desktop'),
53
53
  icon: deviceType === 'Desktop' && check
@@ -59,6 +59,6 @@ export default function PreviewOptions({
59
59
  className: "block-editor-post-preview__button-resize",
60
60
  onClick: () => setDeviceType('Mobile'),
61
61
  icon: deviceType === 'Mobile' && check
62
- }, __('Mobile'))), children));
62
+ }, __('Mobile'))), children(renderProps)));
63
63
  }
64
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"names":["classnames","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","__","check","desktop","mobile","tablet","PreviewOptions","children","viewLabel","className","isEnabled","deviceType","setDeviceType","label","isMobile","popoverProps","placement","toggleProps","disabled","menuProps","deviceIcons","toLowerCase"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,YAAT,EAAuBC,SAAvB,EAAkCC,QAAlC,QAAkD,uBAAlD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,EAAgBC,OAAhB,EAAyBC,MAAzB,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U,KAAK,SAAf,IAA4BT;AAHpC,KAKGD,EAAE,CAAE,SAAF,CALL,CADD,EAQC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMW,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2BT;AAHnC,KAKGD,EAAE,CAAE,QAAF,CALL,CARD,EAeC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMW,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2BT;AAHnC,KAKGD,EAAE,CAAE,QAAF,CALL,CAfD,CADD,EAwBGM,QAxBH,CATF,CADD;AAuCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet } from '@wordpress/icons';\n\nexport default function PreviewOptions( {\n\tchildren,\n\tviewLabel,\n\tclassName,\n\tisEnabled = true,\n\tdeviceType,\n\tsetDeviceType,\n\tlabel,\n} ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( isMobile ) return null;\n\n\tconst popoverProps = {\n\t\tclassName: classnames(\n\t\t\tclassName,\n\t\t\t'block-editor-post-preview__dropdown-content'\n\t\t),\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'block-editor-post-preview__button-toggle',\n\t\tdisabled: ! isEnabled,\n\t\tchildren: viewLabel,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tmobile,\n\t\ttablet,\n\t\tdesktop,\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-post-preview__dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ label || __( 'Preview' ) }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ children }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"names":["classnames","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","__","check","desktop","mobile","tablet","PreviewOptions","children","viewLabel","className","isEnabled","deviceType","setDeviceType","label","isMobile","popoverProps","placement","toggleProps","disab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AAA,IAAI,EAAGC,WAAW,CAAET,UAAU,CAACU,WAAX,EAAF,CALnB;AAMC,IAAA,KAAK,EAAGR,KAAK,IAAIZ,EAAE,CAAE,SAAF;AANpB,KAQKqB,WAAF,IACD,8BACC,cAAC,SAAD,QACC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMV,aAAa,CAAE,SAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,SAAf,IAA4BT;AAHpC,KAKGD,EAAE,CAAE,SAAF,CALL,CADD,EAQC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMW,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2BT;AAHnC,KAKGD,EAAE,CAAE,QAAF,CALL,CARD,EAeC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMW,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2BT;AAHnC,KAKGD,EAAE,CAAE,QAAF,CALL,CAfD,CADD,EAwBGM,QAAQ,CAAEe,WAAF,CAxBX,CATF,CADD;AAuCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet } from '@wordpress/icons';\n\nexport default function PreviewOptions( {\n\tchildren,\n\tviewLabel,\n\tclassName,\n\tisEnabled = true,\n\tdeviceType,\n\tsetDeviceType,\n\tlabel,\n} ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( isMobile ) return null;\n\n\tconst popoverProps = {\n\t\tclassName: classnames(\n\t\t\tclassName,\n\t\t\t'block-editor-post-preview__dropdown-content'\n\t\t),\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'block-editor-post-preview__button-toggle',\n\t\tdisabled: ! isEnabled,\n\t\tchildren: viewLabel,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tmobile,\n\t\ttablet,\n\t\tdesktop,\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-post-preview__dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ label || __( 'Preview' ) }\n\t\t>\n\t\t\t{ ( renderProps ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ children( renderProps ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { RawHTML } from '@wordpress/element';
7
- import { children as childrenSource, getSaveElement, __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';
7
+ import { children as childrenSource } from '@wordpress/blocks';
8
8
  import deprecated from '@wordpress/deprecated';
9
9
  /**
10
10
  * Internal dependencies
@@ -47,39 +47,4 @@ export const Content = ({
47
47
 
48
48
  return content;
49
49
  };
50
- Content.__unstableIsRichTextContent = {};
51
-
52
- function findContent(blocks, richTextValues = []) {
53
- if (!Array.isArray(blocks)) {
54
- blocks = [blocks];
55
- }
56
-
57
- for (const block of blocks) {
58
- if (block?.type?.__unstableIsRichTextContent === Content.__unstableIsRichTextContent) {
59
- richTextValues.push(block.props.value);
60
- continue;
61
- }
62
-
63
- if (block?.props?.children) {
64
- findContent(block.props.children, richTextValues);
65
- }
66
- }
67
-
68
- return richTextValues;
69
- }
70
-
71
- function _getSaveElement({
72
- name,
73
- attributes,
74
- innerBlocks
75
- }) {
76
- return getSaveElement(name, attributes, innerBlocks.map(_getSaveElement));
77
- }
78
-
79
- export function getRichTextValues(blocks = []) {
80
- getBlockProps.skipFilters = true;
81
- const values = findContent((Array.isArray(blocks) ? blocks : [blocks]).map(_getSaveElement));
82
- getBlockProps.skipFilters = false;
83
- return values;
84
- }
85
50
  //# sourceMappingURL=content.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/content.js"],"names":["RawHTML","children","childrenSource","getSaveElement","__unstableGetBlockProps","getBlockProps","deprecated","getMultilineTag","Content","value","tagName","Tag","multiline","props","Array","isArray","since","version","alternative","link","toHTML","MultilineTag","content","format","restProps","__unstableIsRichTextContent","findContent","blocks","richTextValues","block","type","push","_getSaveElement","name","attributes","innerBlocks","map","getRichTextValues","skipFilters","values"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SACCC,QAAQ,IAAIC,cADb,EAECC,cAFD,EAGCC,uBAAuB,IAAIC,aAH5B,QAIO,mBAJP;AAKA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AAEA,OAAO,MAAMC,OAAO,GAAG,CAAE;AAAEC,EAAAA,KAAF;AAASC,EAAAA,OAAO,EAAEC,GAAlB;AAAuBC,EAAAA,SAAvB;AAAkC,KAAGC;AAArC,CAAF,KAAoD;AAC1E;AACA,MAAKC,KAAK,CAACC,OAAN,CAAeN,KAAf,CAAL,EAA8B;AAC7BH,IAAAA,UAAU,CAAE,qDAAF,EAAyD;AAClEU,MAAAA,KAAK,EAAE,KAD2D;AAElEC,MAAAA,OAAO,EAAE,KAFyD;AAGlEC,MAAAA,WAAW,EAAE,sBAHqD;AAIlEC,MAAAA,IAAI,EAAE;AAJ4D,KAAzD,CAAV;AAOAV,IAAAA,KAAK,GAAGP,cAAc,CAACkB,MAAf,CAAuBX,KAAvB,CAAR;AACA;;AAED,QAAMY,YAAY,GAAGd,eAAe,CAAEK,SAAF,CAApC;;AAEA,MAAK,CAAEH,KAAF,IAAWY,YAAhB,EAA+B;AAC9BZ,IAAAA,KAAK,GAAI,IAAIY,YAAc,MAAMA,YAAc,GAA/C;AACA;;AAED,QAAMC,OAAO,GAAG,cAAC,OAAD,QAAWb,KAAX,CAAhB;;AAEA,MAAKE,GAAL,EAAW;AACV,UAAM;AAAEY,MAAAA,MAAF;AAAU,SAAGC;AAAb,QAA2BX,KAAjC;AACA,WAAO,cAAC,GAAD,OAAUW;AAAV,OAAwBF,OAAxB,CAAP;AACA;;AAED,SAAOA,OAAP;AACA,CA3BM;AA6BPd,OAAO,CAACiB,2BAAR,GAAsC,EAAtC;;AAEA,SAASC,WAAT,CAAsBC,MAAtB,EAA8BC,cAAc,GAAG,EAA/C,EAAoD;AACnD,MAAK,CAAEd,KAAK,CAACC,OAAN,CAAeY,MAAf,CAAP,EAAiC;AAChCA,IAAAA,MAAM,GAAG,CAAEA,MAAF,CAAT;AACA;;AAED,OAAM,MAAME,KAAZ,IAAqBF,MAArB,EAA8B;AAC7B,QACCE,KAAK,EAAEC,IAAP,EAAaL,2BAAb,KACAjB,OAAO,CAACiB,2BAFT,EAGE;AACDG,MAAAA,cAAc,CAACG,IAAf,CAAqBF,KAAK,CAAChB,KAAN,CAAYJ,KAAjC;AACA;AACA;;AAED,QAAKoB,KAAK,EAAEhB,KAAP,EAAcZ,QAAnB,EAA8B;AAC7ByB,MAAAA,WAAW,CAAEG,KAAK,CAAChB,KAAN,CAAYZ,QAAd,EAAwB2B,cAAxB,CAAX;AACA;AACD;;AAED,SAAOA,cAAP;AACA;;AAED,SAASI,eAAT,CAA0B;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,UAAR;AAAoBC,EAAAA;AAApB,CAA1B,EAA8D;AAC7D,SAAOhC,cAAc,CACpB8B,IADoB,EAEpBC,UAFoB,EAGpBC,WAAW,CAACC,GAAZ,CAAiBJ,eAAjB,CAHoB,CAArB;AAKA;;AAED,OAAO,SAASK,iBAAT,CAA4BV,MAAM,GAAG,EAArC,EAA0C;AAChDtB,EAAAA,aAAa,CAACiC,WAAd,GAA4B,IAA5B;AACA,QAAMC,MAAM,GAAGb,WAAW,CACzB,CAAEZ,KAAK,CAACC,OAAN,CAAeY,MAAf,IAA0BA,MAA1B,GAAmC,CAAEA,MAAF,CAArC,EAAkDS,GAAlD,CAAuDJ,eAAvD,CADyB,CAA1B;AAGA3B,EAAAA,aAAa,CAACiC,WAAd,GAA4B,KAA5B;AACA,SAAOC,MAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\nimport {\n\tchildren as childrenSource,\n\tgetSaveElement,\n\t__unstableGetBlockProps as getBlockProps,\n} from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { getMultilineTag } from './utils';\n\nexport const Content = ( { value, tagName: Tag, multiline, ...props } ) => {\n\t// Handle deprecated `children` and `node` sources.\n\tif ( Array.isArray( value ) ) {\n\t\tdeprecated( 'wp.blockEditor.RichText value prop as children type', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: 'value prop as string',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',\n\t\t} );\n\n\t\tvalue = childrenSource.toHTML( value );\n\t}\n\n\tconst MultilineTag = getMultilineTag( multiline );\n\n\tif ( ! value && MultilineTag ) {\n\t\tvalue = `<${ MultilineTag }></${ MultilineTag }>`;\n\t}\n\n\tconst content = <RawHTML>{ value }</RawHTML>;\n\n\tif ( Tag ) {\n\t\tconst { format, ...restProps } = props;\n\t\treturn <Tag { ...restProps }>{ content }</Tag>;\n\t}\n\n\treturn content;\n};\n\nContent.__unstableIsRichTextContent = {};\n\nfunction findContent( blocks, richTextValues = [] ) {\n\tif ( ! Array.isArray( blocks ) ) {\n\t\tblocks = [ blocks ];\n\t}\n\n\tfor ( const block of blocks ) {\n\t\tif (\n\t\t\tblock?.type?.__unstableIsRichTextContent ===\n\t\t\tContent.__unstableIsRichTextContent\n\t\t) {\n\t\t\trichTextValues.push( block.props.value );\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( block?.props?.children ) {\n\t\t\tfindContent( block.props.children, richTextValues );\n\t\t}\n\t}\n\n\treturn richTextValues;\n}\n\nfunction _getSaveElement( { name, attributes, innerBlocks } ) {\n\treturn getSaveElement(\n\t\tname,\n\t\tattributes,\n\t\tinnerBlocks.map( _getSaveElement )\n\t);\n}\n\nexport function getRichTextValues( blocks = [] ) {\n\tgetBlockProps.skipFilters = true;\n\tconst values = findContent(\n\t\t( Array.isArray( blocks ) ? blocks : [ blocks ] ).map( _getSaveElement )\n\t);\n\tgetBlockProps.skipFilters = false;\n\treturn values;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/content.js"],"names":["RawHTML","children","childrenSource","deprecated","getMultilineTag","Content","value","tagName","Tag","multiline","props","Array","isArray","since","version","alternative","link","toHTML","MultilineTag","content","format","restProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,QAAQ,IAAIC,cAArB,QAA2C,mBAA3C;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AAEA,OAAO,MAAMC,OAAO,GAAG,CAAE;AAAEC,EAAAA,KAAF;AAASC,EAAAA,OAAO,EAAEC,GAAlB;AAAuBC,EAAAA,SAAvB;AAAkC,KAAGC;AAArC,CAAF,KAAoD;AAC1E;AACA,MAAKC,KAAK,CAACC,OAAN,CAAeN,KAAf,CAAL,EAA8B;AAC7BH,IAAAA,UAAU,CAAE,qDAAF,EAAyD;AAClEU,MAAAA,KAAK,EAAE,KAD2D;AAElEC,MAAAA,OAAO,EAAE,KAFyD;AAGlEC,MAAAA,WAAW,EAAE,sBAHqD;AAIlEC,MAAAA,IAAI,EAAE;AAJ4D,KAAzD,CAAV;AAOAV,IAAAA,KAAK,GAAGJ,cAAc,CAACe,MAAf,CAAuBX,KAAvB,CAAR;AACA;;AAED,QAAMY,YAAY,GAAGd,eAAe,CAAEK,SAAF,CAApC;;AAEA,MAAK,CAAEH,KAAF,IAAWY,YAAhB,EAA+B;AAC9BZ,IAAAA,KAAK,GAAI,IAAIY,YAAc,MAAMA,YAAc,GAA/C;AACA;;AAED,QAAMC,OAAO,GAAG,cAAC,OAAD,QAAWb,KAAX,CAAhB;;AAEA,MAAKE,GAAL,EAAW;AACV,UAAM;AAAEY,MAAAA,MAAF;AAAU,SAAGC;AAAb,QAA2BX,KAAjC;AACA,WAAO,cAAC,GAAD,OAAUW;AAAV,OAAwBF,OAAxB,CAAP;AACA;;AAED,SAAOA,OAAP;AACA,CA3BM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\nimport { children as childrenSource } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { getMultilineTag } from './utils';\n\nexport const Content = ( { value, tagName: Tag, multiline, ...props } ) => {\n\t// Handle deprecated `children` and `node` sources.\n\tif ( Array.isArray( value ) ) {\n\t\tdeprecated( 'wp.blockEditor.RichText value prop as children type', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: 'value prop as string',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',\n\t\t} );\n\n\t\tvalue = childrenSource.toHTML( value );\n\t}\n\n\tconst MultilineTag = getMultilineTag( multiline );\n\n\tif ( ! value && MultilineTag ) {\n\t\tvalue = `<${ MultilineTag }></${ MultilineTag }>`;\n\t}\n\n\tconst content = <RawHTML>{ value }</RawHTML>;\n\n\tif ( Tag ) {\n\t\tconst { format, ...restProps } = props;\n\t\treturn <Tag { ...restProps }>{ content }</Tag>;\n\t}\n\n\treturn content;\n};\n"]}