@wordpress/block-library 9.26.0 → 9.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/edit.js +1 -1
  3. package/build/button/edit.js.map +1 -1
  4. package/build/cover/edit/block-controls.js +4 -2
  5. package/build/cover/edit/block-controls.js.map +1 -1
  6. package/build/cover/edit/index.js +6 -3
  7. package/build/cover/edit/index.js.map +1 -1
  8. package/build/cover/edit/inspector-controls.js +11 -4
  9. package/build/cover/edit/inspector-controls.js.map +1 -1
  10. package/build/cover/edit/poster-image.js +81 -0
  11. package/build/cover/edit/poster-image.js.map +1 -0
  12. package/build/cover/index.js +6 -0
  13. package/build/cover/index.js.map +1 -1
  14. package/build/cover/save.js +3 -1
  15. package/build/cover/save.js.map +1 -1
  16. package/build/details/index.js +1 -1
  17. package/build/details/index.js.map +1 -1
  18. package/build/gallery/constants.js +2 -1
  19. package/build/gallery/constants.js.map +1 -1
  20. package/build/gallery/edit.js +93 -15
  21. package/build/gallery/edit.js.map +1 -1
  22. package/build/image/edit.js +6 -0
  23. package/build/image/edit.js.map +1 -1
  24. package/build/list/index.js +0 -1
  25. package/build/list/index.js.map +1 -1
  26. package/build/media-text/edit.js +2 -2
  27. package/build/media-text/edit.js.map +1 -1
  28. package/build/more/edit.native.js +17 -32
  29. package/build/more/edit.native.js.map +1 -1
  30. package/build/navigation-link/edit.js +49 -16
  31. package/build/navigation-link/edit.js.map +1 -1
  32. package/build/navigation-link/update-attributes.js +112 -14
  33. package/build/navigation-link/update-attributes.js.map +1 -1
  34. package/build/navigation-submenu/edit.js +19 -2
  35. package/build/navigation-submenu/edit.js.map +1 -1
  36. package/build/post-author/edit.js +78 -35
  37. package/build/post-author/edit.js.map +1 -1
  38. package/build/post-comments-form/form.js +1 -1
  39. package/build/post-comments-form/form.js.map +1 -1
  40. package/build/post-content/edit.js +78 -16
  41. package/build/post-content/edit.js.map +1 -1
  42. package/build/post-content/index.js +6 -0
  43. package/build/post-content/index.js.map +1 -1
  44. package/build/post-featured-image/edit.js +2 -1
  45. package/build/post-featured-image/edit.js.map +1 -1
  46. package/build/search/edit.js +1 -1
  47. package/build/search/edit.js.map +1 -1
  48. package/build/separator/edit.js +5 -30
  49. package/build/separator/edit.js.map +1 -1
  50. package/build/site-logo/edit.js +16 -5
  51. package/build/site-logo/edit.js.map +1 -1
  52. package/build/site-tagline/index.js +1 -1
  53. package/build/video/edit.js +2 -5
  54. package/build/video/edit.js.map +1 -1
  55. package/build/video/poster-image.js +25 -25
  56. package/build/video/poster-image.js.map +1 -1
  57. package/build/video/tracks-editor.js +95 -104
  58. package/build/video/tracks-editor.js.map +1 -1
  59. package/build/video/tracks.js +6 -2
  60. package/build/video/tracks.js.map +1 -1
  61. package/build-module/button/edit.js +1 -1
  62. package/build-module/button/edit.js.map +1 -1
  63. package/build-module/cover/edit/block-controls.js +4 -2
  64. package/build-module/cover/edit/block-controls.js.map +1 -1
  65. package/build-module/cover/edit/index.js +6 -3
  66. package/build-module/cover/edit/index.js.map +1 -1
  67. package/build-module/cover/edit/inspector-controls.js +10 -4
  68. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  69. package/build-module/cover/edit/poster-image.js +74 -0
  70. package/build-module/cover/edit/poster-image.js.map +1 -0
  71. package/build-module/cover/index.js +6 -0
  72. package/build-module/cover/index.js.map +1 -1
  73. package/build-module/cover/save.js +3 -1
  74. package/build-module/cover/save.js.map +1 -1
  75. package/build-module/details/index.js +1 -1
  76. package/build-module/details/index.js.map +1 -1
  77. package/build-module/gallery/constants.js +1 -0
  78. package/build-module/gallery/constants.js.map +1 -1
  79. package/build-module/gallery/edit.js +95 -17
  80. package/build-module/gallery/edit.js.map +1 -1
  81. package/build-module/image/edit.js +6 -0
  82. package/build-module/image/edit.js.map +1 -1
  83. package/build-module/list/index.js +0 -1
  84. package/build-module/list/index.js.map +1 -1
  85. package/build-module/media-text/edit.js +2 -2
  86. package/build-module/media-text/edit.js.map +1 -1
  87. package/build-module/more/edit.native.js +16 -30
  88. package/build-module/more/edit.native.js.map +1 -1
  89. package/build-module/navigation-link/edit.js +50 -17
  90. package/build-module/navigation-link/edit.js.map +1 -1
  91. package/build-module/navigation-link/update-attributes.js +113 -15
  92. package/build-module/navigation-link/update-attributes.js.map +1 -1
  93. package/build-module/navigation-submenu/edit.js +20 -3
  94. package/build-module/navigation-submenu/edit.js.map +1 -1
  95. package/build-module/post-author/edit.js +78 -35
  96. package/build-module/post-author/edit.js.map +1 -1
  97. package/build-module/post-comments-form/form.js +1 -1
  98. package/build-module/post-comments-form/form.js.map +1 -1
  99. package/build-module/post-content/edit.js +80 -18
  100. package/build-module/post-content/edit.js.map +1 -1
  101. package/build-module/post-content/index.js +6 -0
  102. package/build-module/post-content/index.js.map +1 -1
  103. package/build-module/post-featured-image/edit.js +2 -1
  104. package/build-module/post-featured-image/edit.js.map +1 -1
  105. package/build-module/search/edit.js +1 -1
  106. package/build-module/search/edit.js.map +1 -1
  107. package/build-module/separator/edit.js +6 -31
  108. package/build-module/separator/edit.js.map +1 -1
  109. package/build-module/site-logo/edit.js +17 -6
  110. package/build-module/site-logo/edit.js.map +1 -1
  111. package/build-module/site-tagline/index.js +1 -1
  112. package/build-module/video/edit.js +2 -5
  113. package/build-module/video/edit.js.map +1 -1
  114. package/build-module/video/poster-image.js +26 -26
  115. package/build-module/video/poster-image.js.map +1 -1
  116. package/build-module/video/tracks-editor.js +96 -105
  117. package/build-module/video/tracks-editor.js.map +1 -1
  118. package/build-module/video/tracks.js +6 -2
  119. package/build-module/video/tracks.js.map +1 -1
  120. package/build-style/archives/editor-rtl.css +0 -4
  121. package/build-style/archives/editor.css +0 -4
  122. package/build-style/editor-rtl.css +0 -21
  123. package/build-style/editor.css +0 -21
  124. package/build-style/file/style-rtl.css +1 -1
  125. package/build-style/file/style.css +1 -1
  126. package/build-style/gallery/editor-rtl.css +0 -13
  127. package/build-style/gallery/editor.css +0 -13
  128. package/build-style/navigation/style-rtl.css +2 -0
  129. package/build-style/navigation/style.css +2 -0
  130. package/build-style/style-rtl.css +3 -1
  131. package/build-style/style.css +3 -1
  132. package/build-style/video/editor-rtl.css +0 -4
  133. package/build-style/video/editor.css +0 -4
  134. package/package.json +35 -35
  135. package/src/archives/editor.scss +0 -4
  136. package/src/button/edit.js +1 -1
  137. package/src/comments-pagination/index.php +7 -2
  138. package/src/cover/block.json +6 -0
  139. package/src/cover/edit/block-controls.js +22 -17
  140. package/src/cover/edit/index.js +4 -1
  141. package/src/cover/edit/inspector-controls.js +12 -3
  142. package/src/cover/edit/poster-image.js +91 -0
  143. package/src/cover/save.js +2 -0
  144. package/src/details/index.js +1 -1
  145. package/src/file/style.scss +1 -1
  146. package/src/gallery/constants.js +1 -0
  147. package/src/gallery/edit.js +182 -68
  148. package/src/gallery/editor.scss +0 -17
  149. package/src/image/edit.js +12 -0
  150. package/src/list/block.json +0 -1
  151. package/src/media-text/edit.js +1 -1
  152. package/src/more/edit.native.js +19 -33
  153. package/src/navigation/style.scss +2 -0
  154. package/src/navigation-link/edit.js +46 -17
  155. package/src/navigation-link/test/edit.js +738 -6
  156. package/src/navigation-link/update-attributes.js +125 -12
  157. package/src/navigation-submenu/edit.js +21 -1
  158. package/src/post-author/edit.js +91 -40
  159. package/src/post-comments-form/form.js +1 -1
  160. package/src/post-content/block.json +6 -0
  161. package/src/post-content/edit.js +71 -19
  162. package/src/post-content/index.php +11 -4
  163. package/src/post-featured-image/edit.js +1 -0
  164. package/src/post-featured-image/index.php +3 -2
  165. package/src/rss/index.php +2 -1
  166. package/src/search/edit.js +1 -1
  167. package/src/separator/edit.js +8 -43
  168. package/src/site-logo/edit.js +22 -10
  169. package/src/site-tagline/block.json +1 -1
  170. package/src/video/edit.js +1 -4
  171. package/src/video/editor.scss +0 -6
  172. package/src/video/poster-image.js +29 -24
  173. package/src/video/tracks-editor.js +93 -103
  174. package/src/video/tracks.js +2 -1
@@ -1 +1 @@
1
- {"version":3,"names":["escapeHTML","safeDecodeURI","updateAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","kind","originalKind","type","originalType","title","newLabel","url","newUrl","opensInNewTab","id","newKind","newType","newLabelWithoutHttp","replace","newUrlWithoutHttp","useNewLabel","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger"],"sources":["@wordpress/block-library/src/navigation-link/update-attributes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { escapeHTML } from '@wordpress/escape-html';\nimport { safeDecodeURI } from '@wordpress/url';\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\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 * 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 updateAttributes = (\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\n\tconst {\n\t\ttitle: newLabel = '', // the title of any provided Post.\n\t\turl: newUrl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\tconst newLabelWithoutHttp = newLabel.replace( /http(s?):\\/\\//gi, '' );\n\tconst newUrlWithoutHttp = newUrl.replace( /http(s?):\\/\\//gi, '' );\n\n\tconst useNewLabel =\n\t\tnewLabel &&\n\t\tnewLabel !== originalLabel &&\n\t\t// LinkControl without the title field relies\n\t\t// on the check below. Specifically, it assumes that\n\t\t// the URL is the same as a title.\n\t\t// This logic a) looks suspicious and b) should really\n\t\t// live in the LinkControl and not here. It's a great\n\t\t// candidate for future refactoring.\n\t\tnewLabelWithoutHttp !== newUrlWithoutHttp;\n\n\t// Unfortunately this causes the escaping model to be inverted.\n\t// The escaped content is stored in the block attributes (and ultimately in the database),\n\t// and then the raw data is \"recovered\" when outputting into the DOM.\n\t// It would be preferable to store the **raw** data in the block attributes and escape it in JS.\n\t// Why? Because there isn't one way to escape data. Depending on the context, you need to do\n\t// different transforms. It doesn't make sense to me to choose one of them for the purposes of storage.\n\t// See also:\n\t// - https://github.com/WordPress/gutenberg/pull/41063\n\t// - https://github.com/WordPress/gutenberg/pull/18617.\n\tconst label = useNewLabel\n\t\t? escapeHTML( newLabel )\n\t\t: originalLabel || escapeHTML( newUrlWithoutHttp );\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...( newUrl && { url: encodeURI( safeDecodeURI( newUrl ) ) } ),\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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,wBAA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B,CAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAE,CAACC,OAAO,CAAEf,IAAK,CAAC,GAAG,CAAC,CAAC;EAE3D,MAAMgB,YAAY,GACf,CAAER,OAAO,IAAI,CAAEM,aAAa,IAAMN,OAAO,KAAK,QAAQ;EACzD,MAAMV,IAAI,GAAGkB,YAAY,GAAG,QAAQ,GAAGR,OAAO;EAE9Cd,aAAa,CAAE;IACd;IACA,IAAKW,MAAM,IAAI;MAAED,GAAG,EAAEa,SAAS,CAAE1B,aAAa,CAAEc,MAAO,CAAE;IAAE,CAAC,CAAE;IAC9D,IAAKT,KAAK,IAAI;MAAEA;IAAM,CAAC,CAAE;IACzB,IAAKsB,SAAS,KAAKZ,aAAa,IAAI;MAAEA;IAAc,CAAC,CAAE;IACvD,IAAKC,EAAE,IAAIY,MAAM,CAACC,SAAS,CAAEb,EAAG,CAAC,IAAI;MAAEA;IAAG,CAAC,CAAE;IAC7C,IAAKT,IAAI,IAAI;MAAEA;IAAK,CAAC,CAAE;IACvB,IAAKE,IAAI,IAAIA,IAAI,KAAK,KAAK,IAAI;MAAEA;IAAK,CAAC;EACxC,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["escapeHTML","safeDecodeURI","getPath","shouldSeverEntityLink","originalUrl","newUrl","normalizePath","path","replace","createUrlObject","url","baseUrl","base","window","location","origin","URL","error","originalUrlObj","newUrlObj","originalHostname","hostname","newHostname","originalPath","toString","newPath","originalP","searchParams","get","newP","originalPageId","newPageId","updateAttributes","updatedValue","setAttributes","blockAttributes","_newUrl$replace","label","originalLabel","kind","originalKind","type","originalType","title","newLabel","newLabelFromLabel","opensInNewTab","id","newID","newKind","newType","finalNewLabel","newLabelWithoutHttp","newUrlWithoutHttp","useNewLabel","isBuiltInType","indexOf","isCustomLink","attributes","undefined","encodeURI","shouldSever","Number","isInteger"],"sources":["@wordpress/block-library/src/navigation-link/update-attributes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { escapeHTML } from '@wordpress/escape-html';\nimport { safeDecodeURI, getPath } from '@wordpress/url';\n\n/**\n * Determines if an entity link should be severed based on URL changes.\n *\n * @param {string} originalUrl - The original URL\n * @param {string} newUrl - The new URL\n * @return {boolean} True if the entity link should be severed\n */\nconst shouldSeverEntityLink = ( originalUrl, newUrl ) => {\n\tif ( ! originalUrl || ! newUrl ) {\n\t\treturn false;\n\t}\n\n\tconst normalizePath = ( path ) => {\n\t\tif ( ! path ) {\n\t\t\treturn '';\n\t\t}\n\t\treturn path.replace( /\\/+$/, '' ); // Remove trailing slashes\n\t};\n\n\t// Helper function to create URL objects with proper base handling\n\tconst createUrlObject = ( url, baseUrl = null ) => {\n\t\ttry {\n\t\t\t// Always provide a base URL - it will be ignored for absolute URLs\n\t\t\t// Use window.location.origin in browser, fallback for Node/tests\n\t\t\tconst base =\n\t\t\t\tbaseUrl ||\n\t\t\t\t( typeof window !== 'undefined'\n\t\t\t\t\t? window.location.origin\n\t\t\t\t\t: 'https://wordpress.org' );\n\t\t\treturn new URL( url, base );\n\t\t} catch ( error ) {\n\t\t\t// If URL construction still fails, it's likely an invalid URL\n\t\t\t// and we should sever the entity link\n\t\t\treturn null;\n\t\t}\n\t};\n\n\tconst originalUrlObj = createUrlObject( originalUrl );\n\tif ( ! originalUrlObj ) {\n\t\treturn true;\n\t}\n\n\tconst newUrlObj = createUrlObject( newUrl, originalUrl );\n\tif ( ! newUrlObj ) {\n\t\treturn true;\n\t}\n\n\t// Move these declarations here, after the null checks\n\tconst originalHostname = originalUrlObj.hostname;\n\tconst newHostname = newUrlObj.hostname;\n\tconst originalPath = normalizePath( getPath( originalUrlObj.toString() ) );\n\tconst newPath = normalizePath( getPath( newUrlObj.toString() ) );\n\n\t// If hostname or path changed, sever the entity link\n\tif ( originalHostname !== newHostname || originalPath !== newPath ) {\n\t\treturn true;\n\t}\n\n\t// Special handling for plain permalinks (query string post IDs)\n\tconst originalP = originalUrlObj.searchParams.get( 'p' );\n\tconst newP = newUrlObj.searchParams.get( 'p' );\n\n\t// If both are plain permalinks (with ?p= or ?page_id=), compare the IDs\n\tif ( originalP && newP && originalP !== newP ) {\n\t\treturn true;\n\t}\n\n\tconst originalPageId = originalUrlObj.searchParams.get( 'page_id' );\n\tconst newPageId = newUrlObj.searchParams.get( 'page_id' );\n\n\tif ( originalPageId && newPageId && originalPageId !== newPageId ) {\n\t\treturn true;\n\t}\n\t// If switching between ?p= and ?page_id=, or one is missing, sever\n\tif ( ( originalP && newPageId ) || ( originalPageId && newP ) ) {\n\t\treturn true;\n\t}\n\n\t// If only query string or fragment changed, preserve the entity link\n\treturn false;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\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 * 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 updateAttributes = (\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\n\tconst {\n\t\ttitle: newLabel = '', // the title of any provided Post.\n\t\tlabel: newLabelFromLabel = '', // alternative to title\n\t\turl: newUrl,\n\t\topensInNewTab,\n\t\tid: newID,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\t// Use title if provided, otherwise fall back to label\n\tconst finalNewLabel = newLabel || newLabelFromLabel;\n\n\tconst newLabelWithoutHttp = finalNewLabel.replace( /http(s?):\\/\\//gi, '' );\n\tconst newUrlWithoutHttp = newUrl?.replace( /http(s?):\\/\\//gi, '' ) ?? '';\n\n\tconst useNewLabel =\n\t\tfinalNewLabel &&\n\t\tfinalNewLabel !== originalLabel &&\n\t\t// LinkControl without the title field relies\n\t\t// on the check below. Specifically, it assumes that\n\t\t// the URL is the same as a title.\n\t\t// This logic a) looks suspicious and b) should really\n\t\t// live in the LinkControl and not here. It's a great\n\t\t// candidate for future refactoring.\n\t\tnewLabelWithoutHttp !== newUrlWithoutHttp;\n\n\t// Unfortunately this causes the escaping model to be inverted.\n\t// The escaped content is stored in the block attributes (and ultimately in the database),\n\t// and then the raw data is \"recovered\" when outputting into the DOM.\n\t// It would be preferable to store the **raw** data in the block attributes and escape it in JS.\n\t// Why? Because there isn't one way to escape data. Depending on the context, you need to do\n\t// different transforms. It doesn't make sense to me to choose one of them for the purposes of storage.\n\t// See also:\n\t// - https://github.com/WordPress/gutenberg/pull/41063\n\t// - https://github.com/WordPress/gutenberg/pull/18617.\n\tconst label = useNewLabel\n\t\t? escapeHTML( finalNewLabel )\n\t\t: originalLabel || escapeHTML( newUrlWithoutHttp );\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\tconst attributes = {\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...( newUrl !== undefined\n\t\t\t? { url: newUrl ? encodeURI( safeDecodeURI( newUrl ) ) : newUrl }\n\t\t\t: {} ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t};\n\n\t// If the block's id is set then the menu item is linking to an entity.\n\t// Therefore, if the URL is set but a new ID is not provided, check if\n\t// the entity link should be severed based on URL changes.\n\tif ( newUrl && ! newID && blockAttributes.id ) {\n\t\tconst shouldSever = shouldSeverEntityLink(\n\t\t\tblockAttributes.url,\n\t\t\tnewUrl\n\t\t);\n\n\t\tif ( shouldSever ) {\n\t\t\tattributes.id = undefined; // explicitly \"unset\" the ID.\n\t\t\t// When URL is manually changed in a way that severs the entity link,\n\t\t\t// update kind and type to \"custom\" to indicate this is now a custom link.\n\t\t\tattributes.kind = 'custom';\n\t\t\tattributes.type = 'custom';\n\t\t}\n\t} else if ( newID && Number.isInteger( newID ) ) {\n\t\tattributes.id = newID;\n\t} else if ( blockAttributes.id ) {\n\t\t// If we have an existing ID and no URL change, ensure kind and type are preserved\n\t\tattributes.kind = kind;\n\t\tattributes.type = type;\n\t}\n\n\tsetAttributes( attributes );\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,wBAAwB;AACnD,SAASC,aAAa,EAAEC,OAAO,QAAQ,gBAAgB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAGA,CAAEC,WAAW,EAAEC,MAAM,KAAM;EACxD,IAAK,CAAED,WAAW,IAAI,CAAEC,MAAM,EAAG;IAChC,OAAO,KAAK;EACb;EAEA,MAAMC,aAAa,GAAKC,IAAI,IAAM;IACjC,IAAK,CAAEA,IAAI,EAAG;MACb,OAAO,EAAE;IACV;IACA,OAAOA,IAAI,CAACC,OAAO,CAAE,MAAM,EAAE,EAAG,CAAC,CAAC,CAAC;EACpC,CAAC;;EAED;EACA,MAAMC,eAAe,GAAGA,CAAEC,GAAG,EAAEC,OAAO,GAAG,IAAI,KAAM;IAClD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;IAC9C,MAAMc,WAAW,GAAG1D,qBAAqB,CACxCgC,eAAe,CAACzB,GAAG,EACnBL,MACD,CAAC;IAED,IAAKwD,WAAW,EAAG;MAClBH,UAAU,CAACX,EAAE,GAAGY,SAAS,CAAC,CAAC;MAC3B;MACA;MACAD,UAAU,CAACnB,IAAI,GAAG,QAAQ;MAC1BmB,UAAU,CAACjB,IAAI,GAAG,QAAQ;IAC3B;EACD,CAAC,MAAM,IAAKO,KAAK,IAAIc,MAAM,CAACC,SAAS,CAAEf,KAAM,CAAC,EAAG;IAChDU,UAAU,CAACX,EAAE,GAAGC,KAAK;EACtB,CAAC,MAAM,IAAKb,eAAe,CAACY,EAAE,EAAG;IAChC;IACAW,UAAU,CAACnB,IAAI,GAAGA,IAAI;IACtBmB,UAAU,CAACjB,IAAI,GAAGA,IAAI;EACvB;EAEAP,aAAa,CAAEwB,UAAW,CAAC;AAC5B,CAAC","ignoreList":[]}
@@ -7,7 +7,7 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useSelect, useDispatch } from '@wordpress/data';
10
- import { TextControl, TextareaControl, ToolbarButton, ToolbarGroup, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
10
+ import { CheckboxControl, TextControl, TextareaControl, ToolbarButton, ToolbarGroup, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
11
11
  import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
12
12
  import { __ } from '@wordpress/i18n';
13
13
  import { BlockControls, InnerBlocks, useInnerBlocksProps, InspectorControls, RichText, useBlockProps, store as blockEditorStore, getColorClassName } from '@wordpress/block-editor';
@@ -111,7 +111,8 @@ export default function NavigationSubmenuEdit({
111
111
  label,
112
112
  url,
113
113
  description,
114
- rel
114
+ rel,
115
+ opensInNewTab
115
116
  } = attributes;
116
117
  const {
117
118
  showSubmenuIcon,
@@ -319,7 +320,8 @@ export default function NavigationSubmenuEdit({
319
320
  label: '',
320
321
  url: '',
321
322
  description: '',
322
- rel: ''
323
+ rel: '',
324
+ opensInNewTab: false
323
325
  });
324
326
  },
325
327
  dropdownMenuProps: dropdownMenuProps,
@@ -362,6 +364,21 @@ export default function NavigationSubmenuEdit({
362
364
  autoComplete: "off",
363
365
  type: "url"
364
366
  })
367
+ }), /*#__PURE__*/_jsx(ToolsPanelItem, {
368
+ hasValue: () => !!opensInNewTab,
369
+ label: __('Open in new tab'),
370
+ onDeselect: () => setAttributes({
371
+ opensInNewTab: false
372
+ }),
373
+ isShownByDefault: true,
374
+ children: /*#__PURE__*/_jsx(CheckboxControl, {
375
+ __nextHasNoMarginBottom: true,
376
+ label: __('Open in new tab'),
377
+ checked: opensInNewTab,
378
+ onChange: value => setAttributes({
379
+ opensInNewTab: value
380
+ })
381
+ })
365
382
  }), /*#__PURE__*/_jsx(ToolsPanelItem, {
366
383
  label: __('Description'),
367
384
  isShownByDefault: true,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useSelect","useDispatch","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","displayShortcut","isKeyboardEvent","__","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","useState","useEffect","useRef","link","linkIcon","removeSubmenu","speak","createBlock","useMergeRefs","usePrevious","ItemSubmenuIcon","LinkUI","updateAttributes","getColors","getNavigationChildBlockProps","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","NavigationSubmenuEdit","attributes","isSelected","setAttributes","mergeBlocks","onReplace","context","clientId","label","url","description","rel","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","__unstableMarkNextChangeAsNotPersistent","replaceBlock","selectBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","dropdownMenuProps","parentCount","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","prevHasChildren","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksColors","allowedBlocks","filter","blockName","navigationChildBlockProps","innerBlocksProps","defaultBlock","directInsert","__experimentalCaptureToolbars","renderAppender","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","children","icon","title","shortcut","onClick","currentTarget","disabled","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","urlValue","type","descriptionValue","help","relValue","identifier","onMerge","placeholder","withoutInteractiveFormatting","onClose","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { LinkUI } from '../navigation-link/link-ui';\nimport { updateAttributes } from '../navigation-link/update-attributes';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\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 * @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 */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description, rel } = attributes;\n\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\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\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\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/**\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}\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\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If we don't stop propagation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( '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': hasChildren,\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( 'background-color', backgroundColor ) ]:\n\t\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\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\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={ ( event ) => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tlabel: '',\n\t\t\t\t\t\t\turl: '',\n\t\t\t\t\t\t\tdescription: '',\n\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! label }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\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\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! url }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { url: '' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! description }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { description: '' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdescription: descriptionValue,\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={ __( 'Description' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\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\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\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<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( ref.current );\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{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\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</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}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ACxB2F,QAAQ,EAAGA,CAAA,KAAM;YAChB9G,aAAa,CAAE;cAAEM,GAAG,EAAE;YAAG,CAAE,CAAC;YAC5B1C,KAAK,CAAElB,EAAE,CAAE,eAAgB,CAAC,EAAE,WAAY,CAAC;UAC5C,CAAG;UACHsJ,QAAQ,EAAKe,YAAY,IAAM;YAC9B7I,gBAAgB,CACf6I,YAAY,EACZ/G,aAAa,EACbF,UACD,CAAC;UACF;QAAG,CACH,CACD;MAAA,CACa,CAAC,EACd,CAAEW,eAAe,IAAIE,mBAAmB,kBACzCpC,IAAA;QAAMyF,SAAS,EAAC,mCAAmC;QAAAkB,QAAA,eAClD3G,IAAA,CAACP,eAAe,IAAE;MAAC,CACd,CACN,eACDO,IAAA;QAAA,GAAUiG;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useSelect","useDispatch","CheckboxControl","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","displayShortcut","isKeyboardEvent","__","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","useState","useEffect","useRef","link","linkIcon","removeSubmenu","speak","createBlock","useMergeRefs","usePrevious","ItemSubmenuIcon","LinkUI","updateAttributes","getColors","getNavigationChildBlockProps","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","NavigationSubmenuEdit","attributes","isSelected","setAttributes","mergeBlocks","onReplace","context","clientId","label","url","description","rel","opensInNewTab","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","__unstableMarkNextChangeAsNotPersistent","replaceBlock","selectBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","dropdownMenuProps","parentCount","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","prevHasChildren","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksColors","allowedBlocks","filter","blockName","navigationChildBlockProps","innerBlocksProps","defaultBlock","directInsert","__experimentalCaptureToolbars","renderAppender","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","children","icon","title","shortcut","onClick","currentTarget","disabled","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","urlValue","type","checked","descriptionValue","help","relValue","identifier","onMerge","placeholder","withoutInteractiveFormatting","onClose","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tCheckboxControl,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { LinkUI } from '../navigation-link/link-ui';\nimport { updateAttributes } from '../navigation-link/update-attributes';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\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 * @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 */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description, rel, opensInNewTab } = attributes;\n\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\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\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\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/**\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}\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\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If we don't stop propagation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( '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': hasChildren,\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( 'background-color', backgroundColor ) ]:\n\t\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\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\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={ ( event ) => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tlabel: '',\n\t\t\t\t\t\t\turl: '',\n\t\t\t\t\t\t\tdescription: '',\n\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\topensInNewTab: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! label }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\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\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! url }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { url: '' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! opensInNewTab }\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tchecked={ opensInNewTab }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { opensInNewTab: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! description }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { description: '' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdescription: descriptionValue,\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={ __( 'Description' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\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\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\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<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( ref.current );\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{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\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</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,eAAe,EACfC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,eAAe,EAAEC,eAAe,QAAQ,qBAAqB;AACtE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,aAAa,EACbC,WAAW,EACXC,mBAAmB,EACnBC,iBAAiB,EACjBC,QAAQ,EACRC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,EACzBC,iBAAiB,QACX,yBAAyB;AAChC,SAASC,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,SAASC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AAChE,SAASC,IAAI,IAAIC,QAAQ,EAAEC,aAAa,QAAQ,kBAAkB;AAClE,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,WAAW,QAAQ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,QAAQ,EAAKgB,YAAY,IAAM;YAC9B/I,gBAAgB,CACf+I,YAAY,EACZjH,aAAa,EACbF,UACD,CAAC;UACF;QAAG,CACH,CACD;MAAA,CACa,CAAC,EACd,CAAEY,eAAe,IAAIE,mBAAmB,kBACzCrC,IAAA;QAAM0F,SAAS,EAAC,mCAAmC;QAAAkB,QAAA,eAClD5G,IAAA,CAACP,eAAe,IAAE;MAAC,CACd,CACN,eACDO,IAAA;QAAA,GAAUkG;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
@@ -8,8 +8,11 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { AlignmentControl, BlockControls, InspectorControls, RichText, useBlockProps } from '@wordpress/block-editor';
10
10
  import { ComboboxControl, SelectControl, ToggleControl, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
11
+ import { debounce } from '@wordpress/compose';
12
+ import { useMemo, useState } from '@wordpress/element';
11
13
  import { useSelect, useDispatch } from '@wordpress/data';
12
14
  import { __, sprintf } from '@wordpress/i18n';
15
+ import { decodeEntities } from '@wordpress/html-entities';
13
16
  import { store as coreStore } from '@wordpress/core-data';
14
17
 
15
18
  /**
@@ -17,11 +20,73 @@ import { store as coreStore } from '@wordpress/core-data';
17
20
  */
18
21
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
19
22
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
20
- const minimumUsersForCombobox = 25;
21
23
  const AUTHORS_QUERY = {
22
24
  who: 'authors',
23
- per_page: 100
25
+ per_page: 100,
26
+ _fields: 'id,name',
27
+ context: 'view'
24
28
  };
29
+ function AuthorCombobox({
30
+ value,
31
+ onChange
32
+ }) {
33
+ const [filterValue, setFilterValue] = useState('');
34
+ const {
35
+ authors,
36
+ isLoading
37
+ } = useSelect(select => {
38
+ const {
39
+ getUsers,
40
+ isResolving
41
+ } = select(coreStore);
42
+ const query = {
43
+ ...AUTHORS_QUERY
44
+ };
45
+ if (filterValue) {
46
+ query.search = filterValue;
47
+ query.search_columns = ['name'];
48
+ }
49
+ return {
50
+ authors: getUsers(query),
51
+ isLoading: isResolving('getUsers', [query])
52
+ };
53
+ }, [filterValue]);
54
+ const authorOptions = useMemo(() => {
55
+ const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => {
56
+ return {
57
+ value: author.id,
58
+ label: decodeEntities(author.name)
59
+ };
60
+ });
61
+
62
+ // Ensure the current author is included in the list.
63
+ const foundAuthor = fetchedAuthors.findIndex(fetchedAuthor => value?.id === fetchedAuthor.value);
64
+ let currentAuthor = [];
65
+ if (foundAuthor < 0 && value) {
66
+ currentAuthor = [{
67
+ value: value.id,
68
+ label: decodeEntities(value.name)
69
+ }];
70
+ } else if (foundAuthor < 0 && !value) {
71
+ currentAuthor = [{
72
+ value: 0,
73
+ label: __('(No author)')
74
+ }];
75
+ }
76
+ return [...currentAuthor, ...fetchedAuthors];
77
+ }, [authors, value]);
78
+ return /*#__PURE__*/_jsx(ComboboxControl, {
79
+ __next40pxDefaultSize: true,
80
+ __nextHasNoMarginBottom: true,
81
+ label: __('Author'),
82
+ options: authorOptions,
83
+ value: value?.id,
84
+ onFilterValueChange: debounce(setFilterValue, 300),
85
+ onChange: onChange,
86
+ allowReset: false,
87
+ isLoading: isLoading
88
+ });
89
+ }
25
90
  function PostAuthorEdit({
26
91
  isSelected,
27
92
  context: {
@@ -35,24 +100,24 @@ function PostAuthorEdit({
35
100
  const isDescendentOfQueryLoop = Number.isFinite(queryId);
36
101
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
37
102
  const {
38
- authorId,
39
103
  authorDetails,
40
- authors,
104
+ canAssignAuthor,
41
105
  supportsAuthor
42
106
  } = useSelect(select => {
43
107
  var _getPostType$supports;
44
108
  const {
45
109
  getEditedEntityRecord,
46
110
  getUser,
47
- getUsers,
48
111
  getPostType
49
112
  } = select(coreStore);
50
- const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
113
+ const currentPost = getEditedEntityRecord('postType', postType, postId);
114
+ const authorId = currentPost?.author;
51
115
  return {
52
- authorId: _authorId,
53
- authorDetails: _authorId ? getUser(_authorId) : null,
54
- authors: getUsers(AUTHORS_QUERY),
55
- supportsAuthor: (_getPostType$supports = getPostType(postType)?.supports?.author) !== null && _getPostType$supports !== void 0 ? _getPostType$supports : false
116
+ authorDetails: authorId ? getUser(authorId, {
117
+ context: 'view'
118
+ }) : null,
119
+ supportsAuthor: (_getPostType$supports = getPostType(postType)?.supports?.author) !== null && _getPostType$supports !== void 0 ? _getPostType$supports : false,
120
+ canAssignAuthor: currentPost?._links?.['wp:action-assign-author'] ? true : false
56
121
  };
57
122
  }, [postType, postId]);
58
123
  const {
@@ -82,22 +147,12 @@ function PostAuthorEdit({
82
147
  [`has-text-align-${textAlign}`]: textAlign
83
148
  })
84
149
  });
85
- const authorOptions = authors?.length ? authors.map(({
86
- id,
87
- name
88
- }) => {
89
- return {
90
- value: id,
91
- label: name
92
- };
93
- }) : [];
94
150
  const handleSelect = nextAuthorId => {
95
151
  editEntityRecord('postType', postType, postId, {
96
152
  author: nextAuthorId
97
153
  });
98
154
  };
99
- const showCombobox = authorOptions.length >= minimumUsersForCombobox;
100
- const showAuthorControl = !!postId && !isDescendentOfQueryLoop && authorOptions.length > 0;
155
+ const showAuthorControl = !!postId && !isDescendentOfQueryLoop && canAssignAuthor;
101
156
  if (!supportsAuthor && postType !== undefined) {
102
157
  return /*#__PURE__*/_jsx("div", {
103
158
  ...blockProps,
@@ -123,20 +178,8 @@ function PostAuthorEdit({
123
178
  style: {
124
179
  gridColumn: '1 / -1'
125
180
  },
126
- children: showCombobox && /*#__PURE__*/_jsx(ComboboxControl, {
127
- __next40pxDefaultSize: true,
128
- __nextHasNoMarginBottom: true,
129
- label: __('Author'),
130
- options: authorOptions,
131
- value: authorId,
132
- onChange: handleSelect,
133
- allowReset: false
134
- }) || /*#__PURE__*/_jsx(SelectControl, {
135
- __next40pxDefaultSize: true,
136
- __nextHasNoMarginBottom: true,
137
- label: __('Author'),
138
- value: authorId,
139
- options: authorOptions,
181
+ children: /*#__PURE__*/_jsx(AuthorCombobox, {
182
+ value: authorDetails,
140
183
  onChange: handleSelect
141
184
  })
142
185
  }), /*#__PURE__*/_jsx(ToolsPanelItem, {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","AlignmentControl","BlockControls","InspectorControls","RichText","useBlockProps","ComboboxControl","SelectControl","ToggleControl","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","useSelect","useDispatch","__","sprintf","store","coreStore","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","minimumUsersForCombobox","AUTHORS_QUERY","who","per_page","PostAuthorEdit","isSelected","context","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","Number","isFinite","dropdownMenuProps","authorId","authorDetails","authors","supportsAuthor","select","_getPostType$supports","getEditedEntityRecord","getUser","getUsers","getPostType","_authorId","author","supports","editEntityRecord","textAlign","showAvatar","showBio","byline","isLink","linkTarget","avatarSize","avatarSizes","authorName","name","avatar_urls","Object","keys","forEach","size","push","value","label","blockProps","className","authorOptions","length","map","id","handleSelect","nextAuthorId","showCombobox","showAuthorControl","undefined","children","resetAll","style","gridColumn","__next40pxDefaultSize","__nextHasNoMarginBottom","options","onChange","allowReset","isShownByDefault","hasValue","onDeselect","checked","group","nextAlign","width","src","alt","isEmpty","identifier","placeholder","href","onClick","event","preventDefault","dangerouslySetInnerHTML","__html","description"],"sources":["@wordpress/block-library/src/post-author/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tComboboxControl,\n\tSelectControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst minimumUsersForCombobox = 25;\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: 100,\n};\n\nfunction PostAuthorEdit( {\n\tisSelected,\n\tcontext: { postType, postId, queryId },\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { authorId, authorDetails, authors, supportsAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser, getUsers, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _authorId = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t)?.author;\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t\tauthors: getUsers( AUTHORS_QUERY ),\n\t\t\t\tsupportsAuthor:\n\t\t\t\t\tgetPostType( postType )?.supports?.author ?? false,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst {\n\t\ttextAlign,\n\t\tshowAvatar,\n\t\tshowBio,\n\t\tbyline,\n\t\tisLink,\n\t\tlinkTarget,\n\t\tavatarSize,\n\t} = attributes;\n\tconst avatarSizes = [];\n\tconst authorName = authorDetails?.name || __( 'Post Author' );\n\tif ( authorDetails?.avatar_urls ) {\n\t\tObject.keys( authorDetails.avatar_urls ).forEach( ( size ) => {\n\t\t\tavatarSizes.push( {\n\t\t\t\tvalue: size,\n\t\t\t\tlabel: `${ size } x ${ size }`,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst authorOptions = authors?.length\n\t\t? authors.map( ( { id, name } ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: id,\n\t\t\t\t\tlabel: name,\n\t\t\t\t};\n\t\t } )\n\t\t: [];\n\n\tconst handleSelect = ( nextAuthorId ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tauthor: nextAuthorId,\n\t\t} );\n\t};\n\n\tconst showCombobox = authorOptions.length >= minimumUsersForCombobox;\n\tconst showAuthorControl =\n\t\t!! postId && ! isDescendentOfQueryLoop && authorOptions.length > 0;\n\n\tif ( ! supportsAuthor && postType !== undefined ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t__( 'This post type (%s) does not support the author.' ),\n\t\t\t\t\tpostType\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tavatarSize: 48,\n\t\t\t\t\t\t\tshowAvatar: true,\n\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<div style={ { gridColumn: '1 / -1' } }>\n\t\t\t\t\t\t\t{ ( showCombobox && (\n\t\t\t\t\t\t\t\t<ComboboxControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\t\toptions={ authorOptions }\n\t\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\t\tonChange={ handleSelect }\n\t\t\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) || (\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\t\toptions={ authorOptions }\n\t\t\t\t\t\t\t\t\tonChange={ handleSelect }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showAvatar }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showAvatar: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\t\tchecked={ showAvatar }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowAvatar: ! showAvatar,\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</ToolsPanelItem>\n\t\t\t\t\t{ showAvatar && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => avatarSize !== 48 }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: 48 } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\t\toptions={ avatarSizes }\n\t\t\t\t\t\t\t\tonChange={ ( size ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tavatarSize: Number( size ),\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/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! showBio }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showBio: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\t\tchecked={ !! showBio }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showBio: ! showBio } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Link target' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls group=\"block\">\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\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ showAvatar && authorDetails?.avatar_urls && (\n\t\t\t\t\t<div className=\"wp-block-post-author__avatar\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\twidth={ avatarSize }\n\t\t\t\t\t\t\tsrc={ authorDetails.avatar_urls[ avatarSize ] }\n\t\t\t\t\t\t\talt={ authorDetails.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-post-author__content\">\n\t\t\t\t\t{ ( ! RichText.isEmpty( byline ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"byline\"\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__byline\"\n\t\t\t\t\t\t\taria-label={ __( 'Post author byline text' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Write byline…' ) }\n\t\t\t\t\t\t\tvalue={ byline }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { byline: value } )\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<p className=\"wp-block-post-author__name\">\n\t\t\t\t\t\t{ isLink ? (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref=\"#post-author-pseudo-link\"\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ authorName }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tauthorName\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t{ showBio && (\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__bio\"\n\t\t\t\t\t\t\tdanger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AAAU,QAAA,GAC3C,CAAE,CAAEjF,QAAQ,CAACmG,OAAO,CAAE5C,MAAO,CAAC,IAAI5B,UAAU,kBAC7CV,IAAA,CAACjB,QAAQ;UACRoG,UAAU,EAAC,QAAQ;UACnB7B,SAAS,EAAC,8BAA8B;UACxC,cAAa5D,EAAE,CAAE,yBAA0B,CAAG;UAC9C0F,WAAW,EAAG1F,EAAE,CAAE,eAAgB,CAAG;UACrCyD,KAAK,EAAGb,MAAQ;UAChBiC,QAAQ,EAAKpB,KAAK,IACjBnC,aAAa,CAAE;YAAEsB,MAAM,EAAEa;UAAM,CAAE;QACjC,CACD,CACD,eACDnD,IAAA;UAAGsD,SAAS,EAAC,4BAA4B;UAAAU,QAAA,EACtCzB,MAAM,gBACPvC,IAAA;YACCqF,IAAI,EAAC,0BAA0B;YAC/BC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;YAAAxB,QAAA,EAE7CrB;UAAU,CACV,CAAC,GAEJA;QACA,CACC,CAAC,EACFN,OAAO,iBACRrC,IAAA;UACCsD,SAAS,EAAC,2BAA2B;UACrCmC,uBAAuB,EAAG;YACzBC,MAAM,EAAEpE,aAAa,EAAEqE;UACxB;QAAG,CACH,CACD;MAAA,CACG,CAAC;IAAA,CACF,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAelF,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["clsx","AlignmentControl","BlockControls","InspectorControls","RichText","useBlockProps","ComboboxControl","SelectControl","ToggleControl","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","debounce","useMemo","useState","useSelect","useDispatch","__","sprintf","decodeEntities","store","coreStore","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","AUTHORS_QUERY","who","per_page","_fields","context","AuthorCombobox","value","onChange","filterValue","setFilterValue","authors","isLoading","select","getUsers","isResolving","query","search","search_columns","authorOptions","fetchedAuthors","map","author","id","label","name","foundAuthor","findIndex","fetchedAuthor","currentAuthor","__next40pxDefaultSize","__nextHasNoMarginBottom","options","onFilterValueChange","allowReset","PostAuthorEdit","isSelected","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","Number","isFinite","dropdownMenuProps","authorDetails","canAssignAuthor","supportsAuthor","_getPostType$supports","getEditedEntityRecord","getUser","getPostType","currentPost","authorId","supports","_links","editEntityRecord","textAlign","showAvatar","showBio","byline","isLink","linkTarget","avatarSize","avatarSizes","authorName","avatar_urls","Object","keys","forEach","size","push","blockProps","className","handleSelect","nextAuthorId","showAuthorControl","undefined","children","resetAll","style","gridColumn","isShownByDefault","hasValue","onDeselect","checked","group","nextAlign","width","src","alt","isEmpty","identifier","placeholder","href","onClick","event","preventDefault","dangerouslySetInnerHTML","__html","description"],"sources":["@wordpress/block-library/src/post-author/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tComboboxControl,\n\tSelectControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: 100,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nfunction AuthorCombobox( { value, onChange } ) {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst { authors, isLoading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUsers, isResolving } = select( coreStore );\n\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\t\t\tif ( filterValue ) {\n\t\t\t\tquery.search = filterValue;\n\t\t\t\tquery.search_columns = [ 'name' ];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tisLoading: isResolving( 'getUsers', [ query ] ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( fetchedAuthor ) => value?.id === fetchedAuthor.value\n\t\t);\n\n\t\tlet currentAuthor = [];\n\t\tif ( foundAuthor < 0 && value ) {\n\t\t\tcurrentAuthor = [\n\t\t\t\t{\n\t\t\t\t\tvalue: value.id,\n\t\t\t\t\tlabel: decodeEntities( value.name ),\n\t\t\t\t},\n\t\t\t];\n\t\t} else if ( foundAuthor < 0 && ! value ) {\n\t\t\tcurrentAuthor = [\n\t\t\t\t{\n\t\t\t\t\tvalue: 0,\n\t\t\t\t\tlabel: __( '(No author)' ),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn [ ...currentAuthor, ...fetchedAuthors ];\n\t}, [ authors, value ] );\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__next40pxDefaultSize\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ value?.id }\n\t\t\tonFilterValueChange={ debounce( setFilterValue, 300 ) }\n\t\t\tonChange={ onChange }\n\t\t\tallowReset={ false }\n\t\t\tisLoading={ isLoading }\n\t\t/>\n\t);\n}\n\nfunction PostAuthorEdit( {\n\tisSelected,\n\tcontext: { postType, postId, queryId },\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { authorDetails, canAssignAuthor, supportsAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst currentPost = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst authorId = currentPost?.author;\n\n\t\t\treturn {\n\t\t\t\tauthorDetails: authorId\n\t\t\t\t\t? getUser( authorId, { context: 'view' } )\n\t\t\t\t\t: null,\n\t\t\t\tsupportsAuthor:\n\t\t\t\t\tgetPostType( postType )?.supports?.author ?? false,\n\t\t\t\tcanAssignAuthor: currentPost?._links?.[\n\t\t\t\t\t'wp:action-assign-author'\n\t\t\t\t]\n\t\t\t\t\t? true\n\t\t\t\t\t: false,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst {\n\t\ttextAlign,\n\t\tshowAvatar,\n\t\tshowBio,\n\t\tbyline,\n\t\tisLink,\n\t\tlinkTarget,\n\t\tavatarSize,\n\t} = attributes;\n\tconst avatarSizes = [];\n\tconst authorName = authorDetails?.name || __( 'Post Author' );\n\tif ( authorDetails?.avatar_urls ) {\n\t\tObject.keys( authorDetails.avatar_urls ).forEach( ( size ) => {\n\t\t\tavatarSizes.push( {\n\t\t\t\tvalue: size,\n\t\t\t\tlabel: `${ size } x ${ size }`,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst handleSelect = ( nextAuthorId ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tauthor: nextAuthorId,\n\t\t} );\n\t};\n\n\tconst showAuthorControl =\n\t\t!! postId && ! isDescendentOfQueryLoop && canAssignAuthor;\n\n\tif ( ! supportsAuthor && postType !== undefined ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t__( 'This post type (%s) does not support the author.' ),\n\t\t\t\t\tpostType\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tavatarSize: 48,\n\t\t\t\t\t\t\tshowAvatar: true,\n\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<div style={ { gridColumn: '1 / -1' } }>\n\t\t\t\t\t\t\t<AuthorCombobox\n\t\t\t\t\t\t\t\tvalue={ authorDetails }\n\t\t\t\t\t\t\t\tonChange={ handleSelect }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showAvatar }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showAvatar: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\t\tchecked={ showAvatar }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowAvatar: ! showAvatar,\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</ToolsPanelItem>\n\t\t\t\t\t{ showAvatar && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => avatarSize !== 48 }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: 48 } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\t\toptions={ avatarSizes }\n\t\t\t\t\t\t\t\tonChange={ ( size ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tavatarSize: Number( size ),\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/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! showBio }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showBio: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\t\tchecked={ !! showBio }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showBio: ! showBio } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Link target' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls group=\"block\">\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\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ showAvatar && authorDetails?.avatar_urls && (\n\t\t\t\t\t<div className=\"wp-block-post-author__avatar\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\twidth={ avatarSize }\n\t\t\t\t\t\t\tsrc={ authorDetails.avatar_urls[ avatarSize ] }\n\t\t\t\t\t\t\talt={ authorDetails.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-post-author__content\">\n\t\t\t\t\t{ ( ! RichText.isEmpty( byline ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"byline\"\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__byline\"\n\t\t\t\t\t\t\taria-label={ __( 'Post author byline text' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Write byline…' ) }\n\t\t\t\t\t\t\tvalue={ byline }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { byline: value } )\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<p className=\"wp-block-post-author__name\">\n\t\t\t\t\t\t{ isLink ? (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref=\"#post-author-pseudo-link\"\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ authorName }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tauthorName\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t{ showBio && (\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__bio\"\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: authorDetails?.description,\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</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default PostAuthorEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,aAAa,QACP,yBAAyB;AAChC,SACCC,eAAe,EACfC,aAAa,EACbC,aAAa,EACbC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,8BAA8B,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEhE,MAAMC,aAAa,GAAG;EACrBC,GAAG,EAAE,SAAS;EACdC,QAAQ,EAAE,GAAG;EACbC,OAAO,EAAE,SAAS;EAClBC,OA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,EAAEuD;UACxB;QAAG,CACH,CACD;MAAA,CACG,CAAC;IAAA,CACF,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAelE,cAAc","ignoreList":[]}
@@ -73,7 +73,7 @@ const CommentsForm = ({
73
73
  });
74
74
  } else if (!postTypeSupportsComments) {
75
75
  return /*#__PURE__*/_jsx(Warning, {
76
- children: sprintf(/* translators: 1: Post type (i.e. "post", "page") */
76
+ children: sprintf(/* translators: %s: Post type (i.e. "post", "page") */
77
77
  __('Post Comments Form block: Comments are not enabled for this post type (%s).'), postType)
78
78
  });
79
79
  } else if ('open' !== defaultCommentStatus) {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","_x","sprintf","Warning","store","blockEditorStore","__experimentalGetElementClassName","Button","useInstanceId","useEntityProp","coreStore","useSelect","jsx","_jsx","jsxs","_jsxs","CommentsFormPlaceholder","instanceId","className","children","noValidate","onSubmit","event","preventDefault","htmlFor","id","name","cols","rows","readOnly","type","label","value","CommentsForm","postId","postType","commentStatus","setCommentStatus","isSiteEditor","undefined","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","postTypeSupportsComments","getPostType","supports","comments","actions","__next40pxDefaultSize","onClick","variant"],"sources":["@wordpress/block-library/src/post-comments-form/form.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nconst CommentsFormPlaceholder = () => {\n\tconst instanceId = useInstanceId( CommentsFormPlaceholder );\n\n\treturn (\n\t\t<div className=\"comment-respond\">\n\t\t\t<h3 className=\"comment-reply-title\">{ __( 'Leave a Reply' ) }</h3>\n\t\t\t<form\n\t\t\t\tnoValidate\n\t\t\t\tclassName=\"comment-form\"\n\t\t\t\tonSubmit={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t<p>\n\t\t\t\t\t<label htmlFor={ `comment-${ instanceId }` }>\n\t\t\t\t\t\t{ __( 'Comment' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tid={ `comment-${ instanceId }` }\n\t\t\t\t\t\tname=\"comment\"\n\t\t\t\t\t\tcols=\"45\"\n\t\t\t\t\t\trows=\"8\"\n\t\t\t\t\t\treadOnly\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t\t<p className=\"form-submit wp-block-button\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tname=\"submit\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Post Comment' ) }\n\t\t\t\t\t\tvalue={ __( 'Post Comment' ) }\n\t\t\t\t\t\taria-disabled=\"true\"\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t</form>\n\t\t</div>\n\t);\n};\n\nconst CommentsForm = ( { postId, postType } ) => {\n\tconst [ commentStatus, setCommentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst { defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\tconst actions = [\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tkey=\"enableComments\"\n\t\t\t\t\tonClick={ () => setCommentStatus( 'open' ) }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ _x(\n\t\t\t\t\t\t'Enable comments',\n\t\t\t\t\t\t'action that affects the current post'\n\t\t\t\t\t) }\n\t\t\t\t</Button>,\n\t\t\t];\n\t\t\treturn (\n\t\t\t\t<Warning actions={ actions }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Post Comments Form block: Comments are not enabled for this item.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t);\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\treturn (\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Post Comments Form block: Comments are not enabled for this post type (%s).'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpostType\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t);\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\treturn (\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Post Comments Form block: Comments are not enabled.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t);\n\t\t}\n\t}\n\n\treturn <CommentsFormPlaceholder />;\n};\n\nexport default CommentsForm;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,OAAO,EACPC,KAAK,IAAIC,gBAAgB,EACzBC,iCAAiC,QAC3B,yBAAyB;AAChC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,QAAQ,oBA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AAK,MAAM,KAAKK,oBAAoB,EAAG;MAC7C,oBACC3B,IAAA,CAACV,OAAO;QAAAgB,QAAA,EACLnB,EAAE,CACH,qDACD;MAAC,CACO,CAAC;IAEZ;EACD;EAEA,oBAAOa,IAAA,CAACG,uBAAuB,IAAE,CAAC;AACnC,CAAC;AAED,eAAeiB,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","_x","sprintf","Warning","store","blockEditorStore","__experimentalGetElementClassName","Button","useInstanceId","useEntityProp","coreStore","useSelect","jsx","_jsx","jsxs","_jsxs","CommentsFormPlaceholder","instanceId","className","children","noValidate","onSubmit","event","preventDefault","htmlFor","id","name","cols","rows","readOnly","type","label","value","CommentsForm","postId","postType","commentStatus","setCommentStatus","isSiteEditor","undefined","defaultCommentStatus","select","getSettings","__experimentalDiscussionSettings","postTypeSupportsComments","getPostType","supports","comments","actions","__next40pxDefaultSize","onClick","variant"],"sources":["@wordpress/block-library/src/post-comments-form/form.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nconst CommentsFormPlaceholder = () => {\n\tconst instanceId = useInstanceId( CommentsFormPlaceholder );\n\n\treturn (\n\t\t<div className=\"comment-respond\">\n\t\t\t<h3 className=\"comment-reply-title\">{ __( 'Leave a Reply' ) }</h3>\n\t\t\t<form\n\t\t\t\tnoValidate\n\t\t\t\tclassName=\"comment-form\"\n\t\t\t\tonSubmit={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t<p>\n\t\t\t\t\t<label htmlFor={ `comment-${ instanceId }` }>\n\t\t\t\t\t\t{ __( 'Comment' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tid={ `comment-${ instanceId }` }\n\t\t\t\t\t\tname=\"comment\"\n\t\t\t\t\t\tcols=\"45\"\n\t\t\t\t\t\trows=\"8\"\n\t\t\t\t\t\treadOnly\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t\t<p className=\"form-submit wp-block-button\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tname=\"submit\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Post Comment' ) }\n\t\t\t\t\t\tvalue={ __( 'Post Comment' ) }\n\t\t\t\t\t\taria-disabled=\"true\"\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t</form>\n\t\t</div>\n\t);\n};\n\nconst CommentsForm = ( { postId, postType } ) => {\n\tconst [ commentStatus, setCommentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst { defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\tconst actions = [\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tkey=\"enableComments\"\n\t\t\t\t\tonClick={ () => setCommentStatus( 'open' ) }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ _x(\n\t\t\t\t\t\t'Enable comments',\n\t\t\t\t\t\t'action that affects the current post'\n\t\t\t\t\t) }\n\t\t\t\t</Button>,\n\t\t\t];\n\t\t\treturn (\n\t\t\t\t<Warning actions={ actions }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Post Comments Form block: Comments are not enabled for this item.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t);\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\treturn (\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Post Comments Form block: Comments are not enabled for this post type (%s).'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpostType\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t);\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\treturn (\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Post Comments Form block: Comments are not enabled.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t);\n\t\t}\n\t}\n\n\treturn <CommentsFormPlaceholder />;\n};\n\nexport default CommentsForm;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,OAAO,EACPC,KAAK,IAAIC,gBAAgB,EACzBC,iCAAiC,QAC3B,yBAAyB;AAChC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,aAAa,EAAEL,KAAK,IAAIM,SAAS,QAAQ,sBAAsB;AACxE,SAASC,SAAS,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5C,MAAMC,uBAAu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