@wordpress/block-library 7.3.10 → 7.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/build/avatar/hooks.js +2 -2
  2. package/build/avatar/hooks.js.map +1 -1
  3. package/build/columns/index.js +3 -1
  4. package/build/columns/index.js.map +1 -1
  5. package/build/comment-author-name/edit.js +3 -3
  6. package/build/comment-author-name/edit.js.map +1 -1
  7. package/build/comment-author-name/index.js +0 -4
  8. package/build/comment-author-name/index.js.map +1 -1
  9. package/build/comment-date/edit.js +4 -4
  10. package/build/comment-date/edit.js.map +1 -1
  11. package/build/comment-date/index.js +0 -4
  12. package/build/comment-date/index.js.map +1 -1
  13. package/build/comment-edit-link/index.js +0 -4
  14. package/build/comment-edit-link/index.js.map +1 -1
  15. package/build/comment-reply-link/index.js +0 -4
  16. package/build/comment-reply-link/index.js.map +1 -1
  17. package/build/comments-query-loop/edit.js +10 -2
  18. package/build/comments-query-loop/edit.js.map +1 -1
  19. package/build/gallery/gap-styles.js +14 -4
  20. package/build/gallery/gap-styles.js.map +1 -1
  21. package/build/image/edit.js +5 -56
  22. package/build/image/edit.js.map +1 -1
  23. package/build/image/image.js +4 -15
  24. package/build/image/image.js.map +1 -1
  25. package/build/latest-posts/edit.js +30 -4
  26. package/build/latest-posts/edit.js.map +1 -1
  27. package/build/media-text/edit.js +0 -1
  28. package/build/media-text/edit.js.map +1 -1
  29. package/build/navigation/edit/index.js +81 -80
  30. package/build/navigation/edit/index.js.map +1 -1
  31. package/build/post-comments/edit.js +12 -33
  32. package/build/post-comments/edit.js.map +1 -1
  33. package/build/post-comments-form/edit.js +46 -25
  34. package/build/post-comments-form/edit.js.map +1 -1
  35. package/build/post-comments-form/form.js +48 -0
  36. package/build/post-comments-form/form.js.map +1 -0
  37. package/build-module/avatar/hooks.js +2 -2
  38. package/build-module/avatar/hooks.js.map +1 -1
  39. package/build-module/columns/index.js +3 -1
  40. package/build-module/columns/index.js.map +1 -1
  41. package/build-module/comment-author-name/edit.js +3 -3
  42. package/build-module/comment-author-name/edit.js.map +1 -1
  43. package/build-module/comment-author-name/index.js +0 -4
  44. package/build-module/comment-author-name/index.js.map +1 -1
  45. package/build-module/comment-date/edit.js +4 -4
  46. package/build-module/comment-date/edit.js.map +1 -1
  47. package/build-module/comment-date/index.js +0 -4
  48. package/build-module/comment-date/index.js.map +1 -1
  49. package/build-module/comment-edit-link/index.js +0 -4
  50. package/build-module/comment-edit-link/index.js.map +1 -1
  51. package/build-module/comment-reply-link/index.js +0 -4
  52. package/build-module/comment-reply-link/index.js.map +1 -1
  53. package/build-module/comments-query-loop/edit.js +10 -2
  54. package/build-module/comments-query-loop/edit.js.map +1 -1
  55. package/build-module/gallery/gap-styles.js +14 -4
  56. package/build-module/gallery/gap-styles.js.map +1 -1
  57. package/build-module/image/edit.js +4 -52
  58. package/build-module/image/edit.js.map +1 -1
  59. package/build-module/image/image.js +5 -16
  60. package/build-module/image/image.js.map +1 -1
  61. package/build-module/latest-posts/edit.js +29 -5
  62. package/build-module/latest-posts/edit.js.map +1 -1
  63. package/build-module/media-text/edit.js +0 -1
  64. package/build-module/media-text/edit.js.map +1 -1
  65. package/build-module/navigation/edit/index.js +81 -80
  66. package/build-module/navigation/edit/index.js.map +1 -1
  67. package/build-module/post-comments/edit.js +12 -34
  68. package/build-module/post-comments/edit.js.map +1 -1
  69. package/build-module/post-comments-form/edit.js +47 -28
  70. package/build-module/post-comments-form/edit.js.map +1 -1
  71. package/build-module/post-comments-form/form.js +39 -0
  72. package/build-module/post-comments-form/form.js.map +1 -0
  73. package/build-style/editor-rtl.css +3 -0
  74. package/build-style/editor.css +3 -0
  75. package/build-style/navigation/style-rtl.css +3 -0
  76. package/build-style/navigation/style.css +3 -0
  77. package/build-style/post-comments-form/editor-rtl.css +3 -0
  78. package/build-style/post-comments-form/editor.css +3 -0
  79. package/build-style/style-rtl.css +3 -0
  80. package/build-style/style.css +3 -0
  81. package/package.json +7 -7
  82. package/src/avatar/hooks.js +9 -6
  83. package/src/columns/block.json +3 -1
  84. package/src/comment-author-name/block.json +0 -4
  85. package/src/comment-author-name/edit.js +3 -12
  86. package/src/comment-date/block.json +0 -4
  87. package/src/comment-date/edit.js +10 -14
  88. package/src/comment-date/index.php +0 -3
  89. package/src/comment-edit-link/block.json +0 -4
  90. package/src/comment-reply-link/block.json +0 -4
  91. package/src/comments-query-loop/edit.js +24 -4
  92. package/src/cover/index.php +9 -6
  93. package/src/gallery/gap-styles.js +21 -6
  94. package/src/gallery/index.php +24 -4
  95. package/src/image/edit.js +0 -44
  96. package/src/image/image.js +3 -14
  97. package/src/latest-posts/edit.js +27 -2
  98. package/src/media-text/edit.js +0 -1
  99. package/src/navigation/edit/index.js +140 -143
  100. package/src/navigation/style.scss +3 -0
  101. package/src/post-comments/edit.js +13 -42
  102. package/src/post-comments-form/edit.js +65 -59
  103. package/src/post-comments-form/editor.scss +4 -0
  104. package/src/post-comments-form/form.js +43 -0
  105. package/src/post-template/index.php +15 -3
@@ -93,8 +93,8 @@ function useUserAvatar(_ref2) {
93
93
  authorDetails: _authorId ? getUser(_authorId) : null
94
94
  };
95
95
  }, [postType, postId, userId]);
96
- const avatarUrls = authorDetails ? Object.values(authorDetails.avatar_urls) : null;
97
- const sizes = authorDetails ? Object.keys(authorDetails.avatar_urls) : null;
96
+ const avatarUrls = authorDetails && authorDetails !== null && authorDetails !== void 0 && authorDetails.avatar_urls ? Object.values(authorDetails.avatar_urls) : null;
97
+ const sizes = authorDetails && authorDetails !== null && authorDetails !== void 0 && authorDetails.avatar_urls ? Object.keys(authorDetails.avatar_urls) : null;
98
98
  const {
99
99
  minSize,
100
100
  maxSize
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/avatar/hooks.js"],"names":["getAvatarSizes","sizes","minSize","maxSize","length","maxSizeBuffer","Math","floor","useDefaultAvatar","avatarURL","defaultAvatarUrl","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","useCommentAvatar","commentId","avatars","authorName","avatarUrls","Object","values","keys","defaultAvatar","src","alt","useUserAvatar","userId","postId","postType","authorDetails","getEditedEntityRecord","getUser","coreStore","_authorId","author","avatar_urls","name"],"mappings":";;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AAChC,QAAMC,OAAO,GAAGD,KAAK,GAAGA,KAAK,CAAE,CAAF,CAAR,GAAgB,EAArC;AACA,QAAME,OAAO,GAAGF,KAAK,GAAGA,KAAK,CAAEA,KAAK,CAACG,MAAN,GAAe,CAAjB,CAAR,GAA+B,EAApD;AACA,QAAMC,aAAa,GAAGC,IAAI,CAACC,KAAL,CAAYJ,OAAO,GAAG,GAAtB,CAAtB;AACA,SAAO;AACND,IAAAA,OADM;AAENC,IAAAA,OAAO,EAAEE;AAFH,GAAP;AAIA;;AAED,SAASG,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA,SAAS,EAAEC;AAAb,MAAkC,qBAAaC,MAAF,IAAc;AAChE,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEE,kBAAF,CAA9B;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAuCF,WAAW,EAAxD;AACA,WAAOE,gCAAP;AACA,GAJuC,CAAxC;AAKA,SAAOJ,gBAAP;AACA;;AAEM,SAASK,gBAAT,OAA2C;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AACjD,QAAM,CAAEC,OAAF,IAAc,6BACnB,MADmB,EAEnB,SAFmB,EAGnB,oBAHmB,EAInBD,SAJmB,CAApB;AAOA,QAAM,CAAEE,UAAF,IAAiB,6BACtB,MADsB,EAEtB,SAFsB,EAGtB,aAHsB,EAItBF,SAJsB,CAAvB;AAMA,QAAMG,UAAU,GAAGF,OAAO,GAAGG,MAAM,CAACC,MAAP,CAAeJ,OAAf,CAAH,GAA8B,IAAxD;AACA,QAAMhB,KAAK,GAAGgB,OAAO,GAAGG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B,GAE7B,IAFH;AAGA,QAAMnC,KAAK,GAAG6B,aAAa,GACxBV,MAAM,CAACE,IAAP,CAAaQ,aAAa,CAACM,WAA3B,CADwB,GAExB,IAFH;AAGA,QAAM;AAAElC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAuBH,cAAc,CAAEC,KAAF,CAA3C;AACA,QAAMsB,aAAa,GAAGf,gBAAgB,EAAtC;AACA,SAAO;AACNgB,IAAAA,GAAG,EAAEL,UAAU,GAAGA,UAAU,CAAEA,UAAU,CAACf,MAAX,GAAoB,CAAtB,CAAb,GAAyCmB,aADlD;AAENrB,IAAAA,OAFM;AAGNC,IAAAA,OAHM;AAINsB,IAAAA,GAAG,EAAEK,aAAa,GACf;AACA,uBAAS,cAAI,WAAJ,CAAT,EAA4BA,aAA5B,aAA4BA,aAA5B,uBAA4BA,aAAa,CAAEO,IAA3C,CAFe,GAGf,cAAI,gBAAJ;AAPG,GAAP;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore, useEntityProp } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\nfunction getAvatarSizes( sizes ) {\n\tconst minSize = sizes ? sizes[ 0 ] : 24;\n\tconst maxSize = sizes ? sizes[ sizes.length - 1 ] : 96;\n\tconst maxSizeBuffer = Math.floor( maxSize * 2.5 );\n\treturn {\n\t\tminSize,\n\t\tmaxSize: maxSizeBuffer,\n\t};\n}\n\nfunction useDefaultAvatar() {\n\tconst { avatarURL: defaultAvatarUrl } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings;\n\t} );\n\treturn defaultAvatarUrl;\n}\n\nexport function useCommentAvatar( { commentId } ) {\n\tconst [ avatars ] = useEntityProp(\n\t\t'root',\n\t\t'comment',\n\t\t'author_avatar_urls',\n\t\tcommentId\n\t);\n\n\tconst [ authorName ] = useEntityProp(\n\t\t'root',\n\t\t'comment',\n\t\t'author_name',\n\t\tcommentId\n\t);\n\tconst avatarUrls = avatars ? Object.values( avatars ) : null;\n\tconst sizes = avatars ? Object.keys( avatars ) : null;\n\tconst { minSize, maxSize } = getAvatarSizes( sizes );\n\tconst defaultAvatar = useDefaultAvatar();\n\treturn {\n\t\tsrc: avatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : defaultAvatar,\n\t\tminSize,\n\t\tmaxSize,\n\t\t// translators: %s is the Author name.\n\t\talt: authorName\n\t\t\t? // translators: %s is the Author name.\n\t\t\t sprintf( __( '%s Avatar' ), authorName )\n\t\t\t: __( 'Default Avatar' ),\n\t};\n}\n\nexport function useUserAvatar( { userId, postId, postType } ) {\n\tconst { authorDetails } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser } = select( coreStore );\n\t\t\tif ( userId ) {\n\t\t\t\treturn {\n\t\t\t\t\tauthorDetails: getUser( userId ),\n\t\t\t\t};\n\t\t\t}\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\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, userId ]\n\t);\n\tconst avatarUrls = authorDetails\n\t\t? Object.values( authorDetails.avatar_urls )\n\t\t: null;\n\tconst sizes = authorDetails\n\t\t? Object.keys( authorDetails.avatar_urls )\n\t\t: null;\n\tconst { minSize, maxSize } = getAvatarSizes( sizes );\n\tconst defaultAvatar = useDefaultAvatar();\n\treturn {\n\t\tsrc: avatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : defaultAvatar,\n\t\tminSize,\n\t\tmaxSize,\n\t\talt: authorDetails\n\t\t\t? // translators: %s is the Author name.\n\t\t\t sprintf( __( '%s Avatar' ), authorDetails?.name )\n\t\t\t: __( 'Default Avatar' ),\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/avatar/hooks.js"],"names":["getAvatarSizes","sizes","minSize","maxSize","length","maxSizeBuffer","Math","floor","useDefaultAvatar","avatarURL","defaultAvatarUrl","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","useCommentAvatar","commentId","avatars","authorName","avatarUrls","Object","values","keys","defaultAvatar","src","alt","useUserAvatar","userId","postId","postType","authorDetails","getEditedEntityRecord","getUser","coreStore","_authorId","author","avatar_urls","name"],"mappings":";;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AAChC,QAAMC,OAAO,GAAGD,KAAK,GAAGA,KAAK,CAAE,CAAF,CAAR,GAAgB,EAArC;AACA,QAAME,OAAO,GAAGF,KAAK,GAAGA,KAAK,CAAEA,KAAK,CAACG,MAAN,GAAe,CAAjB,CAAR,GAA+B,EAApD;AACA,QAAMC,aAAa,GAAGC,IAAI,CAACC,KAAL,CAAYJ,OAAO,GAAG,GAAtB,CAAtB;AACA,SAAO;AACND,IAAAA,OADM;AAENC,IAAAA,OAAO,EAAEE;AAFH,GAAP;AAIA;;AAED,SAASG,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA,SAAS,EAAEC;AAAb,MAAkC,qBAAaC,MAAF,IAAc;AAChE,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEE,kBAAF,CAA9B;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAuCF,WAAW,EAAxD;AACA,WAAOE,gCAAP;AACA,GAJuC,CAAxC;AAKA,SAAOJ,gBAAP;AACA;;AAEM,SAASK,gBAAT,OAA2C;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AACjD,QAAM,CAAEC,OAAF,IAAc,6BACnB,MADmB,EAEnB,SAFmB,EAGnB,oBAHmB,EAInBD,SAJmB,CAApB;AAOA,QAAM,CAAEE,UAAF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,SAAF,CAAV,GAA0B;AAD5C,KAAP;AAGA,GAjBwB,EAkBzB,CAAEL,QAAF,EAAYD,MAAZ,EAAoBD,MAApB,CAlByB,CAA1B;AAqBA,QAAMR,UAAU,GACfW,aAAa,IAAIA,aAAJ,aAAIA,aAAJ,eAAIA,aAAa,CAAEM,WAAhC,GACGhB,MAAM,CAACC,MAAP,CAAeS,aAAa,CAACM,WAA7B,CADH,GAEG,IAHJ;AAIA,QAAMnC,KAAK,GACV6B,aAAa,IAAIA,aAAJ,aAAIA,aAAJ,eAAIA,aAAa,CAAEM,WAAhC,GACGhB,MAAM,CAACE,IAAP,CAAaQ,aAAa,CAACM,WAA3B,CADH,GAEG,IAHJ;AAIA,QAAM;AAAElC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAuBH,cAAc,CAAEC,KAAF,CAA3C;AACA,QAAMsB,aAAa,GAAGf,gBAAgB,EAAtC;AACA,SAAO;AACNgB,IAAAA,GAAG,EAAEL,UAAU,GAAGA,UAAU,CAAEA,UAAU,CAACf,MAAX,GAAoB,CAAtB,CAAb,GAAyCmB,aADlD;AAENrB,IAAAA,OAFM;AAGNC,IAAAA,OAHM;AAINsB,IAAAA,GAAG,EAAEK,aAAa,GACf;AACA,uBAAS,cAAI,WAAJ,CAAT,EAA4BA,aAA5B,aAA4BA,aAA5B,uBAA4BA,aAAa,CAAEO,IAA3C,CAFe,GAGf,cAAI,gBAAJ;AAPG,GAAP;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore, useEntityProp } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\nfunction getAvatarSizes( sizes ) {\n\tconst minSize = sizes ? sizes[ 0 ] : 24;\n\tconst maxSize = sizes ? sizes[ sizes.length - 1 ] : 96;\n\tconst maxSizeBuffer = Math.floor( maxSize * 2.5 );\n\treturn {\n\t\tminSize,\n\t\tmaxSize: maxSizeBuffer,\n\t};\n}\n\nfunction useDefaultAvatar() {\n\tconst { avatarURL: defaultAvatarUrl } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings;\n\t} );\n\treturn defaultAvatarUrl;\n}\n\nexport function useCommentAvatar( { commentId } ) {\n\tconst [ avatars ] = useEntityProp(\n\t\t'root',\n\t\t'comment',\n\t\t'author_avatar_urls',\n\t\tcommentId\n\t);\n\n\tconst [ authorName ] = useEntityProp(\n\t\t'root',\n\t\t'comment',\n\t\t'author_name',\n\t\tcommentId\n\t);\n\tconst avatarUrls = avatars ? Object.values( avatars ) : null;\n\tconst sizes = avatars ? Object.keys( avatars ) : null;\n\tconst { minSize, maxSize } = getAvatarSizes( sizes );\n\tconst defaultAvatar = useDefaultAvatar();\n\treturn {\n\t\tsrc: avatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : defaultAvatar,\n\t\tminSize,\n\t\tmaxSize,\n\t\t// translators: %s is the Author name.\n\t\talt: authorName\n\t\t\t? // translators: %s is the Author name.\n\t\t\t sprintf( __( '%s Avatar' ), authorName )\n\t\t\t: __( 'Default Avatar' ),\n\t};\n}\n\nexport function useUserAvatar( { userId, postId, postType } ) {\n\tconst { authorDetails } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser } = select( coreStore );\n\t\t\tif ( userId ) {\n\t\t\t\treturn {\n\t\t\t\t\tauthorDetails: getUser( userId ),\n\t\t\t\t};\n\t\t\t}\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\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, userId ]\n\t);\n\n\tconst avatarUrls =\n\t\tauthorDetails && authorDetails?.avatar_urls\n\t\t\t? Object.values( authorDetails.avatar_urls )\n\t\t\t: null;\n\tconst sizes =\n\t\tauthorDetails && authorDetails?.avatar_urls\n\t\t\t? Object.keys( authorDetails.avatar_urls )\n\t\t\t: null;\n\tconst { minSize, maxSize } = getAvatarSizes( sizes );\n\tconst defaultAvatar = useDefaultAvatar();\n\treturn {\n\t\tsrc: avatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : defaultAvatar,\n\t\tminSize,\n\t\tmaxSize,\n\t\talt: authorDetails\n\t\t\t? // translators: %s is the Author name.\n\t\t\t sprintf( __( '%s Avatar' ), authorDetails?.name )\n\t\t\t: __( 'Default Avatar' ),\n\t};\n}\n"]}
@@ -58,7 +58,9 @@ const metadata = {
58
58
  }
59
59
  },
60
60
  spacing: {
61
- blockGap: true,
61
+ blockGap: {
62
+ __experimentalDefault: "2em"
63
+ },
62
64
  margin: ["top", "bottom"],
63
65
  padding: true,
64
66
  __experimentalDefaultControls: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/columns/index.js"],"names":["name","metadata","settings","icon","variations","example","viewportWidth","innerBlocks","attributes","content","url","deprecated","edit","save","transforms"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,cADuB;AAEvBC,EAAAA,UAAU,EAAVA,mBAFuB;AAGvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,aAAa,EAAE,GADP;AACY;AACpBC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,aADP;AAECO,MAAAA,WAAW,EAAE,CACZ;AACCP,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,qFADQ;AAFE;AAFb,OADY,EAUZ;AACCT,QAAAA,IAAI,EAAE,YADP;AAECQ,QAAAA,UAAU,EAAE;AACXE,UAAAA,GAAG,EACF;AAFU;AAFb,OAVY,EAiBZ;AACCV,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,6DADQ;AAFE;AAFb,OAjBY;AAFd,KADY,EA+BZ;AACCT,MAAAA,IAAI,EAAE,aADP;AAECO,MAAAA,WAAW,EAAE,CACZ;AACCP,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,+JADQ;AAFE;AAFb,OADY,EAUZ;AACCT,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,yGADQ;AAFE;AAFb,OAVY;AAFd,KA/BY;AAFL,GAHc;AA6DvBE,EAAAA,UAAU,EAAVA,mBA7DuB;AA8DvBC,EAAAA,IAAI,EAAJA,aA9DuB;AA+DvBC,EAAAA,IAAI,EAAJA,aA/DuB;AAgEvBC,EAAAA,UAAU,EAAVA;AAhEuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { columns as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tvariations,\n\texample: {\n\t\tviewportWidth: 600, // Columns collapse \"@media (max-width: 599px)\".\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.'\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{\n\t\t\t\t\t\tname: 'core/image',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\turl:\n\t\t\t\t\t\t\t\t'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Suspendisse commodo neque lacus, a dictum orci interdum et.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.'\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{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tdeprecated,\n\tedit,\n\tsave,\n\ttransforms,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/columns/index.js"],"names":["name","metadata","settings","icon","variations","example","viewportWidth","innerBlocks","attributes","content","url","deprecated","edit","save","transforms"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,cADuB;AAEvBC,EAAAA,UAAU,EAAVA,mBAFuB;AAGvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,aAAa,EAAE,GADP;AACY;AACpBC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,aADP;AAECO,MAAAA,WAAW,EAAE,CACZ;AACCP,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,qFADQ;AAFE;AAFb,OADY,EAUZ;AACCT,QAAAA,IAAI,EAAE,YADP;AAECQ,QAAAA,UAAU,EAAE;AACXE,UAAAA,GAAG,EACF;AAFU;AAFb,OAVY,EAiBZ;AACCV,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,6DADQ;AAFE;AAFb,OAjBY;AAFd,KADY,EA+BZ;AACCT,MAAAA,IAAI,EAAE,aADP;AAECO,MAAAA,WAAW,EAAE,CACZ;AACCP,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,+JADQ;AAFE;AAFb,OADY,EAUZ;AACCT,QAAAA,IAAI,EAAE,gBADP;AAECQ,QAAAA,UAAU,EAAE;AACX;AACAC,UAAAA,OAAO,EAAE,cACR,yGADQ;AAFE;AAFb,OAVY;AAFd,KA/BY;AAFL,GAHc;AA6DvBE,EAAAA,UAAU,EAAVA,mBA7DuB;AA8DvBC,EAAAA,IAAI,EAAJA,aA9DuB;AA+DvBC,EAAAA,IAAI,EAAJA,aA/DuB;AAgEvBC,EAAAA,UAAU,EAAVA;AAhEuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { columns as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tvariations,\n\texample: {\n\t\tviewportWidth: 600, // Columns collapse \"@media (max-width: 599px)\".\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.'\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{\n\t\t\t\t\t\tname: 'core/image',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\turl:\n\t\t\t\t\t\t\t\t'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Suspendisse commodo neque lacus, a dictum orci interdum et.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.'\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{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tdeprecated,\n\tedit,\n\tsave,\n\ttransforms,\n};\n"]}
@@ -60,7 +60,7 @@ function Edit(_ref) {
60
60
  [`has-text-align-${textAlign}`]: textAlign
61
61
  })
62
62
  });
63
- const displayName = (0, _data.useSelect)(select => {
63
+ let displayName = (0, _data.useSelect)(select => {
64
64
  const {
65
65
  getEntityRecord
66
66
  } = select(_coreData.store);
@@ -101,13 +101,13 @@ function Edit(_ref) {
101
101
  })));
102
102
 
103
103
  if (!commentId || !displayName) {
104
- return (0, _element.createElement)(_element.Fragment, null, inspectorControls, blockControls, (0, _element.createElement)("div", blockProps, (0, _element.createElement)("p", null, (0, _i18n._x)('Comment Author', 'block title'))));
104
+ displayName = (0, _i18n._x)('Comment Author', 'block title');
105
105
  }
106
106
 
107
107
  const displayAuthor = isLink ? (0, _element.createElement)("a", {
108
108
  href: "#comment-author-pseudo-link",
109
109
  onClick: event => event.preventDefault()
110
- }, displayName) : (0, _element.createElement)("p", null, displayName);
110
+ }, displayName) : displayName;
111
111
  return (0, _element.createElement)(_element.Fragment, null, inspectorControls, blockControls, (0, _element.createElement)("div", blockProps, displayAuthor));
112
112
  }
113
113
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comment-author-name/edit.js"],"names":["Edit","attributes","isLink","linkTarget","textAlign","context","commentId","setAttributes","blockProps","className","displayName","select","getEntityRecord","coreStore","comment","authorName","author_name","user","author","name","blockControls","newAlign","inspectorControls","value","displayAuthor","event","preventDefault"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,IAAT,OAIX;AAAA,MAJ0B;AAC7BC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,UAAV;AAAsBC,MAAAA;AAAtB,KADiB;AAE7BC,IAAAA,OAAO,EAAE;AAAEC,MAAAA;AAAF,KAFoB;AAG7BC,IAAAA;AAH6B,GAI1B;AACH,QAAMC,UAAU,GAAG,gCAAe;AACjCC,IAAAA,SAAS,EAAE,yBAAY;AACtB,OAAG,kBAAkBL,SAAW,EAAhC,GAAqCA;AADf,KAAZ;AADsB,GAAf,CAAnB;AAKA,QAAMM,WAAW,GAAG,qBACjBC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,eAAF,CAAlC;AAEA,UAAMC,OAAO,GAAGF,eAAe,CAAE,MAAF,EAAU,SAAV,EAAqBN,SAArB,CAA/B;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AK,CAAEG,SAAF,IAAe,CAAEI,WAAtB,EAAoC;AACnC,WACC,qDACGY,iBADH,EAEGF,aAFH,EAGC,mCAAUZ,UAAV,EACC,uCAAK,cAAI,gBAAJ,EAAsB,aAAtB,CAAL,CADD,CAHD,CADD;AASA;;AAED,QAAMgB,aAAa,GAAGtB,MAAM,GAC3B;AACC,IAAA,IAAI,EAAC,6BADN;AAEC,IAAA,OAAO,EAAKuB,KAAF,IAAaA,KAAK,CAACC,cAAN;AAFxB,KAIGhB,WAJH,CAD2B,GAQ3B,uCAAKA,WAAL,CARD;AAWA,SACC,qDACGY,iBADH,EAEGF,aAFH,EAGC,mCAAUZ,UAAV,EAAyBgB,aAAzB,CAHD,CADD;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\n\n/**\n * Renders the `core/comment-author-name` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {string} props.attributes.linkTarget Target of the link.\n * @param {string} props.attributes.textAlign Text alignment.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { isLink, linkTarget, textAlign },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\tconst displayName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\tconst comment = getEntityRecord( 'root', 'comment', commentId );\n\t\t\tconst authorName = comment?.author_name; // eslint-disable-line camelcase\n\n\t\t\tif ( comment && ! authorName ) {\n\t\t\t\tconst user = getEntityRecord( 'root', 'user', comment.author );\n\t\t\t\treturn user?.name ?? __( 'Anonymous' );\n\t\t\t}\n\t\t\treturn authorName ?? '';\n\t\t},\n\t\t[ commentId ]\n\t);\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\tchecked={ isLink }\n\t\t\t\t/>\n\t\t\t\t{ isLink && (\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! displayName ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t{ blockControls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>{ _x( 'Comment Author', 'block title' ) }</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst displayAuthor = isLink ? (\n\t\t<a\n\t\t\thref=\"#comment-author-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ displayName }\n\t\t</a>\n\t) : (\n\t\t<p>{ displayName }</p>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t{ blockControls }\n\t\t\t<div { ...blockProps }>{ displayAuthor }</div>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comment-author-name/edit.js"],"names":["Edit","attributes","isLink","linkTarget","textAlign","context","commentId","setAttributes","blockProps","className","displayName","select","getEntityRecord","coreStore","comment","authorName","author_name","user","author","name","blockControls","newAlign","inspectorControls","value","displayAuthor","event","preventDefault"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,IAAT,OAIX;AAAA,MAJ0B;AAC7BC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,UAAV;AAAsBC,MAAAA;AAAtB,KADiB;AAE7BC,IAAAA,OAAO,EAAE;AAAEC,MAAAA;AAAF,KAFoB;AAG7BC,IAAAA;AAH6B,GAI1B;AACH,QAAMC,UAAU,GAAG,gCAAe;AACjCC,IAAAA,SAAS,EAAE,yBAAY;AACtB,OAAG,kBAAkBL,SAAW,EAAhC,GAAqCA;AADf,KAAZ;AADsB,GAAf,CAAnB;AAKA,MAAIM,WAAW,GAAG,qBACfC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,eAAF,CAAlC;AAEA,UAAMC,OAAO,GAAGF,eAAe,CAAE,MAAF,EAAU,SAAV,EAAqBN,SAArB,CAA/B;AACA,UAAMS,UAAU,GAAGD,OAAH,aAAGA,OAAH,uBAAGA,OAAO,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,WAAW,GAAG,cAAI,gBAAJ,EAAsB,aAAtB,CAAd;AACA;;AAED,QAAMc,aAAa,GAAGtB,MAAM,GAC3B;AACC,IAAA,IAAI,EAAC,6BADN;AAEC,IAAA,OAAO,EAAKuB,KAAF,IAAaA,KAAK,CAACC,cAAN;AAFxB,KAIGhB,WAJH,CAD2B,GAQ3BA,WARD;AAUA,SACC,qDACGY,iBADH,EAEGF,aAFH,EAGC,mCAAUZ,UAAV,EAAyBgB,aAAzB,CAHD,CADD;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\n\n/**\n * Renders the `core/comment-author-name` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {string} props.attributes.linkTarget Target of the link.\n * @param {string} props.attributes.textAlign Text alignment.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { isLink, linkTarget, textAlign },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\tlet displayName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\tconst comment = getEntityRecord( 'root', 'comment', commentId );\n\t\t\tconst authorName = comment?.author_name; // eslint-disable-line camelcase\n\n\t\t\tif ( comment && ! authorName ) {\n\t\t\t\tconst user = getEntityRecord( 'root', 'user', comment.author );\n\t\t\t\treturn user?.name ?? __( 'Anonymous' );\n\t\t\t}\n\t\t\treturn authorName ?? '';\n\t\t},\n\t\t[ commentId ]\n\t);\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\tchecked={ isLink }\n\t\t\t\t/>\n\t\t\t\t{ isLink && (\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! displayName ) {\n\t\tdisplayName = _x( 'Comment Author', 'block title' );\n\t}\n\n\tconst displayAuthor = isLink ? (\n\t\t<a\n\t\t\thref=\"#comment-author-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ displayName }\n\t\t</a>\n\t) : (\n\t\tdisplayName\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t{ blockControls }\n\t\t\t<div { ...blockProps }>{ displayAuthor }</div>\n\t\t</>\n\t);\n}\n"]}
@@ -40,10 +40,6 @@ const metadata = {
40
40
  },
41
41
  textAlign: {
42
42
  type: "string"
43
- },
44
- fontSize: {
45
- type: "string",
46
- "default": "small"
47
43
  }
48
44
  },
49
45
  usesContext: ["commentId"],
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comment-author-name/index.js"],"names":["name","metadata","settings","icon","edit","deprecated"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,wBADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,UAAU,EAAVA;AAHuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentAuthorName as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comment-author-name/index.js"],"names":["name","metadata","settings","icon","edit","deprecated"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,wBADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,UAAU,EAAVA;AAHuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentAuthorName as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n};\n"]}
@@ -46,7 +46,7 @@ function Edit(_ref) {
46
46
  setAttributes
47
47
  } = _ref;
48
48
  const blockProps = (0, _blockEditor.useBlockProps)();
49
- const [date] = (0, _coreData.useEntityProp)('root', 'comment', 'date', commentId);
49
+ let [date] = (0, _coreData.useEntityProp)('root', 'comment', 'date', commentId);
50
50
  const [siteFormat = (0, _date.__experimentalGetSettings)().formats.date] = (0, _coreData.useEntityProp)('root', 'site', 'date_format');
51
51
  const inspectorControls = (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
52
52
  title: (0, _i18n.__)('Settings')
@@ -65,12 +65,12 @@ function Edit(_ref) {
65
65
  })));
66
66
 
67
67
  if (!commentId || !date) {
68
- return (0, _element.createElement)(_element.Fragment, null, inspectorControls, (0, _element.createElement)("div", blockProps, (0, _element.createElement)("p", null, (0, _i18n._x)('Comment Date', 'block title'))));
68
+ date = (0, _i18n._x)('Comment Date', 'block title');
69
69
  }
70
70
 
71
- let commentDate = (0, _element.createElement)("time", {
71
+ let commentDate = date instanceof Date ? (0, _element.createElement)("time", {
72
72
  dateTime: (0, _date.dateI18n)('c', date)
73
- }, (0, _date.dateI18n)(format || siteFormat, date));
73
+ }, (0, _date.dateI18n)(format || siteFormat, date)) : (0, _element.createElement)("time", null, date);
74
74
 
75
75
  if (isLink) {
76
76
  commentDate = (0, _element.createElement)("a", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comment-date/edit.js"],"names":["Edit","attributes","format","isLink","context","commentId","setAttributes","blockProps","date","siteFormat","formats","inspectorControls","nextFormat","commentDate","event","preventDefault"],"mappings":";;;;;;;;;AAGA;;AACA;;AAIA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA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ACG,oBAAUN,MAAM,IAAIO,UAApB,EAAgCD,IAAhC,CADH,CADD;;AAMA,MAAKL,MAAL,EAAc;AACbU,IAAAA,WAAW,GACV;AACC,MAAA,IAAI,EAAC,2BADN;AAEC,MAAA,OAAO,EAAKC,KAAF,IAAaA,KAAK,CAACC,cAAN;AAFxB,OAIGF,WAJH,CADD;AAQA;;AAED,SACC,qDACGF,iBADH,EAEC,mCAAUJ,UAAV,EAAyBM,WAAzB,CAFD,CADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tdateI18n,\n\t__experimentalGetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Renders the `core/comment-date` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.format Format of the date.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { format, isLink },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );\n\tconst [ siteFormat = getDateSettings().formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<DateFormatPicker\n\t\t\t\t\tformat={ format }\n\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\tchecked={ isLink }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! date ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>{ _x( 'Comment Date', 'block title' ) }</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tlet commentDate = (\n\t\t<time dateTime={ dateI18n( 'c', date ) }>\n\t\t\t{ dateI18n( format || siteFormat, date ) }\n\t\t</time>\n\t);\n\n\tif ( isLink ) {\n\t\tcommentDate = (\n\t\t\t<a\n\t\t\t\thref=\"#comment-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ commentDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ commentDate }</div>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comment-date/edit.js"],"names":["Edit","attributes","format","isLink","context","commentId","setAttributes","blockProps","date","siteFormat","formats","inspectorControls","nextFormat","commentDate","Date","event","preventDefault"],"mappings":";;;;;;;;;AAGA;;AACA;;AAIA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,IAAT,OAIX;AAAA,MAJ0B;AAC7BC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV,KADiB;AAE7BC,IAAAA,OAAO,EAAE;AAAEC,MAAAA;AAAF,KAFoB;AAG7BC,I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D;AAQA;;AAED,SACC,qDACGF,iBADH,EAEC,mCAAUJ,UAAV,EAAyBM,WAAzB,CAFD,CADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tdateI18n,\n\t__experimentalGetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Renders the `core/comment-date` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.format Format of the date.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { format, isLink },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tlet [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );\n\tconst [ siteFormat = getDateSettings().formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<DateFormatPicker\n\t\t\t\t\tformat={ format }\n\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\tchecked={ isLink }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! date ) {\n\t\tdate = _x( 'Comment Date', 'block title' );\n\t}\n\n\tlet commentDate =\n\t\tdate instanceof Date ? (\n\t\t\t<time dateTime={ dateI18n( 'c', date ) }>\n\t\t\t\t{ dateI18n( format || siteFormat, date ) }\n\t\t\t</time>\n\t\t) : (\n\t\t\t<time>{ date }</time>\n\t\t);\n\n\tif ( isLink ) {\n\t\tcommentDate = (\n\t\t\t<a\n\t\t\t\thref=\"#comment-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ commentDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ commentDate }</div>\n\t\t</>\n\t);\n}\n"]}
@@ -36,10 +36,6 @@ const metadata = {
36
36
  isLink: {
37
37
  type: "boolean",
38
38
  "default": true
39
- },
40
- fontSize: {
41
- type: "string",
42
- "default": "small"
43
39
  }
44
40
  },
45
41
  usesContext: ["commentId"],
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comment-date/index.js"],"names":["name","metadata","settings","icon","edit","deprecated"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,eADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,UAAU,EAAVA;AAHuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postDate as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comment-date/index.js"],"names":["name","metadata","settings","icon","edit","deprecated"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,eADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,UAAU,EAAVA;AAHuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postDate as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n};\n"]}
@@ -35,10 +35,6 @@ const metadata = {
35
35
  },
36
36
  textAlign: {
37
37
  type: "string"
38
- },
39
- fontSize: {
40
- type: "string",
41
- "default": "small"
42
38
  }
43
39
  },
44
40
  supports: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comment-edit-link/index.js"],"names":["name","metadata","settings","icon","edit"],"mappings":";;;;;;;;;AAGA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,sBADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentEditLink as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comment-edit-link/index.js"],"names":["name","metadata","settings","icon","edit"],"mappings":";;;;;;;;;AAGA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,sBADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentEditLink as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n"]}
@@ -31,10 +31,6 @@ const metadata = {
31
31
  attributes: {
32
32
  textAlign: {
33
33
  type: "string"
34
- },
35
- fontSize: {
36
- type: "string",
37
- "default": "small"
38
34
  }
39
35
  },
40
36
  supports: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comment-reply-link/index.js"],"names":["name","metadata","settings","edit","icon"],"mappings":";;;;;;;;;AAGA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,aADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentReplyLink as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\ticon,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comment-reply-link/index.js"],"names":["name","metadata","settings","edit","icon"],"mappings":";;;;;;;;;AAGA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,aADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentReplyLink as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\ticon,\n};\n"]}
@@ -29,7 +29,9 @@ const TEMPLATE = [['core/comments-title'], ['core/comment-template', {}, [['core
29
29
  radius: '20px'
30
30
  }
31
31
  }
32
- }]]], ['core/column', {}, [['core/comment-author-name'], ['core/group', {
32
+ }]]], ['core/column', {}, [['core/comment-author-name', {
33
+ fontSize: 'small'
34
+ }], ['core/group', {
33
35
  layout: {
34
36
  type: 'flex'
35
37
  },
@@ -41,7 +43,13 @@ const TEMPLATE = [['core/comments-title'], ['core/comment-template', {}, [['core
41
43
  }
42
44
  }
43
45
  }
44
- }, [['core/comment-date'], ['core/comment-edit-link']]], ['core/comment-content'], ['core/comment-reply-link']]]]]]], ['core/comments-pagination'], ['core/post-comments-form']];
46
+ }, [['core/comment-date', {
47
+ fontSize: 'small'
48
+ }], ['core/comment-edit-link', {
49
+ fontSize: 'small'
50
+ }]]], ['core/comment-content'], ['core/comment-reply-link', {
51
+ fontSize: 'small'
52
+ }]]]]]]], ['core/comments-pagination'], ['core/post-comments-form']];
45
53
 
46
54
  function CommentsQueryLoopEdit(_ref) {
47
55
  let {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comments-query-loop/edit.js"],"names":["TEMPLATE","width","size","style","border","radius","layout","type","spacing","margin","top","bottom","CommentsQueryLoopEdit","attributes","setAttributes","tagName","TagName","blockProps","innerBlocksProps","template"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAG,CAChB,CAAE,qBAAF,CADgB,EAEhB,CACC,uBADD,EAEC,EAFD,EAGC,CACC,CACC,cADD,EAEC,EAFD,EAGC,CACC,CACC,aADD,EAEC;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAFD,EAGC,CACC,CACC,aADD,EAEC;AACCC,EAAAA,IAAI,EAAE,EADP;AAECC,EAAAA,KAAK,EAAE;AACNC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAM,EAAE;AAAV;AADF;AAFR,CAFD,CADD,CAHD,CADD,EAgBC,CACC,aADD,EAEC,EAFD,EAGC,CACC,CAAE,0BAAF,CADD,EAEC,CACC,YADD,EAEC;AACCC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GADT;AAECJ,EAAAA,KAAK,EAAE;AACNK,IAAAA,OAAO,EAAE;AACRC,MAAAA,MAAM,EAAE;AACPC,QAAAA,GAAG,EAAE,KADE;AAEPC,QAAAA,MAAM,EAAE;AAFD;AADA;AADH;AAFR,CAFD,EAaC,CACC,CAAE,mBAAF,CADD,EAEC,CAAE,wBAAF,CAFD,CAbD,CAFD,EAoBC,CAAE,sBAAF,CApBD,EAqBC,CAAE,yBAAF,CArBD,CAHD,CAhBD,CAHD,CADD,CAHD,CAFgB,EAwDhB,CAAE,0BAAF,CAxDgB,EAyDhB,CAAE,yBAAF,CAzDgB,CAAjB;;AA4De,SAASC,qBAAT,OAAgE;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAAgC;AAC9E,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AAAX,MAAuBH,UAA7B;AAEA,QAAMI,UAAU,GAAG,iCAAnB;AACA,QAAMC,gBAAgB,GAAG,sCAAqBD,UAArB,EAAiC;AACzDE,IAAAA,QAAQ,EAAEnB;AAD+C,GAAjC,CAAzB;AAIA,SACC,qDACC,4BAAC,kCAAD;AACC,IAAA,UAAU,EAAGa,UADd;AAEC,IAAA,aAAa,EAAGC;AAFjB,IADD,EAKC,4BAAC,OAAD,EAAcI,gBAAd,CALD,CADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport CommentsInspectorControls from './edit/comments-inspector-controls';\n\nconst TEMPLATE = [\n\t[ 'core/comments-title' ],\n\t[\n\t\t'core/comment-template',\n\t\t{},\n\t\t[\n\t\t\t[\n\t\t\t\t'core/columns',\n\t\t\t\t{},\n\t\t\t\t[\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{ width: '40px' },\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/avatar',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tsize: 40,\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\tborder: { radius: '20px' },\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],\n\t\t\t\t\t],\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t[ 'core/comment-author-name' ],\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlayout: { type: 'flex' },\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\t\t\t\t\tmargin: {\n\t\t\t\t\t\t\t\t\t\t\t\ttop: '0px',\n\t\t\t\t\t\t\t\t\t\t\t\tbottom: '0px',\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t[ 'core/comment-date' ],\n\t\t\t\t\t\t\t\t\t[ 'core/comment-edit-link' ],\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[ 'core/comment-content' ],\n\t\t\t\t\t\t\t[ 'core/comment-reply-link' ],\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t],\n\t\t],\n\t],\n\t[ 'core/comments-pagination' ],\n\t[ 'core/post-comments-form' ],\n];\n\nexport default function CommentsQueryLoopEdit( { attributes, setAttributes } ) {\n\tconst { tagName: TagName } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<CommentsInspectorControls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comments-query-loop/edit.js"],"names":["TEMPLATE","width","size","style","border","radius","fontSize","layout","type","spacing","margin","top","bottom","CommentsQueryLoopEdit","attributes","setAttributes","tagName","TagName","blockProps","innerBlocksProps","template"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAG,CAChB,CAAE,qBAAF,CADgB,EAEhB,CACC,uBADD,EAEC,EAFD,EAGC,CACC,CACC,cADD,EAEC,EAFD,EAGC,CACC,CACC,aADD,EAEC;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AAU,EAAGc,UADd;AAEC,IAAA,aAAa,EAAGC;AAFjB,IADD,EAKC,4BAAC,OAAD,EAAcI,gBAAd,CALD,CADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport CommentsInspectorControls from './edit/comments-inspector-controls';\n\nconst TEMPLATE = [\n\t[ 'core/comments-title' ],\n\t[\n\t\t'core/comment-template',\n\t\t{},\n\t\t[\n\t\t\t[\n\t\t\t\t'core/columns',\n\t\t\t\t{},\n\t\t\t\t[\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{ width: '40px' },\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/avatar',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tsize: 40,\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\tborder: { radius: '20px' },\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],\n\t\t\t\t\t],\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/comment-author-name',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfontSize: 'small',\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[\n\t\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlayout: { type: 'flex' },\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\t\t\t\t\tmargin: {\n\t\t\t\t\t\t\t\t\t\t\t\ttop: '0px',\n\t\t\t\t\t\t\t\t\t\t\t\tbottom: '0px',\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'core/comment-date',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfontSize: 'small',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'core/comment-edit-link',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfontSize: 'small',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t[ 'core/comment-content' ],\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/comment-reply-link',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfontSize: 'small',\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],\n\t\t\t],\n\t\t],\n\t],\n\t[ 'core/comments-pagination' ],\n\t[ 'core/post-comments-form' ],\n];\n\nexport default function CommentsQueryLoopEdit( { attributes, setAttributes } ) {\n\tconst { tagName: TagName } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<CommentsInspectorControls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"]}
@@ -20,10 +20,20 @@ function GapStyles(_ref) {
20
20
  const styleElement = (0, _element.useContext)(_blockEditor.BlockList.__unstableElementContext); // --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
21
21
  // gap on the gallery.
22
22
 
23
- const gapValue = blockGap ? blockGap : `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;
24
- const gap = `#block-${clientId} {
25
- --wp--style--unstable-gallery-gap: ${gapValue};
26
- gap: ${gapValue}
23
+ const fallbackValue = `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;
24
+ let gapValue = fallbackValue;
25
+ let column = fallbackValue;
26
+ let row; // Check for the possibility of split block gap values. See: https://github.com/WordPress/gutenberg/pull/37736
27
+
28
+ if (!!blockGap) {
29
+ row = typeof blockGap === 'string' ? blockGap : (blockGap === null || blockGap === void 0 ? void 0 : blockGap.top) || fallbackValue;
30
+ column = typeof blockGap === 'string' ? blockGap : (blockGap === null || blockGap === void 0 ? void 0 : blockGap.left) || fallbackValue;
31
+ gapValue = row === column ? row : `${row} ${column}`;
32
+ }
33
+
34
+ const gap = `#block-${clientId} {
35
+ --wp--style--unstable-gallery-gap: ${column};
36
+ gap: ${gapValue}
27
37
  }`;
28
38
 
29
39
  const GapStyle = () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/gallery/gap-styles.js"],"names":["GapStyles","blockGap","clientId","styleElement","BlockList","__unstableElementContext","gapValue","gap","GapStyle"],"mappings":";;;;;;;AAIA;;AADA;;AAHA;AACA;AACA;AAIe,SAASA,SAAT,OAA6C;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AAC3D,QAAMC,YAAY,GAAG,yBAAYC,uBAAUC,wBAAtB,CAArB,CAD2D,CAE3D;AACA;;AACA,QAAMC,QAAQ,GAAGL,QAAQ,GACtBA,QADsB,GAErB,oHAFJ;AAGA,QAAMM,GAAG,GAAI,UAAUL,QAAU;AAClC,uCAAwCI,QAAU;AAClD,SAAUA,QAAU;AACpB,GAHC;;AAKA,QAAME,QAAQ,GAAG,MAAM;AACtB,WAAO,2CAASD,GAAT,CAAP;AACA,GAFD;;AAIA,SAAOA,GAAG,IAAIJ,YAAP,GACJ,2BAAc,4BAAC,QAAD,OAAd,EAA4BA,YAA5B,CADI,GAEJ,IAFH;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockList } from '@wordpress/block-editor';\nimport { useContext, createPortal } from '@wordpress/element';\n\nexport default function GapStyles( { blockGap, clientId } ) {\n\tconst styleElement = useContext( BlockList.__unstableElementContext );\n\t// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default\n\t// gap on the gallery.\n\tconst gapValue = blockGap\n\t\t? blockGap\n\t\t: `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;\n\tconst gap = `#block-${ clientId } { \n\t\t--wp--style--unstable-gallery-gap: ${ gapValue };\n\t\tgap: ${ gapValue } \n\t}`;\n\n\tconst GapStyle = () => {\n\t\treturn <style>{ gap }</style>;\n\t};\n\n\treturn gap && styleElement\n\t\t? createPortal( <GapStyle />, styleElement )\n\t\t: null;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/gallery/gap-styles.js"],"names":["GapStyles","blockGap","clientId","styleElement","BlockList","__unstableElementContext","fallbackValue","gapValue","column","row","top","left","gap","GapStyle"],"mappings":";;;;;;;AAIA;;AADA;;AAHA;AACA;AACA;AAIe,SAASA,SAAT,OAA6C;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AAC3D,QAAMC,YAAY,GAAG,yBAAYC,uBAAUC,wBAAtB,CAArB,CAD2D,CAE3D;AACA;;AACA,QAAMC,aAAa,GAAI,oHAAvB;AACA,MAAIC,QAAQ,GAAGD,aAAf;AACA,MAAIE,MAAM,GAAGF,aAAb;AACA,MAAIG,GAAJ,CAP2D,CAS3D;;AACA,MAAK,CAAC,CAAER,QAAR,EAAmB;AAClBQ,IAAAA,GAAG,GACF,OAAOR,QAAP,KAAoB,QAApB,GACGA,QADH,GAEG,CAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAES,GAAV,KAAiBJ,aAHrB;AAIAE,IAAAA,MAAM,GACL,OAAOP,QAAP,KAAoB,QAApB,GACGA,QADH,GAEG,CAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEU,IAAV,KAAkBL,aAHtB;AAIAC,IAAAA,QAAQ,GAAGE,GAAG,KAAKD,MAAR,GAAiBC,GAAjB,GAAwB,GAAGA,GAAK,IAAID,MAAQ,EAAvD;AACA;;AAED,QAAMI,GAAG,GAAI,UAAUV,QAAU;AAClC,uCAAwCM,MAAQ;AAChD,SAAUD,QAAU;AACpB,GAHC;;AAKA,QAAMM,QAAQ,GAAG,MAAM;AACtB,WAAO,2CAASD,GAAT,CAAP;AACA,GAFD;;AAIA,SAAOA,GAAG,IAAIT,YAAP,GACJ,2BAAc,4BAAC,QAAD,OAAd,EAA4BA,YAA5B,CADI,GAEJ,IAFH;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockList } from '@wordpress/block-editor';\nimport { useContext, createPortal } from '@wordpress/element';\n\nexport default function GapStyles( { blockGap, clientId } ) {\n\tconst styleElement = useContext( BlockList.__unstableElementContext );\n\t// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default\n\t// gap on the gallery.\n\tconst fallbackValue = `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;\n\tlet gapValue = fallbackValue;\n\tlet column = fallbackValue;\n\tlet row;\n\n\t// Check for the possibility of split block gap values. See: https://github.com/WordPress/gutenberg/pull/37736\n\tif ( !! blockGap ) {\n\t\trow =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? blockGap\n\t\t\t\t: blockGap?.top || fallbackValue;\n\t\tcolumn =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? blockGap\n\t\t\t\t: blockGap?.left || fallbackValue;\n\t\tgapValue = row === column ? row : `${ row } ${ column }`;\n\t}\n\n\tconst gap = `#block-${ clientId } {\n\t\t--wp--style--unstable-gallery-gap: ${ column };\n\t\tgap: ${ gapValue }\n\t}`;\n\n\tconst GapStyle = () => {\n\t\treturn <style>{ gap }</style>;\n\t};\n\n\treturn gap && styleElement\n\t\t? createPortal( <GapStyle />, styleElement )\n\t\t: null;\n}\n"]}
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.ImageEdit = ImageEdit;
9
- exports.isExternalImage = exports.default = void 0;
10
- exports.isMediaDestroyed = isMediaDestroyed;
11
- exports.pickRelevantMediaFiles = void 0;
9
+ exports.pickRelevantMediaFiles = exports.isExternalImage = exports.default = void 0;
12
10
 
13
11
  var _element = require("@wordpress/element");
14
12
 
@@ -96,23 +94,6 @@ exports.isExternalImage = isExternalImage;
96
94
  function hasDefaultSize(image, defaultSize) {
97
95
  return (0, _lodash.has)(image, ['sizes', defaultSize, 'url']) || (0, _lodash.has)(image, ['media_details', 'sizes', defaultSize, 'source_url']);
98
96
  }
99
- /**
100
- * Checks if a media attachment object has been "destroyed",
101
- * that is, removed from the media library. The core Media Library
102
- * adds a `destroyed` property to a deleted attachment object in the media collection.
103
- *
104
- * @param {number} id The attachment id.
105
- *
106
- * @return {boolean} Whether the image has been destroyed.
107
- */
108
-
109
-
110
- function isMediaDestroyed(id) {
111
- var _wp, _wp$media;
112
-
113
- const attachment = ((_wp = wp) === null || _wp === void 0 ? void 0 : (_wp$media = _wp.media) === null || _wp$media === void 0 ? void 0 : _wp$media.attachment(id)) || {};
114
- return attachment.destroyed;
115
- }
116
97
 
117
98
  function ImageEdit(_ref) {
118
99
  let {
@@ -155,36 +136,7 @@ function ImageEdit(_ref) {
155
136
  getSettings
156
137
  } = select(_blockEditor.store);
157
138
  return (0, _lodash.pick)(getSettings(), ['imageDefaultSize', 'mediaUpload']);
158
- }, []); // A callback passed to MediaUpload,
159
- // fired when the media modal closes.
160
-
161
- function onCloseModal() {
162
- if (isMediaDestroyed(attributes === null || attributes === void 0 ? void 0 : attributes.id)) {
163
- setAttributes({
164
- url: undefined,
165
- id: undefined
166
- });
167
- }
168
- }
169
- /*
170
- Runs an error callback if the image does not load.
171
- If the error callback is triggered, we infer that that image
172
- has been deleted.
173
- */
174
-
175
-
176
- function onImageError() {
177
- let isReplaced = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
178
-
179
- // If the image block was not replaced with an embed,
180
- // clear the attributes and trigger the placeholder.
181
- if (!isReplaced) {
182
- setAttributes({
183
- url: undefined,
184
- id: undefined
185
- });
186
- }
187
- }
139
+ }, []);
188
140
 
189
141
  function onUploadError(message) {
190
142
  noticeOperations.removeAllNotices();
@@ -198,7 +150,7 @@ function ImageEdit(_ref) {
198
150
  }
199
151
 
200
152
  function onSelectImage(media) {
201
- var _wp2, _wp2$media, _wp2$media$view, _wp2$media$view$setti, _wp2$media$view$setti2;
153
+ var _wp, _wp$media, _wp$media$view, _wp$media$view$settin, _wp$media$view$settin2;
202
154
 
203
155
  if (!media || !media.url) {
204
156
  setAttributes({
@@ -249,7 +201,7 @@ function ImageEdit(_ref) {
249
201
  // Use the WordPress option to determine the proper default.
250
202
  // The constants used in Gutenberg do not match WP options so a little more complicated than ideal.
251
203
  // TODO: fix this in a follow up PR, requires updating media-text and ui component.
252
- switch (((_wp2 = wp) === null || _wp2 === void 0 ? void 0 : (_wp2$media = _wp2.media) === null || _wp2$media === void 0 ? void 0 : (_wp2$media$view = _wp2$media.view) === null || _wp2$media$view === void 0 ? void 0 : (_wp2$media$view$setti = _wp2$media$view.settings) === null || _wp2$media$view$setti === void 0 ? void 0 : (_wp2$media$view$setti2 = _wp2$media$view$setti.defaultProps) === null || _wp2$media$view$setti2 === void 0 ? void 0 : _wp2$media$view$setti2.link) || _constants.LINK_DESTINATION_NONE) {
204
+ switch (((_wp = wp) === null || _wp === void 0 ? void 0 : (_wp$media = _wp.media) === null || _wp$media === void 0 ? void 0 : (_wp$media$view = _wp$media.view) === null || _wp$media$view === void 0 ? void 0 : (_wp$media$view$settin = _wp$media$view.settings) === null || _wp$media$view$settin === void 0 ? void 0 : (_wp$media$view$settin2 = _wp$media$view$settin.defaultProps) === null || _wp$media$view$settin2 === void 0 ? void 0 : _wp$media$view$settin2.link) || _constants.LINK_DESTINATION_NONE) {
253
205
  case 'file':
254
206
  case _constants.LINK_DESTINATION_MEDIA:
255
207
  linkDestination = _constants.LINK_DESTINATION_MEDIA;
@@ -375,9 +327,7 @@ function ImageEdit(_ref) {
375
327
  onUploadError: onUploadError,
376
328
  containerRef: ref,
377
329
  context: context,
378
- clientId: clientId,
379
- onCloseModal: onCloseModal,
380
- onImageLoadError: onImageError
330
+ clientId: clientId
381
331
  }), !url && (0, _element.createElement)(_blockEditor.BlockControls, {
382
332
  group: "block"
383
333
  }, (0, _element.createElement)(_blockEditor.BlockAlignmentControl, {
@@ -391,7 +341,6 @@ function ImageEdit(_ref) {
391
341
  onSelectURL: onSelectURL,
392
342
  notices: noticeUI,
393
343
  onError: onUploadError,
394
- onClose: onCloseModal,
395
344
  accept: "image/*",
396
345
  allowedTypes: _constants.ALLOWED_MEDIA_TYPES,
397
346
  value: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/image/edit.js"],"names":["pickRelevantMediaFiles","image","size","imageProps","url","isTemporaryImage","id","isExternalImage","hasDefaultSize","defaultSize","isMediaDestroyed","attachment","wp","media","destroyed","ImageEdit","attributes","setAttributes","isSelected","className","noticeUI","insertBlocksAfter","noticeOperations","onReplace","context","clientId","alt","caption","align","width","height","sizeSlug","temporaryURL","setTemporaryURL","altRef","current","captionRef","ref","imageDefaultSize","mediaUpload","select","getSettings","blockEditorStore","onCloseModal","undefined","onImageError","isReplaced","onUploadError","message","removeAllNotices","createErrorNotice","src","onSelectImage","title","mediaAttributes","additionalAttributes","linkDestination","view","settings","defaultProps","link","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_CUSTOM","href","onSelectURL","newURL","updateAlignment","nextAlign","extraUpdatedAttributes","includes","isTemp","file","filesList","onFileChange","img","allowedTypes","ALLOWED_MEDIA_TYPES","onError","isExternal","mediaPreview","classes","blockProps","icon"],"mappings":";;;;;;;;;;;;AAoBA;;AAjBA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AASA;;AACA;;AAOA;;AAKA;;AAlCA;AACA;AACA;;AAIA;AACA;AACA;;AAgBA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AASO,MAAMA,sBAAsB,GAAG,CAAEC,KAAF,EAASC,IAAT,KAAmB;AACxD,QAAMC,UAAU,GAAG,kBAAMF,KAAN,EAAa,CAAE,KAAF,EAAS,IAAT,EAAe,MAAf,EAAuB,SAAvB,CAAb,CAAnB;AACAE,EAAAA,UAAU,CAACC,GAAX,GACC,iBAAKH,KAAL,EAAY,CAAE,OAAF,EAAWC,IAAX,EAAiB,KAAjB,CAAZ,KACA,iBAAKD,KAAL,EAAY,CAAE,eAAF,EAAmB,OAAnB,EAA4BC,IAA5B,EAAkC,YAAlC,CAAZ,CADA,IAEAD,KAAK,CAACG,GAHP;AAIA,SAAOD,UAAP;AACA,CAPM;AASP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACA,MAAME,gBAAgB,GAAG,CAAEC,EAAF,EAAMF,GAAN,KAAe,CAAEE,EAAF,IAAQ,qBAAWF,GAAX,CAAhD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,eAAe,GAAG,CAAED,EAAF,EAAMF,GAAN,KAAeA,GAAG,IAAI,CAAEE,EAAT,IAAe,CAAE,qBAAWF,GAAX,CAAxD;AAEP;AACA;A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;AAGC,IAAA,WAAW,EAAGc,WAHf;AAIC,IAAA,OAAO,EAAG9C,QAJX;AAKC,IAAA,OAAO,EAAG2B,aALX;AAMC,IAAA,OAAO,EAAGJ,YANX;AAOC,IAAA,MAAM,EAAC,SAPR;AAQC,IAAA,YAAY,EAAGmC,8BARhB;AASC,IAAA,KAAK,EAAG;AAAExE,MAAAA,EAAF;AAAM6C,MAAAA;AAAN,KATT;AAUC,IAAA,YAAY,EAAG8B,YAVhB;AAWC,IAAA,mBAAmB,EAAGjD,YAAY,IAAI5B;AAXvC,IA3BD,CADD;AA2CA;;eAEc,6BAAaW,SAAb,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { get, has, omit, pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport { withNotices } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockAlignmentControl,\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { image as icon } from '@wordpress/icons';\n\n/* global wp */\n\n/**\n * Internal dependencies\n */\nimport Image from './image';\n\n/**\n * Module constants\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_CUSTOM,\n\tLINK_DESTINATION_MEDIA,\n\tLINK_DESTINATION_NONE,\n\tALLOWED_MEDIA_TYPES,\n} from './constants';\n\nexport const pickRelevantMediaFiles = ( image, size ) => {\n\tconst imageProps = pick( image, [ 'alt', 'id', 'link', 'caption' ] );\n\timageProps.url =\n\t\tget( image, [ 'sizes', size, 'url' ] ) ||\n\t\tget( image, [ 'media_details', 'sizes', size, 'source_url' ] ) ||\n\t\timage.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no\n * id and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\n/**\n * Checks if WP generated default image size. Size generation is skipped\n * when the image is smaller than the said size.\n *\n * @param {Object} image\n * @param {string} defaultSize\n *\n * @return {boolean} Whether or not it has default image size.\n */\nfunction hasDefaultSize( image, defaultSize ) {\n\treturn (\n\t\thas( image, [ 'sizes', defaultSize, 'url' ] ) ||\n\t\thas( image, [ 'media_details', 'sizes', defaultSize, 'source_url' ] )\n\t);\n}\n\n/**\n * Checks if a media attachment object has been \"destroyed\",\n * that is, removed from the media library. The core Media Library\n * adds a `destroyed` property to a deleted attachment object in the media collection.\n *\n * @param {number} id The attachment id.\n *\n * @return {boolean} Whether the image has been destroyed.\n */\nexport function isMediaDestroyed( id ) {\n\tconst attachment = wp?.media?.attachment( id ) || {};\n\treturn attachment.destroyed;\n}\n\nexport function ImageEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tclassName,\n\tnoticeUI,\n\tinsertBlocksAfter,\n\tnoticeOperations,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tsizeSlug,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\n\tconst altRef = useRef();\n\tuseEffect( () => {\n\t\taltRef.current = alt;\n\t}, [ alt ] );\n\n\tconst captionRef = useRef();\n\tuseEffect( () => {\n\t\tcaptionRef.current = caption;\n\t}, [ caption ] );\n\n\tconst ref = useRef();\n\tconst { imageDefaultSize, mediaUpload } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn pick( getSettings(), [ 'imageDefaultSize', 'mediaUpload' ] );\n\t}, [] );\n\n\t// A callback passed to MediaUpload,\n\t// fired when the media modal closes.\n\tfunction onCloseModal() {\n\t\tif ( isMediaDestroyed( attributes?.id ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\tid: undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\t/*\n\t\t Runs an error callback if the image does not load.\n\t\t If the error callback is triggered, we infer that that image\n\t\t has been deleted.\n\t*/\n\tfunction onImageError( isReplaced = false ) {\n\t\t// If the image block was not replaced with an embed,\n\t\t// clear the attributes and trigger the placeholder.\n\t\tif ( ! isReplaced ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\tid: undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t\tsetAttributes( {\n\t\t\tsrc: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tsetTemporaryURL( undefined );\n\t}\n\n\tfunction onSelectImage( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\ttitle: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\tsetTemporaryURL();\n\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, imageDefaultSize );\n\n\t\t// If a caption text was meanwhile written by the user,\n\t\t// make sure the text is not overwritten by empty captions.\n\t\tif ( captionRef.current && ! get( mediaAttributes, [ 'caption' ] ) ) {\n\t\t\tmediaAttributes = omit( mediaAttributes, [ 'caption' ] );\n\t\t}\n\n\t\tlet additionalAttributes;\n\t\t// Reset the dimension attributes if changing to a different image.\n\t\tif ( ! media.id || media.id !== id ) {\n\t\t\tadditionalAttributes = {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t\t// Fallback to size \"full\" if there's no default image size.\n\t\t\t\t// It means the image is smaller, and the block will use a full-size URL.\n\t\t\t\tsizeSlug: hasDefaultSize( media, imageDefaultSize )\n\t\t\t\t\t? imageDefaultSize\n\t\t\t\t\t: 'full',\n\t\t\t};\n\t\t} else {\n\t\t\t// Keep the same url when selecting the same file, so \"Image Size\"\n\t\t\t// option is not changed.\n\t\t\tadditionalAttributes = { url };\n\t\t}\n\n\t\t// Check if default link setting should be used.\n\t\tlet linkDestination = attributes.linkDestination;\n\t\tif ( ! linkDestination ) {\n\t\t\t// Use the WordPress option to determine the proper default.\n\t\t\t// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.\n\t\t\t// TODO: fix this in a follow up PR, requires updating media-text and ui component.\n\t\t\tswitch (\n\t\t\t\twp?.media?.view?.settings?.defaultProps?.link ||\n\t\t\t\tLINK_DESTINATION_NONE\n\t\t\t) {\n\t\t\t\tcase 'file':\n\t\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_MEDIA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'post':\n\t\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_CUSTOM:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_CUSTOM;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_NONE:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_NONE;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Check if the image is linked to it's media.\n\t\tlet href;\n\t\tswitch ( linkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\thref = media.url;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\thref = media.link;\n\t\t\t\tbreak;\n\t\t}\n\t\tmediaAttributes.href = href;\n\n\t\tsetAttributes( {\n\t\t\t...mediaAttributes,\n\t\t\t...additionalAttributes,\n\t\t\tlinkDestination,\n\t\t} );\n\t}\n\n\tfunction onSelectURL( newURL ) {\n\t\tif ( newURL !== url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: newURL,\n\t\t\t\tid: undefined,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t\tsizeSlug: imageDefaultSize,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? { width: undefined, height: undefined }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tlet isTemp = isTemporaryImage( id, url );\n\n\t// Upload a temporary image on mount.\n\tuseEffect( () => {\n\t\tif ( ! isTemp ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst file = getBlobByURL( url );\n\n\t\tif ( file ) {\n\t\t\tmediaUpload( {\n\t\t\t\tfilesList: [ file ],\n\t\t\t\tonFileChange: ( [ img ] ) => {\n\t\t\t\t\tonSelectImage( img );\n\t\t\t\t},\n\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\tonError: ( message ) => {\n\t\t\t\t\tisTemp = false;\n\t\t\t\t\tonUploadError( message );\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\t// If an image is temporary, revoke the Blob url when it is uploaded (and is\n\t// no longer temporary).\n\tuseEffect( () => {\n\t\tif ( isTemp ) {\n\t\t\tsetTemporaryURL( url );\n\t\t\treturn;\n\t\t}\n\t\trevokeBlobURL( temporaryURL );\n\t}, [ isTemp, url ] );\n\n\tconst isExternal = isExternalImage( id, url );\n\tconst src = isExternal ? url : undefined;\n\tconst mediaPreview = !! url && (\n\t\t<img\n\t\t\talt={ __( 'Edit image' ) }\n\t\t\ttitle={ __( 'Edit image' ) }\n\t\t\tclassName={ 'edit-image-preview' }\n\t\t\tsrc={ url }\n\t\t/>\n\t);\n\n\tconst classes = classnames( className, {\n\t\t'is-transient': temporaryURL,\n\t\t'is-resized': !! width || !! height,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref,\n\t\tclassName: classes,\n\t} );\n\n\treturn (\n\t\t<figure { ...blockProps }>\n\t\t\t{ ( temporaryURL || url ) && (\n\t\t\t\t<Image\n\t\t\t\t\ttemporaryURL={ temporaryURL }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonSelectImage={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonUploadError={ onUploadError }\n\t\t\t\t\tcontainerRef={ ref }\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tonCloseModal={ onCloseModal }\n\t\t\t\t\tonImageLoadError={ onImageError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! url && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<MediaPlaceholder\n\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\tnotices={ noticeUI }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tonClose={ onCloseModal }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tvalue={ { id, src } }\n\t\t\t\tmediaPreview={ mediaPreview }\n\t\t\t\tdisableMediaButtons={ temporaryURL || url }\n\t\t\t/>\n\t\t</figure>\n\t);\n}\n\nexport default withNotices( ImageEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/image/edit.js"],"names":["pickRelevantMediaFiles","image","size","imageProps","url","isTemporaryImage","id","isExternalImage","hasDefaultSize","defaultSize","ImageEdit","attributes","setAttributes","isSelected","className","noticeUI","insertBlocksAfter","noticeOperations","onReplace","context","clientId","alt","caption","align","width","height","sizeSlug","temporaryURL","setTemporaryURL","altRef","current","captionRef","ref","imageDefaultSize","mediaUpload","select","getSettings","blockEditorStore","onUploadError","message","removeAllNotices","createErrorNotice","src","undefined","onSelectImage","media","title","mediaAttributes","additionalAttributes","linkDestination","wp","view","settings","defaultProps","link","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_CUSTOM","href","onSelectURL","newURL","updateAlignment","nextAlign","extraUpdatedAttributes","includes","isTemp","file","filesList","onFileChange","img","allowedTypes","ALLOWED_MEDIA_TYPES","onError","isExternal","mediaPreview","classes","blockProps","icon"],"mappings":";;;;;;;;;;AAoBA;;AAjBA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AASA;;AACA;;AAOA;;AAKA;;AAlCA;AACA;AACA;;AAIA;AACA;AACA;;AAgBA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AASO,MAAMA,sBAAsB,GAAG,CAAEC,KAAF,EAASC,IAAT,KAAmB;AACxD,QAAMC,UAAU,GAAG,kBAAMF,KAAN,E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AGkC,8BAPhB;AAQC,IAAA,KAAK,EAAG;AAAElE,MAAAA,EAAF;AAAMoC,MAAAA;AAAN,KART;AASC,IAAA,YAAY,EAAGiC,YAThB;AAUC,IAAA,mBAAmB,EAAGhD,YAAY,IAAIvB;AAVvC,IAzBD,CADD;AAwCA;;eAEc,6BAAaM,SAAb,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { get, has, omit, pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport { withNotices } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockAlignmentControl,\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { image as icon } from '@wordpress/icons';\n\n/* global wp */\n\n/**\n * Internal dependencies\n */\nimport Image from './image';\n\n/**\n * Module constants\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_CUSTOM,\n\tLINK_DESTINATION_MEDIA,\n\tLINK_DESTINATION_NONE,\n\tALLOWED_MEDIA_TYPES,\n} from './constants';\n\nexport const pickRelevantMediaFiles = ( image, size ) => {\n\tconst imageProps = pick( image, [ 'alt', 'id', 'link', 'caption' ] );\n\timageProps.url =\n\t\tget( image, [ 'sizes', size, 'url' ] ) ||\n\t\tget( image, [ 'media_details', 'sizes', size, 'source_url' ] ) ||\n\t\timage.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no\n * id and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\n/**\n * Checks if WP generated default image size. Size generation is skipped\n * when the image is smaller than the said size.\n *\n * @param {Object} image\n * @param {string} defaultSize\n *\n * @return {boolean} Whether or not it has default image size.\n */\nfunction hasDefaultSize( image, defaultSize ) {\n\treturn (\n\t\thas( image, [ 'sizes', defaultSize, 'url' ] ) ||\n\t\thas( image, [ 'media_details', 'sizes', defaultSize, 'source_url' ] )\n\t);\n}\n\nexport function ImageEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tclassName,\n\tnoticeUI,\n\tinsertBlocksAfter,\n\tnoticeOperations,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tsizeSlug,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\n\tconst altRef = useRef();\n\tuseEffect( () => {\n\t\taltRef.current = alt;\n\t}, [ alt ] );\n\n\tconst captionRef = useRef();\n\tuseEffect( () => {\n\t\tcaptionRef.current = caption;\n\t}, [ caption ] );\n\n\tconst ref = useRef();\n\tconst { imageDefaultSize, mediaUpload } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn pick( getSettings(), [ 'imageDefaultSize', 'mediaUpload' ] );\n\t}, [] );\n\n\tfunction onUploadError( message ) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t\tsetAttributes( {\n\t\t\tsrc: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tsetTemporaryURL( undefined );\n\t}\n\n\tfunction onSelectImage( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\ttitle: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\tsetTemporaryURL();\n\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, imageDefaultSize );\n\n\t\t// If a caption text was meanwhile written by the user,\n\t\t// make sure the text is not overwritten by empty captions.\n\t\tif ( captionRef.current && ! get( mediaAttributes, [ 'caption' ] ) ) {\n\t\t\tmediaAttributes = omit( mediaAttributes, [ 'caption' ] );\n\t\t}\n\n\t\tlet additionalAttributes;\n\t\t// Reset the dimension attributes if changing to a different image.\n\t\tif ( ! media.id || media.id !== id ) {\n\t\t\tadditionalAttributes = {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t\t// Fallback to size \"full\" if there's no default image size.\n\t\t\t\t// It means the image is smaller, and the block will use a full-size URL.\n\t\t\t\tsizeSlug: hasDefaultSize( media, imageDefaultSize )\n\t\t\t\t\t? imageDefaultSize\n\t\t\t\t\t: 'full',\n\t\t\t};\n\t\t} else {\n\t\t\t// Keep the same url when selecting the same file, so \"Image Size\"\n\t\t\t// option is not changed.\n\t\t\tadditionalAttributes = { url };\n\t\t}\n\n\t\t// Check if default link setting should be used.\n\t\tlet linkDestination = attributes.linkDestination;\n\t\tif ( ! linkDestination ) {\n\t\t\t// Use the WordPress option to determine the proper default.\n\t\t\t// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.\n\t\t\t// TODO: fix this in a follow up PR, requires updating media-text and ui component.\n\t\t\tswitch (\n\t\t\t\twp?.media?.view?.settings?.defaultProps?.link ||\n\t\t\t\tLINK_DESTINATION_NONE\n\t\t\t) {\n\t\t\t\tcase 'file':\n\t\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_MEDIA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'post':\n\t\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_CUSTOM:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_CUSTOM;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_NONE:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_NONE;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Check if the image is linked to it's media.\n\t\tlet href;\n\t\tswitch ( linkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\thref = media.url;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\thref = media.link;\n\t\t\t\tbreak;\n\t\t}\n\t\tmediaAttributes.href = href;\n\n\t\tsetAttributes( {\n\t\t\t...mediaAttributes,\n\t\t\t...additionalAttributes,\n\t\t\tlinkDestination,\n\t\t} );\n\t}\n\n\tfunction onSelectURL( newURL ) {\n\t\tif ( newURL !== url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: newURL,\n\t\t\t\tid: undefined,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t\tsizeSlug: imageDefaultSize,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? { width: undefined, height: undefined }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tlet isTemp = isTemporaryImage( id, url );\n\n\t// Upload a temporary image on mount.\n\tuseEffect( () => {\n\t\tif ( ! isTemp ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst file = getBlobByURL( url );\n\n\t\tif ( file ) {\n\t\t\tmediaUpload( {\n\t\t\t\tfilesList: [ file ],\n\t\t\t\tonFileChange: ( [ img ] ) => {\n\t\t\t\t\tonSelectImage( img );\n\t\t\t\t},\n\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\tonError: ( message ) => {\n\t\t\t\t\tisTemp = false;\n\t\t\t\t\tonUploadError( message );\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\t// If an image is temporary, revoke the Blob url when it is uploaded (and is\n\t// no longer temporary).\n\tuseEffect( () => {\n\t\tif ( isTemp ) {\n\t\t\tsetTemporaryURL( url );\n\t\t\treturn;\n\t\t}\n\t\trevokeBlobURL( temporaryURL );\n\t}, [ isTemp, url ] );\n\n\tconst isExternal = isExternalImage( id, url );\n\tconst src = isExternal ? url : undefined;\n\tconst mediaPreview = !! url && (\n\t\t<img\n\t\t\talt={ __( 'Edit image' ) }\n\t\t\ttitle={ __( 'Edit image' ) }\n\t\t\tclassName={ 'edit-image-preview' }\n\t\t\tsrc={ url }\n\t\t/>\n\t);\n\n\tconst classes = classnames( className, {\n\t\t'is-transient': temporaryURL,\n\t\t'is-resized': !! width || !! height,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref,\n\t\tclassName: classes,\n\t} );\n\n\treturn (\n\t\t<figure { ...blockProps }>\n\t\t\t{ ( temporaryURL || url ) && (\n\t\t\t\t<Image\n\t\t\t\t\ttemporaryURL={ temporaryURL }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonSelectImage={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonUploadError={ onUploadError }\n\t\t\t\t\tcontainerRef={ ref }\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! url && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<MediaPlaceholder\n\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\tnotices={ noticeUI }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tvalue={ { id, src } }\n\t\t\t\tmediaPreview={ mediaPreview }\n\t\t\t\tdisableMediaButtons={ temporaryURL || url }\n\t\t\t/>\n\t\t</figure>\n\t);\n}\n\nexport default withNotices( ImageEdit );\n"]}