@wordpress/block-library 9.19.0 → 9.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/archives/edit.js +2 -2
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/audio/edit.js +66 -33
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/avatar/index.js +8 -3
  7. package/build/avatar/index.js.map +1 -1
  8. package/build/button/edit.js +43 -16
  9. package/build/button/edit.js.map +1 -1
  10. package/build/comment-template/hooks.js +6 -0
  11. package/build/comment-template/hooks.js.map +1 -1
  12. package/build/cover/index.js +8 -1
  13. package/build/cover/index.js.map +1 -1
  14. package/build/image/constants.js +2 -1
  15. package/build/image/constants.js.map +1 -1
  16. package/build/image/image.js +85 -72
  17. package/build/image/image.js.map +1 -1
  18. package/build/latest-posts/edit.js +2 -1
  19. package/build/latest-posts/edit.js.map +1 -1
  20. package/build/navigation/use-template-part-area-label.js +7 -6
  21. package/build/navigation/use-template-part-area-label.js.map +1 -1
  22. package/build/post-author/edit.js +1 -1
  23. package/build/post-author/edit.js.map +1 -1
  24. package/build/post-author/index.js +8 -1
  25. package/build/post-author/index.js.map +1 -1
  26. package/build/post-author-name/edit.js +2 -2
  27. package/build/post-author-name/edit.js.map +1 -1
  28. package/build/query/edit/inspector-controls/index.js +2 -0
  29. package/build/query/edit/inspector-controls/index.js.map +1 -1
  30. package/build/query/edit/inspector-controls/order-control.js +3 -2
  31. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  32. package/build/query/utils.js +45 -0
  33. package/build/query/utils.js.map +1 -1
  34. package/build/query-total/index.js +2 -2
  35. package/build/query-total/index.js.map +1 -1
  36. package/build/site-logo/index.js +8 -1
  37. package/build/site-logo/index.js.map +1 -1
  38. package/build/social-links/index.js +1 -0
  39. package/build/social-links/index.js.map +1 -1
  40. package/build/table-of-contents/hooks.js +6 -3
  41. package/build/table-of-contents/hooks.js.map +1 -1
  42. package/build/template-part/edit/advanced-controls.js +1 -1
  43. package/build/template-part/edit/advanced-controls.js.map +1 -1
  44. package/build/template-part/edit/utils/hooks.js +1 -1
  45. package/build/template-part/edit/utils/hooks.js.map +1 -1
  46. package/build-module/archives/edit.js +2 -2
  47. package/build-module/archives/edit.js.map +1 -1
  48. package/build-module/audio/edit.js +68 -35
  49. package/build-module/audio/edit.js.map +1 -1
  50. package/build-module/avatar/index.js +8 -3
  51. package/build-module/avatar/index.js.map +1 -1
  52. package/build-module/button/edit.js +44 -17
  53. package/build-module/button/edit.js.map +1 -1
  54. package/build-module/comment-template/hooks.js +6 -0
  55. package/build-module/comment-template/hooks.js.map +1 -1
  56. package/build-module/cover/index.js +8 -1
  57. package/build-module/cover/index.js.map +1 -1
  58. package/build-module/image/constants.js +1 -0
  59. package/build-module/image/constants.js.map +1 -1
  60. package/build-module/image/image.js +88 -75
  61. package/build-module/image/image.js.map +1 -1
  62. package/build-module/latest-posts/edit.js +2 -1
  63. package/build-module/latest-posts/edit.js.map +1 -1
  64. package/build-module/navigation/use-template-part-area-label.js +7 -6
  65. package/build-module/navigation/use-template-part-area-label.js.map +1 -1
  66. package/build-module/post-author/edit.js +1 -1
  67. package/build-module/post-author/edit.js.map +1 -1
  68. package/build-module/post-author/index.js +8 -1
  69. package/build-module/post-author/index.js.map +1 -1
  70. package/build-module/post-author-name/edit.js +2 -2
  71. package/build-module/post-author-name/edit.js.map +1 -1
  72. package/build-module/query/edit/inspector-controls/index.js +3 -1
  73. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  74. package/build-module/query/edit/inspector-controls/order-control.js +3 -2
  75. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  76. package/build-module/query/utils.js +44 -0
  77. package/build-module/query/utils.js.map +1 -1
  78. package/build-module/query-total/index.js +2 -2
  79. package/build-module/query-total/index.js.map +1 -1
  80. package/build-module/site-logo/index.js +8 -1
  81. package/build-module/site-logo/index.js.map +1 -1
  82. package/build-module/social-links/index.js +1 -0
  83. package/build-module/social-links/index.js.map +1 -1
  84. package/build-module/table-of-contents/hooks.js +6 -3
  85. package/build-module/table-of-contents/hooks.js.map +1 -1
  86. package/build-module/template-part/edit/advanced-controls.js +1 -1
  87. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  88. package/build-module/template-part/edit/utils/hooks.js +1 -1
  89. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  90. package/build-style/editor-rtl.css +0 -9
  91. package/build-style/editor.css +0 -9
  92. package/build-style/image/editor-rtl.css +0 -9
  93. package/build-style/image/editor.css +0 -9
  94. package/package.json +35 -35
  95. package/src/archives/edit.js +2 -2
  96. package/src/audio/edit.js +84 -33
  97. package/src/avatar/block.json +8 -3
  98. package/src/button/edit.js +69 -24
  99. package/src/comment-template/hooks.js +14 -6
  100. package/src/cover/block.json +8 -1
  101. package/src/image/constants.js +1 -0
  102. package/src/image/editor.scss +0 -13
  103. package/src/image/image.js +115 -122
  104. package/src/latest-posts/edit.js +1 -0
  105. package/src/navigation/use-template-part-area-label.js +6 -6
  106. package/src/post-author/block.json +8 -1
  107. package/src/post-author/edit.js +1 -1
  108. package/src/post-author-name/edit.js +4 -4
  109. package/src/query/edit/inspector-controls/index.js +3 -1
  110. package/src/query/edit/inspector-controls/order-control.js +9 -3
  111. package/src/query/utils.js +58 -0
  112. package/src/query-total/block.json +2 -2
  113. package/src/query-total/index.php +2 -2
  114. package/src/site-logo/block.json +8 -1
  115. package/src/site-title/index.php +1 -1
  116. package/src/social-links/block.json +1 -0
  117. package/src/table-of-contents/hooks.js +5 -2
  118. package/src/template-part/edit/advanced-controls.js +1 -1
  119. package/src/template-part/edit/utils/hooks.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","_variations","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","url","type","useFeaturedImage","id","alt","hasParallax","isRepeated","dimRatio","overlayColor","customOverlayColor","isUserOverlayColor","backgroundType","focalPoint","minHeight","minHeightUnit","gradient","customGradient","contentPosition","isDark","allowedBlocks","templateLock","tagName","sizeSlug","usesContext","supports","anchor","align","html","shadow","spacing","padding","margin","blockGap","__experimentalDefaultControls","__experimentalBorder","color","radius","style","width","__experimentalDuotone","heading","text","background","__experimentalSkipSerialization","enableContrastChecker","dimensions","aspectRatio","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","layout","allowJustification","interactivity","clientNavigation","editorStyle","settings","icon","example","innerBlocks","content","__","transforms","save","edit","deprecated","variations","init","initBlock"],"sources":["@wordpress/block-library/src/cover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomOverlayColor: '#065174',\n\t\t\tdimRatio: 40,\n\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\tfontSize: 48,\n\t\t\t\t},\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: 'white',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( '<strong>Snow Patrol</strong>' ),\n\t\t\t\t\talign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tsave,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initB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AK,EAAE;UACNM,IAAI,EAAE;QACP;MACD;IACD,CAAC;IACDuB,WAAW,EAAE,CACZ;MACCtE,IAAI,EAAE,gBAAgB;MACtBK,UAAU,EAAE;QACXkE,OAAO,EAAE,IAAAC,QAAE,EAAE,8BAA+B,CAAC;QAC7CxC,KAAK,EAAE;MACR;IACD,CAAC;EAEH,CAAC;EACDyC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA,mBAAU;EACVC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAE/E,IAAI;EAAEJ,QAAQ;EAAEuE;AAAS,CAAE,CAAC;AAACtE,OAAA,CAAAiF,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","_variations","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","url","type","useFeaturedImage","id","alt","hasParallax","isRepeated","dimRatio","overlayColor","customOverlayColor","isUserOverlayColor","backgroundType","focalPoint","minHeight","minHeightUnit","gradient","customGradient","contentPosition","isDark","allowedBlocks","templateLock","tagName","sizeSlug","usesContext","supports","anchor","align","html","shadow","spacing","padding","margin","blockGap","__experimentalDefaultControls","__experimentalBorder","color","radius","style","width","heading","text","background","__experimentalSkipSerialization","enableContrastChecker","dimensions","aspectRatio","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","layout","allowJustification","interactivity","clientNavigation","filter","duotone","selectors","editorStyle","settings","icon","example","innerBlocks","content","__","transforms","save","edit","deprecated","variations","init","initBlock"],"sources":["@wordpress/block-library/src/cover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomOverlayColor: '#065174',\n\t\t\tdimRatio: 40,\n\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\tfontSize: 48,\n\t\t\t\t},\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: 'white',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( '<strong>Snow Patrol</strong>' ),\n\t\t\t\t\talign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tsave,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,WAAA,GAAAL,sBAAA,CAAAH,OAAA;AAfA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAS,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EA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AAC;AAACxE,OAAA,CAAAmF,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.NEW_TAB_REL = exports.MIN_SIZE = exports.MEDIA_ID_NO_FEATURED_IMAGE_SET = exports.LINK_DESTINATION_NONE = exports.LINK_DESTINATION_MEDIA = exports.LINK_DESTINATION_CUSTOM = exports.LINK_DESTINATION_ATTACHMENT = exports.ALLOWED_MEDIA_TYPES = void 0;
6
+ exports.SIZED_LAYOUTS = exports.NEW_TAB_REL = exports.MIN_SIZE = exports.MEDIA_ID_NO_FEATURED_IMAGE_SET = exports.LINK_DESTINATION_NONE = exports.LINK_DESTINATION_MEDIA = exports.LINK_DESTINATION_CUSTOM = exports.LINK_DESTINATION_ATTACHMENT = exports.ALLOWED_MEDIA_TYPES = void 0;
7
7
  const MIN_SIZE = exports.MIN_SIZE = 20;
8
8
  const LINK_DESTINATION_NONE = exports.LINK_DESTINATION_NONE = 'none';
9
9
  const LINK_DESTINATION_MEDIA = exports.LINK_DESTINATION_MEDIA = 'media';
@@ -12,4 +12,5 @@ const LINK_DESTINATION_CUSTOM = exports.LINK_DESTINATION_CUSTOM = 'custom';
12
12
  const NEW_TAB_REL = exports.NEW_TAB_REL = ['noreferrer', 'noopener'];
13
13
  const ALLOWED_MEDIA_TYPES = exports.ALLOWED_MEDIA_TYPES = ['image'];
14
14
  const MEDIA_ID_NO_FEATURED_IMAGE_SET = exports.MEDIA_ID_NO_FEATURED_IMAGE_SET = 0;
15
+ const SIZED_LAYOUTS = exports.SIZED_LAYOUTS = ['flex', 'grid'];
15
16
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["MIN_SIZE","exports","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_CUSTOM","NEW_TAB_REL","ALLOWED_MEDIA_TYPES","MEDIA_ID_NO_FEATURED_IMAGE_SET"],"sources":["@wordpress/block-library/src/image/constants.js"],"sourcesContent":["export const MIN_SIZE = 20;\nexport const LINK_DESTINATION_NONE = 'none';\nexport const LINK_DESTINATION_MEDIA = 'media';\nexport const LINK_DESTINATION_ATTACHMENT = 'attachment';\nexport const LINK_DESTINATION_CUSTOM = 'custom';\nexport const NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\nexport const ALLOWED_MEDIA_TYPES = [ 'image' ];\nexport const MEDIA_ID_NO_FEATURED_IMAGE_SET = 0;\n"],"mappings":";;;;;;AAAO,MAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,EAAE;AACnB,MAAME,qBAAqB,GAAAD,OAAA,CAAAC,qBAAA,GAAG,MAAM;AACpC,MAAMC,sBAAsB,GAAAF,OAAA,CAAAE,sBAAA,GAAG,OAAO;AACtC,MAAMC,2BAA2B,GAAAH,OAAA,CAAAG,2BAAA,GAAG,YAAY;AAChD,MAAMC,uBAAuB,GAAAJ,OAAA,CAAAI,uBAAA,GAAG,QAAQ;AACxC,MAAMC,WAAW,GAAAL,OAAA,CAAAK,WAAA,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE;AAChD,MAAMC,mBAAmB,GAAAN,OAAA,CAAAM,mBAAA,GAAG,CAAE,OAAO,CAAE;AACvC,MAAMC,8BAA8B,GAAAP,OAAA,CAAAO,8BAAA,GAAG,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["MIN_SIZE","exports","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_CUSTOM","NEW_TAB_REL","ALLOWED_MEDIA_TYPES","MEDIA_ID_NO_FEATURED_IMAGE_SET","SIZED_LAYOUTS"],"sources":["@wordpress/block-library/src/image/constants.js"],"sourcesContent":["export const MIN_SIZE = 20;\nexport const LINK_DESTINATION_NONE = 'none';\nexport const LINK_DESTINATION_MEDIA = 'media';\nexport const LINK_DESTINATION_ATTACHMENT = 'attachment';\nexport const LINK_DESTINATION_CUSTOM = 'custom';\nexport const NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\nexport const ALLOWED_MEDIA_TYPES = [ 'image' ];\nexport const MEDIA_ID_NO_FEATURED_IMAGE_SET = 0;\nexport const SIZED_LAYOUTS = [ 'flex', 'grid' ];\n"],"mappings":";;;;;;AAAO,MAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,EAAE;AACnB,MAAME,qBAAqB,GAAAD,OAAA,CAAAC,qBAAA,GAAG,MAAM;AACpC,MAAMC,sBAAsB,GAAAF,OAAA,CAAAE,sBAAA,GAAG,OAAO;AACtC,MAAMC,2BAA2B,GAAAH,OAAA,CAAAG,2BAAA,GAAG,YAAY;AAChD,MAAMC,uBAAuB,GAAAJ,OAAA,CAAAI,uBAAA,GAAG,QAAQ;AACxC,MAAMC,WAAW,GAAAL,OAAA,CAAAK,WAAA,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE;AAChD,MAAMC,mBAAmB,GAAAN,OAAA,CAAAM,mBAAA,GAAG,CAAE,OAAO,CAAE;AACvC,MAAMC,8BAA8B,GAAAP,OAAA,CAAAO,8BAAA,GAAG,CAAC;AACxC,MAAMC,aAAa,GAAAR,OAAA,CAAAQ,aAAA,GAAG,CAAE,MAAM,EAAE,MAAM,CAAE","ignoreList":[]}
@@ -217,11 +217,26 @@ function Image({
217
217
  lightbox,
218
218
  metadata
219
219
  } = attributes;
220
-
221
- // The only supported unit is px, so we can parseInt to strip the px here.
222
- const numericWidth = width ? parseInt(width, 10) : undefined;
223
- const numericHeight = height ? parseInt(height, 10) : undefined;
224
- const imageRef = (0, _element.useRef)();
220
+ const [imageElement, setImageElement] = (0, _element.useState)();
221
+ const [resizeDelta, setResizeDelta] = (0, _element.useState)(null);
222
+ const [pixelSize, setPixelSize] = (0, _element.useState)({});
223
+ const [offsetTop, setOffsetTop] = (0, _element.useState)(0);
224
+ const setResizeObserved = (0, _compose.useResizeObserver)(([entry]) => {
225
+ if (!resizeDelta) {
226
+ const [box] = entry.borderBoxSize;
227
+ setPixelSize({
228
+ width: box.inlineSize,
229
+ height: box.blockSize
230
+ });
231
+ }
232
+ // This is usually 0 unless the image height is less than the line-height.
233
+ setOffsetTop(entry.target.offsetTop);
234
+ });
235
+ const effectResizeableBoxPlacement = (0, _element.useCallback)(() => {
236
+ var _imageElement$offsetT;
237
+ setOffsetTop((_imageElement$offsetT = imageElement?.offsetTop) !== null && _imageElement$offsetT !== void 0 ? _imageElement$offsetT : 0);
238
+ }, [imageElement]);
239
+ const setRefs = (0, _compose.useMergeRefs)([setImageElement, setResizeObserved]);
225
240
  const {
226
241
  allowResize = true
227
242
  } = context;
@@ -299,7 +314,7 @@ function Image({
299
314
  .catch(() => {});
300
315
  }, [id, url, isSingleSelected, externalBlob]);
301
316
 
302
- // Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural
317
+ // Get naturalWidth and naturalHeight from image, and fall back to loaded natural
303
318
  // width and height. This resolves an issue in Safari where the loaded natural
304
319
  // width and height is otherwise lost when switching between alignments.
305
320
  // See: https://github.com/WordPress/gutenberg/pull/37210.
@@ -308,16 +323,10 @@ function Image({
308
323
  naturalHeight
309
324
  } = (0, _element.useMemo)(() => {
310
325
  return {
311
- naturalWidth: imageRef.current?.naturalWidth || loadedNaturalWidth || undefined,
312
- naturalHeight: imageRef.current?.naturalHeight || loadedNaturalHeight || undefined
326
+ naturalWidth: imageElement?.naturalWidth || loadedNaturalWidth || undefined,
327
+ naturalHeight: imageElement?.naturalHeight || loadedNaturalHeight || undefined
313
328
  };
314
- }, [loadedNaturalWidth, loadedNaturalHeight, imageRef.current?.complete]);
315
- function onResizeStart() {
316
- toggleSelection(false);
317
- }
318
- function onResizeStop() {
319
- toggleSelection(true);
320
- }
329
+ }, [loadedNaturalWidth, loadedNaturalHeight, imageElement?.complete]);
321
330
  function onImageError() {
322
331
  setHasImageErrored(true);
323
332
 
@@ -451,7 +460,21 @@ function Image({
451
460
  !!lightbox && lightbox?.enabled !== lightboxSetting?.enabled || lightboxSetting?.allowEditing;
452
461
  const lightboxChecked = !!lightbox?.enabled || !lightbox && !!lightboxSetting?.enabled;
453
462
  const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
454
- const dimensionsControl = /*#__PURE__*/(0, _jsxRuntime.jsx)(DimensionsTool, {
463
+ const dimensionsControl = isResizable && (_constants.SIZED_LAYOUTS.includes(parentLayoutType) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(DimensionsTool, {
464
+ value: {
465
+ aspectRatio
466
+ },
467
+ onChange: ({
468
+ aspectRatio: newAspectRatio
469
+ }) => {
470
+ setAttributes({
471
+ aspectRatio: newAspectRatio,
472
+ scale: 'cover'
473
+ });
474
+ },
475
+ defaultAspectRatio: "auto",
476
+ tools: ['aspectRatio']
477
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DimensionsTool, {
455
478
  value: {
456
479
  width,
457
480
  height,
@@ -482,22 +505,7 @@ function Image({
482
505
  defaultAspectRatio: "auto",
483
506
  scaleOptions: scaleOptions,
484
507
  unitsOptions: dimensionsUnitsOptions
485
- });
486
- const aspectRatioControl = /*#__PURE__*/(0, _jsxRuntime.jsx)(DimensionsTool, {
487
- value: {
488
- aspectRatio
489
- },
490
- onChange: ({
491
- aspectRatio: newAspectRatio
492
- }) => {
493
- setAttributes({
494
- aspectRatio: newAspectRatio,
495
- scale: 'cover'
496
- });
497
- },
498
- defaultAspectRatio: "auto",
499
- tools: ['aspectRatio']
500
- });
508
+ }));
501
509
  const resetAll = () => {
502
510
  setAttributes({
503
511
  alt: undefined,
@@ -513,7 +521,7 @@ function Image({
513
521
  label: (0, _i18n.__)('Settings'),
514
522
  resetAll: resetAll,
515
523
  dropdownMenuProps: dropdownMenuProps,
516
- children: isResizable && (parentLayoutType === 'grid' ? aspectRatioControl : dimensionsControl)
524
+ children: dimensionsControl
517
525
  })
518
526
  });
519
527
  const arePatternOverridesEnabled = metadata?.bindings?.__default?.source === 'core/pattern-overrides';
@@ -665,7 +673,7 @@ function Image({
665
673
  }),
666
674
  __nextHasNoMarginBottom: true
667
675
  })
668
- }), isResizable && (parentLayoutType === 'grid' ? aspectRatioControl : dimensionsControl), !!imageSizeOptions.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(ResolutionTool, {
676
+ }), dimensionsControl, !!imageSizeOptions.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(ResolutionTool, {
669
677
  value: sizeSlug,
670
678
  onChange: updateImage,
671
679
  options: imageSizeOptions
@@ -730,11 +738,19 @@ function Image({
730
738
  alt: defaultedAlt,
731
739
  onError: onImageError,
732
740
  onLoad: onImageLoad,
733
- ref: imageRef,
741
+ ref: setRefs,
734
742
  className: borderProps.className,
743
+ width: naturalWidth,
744
+ height: naturalHeight,
735
745
  style: {
736
- width: width && height || aspectRatio ? '100%' : undefined,
737
- height: width && height || aspectRatio ? '100%' : undefined,
746
+ aspectRatio,
747
+ ...(resizeDelta ? {
748
+ width: pixelSize.width + resizeDelta.width,
749
+ height: pixelSize.height + resizeDelta.height
750
+ } : {
751
+ width,
752
+ height
753
+ }),
738
754
  objectFit: scale,
739
755
  ...borderProps.style,
740
756
  ...shadowProps.style
@@ -748,8 +764,7 @@ function Image({
748
764
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalImageEditor, {
749
765
  id: id,
750
766
  url: url,
751
- width: numericWidth,
752
- height: numericHeight,
767
+ ...pixelSize,
753
768
  naturalHeight: naturalHeight,
754
769
  naturalWidth: naturalWidth,
755
770
  onSaveImage: imageAttributes => setAttributes(imageAttributes),
@@ -759,25 +774,18 @@ function Image({
759
774
  borderProps: isRounded ? undefined : borderProps
760
775
  })
761
776
  });
762
- } else if (!isResizable || parentLayoutType === 'grid') {
763
- img = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
764
- style: {
765
- width,
766
- height,
767
- aspectRatio
768
- },
769
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageWrapper, {
770
- href: href,
771
- children: img
772
- })
773
- });
774
777
  } else {
778
+ img = /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageWrapper, {
779
+ href: href,
780
+ children: img
781
+ });
782
+ }
783
+ let resizableBox;
784
+ if (isResizable && isSingleSelected && !isEditingImage && !_constants.SIZED_LAYOUTS.includes(parentLayoutType)) {
775
785
  const numericRatio = aspectRatio && (0, _utils.evalAspectRatio)(aspectRatio);
776
- const customRatio = numericWidth / numericHeight;
786
+ const customRatio = pixelSize.width / pixelSize.height;
777
787
  const naturalRatio = naturalWidth / naturalHeight;
778
788
  const ratio = numericRatio || customRatio || naturalRatio || 1;
779
- const currentWidth = !numericWidth && numericHeight ? numericHeight * ratio : numericWidth;
780
- const currentHeight = !numericHeight && numericWidth ? numericWidth / ratio : numericHeight;
781
789
  const minWidth = naturalWidth < naturalHeight ? _constants.MIN_SIZE : _constants.MIN_SIZE * ratio;
782
790
  const minHeight = naturalHeight < naturalWidth ? _constants.MIN_SIZE : _constants.MIN_SIZE / ratio;
783
791
 
@@ -820,17 +828,16 @@ function Image({
820
828
  }
821
829
  }
822
830
  /* eslint-enable no-lonely-if */
823
- img = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ResizableBox, {
831
+ resizableBox = /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ResizableBox, {
832
+ ref: effectResizeableBoxPlacement,
824
833
  style: {
825
- display: 'block',
826
- objectFit: scale,
827
- aspectRatio: !width && !height && aspectRatio ? aspectRatio : undefined
828
- },
829
- size: {
830
- width: currentWidth !== null && currentWidth !== void 0 ? currentWidth : 'auto',
831
- height: currentHeight !== null && currentHeight !== void 0 ? currentHeight : 'auto'
834
+ position: 'absolute',
835
+ // To match the vertical-align: bottom of the img (from style.scss)
836
+ // syncs the top with the img. This matters when the img height is
837
+ // less than the line-height.
838
+ inset: `${offsetTop}px 0 0 0`
832
839
  },
833
- showHandle: isSingleSelected,
840
+ size: pixelSize,
834
841
  minWidth: minWidth,
835
842
  maxWidth: maxResizeWidth,
836
843
  minHeight: minHeight,
@@ -842,9 +849,19 @@ function Image({
842
849
  bottom: true,
843
850
  left: showLeftHandle
844
851
  },
845
- onResizeStart: onResizeStart,
846
- onResizeStop: (event, direction, elt) => {
847
- onResizeStop();
852
+ onResizeStart: () => {
853
+ toggleSelection(false);
854
+ },
855
+ onResize: (event, direction, elt, delta) => {
856
+ setResizeDelta(delta);
857
+ },
858
+ onResizeStop: (event, direction, elt, delta) => {
859
+ toggleSelection(true);
860
+ setResizeDelta(null);
861
+ setPixelSize(current => ({
862
+ width: current.width + delta.width,
863
+ height: current.height + delta.height
864
+ }));
848
865
 
849
866
  // Clear hardcoded width if the resized width is close to the max-content width.
850
867
  if (maxContentWidth &&
@@ -868,11 +885,7 @@ function Image({
868
885
  aspectRatio: ratio === naturalRatio ? undefined : String(ratio)
869
886
  });
870
887
  },
871
- resizeRatio: align === 'center' ? 2 : 1,
872
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageWrapper, {
873
- href: href,
874
- children: img
875
- })
888
+ resizeRatio: align === 'center' ? 2 : 1
876
889
  });
877
890
  }
878
891
  if (!url && !temporaryURL) {
@@ -899,7 +912,7 @@ function Image({
899
912
  })
900
913
  });
901
914
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
902
- children: [mediaReplaceFlow, controls, featuredImageControl, img, /*#__PURE__*/(0, _jsxRuntime.jsx)(_caption.Caption, {
915
+ children: [mediaReplaceFlow, controls, featuredImageControl, img, resizableBox, /*#__PURE__*/(0, _jsxRuntime.jsx)(_caption.Caption, {
903
916
  attributes: attributes,
904
917
  setAttributes: setAttributes,
905
918
  isSelected: isSingleSelected,