@wordpress/block-library 6.0.9 → 6.0.13

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 (208) hide show
  1. package/build/cover/edit.js +9 -3
  2. package/build/cover/edit.js.map +1 -1
  3. package/build/gallery/deprecated.js +314 -26
  4. package/build/gallery/deprecated.js.map +1 -1
  5. package/build/gallery/edit-wrapper.js +10 -27
  6. package/build/gallery/edit-wrapper.js.map +1 -1
  7. package/build/gallery/edit.js +11 -13
  8. package/build/gallery/edit.js.map +1 -1
  9. package/build/gallery/save.js +3 -3
  10. package/build/gallery/save.js.map +1 -1
  11. package/build/gallery/shared.js +24 -0
  12. package/build/gallery/shared.js.map +1 -1
  13. package/build/gallery/transforms.js +8 -22
  14. package/build/gallery/transforms.js.map +1 -1
  15. package/build/gallery/use-mobile-warning.js +1 -1
  16. package/build/gallery/use-mobile-warning.js.map +1 -1
  17. package/build/gallery/v1/edit.js +2 -21
  18. package/build/gallery/v1/edit.js.map +1 -1
  19. package/build/index.js +3 -2
  20. package/build/index.js.map +1 -1
  21. package/build/navigation/deprecated.js +127 -19
  22. package/build/navigation/deprecated.js.map +1 -1
  23. package/build/navigation/edit/index.js +46 -31
  24. package/build/navigation/edit/index.js.map +1 -1
  25. package/build/navigation/edit/inner-blocks.js +0 -4
  26. package/build/navigation/edit/inner-blocks.js.map +1 -1
  27. package/build/navigation/edit/navigation-menu-selector.js +2 -2
  28. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  29. package/build/navigation/edit/placeholder/index.js +16 -48
  30. package/build/navigation/edit/placeholder/index.js.map +1 -1
  31. package/build/navigation/edit/unsaved-inner-blocks.js +4 -35
  32. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  33. package/build/navigation/edit/use-create-navigation-menu.js +50 -0
  34. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -0
  35. package/build/navigation/edit/use-generate-default-navigation-title.js +73 -0
  36. package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  37. package/build/navigation/index.js +1 -1
  38. package/build/navigation/save.js +2 -2
  39. package/build/navigation/save.js.map +1 -1
  40. package/build/navigation/use-navigation-menu.js +19 -8
  41. package/build/navigation/use-navigation-menu.js.map +1 -1
  42. package/build/navigation-submenu/edit.js +4 -0
  43. package/build/navigation-submenu/edit.js.map +1 -1
  44. package/build/pattern/index.js +1 -1
  45. package/build/post-featured-image/edit.js +2 -3
  46. package/build/post-featured-image/edit.js.map +1 -1
  47. package/build/post-terms/index.js +1 -1
  48. package/build/post-title/edit.js +2 -2
  49. package/build/post-title/edit.js.map +1 -1
  50. package/build/query-pagination/index.js +1 -1
  51. package/build/query-pagination-next/index.js +2 -2
  52. package/build/query-pagination-numbers/index.js +1 -1
  53. package/build/query-pagination-previous/index.js +2 -2
  54. package/build/query-title/index.js +1 -1
  55. package/build/separator/separator-settings.js +1 -0
  56. package/build/separator/separator-settings.js.map +1 -1
  57. package/build/site-logo/index.js +1 -1
  58. package/build/site-tagline/index.js +1 -1
  59. package/build/site-title/index.js +1 -1
  60. package/build/social-links/edit.js +1 -0
  61. package/build/social-links/edit.js.map +1 -1
  62. package/build/template-part/edit/placeholder/index.js +1 -1
  63. package/build/template-part/edit/placeholder/index.js.map +1 -1
  64. package/build/template-part/index.js +2 -1
  65. package/build/template-part/index.js.map +1 -1
  66. package/build-module/cover/edit.js +9 -3
  67. package/build-module/cover/edit.js.map +1 -1
  68. package/build-module/gallery/deprecated.js +309 -27
  69. package/build-module/gallery/deprecated.js.map +1 -1
  70. package/build-module/gallery/edit-wrapper.js +7 -27
  71. package/build-module/gallery/edit-wrapper.js.map +1 -1
  72. package/build-module/gallery/edit.js +11 -13
  73. package/build-module/gallery/edit.js.map +1 -1
  74. package/build-module/gallery/save.js +2 -3
  75. package/build-module/gallery/save.js.map +1 -1
  76. package/build-module/gallery/shared.js +22 -0
  77. package/build-module/gallery/shared.js.map +1 -1
  78. package/build-module/gallery/transforms.js +9 -21
  79. package/build-module/gallery/transforms.js.map +1 -1
  80. package/build-module/gallery/use-mobile-warning.js +1 -1
  81. package/build-module/gallery/use-mobile-warning.js.map +1 -1
  82. package/build-module/gallery/v1/edit.js +4 -22
  83. package/build-module/gallery/v1/edit.js.map +1 -1
  84. package/build-module/index.js +3 -2
  85. package/build-module/index.js.map +1 -1
  86. package/build-module/navigation/deprecated.js +127 -19
  87. package/build-module/navigation/deprecated.js.map +1 -1
  88. package/build-module/navigation/edit/index.js +47 -31
  89. package/build-module/navigation/edit/index.js.map +1 -1
  90. package/build-module/navigation/edit/inner-blocks.js +0 -4
  91. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  92. package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
  93. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  94. package/build-module/navigation/edit/placeholder/index.js +15 -45
  95. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  96. package/build-module/navigation/edit/unsaved-inner-blocks.js +6 -35
  97. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  98. package/build-module/navigation/edit/use-create-navigation-menu.js +36 -0
  99. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -0
  100. package/build-module/navigation/edit/use-generate-default-navigation-title.js +57 -0
  101. package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  102. package/build-module/navigation/index.js +1 -1
  103. package/build-module/navigation/save.js +2 -2
  104. package/build-module/navigation/save.js.map +1 -1
  105. package/build-module/navigation/use-navigation-menu.js +19 -8
  106. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  107. package/build-module/navigation-submenu/edit.js +4 -0
  108. package/build-module/navigation-submenu/edit.js.map +1 -1
  109. package/build-module/pattern/index.js +1 -1
  110. package/build-module/post-featured-image/edit.js +2 -3
  111. package/build-module/post-featured-image/edit.js.map +1 -1
  112. package/build-module/post-terms/index.js +1 -1
  113. package/build-module/post-title/edit.js +2 -2
  114. package/build-module/post-title/edit.js.map +1 -1
  115. package/build-module/query-pagination/index.js +1 -1
  116. package/build-module/query-pagination-next/index.js +2 -2
  117. package/build-module/query-pagination-numbers/index.js +1 -1
  118. package/build-module/query-pagination-previous/index.js +2 -2
  119. package/build-module/query-title/index.js +1 -1
  120. package/build-module/separator/separator-settings.js +1 -0
  121. package/build-module/separator/separator-settings.js.map +1 -1
  122. package/build-module/site-logo/index.js +1 -1
  123. package/build-module/site-tagline/index.js +1 -1
  124. package/build-module/site-title/index.js +1 -1
  125. package/build-module/social-links/edit.js +1 -0
  126. package/build-module/social-links/edit.js.map +1 -1
  127. package/build-module/template-part/edit/placeholder/index.js +2 -2
  128. package/build-module/template-part/edit/placeholder/index.js.map +1 -1
  129. package/build-module/template-part/index.js +2 -1
  130. package/build-module/template-part/index.js.map +1 -1
  131. package/build-style/columns/editor-rtl.css +1 -1
  132. package/build-style/columns/editor.css +1 -1
  133. package/build-style/editor-rtl.css +6 -5
  134. package/build-style/editor.css +6 -5
  135. package/build-style/gallery/editor-rtl.css +1 -0
  136. package/build-style/gallery/editor.css +1 -0
  137. package/build-style/navigation/style-rtl.css +5 -1
  138. package/build-style/navigation/style.css +5 -1
  139. package/build-style/post-featured-image/editor-rtl.css +2 -2
  140. package/build-style/post-featured-image/editor.css +2 -2
  141. package/build-style/site-logo/editor-rtl.css +2 -2
  142. package/build-style/site-logo/editor.css +2 -2
  143. package/build-style/style-rtl.css +5 -1
  144. package/build-style/style.css +5 -1
  145. package/package.json +9 -9
  146. package/src/calendar/index.php +2 -2
  147. package/src/columns/editor.scss +3 -2
  148. package/src/cover/edit.js +9 -1
  149. package/src/gallery/deprecated.js +831 -559
  150. package/src/gallery/edit-wrapper.js +7 -27
  151. package/src/gallery/edit.js +11 -13
  152. package/src/gallery/editor.scss +1 -0
  153. package/src/gallery/save.js +2 -1
  154. package/src/gallery/shared.js +24 -0
  155. package/src/gallery/transforms.js +9 -27
  156. package/src/gallery/use-mobile-warning.js +1 -1
  157. package/src/gallery/v1/edit.js +1 -28
  158. package/src/index.js +27 -25
  159. package/src/navigation/block.json +1 -1
  160. package/src/navigation/deprecated.js +115 -13
  161. package/src/navigation/edit/index.js +44 -36
  162. package/src/navigation/edit/inner-blocks.js +0 -5
  163. package/src/navigation/edit/navigation-menu-selector.js +2 -2
  164. package/src/navigation/edit/placeholder/index.js +16 -62
  165. package/src/navigation/edit/unsaved-inner-blocks.js +6 -57
  166. package/src/navigation/edit/use-create-navigation-menu.js +39 -0
  167. package/src/navigation/edit/use-generate-default-navigation-title.js +79 -0
  168. package/src/navigation/index.php +263 -26
  169. package/src/navigation/save.js +2 -2
  170. package/src/navigation/style.scss +5 -1
  171. package/src/navigation/use-navigation-menu.js +20 -9
  172. package/src/navigation-submenu/edit.js +6 -0
  173. package/src/navigation-submenu/index.php +30 -45
  174. package/src/page-list/index.php +10 -9
  175. package/src/pattern/block.json +1 -1
  176. package/src/post-featured-image/edit.js +2 -5
  177. package/src/post-featured-image/editor.scss +2 -2
  178. package/src/post-terms/block.json +1 -1
  179. package/src/post-title/edit.js +2 -2
  180. package/src/query-pagination/block.json +1 -1
  181. package/src/query-pagination-next/block.json +2 -2
  182. package/src/query-pagination-numbers/block.json +1 -1
  183. package/src/query-pagination-previous/block.json +2 -2
  184. package/src/query-title/block.json +1 -1
  185. package/src/separator/separator-settings.js +1 -0
  186. package/src/site-logo/block.json +1 -1
  187. package/src/site-logo/editor.scss +2 -2
  188. package/src/site-tagline/block.json +1 -1
  189. package/src/site-title/block.json +1 -1
  190. package/src/social-links/edit.js +1 -0
  191. package/src/template-part/block.json +2 -1
  192. package/src/template-part/edit/placeholder/index.js +2 -2
  193. package/src/template-part/index.php +38 -1
  194. package/build/gallery/v1/update-gallery-modal.js +0 -114
  195. package/build/gallery/v1/update-gallery-modal.js.map +0 -1
  196. package/build/navigation/edit/navigation-menu-name-modal.js +0 -55
  197. package/build/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  198. package/build/navigation/edit/navigation-menu-publish-button.js +0 -53
  199. package/build/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  200. package/build-module/gallery/v1/update-gallery-modal.js +0 -97
  201. package/build-module/gallery/v1/update-gallery-modal.js.map +0 -1
  202. package/build-module/navigation/edit/navigation-menu-name-modal.js +0 -47
  203. package/build-module/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  204. package/build-module/navigation/edit/navigation-menu-publish-button.js +0 -40
  205. package/build-module/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  206. package/src/gallery/v1/update-gallery-modal.js +0 -97
  207. package/src/navigation/edit/navigation-menu-name-modal.js +0 -69
  208. package/src/navigation/edit/navigation-menu-publish-button.js +0 -57
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["classnames","escape","pull","useSelect","useDispatch","PanelBody","Popover","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","sprintf","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","__experimentalLinkControl","LinkControl","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","safeDecodeURI","Fragment","useState","useEffect","useRef","createInterpolateElement","placeCaretAtHorizontalEdge","link","linkIcon","coreStore","speak","ItemSubmenuIcon","ALLOWED_BLOCKS","DEFAULT_BLOCK","MAX_NESTING","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getSuggestionsQuery","type","kind","subtype","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","updateNavigationLinkBlockAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","originalKind","originalType","title","url","opensInNewTab","id","newKind","newType","normalizedTitle","replace","normalizedURL","escapeTitle","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger","NavigationSubmenuEdit","attributes","isSelected","mergeBlocks","onReplace","clientId","description","rel","showSubmenuIcon","openSubmenusOnClick","saveEntityRecord","__unstableMarkNextChangeAsNotPersistent","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasDescendants","selectedBlockHasDescendants","userCanCreatePages","userCanCreatePosts","select","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","selectedBlockId","descendants","length","name","canUser","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","primary","blockProps","className","innerBlocksColors","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","renderAppender","DefaultAppender","ParentElement","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,SADD,EAECC,OAFD,EAGCC,WAHD,EAICC,eAJD,EAKCC,aALD,EAMCC,YAND,QAOO,uBAPP;AAQA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,qBAAjD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,aADD,EAECC,WAFD,EAGCC,mBAHD,EAICC,iBAJD,EAKCC,QALD,EAMCC,yBAAyB,IAAIC,WAN9B,EAOCC,aAPD,EAQCC,KAAK,IAAIC,gBARV,EASCC,iBATD,QAUO,yBAVP;AAWA,SAASC,KAAT,EAAgBC,WAAhB,EAA6BC,aAA7B,QAAkD,gBAAlD;AACA,SACCC,QADD,EAECC,QAFD,EAGCC,SAHD,EAICC,MAJD,EAKCC,wBALD,QAMO,oBANP;AAOA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names from 'classnames';\nimport { escape, pull } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalLinkControl as LinkControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport {\n\tFragment,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation-link', 'core/navigation-submenu' ];\n\nconst DEFAULT_BLOCK = [ 'core/navigation-link' ];\n\nconst MAX_NESTING = 5;\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nfunction getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {};\n\t}\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\nexport const updateNavigationLinkBlockAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\tconst {\n\t\ttitle = '',\n\t\turl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\tconst normalizedTitle = title.replace( /http(s?):\\/\\//gi, '' );\n\tconst normalizedURL = url.replace( /http(s?):\\/\\//gi, '' );\n\tconst escapeTitle =\n\t\ttitle !== '' &&\n\t\tnormalizedTitle !== normalizedURL &&\n\t\toriginalLabel !== title;\n\tconst label = escapeTitle\n\t\t? escape( title )\n\t\t: originalLabel || escape( normalizedURL );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( url && { url: encodeURI( safeDecodeURI( url ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\ttype,\n\t\topensInNewTab,\n\t\turl,\n\t\tdescription,\n\t\trel,\n\t\ttitle,\n\t\tkind,\n\t} = attributes;\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t};\n\tconst { showSubmenuIcon, openSubmenusOnClick } = context;\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tselectedBlockHasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst descendants = getClientIdsOfDescendants( [ clientId ] )\n\t\t\t\t.length;\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tMAX_NESTING,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasDescendants: !! descendants,\n\t\t\t\tselectedBlockHasDescendants: !! getClientIdsOfDescendants( [\n\t\t\t\t\tselectedBlockId,\n\t\t\t\t] )?.length,\n\t\t\t\tuserCanCreatePages: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'pages'\n\t\t\t\t),\n\t\t\t\tuserCanCreatePosts: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'posts'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = userCanCreatePages;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = userCanCreatePosts;\n\t}\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: listItemRef,\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasDescendants,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t) ]: !! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus\n\tconst innerBlocksColors = getColors( context, true );\n\n\tif ( isAtMaxNesting ) {\n\t\tpull( ALLOWED_BLOCKS, 'core/navigation-submenu' );\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t\t'is-parent-of-selected-block': isParentOfSelectedBlock,\n\t\t\t\t'has-text-color': !! (\n\t\t\t\t\tinnerBlocksColors.textColor ||\n\t\t\t\t\tinnerBlocksColors.customTextColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]: !! innerBlocksColors.textColor,\n\t\t\t\t'has-background': !! (\n\t\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]: !! innerBlocksColors.backgroundColor,\n\t\t\t} ),\n\t\t\tstyle: {\n\t\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: true,\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasDescendants ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\thasDescendants\n\t\t\t\t\t? InnerBlocks.DefaultAppender\n\t\t\t\t\t: false,\n\t\t}\n\t);\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchorRef={ listItemRef.current }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\t\tshowInitialSuggestions={ true }\n\t\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\t\tlet format;\n\t\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t\t{ mark: <mark /> }\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( updatedValue ) =>\n\t\t\t\t\t\t\t\t\tupdateNavigationLinkBlockAttributes(\n\t\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["classnames","escape","pull","useSelect","useDispatch","PanelBody","Popover","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","sprintf","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","__experimentalLinkControl","LinkControl","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","safeDecodeURI","Fragment","useState","useEffect","useRef","createInterpolateElement","placeCaretAtHorizontalEdge","link","linkIcon","coreStore","speak","ItemSubmenuIcon","ALLOWED_BLOCKS","DEFAULT_BLOCK","MAX_NESTING","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getSuggestionsQuery","type","kind","subtype","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","updateNavigationLinkBlockAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","originalKind","originalType","title","url","opensInNewTab","id","newKind","newType","normalizedTitle","replace","normalizedURL","escapeTitle","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger","NavigationSubmenuEdit","attributes","isSelected","mergeBlocks","onReplace","clientId","description","rel","showSubmenuIcon","openSubmenusOnClick","saveEntityRecord","__unstableMarkNextChangeAsNotPersistent","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasDescendants","selectedBlockHasDescendants","userCanCreatePages","userCanCreatePosts","select","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","selectedBlockId","descendants","length","name","canUser","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","primary","blockProps","className","innerBlocksColors","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","__experimentalCaptureToolbars","renderAppender","DefaultAppender","ParentElement","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,SADD,EAECC,OA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IADqC,EAErCC,IAFqC,CA1BvC;AA8BC,IAAA,QAAQ,EAAKmB,YAAF,IACVD,mCAAmC,CAClCC,YADkC,EAElCC,aAFkC,EAGlCwB,UAHkC,CA/BrC;AAqCC,IAAA,QAAQ,EAAG,MAAM;AAChBxB,MAAAA,aAAa,CAAE;AAAEO,QAAAA,GAAG,EAAE;AAAP,OAAF,CAAb;AACAhD,MAAAA,KAAK,CAAEzB,EAAE,CAAE,eAAF,CAAJ,EAAyB,WAAzB,CAAL;AACA;AAxCF,IALD,CA9BF,EA+EG,CAAEiG,eAAe,IAAIC,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,eAAD,OADD,CAhFF,CAFD,EAuFC,qBAAUiD,gBAAV,CAvFD,CA9CD,CADD;AA0IA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { escape, pull } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalLinkControl as LinkControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport {\n\tFragment,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation-link', 'core/navigation-submenu' ];\n\nconst DEFAULT_BLOCK = [ 'core/navigation-link' ];\n\nconst MAX_NESTING = 5;\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nfunction getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {};\n\t}\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\nexport const updateNavigationLinkBlockAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\tconst {\n\t\ttitle = '',\n\t\turl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\tconst normalizedTitle = title.replace( /http(s?):\\/\\//gi, '' );\n\tconst normalizedURL = url.replace( /http(s?):\\/\\//gi, '' );\n\tconst escapeTitle =\n\t\ttitle !== '' &&\n\t\tnormalizedTitle !== normalizedURL &&\n\t\toriginalLabel !== title;\n\tconst label = escapeTitle\n\t\t? escape( title )\n\t\t: originalLabel || escape( normalizedURL );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( url && { url: encodeURI( safeDecodeURI( url ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\ttype,\n\t\topensInNewTab,\n\t\turl,\n\t\tdescription,\n\t\trel,\n\t\ttitle,\n\t\tkind,\n\t} = attributes;\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t};\n\tconst { showSubmenuIcon, openSubmenusOnClick } = context;\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tselectedBlockHasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst descendants = getClientIdsOfDescendants( [ clientId ] )\n\t\t\t\t.length;\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tMAX_NESTING,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasDescendants: !! descendants,\n\t\t\t\tselectedBlockHasDescendants: !! getClientIdsOfDescendants( [\n\t\t\t\t\tselectedBlockId,\n\t\t\t\t] )?.length,\n\t\t\t\tuserCanCreatePages: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'pages'\n\t\t\t\t),\n\t\t\t\tuserCanCreatePosts: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'posts'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = userCanCreatePages;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = userCanCreatePosts;\n\t}\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: listItemRef,\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasDescendants,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t) ]: !! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus\n\tconst innerBlocksColors = getColors( context, true );\n\n\tif ( isAtMaxNesting ) {\n\t\tpull( ALLOWED_BLOCKS, 'core/navigation-submenu' );\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t\t'is-parent-of-selected-block': isParentOfSelectedBlock,\n\t\t\t\t'has-text-color': !! (\n\t\t\t\t\tinnerBlocksColors.textColor ||\n\t\t\t\t\tinnerBlocksColors.customTextColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]: !! innerBlocksColors.textColor,\n\t\t\t\t'has-background': !! (\n\t\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]: !! innerBlocksColors.backgroundColor,\n\t\t\t} ),\n\t\t\tstyle: {\n\t\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: true,\n\n\t\t\t// Ensure block toolbar is not too far removed from item\n\t\t\t// being edited.\n\t\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t\t__experimentalCaptureToolbars: true,\n\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasDescendants ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\thasDescendants\n\t\t\t\t\t? InnerBlocks.DefaultAppender\n\t\t\t\t\t: false,\n\t\t}\n\t);\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchorRef={ listItemRef.current }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\t\tshowInitialSuggestions={ true }\n\t\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\t\tlet format;\n\t\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t\t{ mark: <mark /> }\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( updatedValue ) =>\n\t\t\t\t\t\t\t\t\tupdateNavigationLinkBlockAttributes(\n\t\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
@@ -5,7 +5,7 @@ const metadata = {
5
5
  apiVersion: 2,
6
6
  name: "core/pattern",
7
7
  title: "Pattern",
8
- category: "design",
8
+ category: "theme",
9
9
  description: "Show a block pattern.",
10
10
  supports: {
11
11
  html: false,
@@ -21,11 +21,10 @@ const placeholderIllustration = createElement(SVG, {
21
21
  fill: "none",
22
22
  xmlns: "http://www.w3.org/2000/svg",
23
23
  viewBox: "0 0 60 60",
24
- preserveAspectRatio: "xMidYMid slice" // @todo: "slice" matches the "cover" behavior, "meet" could be used for "container" and "fill" values.
25
-
24
+ preserveAspectRatio: "none"
26
25
  }, createElement(Path, {
27
26
  vectorEffect: "non-scaling-stroke",
28
- d: "m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5"
27
+ d: "M60 60 0 0"
29
28
  }));
30
29
  const ALLOWED_MEDIA_TYPES = ['image'];
31
30
  const placeholderChip = createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["useEntityProp","store","coreStore","useSelect","useDispatch","ToggleControl","PanelBody","Placeholder","Button","InspectorControls","BlockControls","MediaPlaceholder","MediaReplaceFlow","useBlockProps","__","sprintf","upload","SVG","Path","noticesStore","DimensionControls","placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","getMedia","blockProps","style","placeholder","content","onSelectImage","value","id","createErrorNotice","onUploadError","message","type","image","label","open","source_url","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,KAAK,IAAIC,SAAjC,QAAkD,sBAAlD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,SAFD,EAGCC,WAHD,EAICC,MAJD,QAKO,uBALP;AAMA,SACCC,iBADD,EAECC,aAFD,EAGCC,gBAHD,EAICC,gBAJD,EAKCC,aALD,QAMO,yBANP;AAOA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,GAAT,EAAcC,IAAd,QAA0B,uBAA1B;AACA,SAASjB,KAAK,IAAIkB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;AAEA,MAAMC,uBAAuB,GAC5B,cAAC,GAAD;AACC,EAAA,SAAS,EAAC,sCADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,EAAA,KAAK,EAAC,4BAHP;AAIC,EAAA,OAAO,EAAC,WAJT;AAKC,EAAA,mBAAmB,EAAC,gBALrB,CAKsC;;AALtC,GAOC,cAAC,IAAD;AACC,EAAA,YAAY,EAAC,oBADd;AAEC,EAAA,CAAC,EAAC;AAFH,EAPD,CADD;AAeA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,MAAMC,eAAe,GACpB;AAAK,EAAA,SAAS,EAAC;AAAf,GACGF,uBADH,CADD;;AAMA,SAASG,wBAAT,OAII;AAAA,MAJ+B;AAClCC,IAAAA,UADkC;AAElCC,IAAAA,aAFkC;AAGlCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;AAApB;AAHyB,GAI/B;AACH,QAAMC,uBAAuB,GAAG,CAAC,CAAED,OAAnC;AACA,QAAM;AAAEE,I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EAAG,MAAMH,aAAa,CAAE;AAAEM,MAAAA,MAAM,EAAE,CAAEA;AAAZ,KAAF,CAN/B;AAOC,IAAA,OAAO,EAAGA;AAPX,IADD,CALD,CADD,EAkBG,CAAC,CAAEM,KAAH,IAAY,CAAEP,uBAAd,IACD,cAAC,aAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,cAAC,gBAAD;AACC,IAAA,OAAO,EAAGK,aADX;AAEC,IAAA,QAAQ,EAAGE,KAAK,CAACiB,UAFlB;AAGC,IAAA,YAAY,EAAGjC,mBAHhB;AAIC,IAAA,MAAM,EAAC,SAJR;AAKC,IAAA,QAAQ,EAAGuB,aALZ;AAMC,IAAA,OAAO,EAAGI;AANX,IADD,CAnBF,EA8BC,wBAAaR,UAAb,EAA4BW,KAA5B,CA9BD,CADD;AAkCA;;AAED,eAAe,SAASM,qBAAT,CAAgCC,KAAhC,EAAwC;AAAA;;AACtD,QAAMlB,UAAU,GAAG5B,aAAa,EAAhC;;AACA,MAAK,oBAAE8C,KAAK,CAAChC,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,qBAAUa,UAAV,EAAyBlB,eAAzB,CAAP;AACA;;AACD,SAAO,cAAC,wBAAD,EAA+BoC,KAA/B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst placeholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"xMidYMid slice\" // @todo: \"slice\" matches the \"cover\" behavior, \"meet\" could be used for \"container\" and \"fill\" values.\n\t>\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\td=\"m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5\"\n\t\t/>\n\t</SVG>\n);\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"wp-block-post-featured-image__placeholder\">\n\t\t{ placeholderIllustration }\n\t</div>\n);\n\nfunction PostFeaturedImageDisplay( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = !! queryId;\n\tconst { isLink, height, width, scale } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height },\n\t} );\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder className=\"block-editor-media-placeholder\">\n\t\t\t\t{ placeholderIllustration }\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\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);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ media.source_url }\n\t\t\t\talt={ media.alt_text || __( 'Featured image' ) }\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<DimensionControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ media.source_url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageDisplay { ...props } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["useEntityProp","store","coreStore","useSelect","useDispatch","ToggleControl","PanelBody","Placeholder","Button","InspectorControls","BlockControls","MediaPlaceholder","MediaReplaceFlow","useBlockProps","__","sprintf","upload","SVG","Path","noticesStore","DimensionControls","placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","getMedia","blockProps","style","placeholder","content","onSelectImage","value","id","createErrorNotice","onUploadError","message","type","image","label","open","source_url","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,KAAK,IAAIC,SAAjC,QAAkD,sBAAlD;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Y,CAAEP,uBAAd,IACD,cAAC,aAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,cAAC,gBAAD;AACC,IAAA,OAAO,EAAGK,aADX;AAEC,IAAA,QAAQ,EAAGE,KAAK,CAACiB,UAFlB;AAGC,IAAA,YAAY,EAAGjC,mBAHhB;AAIC,IAAA,MAAM,EAAC,SAJR;AAKC,IAAA,QAAQ,EAAGuB,aALZ;AAMC,IAAA,OAAO,EAAGI;AANX,IADD,CAnBF,EA8BC,wBAAaR,UAAb,EAA4BW,KAA5B,CA9BD,CADD;AAkCA;;AAED,eAAe,SAASM,qBAAT,CAAgCC,KAAhC,EAAwC;AAAA;;AACtD,QAAMlB,UAAU,GAAG5B,aAAa,EAAhC;;AACA,MAAK,oBAAE8C,KAAK,CAAChC,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,qBAAUa,UAAV,EAAyBlB,eAAzB,CAAP;AACA;;AACD,SAAO,cAAC,wBAAD,EAA+BoC,KAA/B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst placeholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"wp-block-post-featured-image__placeholder\">\n\t\t{ placeholderIllustration }\n\t</div>\n);\n\nfunction PostFeaturedImageDisplay( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = !! queryId;\n\tconst { isLink, height, width, scale } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height },\n\t} );\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder className=\"block-editor-media-placeholder\">\n\t\t\t\t{ placeholderIllustration }\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\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);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ media.source_url }\n\t\t\t\talt={ media.alt_text || __( 'Featured image' ) }\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<DimensionControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ media.source_url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageDisplay { ...props } />;\n}\n"]}
@@ -5,7 +5,7 @@ const metadata = {
5
5
  apiVersion: 2,
6
6
  name: "core/post-terms",
7
7
  title: "Post Terms",
8
- category: "design",
8
+ category: "theme",
9
9
  description: "Post terms.",
10
10
  textdomain: "default",
11
11
  attributes: {
@@ -57,7 +57,7 @@ export default function PostTitleEdit(_ref) {
57
57
  __experimentalVersion: 2
58
58
  }, blockProps)) : createElement(TagName, blockProps, createElement(RawHTML, {
59
59
  key: "html"
60
- }, fullTitle.rendered));
60
+ }, fullTitle === null || fullTitle === void 0 ? void 0 : fullTitle.rendered));
61
61
  }
62
62
 
63
63
  if (isLink && postType && postId) {
@@ -77,7 +77,7 @@ export default function PostTitleEdit(_ref) {
77
77
  onClick: event => event.preventDefault()
78
78
  }, createElement(RawHTML, {
79
79
  key: "html"
80
- }, fullTitle.rendered)));
80
+ }, fullTitle === null || fullTitle === void 0 ? void 0 : fullTitle.rendered)));
81
81
  }
82
82
 
83
83
  return createElement(Fragment, null, createElement(BlockControls, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-title/edit.js"],"names":["classnames","AlignmentControl","BlockControls","InspectorControls","useBlockProps","PlainText","RawHTML","ToggleControl","TextControl","PanelBody","__","useEntityProp","HeadingLevelDropdown","useCanEditEntity","PostTitleEdit","attributes","level","textAlign","isLink","rel","linkTarget","setAttributes","context","postType","postId","queryId","TagName","isDescendentOfQueryLoop","userCanEdit","rawTitle","setTitle","fullTitle","link","blockProps","className","titleElement","rendered","length","event","preventDefault","newLevel","nextAlign","value","newRel"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,iBAHD,EAICC,aAJD,EAKCC,SALD,QAMO,yBANP;AAOA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,aAAT,EAAwBC,WAAxB,EAAqCC,SAArC,QAAsD,uBAAtD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,mCAAjC;AACA,SAASC,gBAAT,QAAiC,gBAAjC;AAEA,eAAe,SAASC,aAAT,OAIX;AAAA,MAJmC;AACtCC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,SAAT;AAAoBC,MAAAA,MAApB;AAA4BC,MAAAA,GAA5B;AAAiCC,MAAAA;AAAjC,KAD0B;AAEtCC,IAAAA,aAFsC;AAGtCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,MAAZ;AAAoBC,MAAAA;AAApB;AAH6B,GAInC;AACH,QAAMC,OAAO,GAAG,MAAMV,KAAN,GAAc,GAAd,GAAoB,MAAMA,KAA1C;AACA,QAAMW,uBAAuB,GAAG,CAAC,CAAEF,OAAnC;AACA,QAAMG,WAAW,GAAGf,gBAAgB,CAAE,UAAF,EAAcU,QAAd,EAAwBC,MAAxB,CAApC;AACA,QAAM,CAAEK,QAAQ,GAAG,EAAb,EAAiBC,QAAjB,EAA2BC,SAA3B,IAAyCpB,aAAa,CAC3D,UAD2D,EAE3DY,QAF2D,EAG3D,OAH2D,EAI3DC,MAJ2D,CAA5D;AAMA,QAAM,CAAEQ,IAAF,IAAWrB,aAAa,C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,cAAC,WAAD;AACC,IAAA,KAAK,EAAGV,EAAE,CAAE,UAAF,CADX;AAEC,IAAA,KAAK,EAAGS,GAFT;AAGC,IAAA,QAAQ,EAAKwB,MAAF,IACVtB,aAAa,CAAE;AAAEF,MAAAA,GAAG,EAAEwB;AAAP,KAAF;AAJf,IAVD,CAPF,CADD,CAfD,EA4CGR,YA5CH,CADD;AAgDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n} from '@wordpress/block-editor';\nimport { RawHTML } from '@wordpress/element';\nimport { ToggleControl, TextControl, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, textAlign, isLink, rel, linkTarget },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n} ) {\n\tconst TagName = 0 === level ? 'p' : 'h' + level;\n\tconst isDescendentOfQueryLoop = !! queryId;\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tlet titleElement = (\n\t\t<TagName { ...blockProps }>{ __( 'Post Title' ) }</TagName>\n\t);\n\n\tif ( postType && postId ) {\n\t\ttitleElement =\n\t\t\tuserCanEdit && ! isDescendentOfQueryLoop ? (\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tplaceholder={ __( 'No Title' ) }\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<RawHTML key=\"html\">{ fullTitle.rendered }</RawHTML>\n\t\t\t\t</TagName>\n\t\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement =\n\t\t\tuserCanEdit && ! isDescendentOfQueryLoop ? (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<PlainText\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t! rawTitle.length ? __( 'No Title' ) : null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t/>\n\t\t\t\t</TagName>\n\t\t\t) : (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RawHTML key=\"html\">{ fullTitle.rendered }</RawHTML>\n\t\t\t\t\t</a>\n\t\t\t\t</TagName>\n\t\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\tselectedLevel={ level }\n\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ titleElement }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-title/edit.js"],"names":["classnames","AlignmentControl","BlockControls","InspectorControls","useBlockProps","PlainText","RawHTML","ToggleControl","TextControl","PanelBody","__","useEntityProp","HeadingLevelDropdown","useCanEditEntity","PostTitleEdit","attributes","level","textAlign","isLink","rel","linkTarget","setAttributes","context","postType","postId","queryId","TagName","isDescendentOfQueryLoop","userCanEdit","rawTitle","setTitle","fullTitle","link","blockProps","className","titleElement","rendered","length","event","preventDefault","newLevel","nextAlign","value","newRel"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,iBAHD,EAICC,aAJD,EAKCC,SALD,QAMO,yBANP;AAOA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,aAAT,EAAwBC,WAAxB,EAAqCC,SAArC,QAAsD,uBAAtD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,mCAAjC;AACA,SAASC,gBAAT,QAAiC,gBAAjC;AAEA,eAAe,SAASC,aAAT,OAIX;AAAA,MAJmC;AACtCC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,SAAT;AAAoBC,MAAAA,MAApB;AAA4BC,MAAAA,GAA5B;AAAiCC,MAAAA;AAAjC,KAD0B;AAEtCC,IAAAA,aAFsC;AAGtCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,MAAZ;AAAoBC,MAAAA;AAApB;AAH6B,GAInC;AACH,QAAMC,OAAO,GAAG,MAAMV,KAAN,GAAc,GAAd,GAAoB,MAAMA,KAA1C;AACA,QAAMW,uBAAuB,GAAG,CAAC,CAAEF,OAAnC;AACA,QAAMG,WAAW,GAAGf,gBAAgB,CAAE,UAAF,EAAcU,QAAd,EAAwBC,MAAxB,CAApC;AACA,QAAM,CAAEK,QAAQ,GAAG,EAAb,EAAiBC,QAAjB,EAA2BC,SAA3B,IAAyCpB,aAAa,CAC3D,UAD2D,EAE3DY,QAF2D,EAG3D,OAH2D,EAI3DC,MAJ2D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AAAA,UAAU,EAAEsB,KAAK,GAAG,QAAH,GAAc;AADjB,KAAF,CAHf;AAOC,IAAA,OAAO,EAAGtB,UAAU,KAAK;AAP1B,IADD,EAUC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGV,EAAE,CAAE,UAAF,CADX;AAEC,IAAA,KAAK,EAAGS,GAFT;AAGC,IAAA,QAAQ,EAAKwB,MAAF,IACVtB,aAAa,CAAE;AAAEF,MAAAA,GAAG,EAAEwB;AAAP,KAAF;AAJf,IAVD,CAPF,CADD,CAfD,EA4CGR,YA5CH,CADD;AAgDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n} from '@wordpress/block-editor';\nimport { RawHTML } from '@wordpress/element';\nimport { ToggleControl, TextControl, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, textAlign, isLink, rel, linkTarget },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n} ) {\n\tconst TagName = 0 === level ? 'p' : 'h' + level;\n\tconst isDescendentOfQueryLoop = !! queryId;\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tlet titleElement = (\n\t\t<TagName { ...blockProps }>{ __( 'Post Title' ) }</TagName>\n\t);\n\n\tif ( postType && postId ) {\n\t\ttitleElement =\n\t\t\tuserCanEdit && ! isDescendentOfQueryLoop ? (\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tplaceholder={ __( 'No Title' ) }\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<RawHTML key=\"html\">{ fullTitle?.rendered }</RawHTML>\n\t\t\t\t</TagName>\n\t\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement =\n\t\t\tuserCanEdit && ! isDescendentOfQueryLoop ? (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<PlainText\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t! rawTitle.length ? __( 'No Title' ) : null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t/>\n\t\t\t\t</TagName>\n\t\t\t) : (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RawHTML key=\"html\">{ fullTitle?.rendered }</RawHTML>\n\t\t\t\t\t</a>\n\t\t\t\t</TagName>\n\t\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\tselectedLevel={ level }\n\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ titleElement }\n\t\t</>\n\t);\n}\n"]}
@@ -9,7 +9,7 @@ import { queryPagination as icon } from '@wordpress/icons';
9
9
  const metadata = {
10
10
  apiVersion: 2,
11
11
  name: "core/query-pagination",
12
- title: "Query Pagination",
12
+ title: "Pagination",
13
13
  category: "design",
14
14
  parent: ["core/query"],
15
15
  description: "Displays a paginated navigation to next/previous set of posts, when applicable.",
@@ -9,7 +9,7 @@ import { queryPaginationNext as icon } from '@wordpress/icons';
9
9
  const metadata = {
10
10
  apiVersion: 2,
11
11
  name: "core/query-pagination-next",
12
- title: "Query Pagination Next",
12
+ title: "Next Page",
13
13
  category: "design",
14
14
  parent: ["core/query-pagination"],
15
15
  description: "Displays the next posts page link.",
@@ -25,7 +25,7 @@ const metadata = {
25
25
  html: false,
26
26
  color: {
27
27
  gradients: true,
28
- link: true
28
+ text: false
29
29
  },
30
30
  typography: {
31
31
  fontSize: true,
@@ -9,7 +9,7 @@ import { queryPaginationNumbers as icon } from '@wordpress/icons';
9
9
  const metadata = {
10
10
  apiVersion: 2,
11
11
  name: "core/query-pagination-numbers",
12
- title: "Query Pagination Numbers",
12
+ title: "Page Numbers",
13
13
  category: "design",
14
14
  parent: ["core/query-pagination"],
15
15
  description: "Displays a list of page numbers for pagination",
@@ -9,7 +9,7 @@ import { queryPaginationPrevious as icon } from '@wordpress/icons';
9
9
  const metadata = {
10
10
  apiVersion: 2,
11
11
  name: "core/query-pagination-previous",
12
- title: "Query Pagination Previous",
12
+ title: "Previous Page",
13
13
  category: "design",
14
14
  parent: ["core/query-pagination"],
15
15
  description: "Displays the previous posts page link.",
@@ -25,7 +25,7 @@ const metadata = {
25
25
  html: false,
26
26
  color: {
27
27
  gradients: true,
28
- link: true
28
+ text: false
29
29
  },
30
30
  typography: {
31
31
  fontSize: true,
@@ -5,7 +5,7 @@ const metadata = {
5
5
  apiVersion: 2,
6
6
  name: "core/query-title",
7
7
  title: "Query Title",
8
- category: "design",
8
+ category: "theme",
9
9
  description: "Display the query title.",
10
10
  textdomain: "default",
11
11
  attributes: {
@@ -13,6 +13,7 @@ const SeparatorSettings = _ref => {
13
13
  } = _ref;
14
14
  return createElement(InspectorControls, null, createElement(PanelColorSettings, {
15
15
  __experimentalHasMultipleOrigins: true,
16
+ __experimentalIsRenderedInSidebar: true,
16
17
  title: __('Color'),
17
18
  colorSettings: [{
18
19
  value: color.color,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/separator-settings.js"],"names":["__","InspectorControls","PanelColorSettings","SeparatorSettings","color","setColor","value","onChange","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,iBAAT,EAA4BC,kBAA5B,QAAsD,yBAAtD;;AAEA,MAAMC,iBAAiB,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF;AAAA,SACzB,cAAC,iBAAD,QACC,cAAC,kBAAD;AACC,IAAA,gCAAgC,MADjC;AAEC,IAAA,KAAK,EAAGL,EAAE,CAAE,OAAF,CAFX;AAGC,IAAA,aAAa,EAAG,CACf;AACCM,MAAAA,KAAK,EAAEF,KAAK,CAACA,KADd;AAECG,MAAAA,QAAQ,EAAEF,QAFX;AAGCG,MAAAA,KAAK,EAAER,EAAE,CAAE,OAAF;AAHV,KADe;AAHjB,IADD,CADyB;AAAA,CAA1B;;AAgBA,eAAeG,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, PanelColorSettings } from '@wordpress/block-editor';\n\nconst SeparatorSettings = ( { color, setColor } ) => (\n\t<InspectorControls>\n\t\t<PanelColorSettings\n\t\t\t__experimentalHasMultipleOrigins\n\t\t\ttitle={ __( 'Color' ) }\n\t\t\tcolorSettings={ [\n\t\t\t\t{\n\t\t\t\t\tvalue: color.color,\n\t\t\t\t\tonChange: setColor,\n\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t},\n\t\t\t] }\n\t\t></PanelColorSettings>\n\t</InspectorControls>\n);\n\nexport default SeparatorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/separator-settings.js"],"names":["__","InspectorControls","PanelColorSettings","SeparatorSettings","color","setColor","value","onChange","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,iBAAT,EAA4BC,kBAA5B,QAAsD,yBAAtD;;AAEA,MAAMC,iBAAiB,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF;AAAA,SACzB,cAAC,iBAAD,QACC,cAAC,kBAAD;AACC,IAAA,gCAAgC,MADjC;AAEC,IAAA,iCAAiC,MAFlC;AAGC,IAAA,KAAK,EAAGL,EAAE,CAAE,OAAF,CAHX;AAIC,IAAA,aAAa,EAAG,CACf;AACCM,MAAAA,KAAK,EAAEF,KAAK,CAACA,KADd;AAECG,MAAAA,QAAQ,EAAEF,QAFX;AAGCG,MAAAA,KAAK,EAAER,EAAE,CAAE,OAAF;AAHV,KADe;AAJjB,IADD,CADyB;AAAA,CAA1B;;AAiBA,eAAeG,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, PanelColorSettings } from '@wordpress/block-editor';\n\nconst SeparatorSettings = ( { color, setColor } ) => (\n\t<InspectorControls>\n\t\t<PanelColorSettings\n\t\t\t__experimentalHasMultipleOrigins\n\t\t\t__experimentalIsRenderedInSidebar\n\t\t\ttitle={ __( 'Color' ) }\n\t\t\tcolorSettings={ [\n\t\t\t\t{\n\t\t\t\t\tvalue: color.color,\n\t\t\t\t\tonChange: setColor,\n\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t},\n\t\t\t] }\n\t\t></PanelColorSettings>\n\t</InspectorControls>\n);\n\nexport default SeparatorSettings;\n"]}
@@ -10,7 +10,7 @@ const metadata = {
10
10
  apiVersion: 2,
11
11
  name: "core/site-logo",
12
12
  title: "Site Logo",
13
- category: "layout",
13
+ category: "theme",
14
14
  description: "Display a graphic to represent this site. Update the block, and the changes apply everywhere it\u2019s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.",
15
15
  textdomain: "default",
16
16
  attributes: {
@@ -5,7 +5,7 @@ const metadata = {
5
5
  apiVersion: 2,
6
6
  name: "core/site-tagline",
7
7
  title: "Site Tagline",
8
- category: "design",
8
+ category: "theme",
9
9
  description: "Describe in a few words what the website is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design.",
10
10
  keywords: ["description"],
11
11
  textdomain: "default",
@@ -10,7 +10,7 @@ const metadata = {
10
10
  apiVersion: 2,
11
11
  name: "core/site-title",
12
12
  title: "Site Title",
13
- category: "design",
13
+ category: "theme",
14
14
  description: "Displays the name of this site. Update the block, and the changes apply everywhere it\u2019s used. This will also appear in the browser title bar and in search results.",
15
15
  textdomain: "default",
16
16
  attributes: {
@@ -136,6 +136,7 @@ export function SocialLinksEdit(props) {
136
136
  })
137
137
  })), createElement(PanelColorSettings, {
138
138
  __experimentalHasMultipleOrigins: true,
139
+ __experimentalIsRenderedInSidebar: true,
139
140
  title: __('Color'),
140
141
  colorSettings: [{
141
142
  // Use custom attribute as fallback to prevent loss of named color selection when
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["classNames","getBlockSupport","Fragment","useEffect","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","PanelColorSettings","withColors","MenuGroup","MenuItem","PanelBody","ToggleControl","ToolbarDropdownMenu","__","check","ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","size","layout","usedLayout","logosOnly","className","indexOf","undefined","customIconBackgroundColor","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","onClose","map","entry","onChange","colorValue","label","textColor","backgroundColor","iconColorAttributes"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SACCC,aADD,EAECC,mBAFD,EAGCC,aAHD,EAICC,iBAJD,EAKCC,eALD,EAMCC,kBAND,EAOCC,UAPD,QAQO,yBARP;AASA,SACCC,SADD,EAECC,QAFD,EAGCC,SAHD,EAICC,aAJD,EAKCC,mBALD,QAMO,uBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA,MAAMC,cAAc,GAAG,CAAE,kBAAF,CAAvB;AAEA,MAAMC,WAAW,GAAG,CACnB;AAAEC,EAAAA,IAAI,EAAEJ,EAAE,CAAE,OAAF,CAAV;AAAuBK,EAAAA,KAAK,EAAE;AAA9B,CADmB,EAEnB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,QAAF,CAAV;AAAwBK,EAAAA,KAAK,EAAE;AAA/B,CAFmB,EAGnB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,OAAF,CAAV;AAAuBK,EAAAA,KAAK,EAAE;AAA9B,CAHmB,EAInB;AAAED,EAAAA,IAAI,EAAEJ,EAAE,CAAE,MAAF,CAAV;AAAsBK,EAAAA,KAAK,EAAE;AAA7B,CAJmB,CAApB;;AAOA,MAAMC,qBAAqB,GAAKC,eAAF,IAAuB;AACpD,QAAMC,wBAAwB,GAAGvB,eAAe,CAC/CsB,eAD+C,EAE/C,sBAF+C,CAAhD;AAIA,SAAOC,wBAAP,aAAOA,wBAAP,uBAAOA,wBAAwB,CAAEC,OAAjC;AACA,CAND;;AAQA,OAAO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AAAA;;AACxC,QAAM;AACLP,I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AF,IACD,cAAC,eAAD;AAEEuB,IAAAA,SAAS,EAAE5B,cAFb;AAGE6B,IAAAA,eAAe,EAAE9B,wBAHnB;AAKC,IAAA,WAAW,EAAG;AALf,IAzCF,CAtCD,EAwFC,oBAASe,gBAAT,CAxFD,CADD;AA4FA;AAED,MAAMgB,mBAAmB,GAAG;AAC3BpC,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;AAKA,eAAenB,UAAU,CAAEwD,mBAAF,CAAV,CAAmCxC,eAAnC,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\t// Remove icon background color if logos only style selected.\n\tconst logosOnly =\n\t\tattributes.className?.indexOf( 'is-style-logos-only' ) >= 0;\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-social-link\"></div>\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t! logosOnly && {\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\t\ticonBackgroundColor.color ||\n\t\t\t\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon background color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["classNames","getBlockSupport","Fragment","useEffect","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","PanelColorSettings","withColors","MenuGroup","MenuItem","PanelBody","ToggleControl","ToolbarDropdownMenu","__","check","ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","size","layout","usedLayout","logosOnly","className","indexOf","undefined","customIconBackgroundColor","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","onClose","map","entry","onChange","colorValue","label","textColor","backgroundColor","iconColorAttributes"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SACCC,aADD,EAECC,mBAFD,EAGCC,aAHD,EAICC,iBAJD,EAKCC,e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E;AAFM,CAA5B;AAKA,eAAenB,UAAU,CAAEwD,mBAAF,CAAV,CAAmCxC,eAAnC,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\t// Remove icon background color if logos only style selected.\n\tconst logosOnly =\n\t\tattributes.className?.indexOf( 'is-style-logos-only' ) >= 0;\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-social-link\"></div>\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t! logosOnly && {\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\t\ticonBackgroundColor.color ||\n\t\t\t\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon background color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { find } from 'lodash';
6
+ import { find, kebabCase } from 'lodash';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
@@ -65,7 +65,7 @@ export default function TemplatePartPlaceholder(_ref) {
65
65
  // block attributes.
66
66
  const record = {
67
67
  title,
68
- slug: 'template-part',
68
+ slug: kebabCase(title),
69
69
  content: serialize(startingBlocks),
70
70
  // `area` is filterable on the server and defaults to `UNCATEGORIZED`
71
71
  // if provided value is not allowed.