@wordpress/block-editor 12.18.0 → 12.18.2

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 (101) hide show
  1. package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  2. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  3. package/build/components/global-styles/dimensions-panel.js +30 -5
  4. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  5. package/build/components/global-styles/hooks.js +10 -9
  6. package/build/components/global-styles/hooks.js.map +1 -1
  7. package/build/components/global-styles/typography-panel.js +14 -31
  8. package/build/components/global-styles/typography-panel.js.map +1 -1
  9. package/build/components/global-styles/use-global-styles-output.js +6 -0
  10. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  11. package/build/components/rich-text/index.js +1 -1
  12. package/build/components/rich-text/index.js.map +1 -1
  13. package/build/components/url-popover/image-url-input-ui.js +55 -34
  14. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  15. package/build/components/url-popover/index.js +3 -1
  16. package/build/components/url-popover/index.js.map +1 -1
  17. package/build/components/url-popover/link-editor.js +2 -1
  18. package/build/components/url-popover/link-editor.js.map +1 -1
  19. package/build/components/url-popover/link-viewer.js +2 -1
  20. package/build/components/url-popover/link-viewer.js.map +1 -1
  21. package/build/hooks/dimensions.js +71 -1
  22. package/build/hooks/dimensions.js.map +1 -1
  23. package/build/hooks/index.js +2 -8
  24. package/build/hooks/index.js.map +1 -1
  25. package/build/hooks/index.native.js +0 -6
  26. package/build/hooks/index.native.js.map +1 -1
  27. package/build/hooks/style.js +3 -0
  28. package/build/hooks/style.js.map +1 -1
  29. package/build/hooks/use-bindings-attributes.js +2 -2
  30. package/build/hooks/use-bindings-attributes.js.map +1 -1
  31. package/build/hooks/use-shadow-props.js +0 -15
  32. package/build/hooks/use-shadow-props.js.map +1 -1
  33. package/build/hooks/utils.js +4 -6
  34. package/build/hooks/utils.js.map +1 -1
  35. package/build/index.js +0 -7
  36. package/build/index.js.map +1 -1
  37. package/build/utils/object.js +0 -17
  38. package/build/utils/object.js.map +1 -1
  39. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  40. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  41. package/build-module/components/global-styles/dimensions-panel.js +30 -5
  42. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  43. package/build-module/components/global-styles/hooks.js +10 -9
  44. package/build-module/components/global-styles/hooks.js.map +1 -1
  45. package/build-module/components/global-styles/typography-panel.js +15 -32
  46. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  47. package/build-module/components/global-styles/use-global-styles-output.js +6 -0
  48. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  49. package/build-module/components/rich-text/index.js +1 -1
  50. package/build-module/components/rich-text/index.js.map +1 -1
  51. package/build-module/components/url-popover/image-url-input-ui.js +57 -36
  52. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  53. package/build-module/components/url-popover/index.js +3 -1
  54. package/build-module/components/url-popover/index.js.map +1 -1
  55. package/build-module/components/url-popover/link-editor.js +2 -1
  56. package/build-module/components/url-popover/link-editor.js.map +1 -1
  57. package/build-module/components/url-popover/link-viewer.js +2 -1
  58. package/build-module/components/url-popover/link-viewer.js.map +1 -1
  59. package/build-module/hooks/dimensions.js +70 -2
  60. package/build-module/hooks/dimensions.js.map +1 -1
  61. package/build-module/hooks/index.js +3 -2
  62. package/build-module/hooks/index.js.map +1 -1
  63. package/build-module/hooks/index.native.js +1 -1
  64. package/build-module/hooks/index.native.js.map +1 -1
  65. package/build-module/hooks/style.js +3 -0
  66. package/build-module/hooks/style.js.map +1 -1
  67. package/build-module/hooks/use-bindings-attributes.js +2 -2
  68. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  69. package/build-module/hooks/use-shadow-props.js +0 -14
  70. package/build-module/hooks/use-shadow-props.js.map +1 -1
  71. package/build-module/hooks/utils.js +4 -6
  72. package/build-module/hooks/utils.js.map +1 -1
  73. package/build-module/index.js +1 -1
  74. package/build-module/index.js.map +1 -1
  75. package/build-module/utils/object.js +0 -16
  76. package/build-module/utils/object.js.map +1 -1
  77. package/build-style/style-rtl.css +48 -31
  78. package/build-style/style.css +48 -31
  79. package/package.json +4 -4
  80. package/src/components/block-canvas/style.scss +2 -2
  81. package/src/components/dimensions-tool/aspect-ratio-tool.js +4 -1
  82. package/src/components/global-styles/dimensions-panel.js +50 -1
  83. package/src/components/global-styles/hooks.js +9 -8
  84. package/src/components/global-styles/typography-panel.js +13 -45
  85. package/src/components/global-styles/use-global-styles-output.js +6 -0
  86. package/src/components/media-replace-flow/style.scss +1 -1
  87. package/src/components/rich-text/index.js +1 -2
  88. package/src/components/url-popover/image-url-input-ui.js +86 -37
  89. package/src/components/url-popover/index.js +2 -0
  90. package/src/components/url-popover/link-editor.js +1 -0
  91. package/src/components/url-popover/link-viewer.js +1 -0
  92. package/src/components/url-popover/style.scss +51 -31
  93. package/src/hooks/dimensions.js +74 -3
  94. package/src/hooks/index.js +3 -1
  95. package/src/hooks/index.native.js +1 -1
  96. package/src/hooks/style.js +4 -0
  97. package/src/hooks/use-bindings-attributes.js +2 -5
  98. package/src/hooks/use-shadow-props.js +0 -14
  99. package/src/hooks/utils.js +8 -16
  100. package/src/index.js +0 -1
  101. package/src/utils/object.js +0 -16
@@ -4,8 +4,8 @@ import { createElement, Fragment } from "react";
4
4
  */
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import { useRef, useState } from '@wordpress/element';
7
- import { ToolbarButton, Button, NavigableMenu, MenuItem, ToggleControl, TextControl, SVG, Path, __experimentalVStack as VStack } from '@wordpress/components';
8
- import { link as linkIcon, close } from '@wordpress/icons';
7
+ import { ToolbarButton, Button, MenuItem, ToggleControl, TextControl, MenuGroup, __experimentalVStack as VStack } from '@wordpress/components';
8
+ import { link as linkIcon, image, page, fullscreen, linkOff } from '@wordpress/icons';
9
9
 
10
10
  /**
11
11
  * Internal dependencies
@@ -16,17 +16,6 @@ const LINK_DESTINATION_CUSTOM = 'custom';
16
16
  const LINK_DESTINATION_MEDIA = 'media';
17
17
  const LINK_DESTINATION_ATTACHMENT = 'attachment';
18
18
  const NEW_TAB_REL = ['noreferrer', 'noopener'];
19
- const icon = createElement(SVG, {
20
- viewBox: "0 0 24 24",
21
- xmlns: "http://www.w3.org/2000/svg"
22
- }, createElement(Path, {
23
- d: "M0,0h24v24H0V0z",
24
- fill: "none"
25
- }), createElement(Path, {
26
- d: "m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z"
27
- }), createElement(Path, {
28
- d: "m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"
29
- }));
30
19
  const ImageURLInputUI = ({
31
20
  linkDestination,
32
21
  onChangeUrl,
@@ -36,7 +25,10 @@ const ImageURLInputUI = ({
36
25
  mediaLink,
37
26
  linkTarget,
38
27
  linkClass,
39
- rel
28
+ rel,
29
+ showLightboxSetting,
30
+ lightboxEnabled,
31
+ onSetLightbox
40
32
  }) => {
41
33
  const [isOpen, setIsOpen] = useState(false);
42
34
  // Use internal state instead of a ref to make sure that the component
@@ -105,7 +97,10 @@ const ImageURLInputUI = ({
105
97
  const selectedDestination = getLinkDestinations().find(destination => destination.url === urlInput)?.linkDestination || LINK_DESTINATION_CUSTOM;
106
98
  onChangeUrl({
107
99
  href: urlInput,
108
- linkDestination: selectedDestination
100
+ linkDestination: selectedDestination,
101
+ lightbox: {
102
+ enabled: false
103
+ }
109
104
  });
110
105
  }
111
106
  stopEditLink();
@@ -122,24 +117,16 @@ const ImageURLInputUI = ({
122
117
  const getLinkDestinations = () => {
123
118
  const linkDestinations = [{
124
119
  linkDestination: LINK_DESTINATION_MEDIA,
125
- title: __('Media File'),
120
+ title: __('Link to image file'),
126
121
  url: mediaType === 'image' ? mediaUrl : undefined,
127
- icon
122
+ icon: image
128
123
  }];
129
124
  if (mediaType === 'image' && mediaLink) {
130
125
  linkDestinations.push({
131
126
  linkDestination: LINK_DESTINATION_ATTACHMENT,
132
- title: __('Attachment Page'),
127
+ title: __('Link to attachment page'),
133
128
  url: mediaType === 'image' ? mediaLink : undefined,
134
- icon: createElement(SVG, {
135
- viewBox: "0 0 24 24",
136
- xmlns: "http://www.w3.org/2000/svg"
137
- }, createElement(Path, {
138
- d: "M0 0h24v24H0V0z",
139
- fill: "none"
140
- }), createElement(Path, {
141
- d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
142
- }))
129
+ icon: page
143
130
  });
144
131
  }
145
132
  return linkDestinations;
@@ -189,16 +176,17 @@ const ImageURLInputUI = ({
189
176
  onChange: onSetLinkRel
190
177
  }), createElement(TextControl, {
191
178
  __nextHasNoMarginBottom: true,
192
- label: __('Link CSS Class'),
179
+ label: __('Link CSS class'),
193
180
  value: linkClass || '',
194
181
  onChange: onSetLinkClass
195
182
  }));
196
183
  const linkEditorValue = urlInput !== null ? urlInput : url;
184
+ const showLinkEditor = (!linkEditorValue && !lightboxEnabled) === true;
197
185
  const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title;
198
186
  return createElement(Fragment, null, createElement(ToolbarButton, {
199
187
  icon: linkIcon,
200
188
  className: "components-toolbar__control",
201
- label: url ? __('Edit link') : __('Insert link'),
189
+ label: url ? __('Edit link') : __('Add link'),
202
190
  "aria-expanded": isOpen,
203
191
  onClick: openLinkUI,
204
192
  ref: setPopoverAnchor,
@@ -207,31 +195,64 @@ const ImageURLInputUI = ({
207
195
  anchor: popoverAnchor,
208
196
  onFocusOutside: onFocusOutside(),
209
197
  onClose: closeLinkUI,
210
- renderSettings: () => advancedOptions,
211
- additionalControls: !linkEditorValue && createElement(NavigableMenu, null, getLinkDestinations().map(link => createElement(MenuItem, {
198
+ renderSettings: !lightboxEnabled ? () => advancedOptions : null,
199
+ additionalControls: showLinkEditor && createElement(MenuGroup, null, getLinkDestinations().map(link => createElement(MenuItem, {
212
200
  key: link.linkDestination,
213
201
  icon: link.icon,
202
+ iconPosition: "left",
214
203
  onClick: () => {
215
204
  setUrlInput(null);
216
205
  onSetHref(link.url);
217
206
  stopEditLink();
218
207
  }
219
- }, link.title)))
220
- }, (!url || isEditingLink) && createElement(URLPopover.LinkEditor, {
208
+ }, link.title)), showLightboxSetting && createElement(MenuItem, {
209
+ key: "expand-on-click",
210
+ className: "block-editor-url-popover__expand-on-click",
211
+ icon: fullscreen,
212
+ info: __('Scale the image with a lightbox effect.'),
213
+ iconPosition: "left",
214
+ onClick: () => {
215
+ setUrlInput(null);
216
+ onChangeUrl({
217
+ linkDestination: LINK_DESTINATION_NONE,
218
+ href: ''
219
+ });
220
+ onSetLightbox(true);
221
+ stopEditLink();
222
+ }
223
+ }, __('Expand on click')))
224
+ }, (!url || isEditingLink) && !lightboxEnabled && createElement(Fragment, null, createElement(URLPopover.LinkEditor, {
221
225
  className: "block-editor-format-toolbar__link-container-content",
222
226
  value: linkEditorValue,
223
227
  onChangeInputValue: setUrlInput,
224
228
  onSubmit: onSubmitLinkChange(),
225
229
  autocompleteRef: autocompleteRef
226
- }), url && !isEditingLink && createElement(Fragment, null, createElement(URLPopover.LinkViewer, {
230
+ })), url && !isEditingLink && !lightboxEnabled && createElement(Fragment, null, createElement(URLPopover.LinkViewer, {
227
231
  className: "block-editor-format-toolbar__link-container-content",
228
232
  url: url,
229
233
  onEditLinkClick: startEditLink,
230
234
  urlLabel: urlLabel
231
235
  }), createElement(Button, {
232
- icon: close,
236
+ icon: linkOff,
233
237
  label: __('Remove link'),
234
- onClick: onLinkRemove
238
+ onClick: onLinkRemove,
239
+ size: "compact"
240
+ })), !url && !isEditingLink && lightboxEnabled && createElement("div", {
241
+ className: "block-editor-url-popover__expand-on-click"
242
+ }, createElement("div", {
243
+ className: "fullscreen-icon"
244
+ }, fullscreen), createElement("div", {
245
+ className: "text"
246
+ }, createElement("p", null, __('Expand on click')), createElement("p", {
247
+ className: "description"
248
+ }, __('Scales the image with a lightbox effect'))), createElement(Button, {
249
+ icon: linkOff,
250
+ className: "remove-link",
251
+ label: __('Disable expand on click'),
252
+ onClick: () => {
253
+ onSetLightbox(false);
254
+ },
255
+ size: "compact"
235
256
  }))));
236
257
  };
237
258
  export { ImageURLInputUI as __experimentalImageURLInputUI };
@@ -1 +1 @@
1
- {"version":3,"names":["__","useRef","useState","ToolbarButton","Button","NavigableMenu","MenuItem","ToggleControl","TextControl","SVG","Path","__experimentalVStack","VStack","link","linkIcon","close","URLPopover","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","icon","createElement","viewBox","xmlns","d","fill","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","current","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","find","destination","href","preventDefault","onLinkRemove","linkDestinations","title","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","spacing","__nextHasNoMarginBottom","label","onChange","checked","linkEditorValue","urlLabel","Fragment","className","onClick","ref","isActive","anchor","onClose","renderSettings","additionalControls","map","key","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState } from '@wordpress/element';\nimport {\n\tToolbarButton,\n\tButton,\n\tNavigableMenu,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\tSVG,\n\tPath,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { link as linkIcon, close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst icon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M0,0h24v24H0V0z\" fill=\"none\" />\n\t\t<Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" />\n\t\t<Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" />\n\t</SVG>\n);\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Media File' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Attachment Page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: (\n\t\t\t\t\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t<Path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n\t\t\t\t\t\t<Path d=\"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z\" />\n\t\t\t\t\t</SVG>\n\t\t\t\t),\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS Class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ url ? __( 'Edit link' ) : __( 'Insert link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={ !! url }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={ () => advancedOptions }\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\t! linkEditorValue && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && (\n\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ url && ! isEditingLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\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</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AACrD,SACCC,aAAa,EACbC,MAAM,EACNC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,WAAW,EACXC,GAAG,EACHC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,IAAI,IAAIC,QAAQ,EAAEC,KAAK,QAAQ,kBAAkB;;AAE1D;AACA;AACA;AACA,OAAOC,UAAU,MAAM,SAAS;AAEhC,MAAMC,qBAAqB,GAAG,MAAM;AACpC,MAAMC,uBAAuB,GAAG,QAAQ;AACxC,MAAMC,sBAAsB,GAAG,OAAO;AACtC,MAAMC,2BAA2B,GAAG,YAAY;AAChD,MAAMC,WAAW,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE;AAEhD,MAAMC,IAAI,G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AGA,CAAA,KAAMf,eAAiB;IACxCgB,kBAAkB,EACjB,CAAEV,eAAe,IAChBtE,aAAA,CAAClB,aAAa,QACXoE,mBAAmB,CAAC,CAAC,CAAC+B,GAAG,CAAI3F,IAAI,IAClCU,aAAA,CAACjB,QAAQ;MACRmG,GAAG,EAAG5F,IAAI,CAACgB,eAAiB;MAC5BP,IAAI,EAAGT,IAAI,CAACS,IAAM;MAClB2E,OAAO,EAAGA,CAAA,KAAM;QACfnD,WAAW,CAAE,IAAK,CAAC;QACnBmC,SAAS,CAAEpE,IAAI,CAACkB,GAAI,CAAC;QACrBkB,YAAY,CAAC,CAAC;MACf;IAAG,GAEDpC,IAAI,CAACmE,KACE,CACT,CACY;EAEhB,GAEC,CAAE,CAAEjD,GAAG,IAAIY,aAAa,KACzBpB,aAAA,CAACP,UAAU,CAAC0F,UAAU;IACrBV,SAAS,EAAC,qDAAqD;IAC/D5C,KAAK,EAAGyC,eAAiB;IACzBc,kBAAkB,EAAG7D,WAAa;IAClC8D,QAAQ,EAAGrC,kBAAkB,CAAC,CAAG;IACjCxB,eAAe,EAAGA;EAAiB,CACnC,CACD,EACChB,GAAG,IAAI,CAAEY,aAAa,IACvBpB,aAAA,CAAAwE,QAAA,QACCxE,aAAA,CAACP,UAAU,CAAC6F,UAAU;IACrBb,SAAS,EAAC,qDAAqD;IAC/DjE,GAAG,EAAGA,GAAK;IACX+E,eAAe,EAAG9D,aAAe;IACjC8C,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACFvE,aAAA,CAACnB,MAAM;IACNkB,IAAI,EAAGP,KAAO;IACd2E,KAAK,EAAG1F,EAAE,CAAE,aAAc,CAAG;IAC7BiG,OAAO,EAAGnB;EAAc,CACxB,CACA,CAEQ,CAEZ,CAAC;AAEL,CAAC;AAED,SAASlD,eAAe,IAAImF,6BAA6B"}
1
+ {"version":3,"names":["__","useRef","useState","ToolbarButton","Button","MenuItem","ToggleControl","TextControl","MenuGroup","__experimentalVStack","VStack","link","linkIcon","image","page","fullscreen","linkOff","URLPopover","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","current","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","find","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","icon","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","createElement","spacing","__nextHasNoMarginBottom","label","onChange","checked","linkEditorValue","showLinkEditor","urlLabel","Fragment","className","onClick","ref","isActive","anchor","onClose","renderSettings","additionalControls","map","key","iconPosition","info","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","size","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState } from '@wordpress/element';\nimport {\n\tToolbarButton,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\tMenuGroup,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst showLinkEditor = ( ! linkEditorValue && ! lightboxEnabled ) === true;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ url ? __( 'Edit link' ) : __( 'Add link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={ !! url }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\t! lightboxEnabled ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\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{ url && ! isEditingLink && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\n\t\t\t\t\t\t\t\tsize=\"compact\"\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{ ! url && ! isEditingLink && lightboxEnabled && (\n\t\t\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t\t\t<div className=\"fullscreen-icon\">\n\t\t\t\t\t\t\t\t{ fullscreen }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Scales the image with a lightbox effect'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tclassName=\"remove-link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonSetLightbox( false );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AACrD,SACCC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,aAAa,EACbC,WAAW,EACXC,SAAS,EACTC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SACCC,IAAI,IAAIC,QAAQ,EAChBC,KAAK,EACLC,IAAI,EACJC,UAAU,EACVC,OAAO,QACD,kBAAkB;;AAEzB;AACA;AACA;AACA,OAAOC,UAAU,MAAM,SAAS;AAEhC,MAAMC,qBAAqB,GAAG,MAAM;AACpC,MAAMC,uBAAuB,GAAG,QAAQ;AACxC,MAAMC,sBAAsB,GAAG,OAAO;AACtC,MAAMC,2BAA2B,GAAG,YAAY;AAChD,MAAMC,WAAW,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE;AAEhD,MAAMC,eAAe,GAAGA,CAAE;EACzBC,eAAe;EACfC,WAAW;EACXC,GAAG;EACHC,SAAS,GAAG,OAAO;EACnBC,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVC,SAAS;EACTC,GAAG;EACHC,mBAAmB;EACnBC,eAAe;EACfC;AACD,CAAC,KA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EAA2C,GACzDV,aAAA;IAAKU,SAAS,EAAC;EAAiB,GAC7BpF,UACE,CAAC,EACN0E,aAAA;IAAKU,SAAS,EAAC;EAAM,GACpBV,aAAA,YAAKzF,EAAE,CAAE,iBAAkB,CAAM,CAAC,EAClCyF,aAAA;IAAGU,SAAS,EAAC;EAAa,GACvBnG,EAAE,CACH,yCACD,CACE,CACC,CAAC,EACNyF,aAAA,CAACrF,MAAM;IACN6E,IAAI,EAAGjE,OAAS;IAChBmF,SAAS,EAAC,aAAa;IACvBP,KAAK,EAAG5F,EAAE,CAAE,yBAA0B,CAAG;IACzCoG,OAAO,EAAGA,CAAA,KAAM;MACfjE,aAAa,CAAE,KAAM,CAAC;IACvB,CAAG;IACHiF,IAAI,EAAC;EAAS,CACd,CACG,CAEK,CAEZ,CAAC;AAEL,CAAC;AAED,SAAS7F,eAAe,IAAI8F,6BAA6B"}
@@ -58,6 +58,7 @@ function URLPopover({
58
58
  focusOnMount: focusOnMount,
59
59
  placement: computedPlacement,
60
60
  shift: true,
61
+ variant: "toolbar",
61
62
  ...popoverProps
62
63
  }, createElement("div", {
63
64
  className: "block-editor-url-popover__input-container"
@@ -68,7 +69,8 @@ function URLPopover({
68
69
  icon: chevronDown,
69
70
  label: __('Link settings'),
70
71
  onClick: toggleSettingsVisibility,
71
- "aria-expanded": isSettingsExpanded
72
+ "aria-expanded": isSettingsExpanded,
73
+ size: "compact"
72
74
  })), showSettings && createElement("div", {
73
75
  className: "block-editor-url-popover__row block-editor-url-popover__settings"
74
76
  }, renderSettings())), additionalControls && !showSettings && createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"names":["__","useState","Button","Popover","privateApis","componentsPrivateApis","chevronDown","deprecated","LinkViewer","LinkEditor","unlock","__experimentalPopoverLegacyPositionToPlacement","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","undefined","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","showSettings","toggleSettingsVisibility","createElement","className","shift","icon","label","onClick"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\nfunction URLPopover( {\n\tadditionalControls,\n\tchildren,\n\trenderSettings,\n\t// The DEFAULT_PLACEMENT value is assigned inside the function's body\n\tplacement,\n\tfocusOnMount = 'firstElement',\n\t// Deprecated\n\tposition,\n\t// Rest\n\t...popoverProps\n} ) {\n\tif ( position !== undefined ) {\n\t\tdeprecated( '`position` prop in wp.blockEditor.URLPopover', {\n\t\t\tsince: '6.2',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\n\t// Compute popover's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the DEFAULT_PLACEMENT.\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement =\n\t\t\t__experimentalPopoverLegacyPositionToPlacement( position );\n\t}\n\tcomputedPlacement = computedPlacement || DEFAULT_PLACEMENT;\n\n\tconst [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n\n\tconst showSettings = !! renderSettings && isSettingsExpanded;\n\n\tconst toggleSettingsVisibility = () => {\n\t\tsetIsSettingsExpanded( ! isSettingsExpanded );\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"block-editor-url-popover\"\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\tplacement={ computedPlacement }\n\t\t\tshift\n\t\t\t{ ...popoverProps }\n\t\t>\n\t\t\t<div className=\"block-editor-url-popover__input-container\">\n\t\t\t\t<div className=\"block-editor-url-popover__row\">\n\t\t\t\t\t{ children }\n\t\t\t\t\t{ !! renderSettings && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tlabel={ __( 'Link settings' ) }\n\t\t\t\t\t\t\tonClick={ toggleSettingsVisibility }\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t{ showSettings && (\n\t\t\t\t\t<div className=\"block-editor-url-popover__row block-editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ additionalControls && ! showSettings && (\n\t\t\t\t<div className=\"block-editor-url-popover__additional-controls\">\n\t\t\t\t\t{ additionalControls }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nURLPopover.LinkEditor = LinkEditor;\n\nURLPopover.LinkViewer = LinkViewer;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md\n */\nexport default URLPopover;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACCC,MAAM,EACNC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,UAAU,MAAM,eAAe;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AA,CAAC3B,MAAM;IACN4B,SAAS,EAAC,2CAA2C;IACrDE,IAAI,EAAG1B,WAAa;IACpB2B,KAAK,EAAGjC,EAAE,CAAE,eAAgB,CAAG;IAC/BkC,OAAO,EAAGN,wBAA0B;IACpC,iBAAgBH;EAAoB,CACpC,CAEE,CAAC,EACJE,YAAY,IACbE,aAAA;IAAKC,SAAS,EAAC;EAAkE,GAC9Ed,cAAc,CAAC,CACb,CAEF,CAAC,EACJF,kBAAkB,IAAI,CAAEa,YAAY,IACrCE,aAAA;IAAKC,SAAS,EAAC;EAA+C,GAC3DhB,kBACE,CAEE,CAAC;AAEZ;AAEAD,UAAU,CAACJ,UAAU,GAAGA,UAAU;AAElCI,UAAU,CAACL,UAAU,GAAGA,UAAU;;AAElC;AACA;AACA;AACA,eAAeK,UAAU"}
1
+ {"version":3,"names":["__","useState","Button","Popover","privateApis","componentsPrivateApis","chevronDown","deprecated","LinkViewer","LinkEditor","unlock","__experimentalPopoverLegacyPositionToPlacement","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","undefined","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","showSettings","toggleSettingsVisibility","createElement","className","shift","variant","icon","label","onClick","size"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\nfunction URLPopover( {\n\tadditionalControls,\n\tchildren,\n\trenderSettings,\n\t// The DEFAULT_PLACEMENT value is assigned inside the function's body\n\tplacement,\n\tfocusOnMount = 'firstElement',\n\t// Deprecated\n\tposition,\n\t// Rest\n\t...popoverProps\n} ) {\n\tif ( position !== undefined ) {\n\t\tdeprecated( '`position` prop in wp.blockEditor.URLPopover', {\n\t\t\tsince: '6.2',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\n\t// Compute popover's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the DEFAULT_PLACEMENT.\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement =\n\t\t\t__experimentalPopoverLegacyPositionToPlacement( position );\n\t}\n\tcomputedPlacement = computedPlacement || DEFAULT_PLACEMENT;\n\n\tconst [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n\n\tconst showSettings = !! renderSettings && isSettingsExpanded;\n\n\tconst toggleSettingsVisibility = () => {\n\t\tsetIsSettingsExpanded( ! isSettingsExpanded );\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"block-editor-url-popover\"\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\tplacement={ computedPlacement }\n\t\t\tshift\n\t\t\tvariant=\"toolbar\"\n\t\t\t{ ...popoverProps }\n\t\t>\n\t\t\t<div className=\"block-editor-url-popover__input-container\">\n\t\t\t\t<div className=\"block-editor-url-popover__row\">\n\t\t\t\t\t{ children }\n\t\t\t\t\t{ !! renderSettings && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tlabel={ __( 'Link settings' ) }\n\t\t\t\t\t\t\tonClick={ toggleSettingsVisibility }\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t{ showSettings && (\n\t\t\t\t\t<div className=\"block-editor-url-popover__row block-editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ additionalControls && ! showSettings && (\n\t\t\t\t<div className=\"block-editor-url-popover__additional-controls\">\n\t\t\t\t\t{ additionalControls }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nURLPopover.LinkEditor = LinkEditor;\n\nURLPopover.LinkViewer = LinkViewer;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md\n */\nexport default URLPopover;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACCC,MAAM,EACNC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAA+C,CAAC,GAAGD,MAAM,CAChEL,qBACD,CAAC;AAED,MAAMO,iBAAiB,GAAG,QAAQ;AAElC,SAASC,UAAUA,CAAE;EACpBC,kBAAkB;EAClBC,QAAQ;EACRC,cAAc;EACd;EACAC,SAAS;EACTC,YAAY,GAAG,cAAc;EAC7B;EACAC,QAAQ;EACR;EACA,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKD,QAAQ,KAAKE,SAAS,EAAG;IAC7Bd,UAAU,CAAE,8CAA8C,EAAE;MAC3De,KAAK,EAAE,KAAK;MACZC,WAAW,EAAE;IACd,CAAE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EE,CAAC;AAEZ;AAEAD,UAAU,CAACJ,UAAU,GAAGA,UAAU;AAElCI,UAAU,CAACL,UAAU,GAAGA,UAAU;;AAElC;AACA;AACA;AACA,eAAeK,UAAU"}
@@ -33,7 +33,8 @@ export default function LinkEditor({
33
33
  }), createElement(Button, {
34
34
  icon: keyboardReturn,
35
35
  label: __('Apply'),
36
- type: "submit"
36
+ type: "submit",
37
+ size: "compact"
37
38
  }));
38
39
  }
39
40
  //# sourceMappingURL=link-editor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__","Button","keyboardReturn","URLInput","LinkEditor","autocompleteRef","className","onChangeInputValue","value","props","createElement","__nextHasNoMarginBottom","onChange","icon","label","type"],"sources":["@wordpress/block-editor/src/components/url-popover/link-editor.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLInput from '../url-input';\n\nexport default function LinkEditor( {\n\tautocompleteRef,\n\tclassName,\n\tonChangeInputValue,\n\tvalue,\n\t...props\n} ) {\n\treturn (\n\t\t<form\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-editor',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<URLInput\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeInputValue }\n\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t/>\n\t\t</form>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,cAAc,QAAQ,kBAAkB;;AAEjD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,cAAc;AAEnC,eAAe,SAASC,UAAUA,CAAE;EACnCC,eAAe;EACfC,SAAS;EACTC,kBAAkB;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,OACCC,aAAA;IACCJ,SAAS,EAAGP,UAAU,CACrB,uCAAuC,EACvCO,SACD,CAAG;IAAA,GACEG;EAAK,GAEVC,aAAA,CAACP,QAAQ;IACRQ,uBAAuB;IACvBH,KAAK,EAAGA,KAAO;IACfI,QAAQ,EAAGL,kBAAoB;IAC/BF,eAAe,EAAGA;EAAiB,CACnC,CAAC,EACFK,aAAA,CAACT,MAAM;IACNY,IAAI,EAAGX,cAAgB;IACvBY,KAAK,EAAGd,EAAE,CAAE,OAAQ,CAAG;IACvBe,IAAI,EAAC;EAAQ,CACb,CACI,CAAC;AAET"}
1
+ {"version":3,"names":["classnames","__","Button","keyboardReturn","URLInput","LinkEditor","autocompleteRef","className","onChangeInputValue","value","props","createElement","__nextHasNoMarginBottom","onChange","icon","label","type","size"],"sources":["@wordpress/block-editor/src/components/url-popover/link-editor.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLInput from '../url-input';\n\nexport default function LinkEditor( {\n\tautocompleteRef,\n\tclassName,\n\tonChangeInputValue,\n\tvalue,\n\t...props\n} ) {\n\treturn (\n\t\t<form\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-editor',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<URLInput\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeInputValue }\n\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t</form>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,cAAc,QAAQ,kBAAkB;;AAEjD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,cAAc;AAEnC,eAAe,SAASC,UAAUA,CAAE;EACnCC,eAAe;EACfC,SAAS;EACTC,kBAAkB;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,OACCC,aAAA;IACCJ,SAAS,EAAGP,UAAU,CACrB,uCAAuC,EACvCO,SACD,CAAG;IAAA,GACEG;EAAK,GAEVC,aAAA,CAACP,QAAQ;IACRQ,uBAAuB;IACvBH,KAAK,EAAGA,KAAO;IACfI,QAAQ,EAAGL,kBAAoB;IAC/BF,eAAe,EAAGA;EAAiB,CACnC,CAAC,EACFK,aAAA,CAACT,MAAM;IACNY,IAAI,EAAGX,cAAgB;IACvBY,KAAK,EAAGd,EAAE,CAAE,OAAQ,CAAG;IACvBe,IAAI,EAAC,QAAQ;IACbC,IAAI,EAAC;EAAS,CACd,CACI,CAAC;AAET"}
@@ -33,7 +33,8 @@ export default function LinkViewer({
33
33
  }), onEditLinkClick && createElement(Button, {
34
34
  icon: edit,
35
35
  label: __('Edit'),
36
- onClick: onEditLinkClick
36
+ onClick: onEditLinkClick,
37
+ size: "compact"
37
38
  }));
38
39
  }
39
40
  //# sourceMappingURL=link-viewer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__","Button","edit","LinkViewerURL","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","createElement","icon","label","onClick"],"sources":["@wordpress/block-editor/src/components/url-popover/link-viewer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkViewerURL from './link-viewer-url';\n\nexport default function LinkViewer( {\n\tclassName,\n\tlinkClassName,\n\tonEditLinkClick,\n\turl,\n\turlLabel,\n\t...props\n} ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-viewer',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<LinkViewerURL\n\t\t\t\turl={ url }\n\t\t\t\turlLabel={ urlLabel }\n\t\t\t\tclassName={ linkClassName }\n\t\t\t/>\n\t\t\t{ onEditLinkClick && (\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tonClick={ onEditLinkClick }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,eAAe,SAASC,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,OACCC,aAAA;IACCN,SAAS,EAAGN,UAAU,CACrB,uCAAuC,EACvCM,SACD,CAAG;IAAA,GACEK;EAAK,GAEVC,aAAA,CAACR,aAAa;IACbK,GAAG,EAAGA,GAAK;IACXC,QAAQ,EAAGA,QAAU;IACrBJ,SAAS,EAAGC;EAAe,CAC3B,CAAC,EACAC,eAAe,IAChBI,aAAA,CAACV,MAAM;IACNW,IAAI,EAAGV,IAAM;IACbW,KAAK,EAAGb,EAAE,CAAE,MAAO,CAAG;IACtBc,OAAO,EAAGP;EAAiB,CAC3B,CAEE,CAAC;AAER"}
1
+ {"version":3,"names":["classnames","__","Button","edit","LinkViewerURL","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","createElement","icon","label","onClick","size"],"sources":["@wordpress/block-editor/src/components/url-popover/link-viewer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkViewerURL from './link-viewer-url';\n\nexport default function LinkViewer( {\n\tclassName,\n\tlinkClassName,\n\tonEditLinkClick,\n\turl,\n\turlLabel,\n\t...props\n} ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-viewer',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<LinkViewerURL\n\t\t\t\turl={ url }\n\t\t\t\turlLabel={ urlLabel }\n\t\t\t\tclassName={ linkClassName }\n\t\t\t/>\n\t\t\t{ onEditLinkClick && (\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tonClick={ onEditLinkClick }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,eAAe,SAASC,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,OACCC,aAAA;IACCN,SAAS,EAAGN,UAAU,CACrB,uCAAuC,EACvCM,SACD,CAAG;IAAA,GACEK;EAAK,GAEVC,aAAA,CAACR,aAAa;IACbK,GAAG,EAAGA,GAAK;IACXC,QAAQ,EAAGA,QAAU;IACrBJ,SAAS,EAAGC;EAAe,CAC3B,CAAC,EACAC,eAAe,IAChBI,aAAA,CAACV,MAAM;IACNW,IAAI,EAAGV,IAAM;IACbW,KAAK,EAAGb,EAAE,CAAE,MAAO,CAAG;IACtBc,OAAO,EAAGP,eAAiB;IAC3BQ,IAAI,EAAC;EAAS,CACd,CAEE,CAAC;AAER"}
@@ -1,8 +1,13 @@
1
1
  import { createElement, Fragment } from "react";
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import classnames from 'classnames';
6
+
2
7
  /**
3
8
  * WordPress dependencies
4
9
  */
5
- import { useState, useEffect, useCallback } from '@wordpress/element';
10
+ import { Platform, useState, useEffect, useCallback } from '@wordpress/element';
6
11
  import { useDispatch, useSelect } from '@wordpress/data';
7
12
  import { getBlockSupport } from '@wordpress/blocks';
8
13
  import deprecated from '@wordpress/deprecated';
@@ -16,7 +21,7 @@ import { MarginVisualizer } from './margin';
16
21
  import { PaddingVisualizer } from './padding';
17
22
  import { store as blockEditorStore } from '../store';
18
23
  import { unlock } from '../lock-unlock';
19
- import { cleanEmptyObject } from './utils';
24
+ import { cleanEmptyObject, shouldSkipSerialization } from './utils';
20
25
  export const DIMENSIONS_SUPPORT_KEY = 'dimensions';
21
26
  export const SPACING_SUPPORT_KEY = 'spacing';
22
27
  export const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
@@ -95,6 +100,69 @@ export function DimensionsPanel({
95
100
  }));
96
101
  }
97
102
 
103
+ /**
104
+ * Determine whether there is block support for dimensions.
105
+ *
106
+ * @param {string} blockName Block name.
107
+ * @param {string} feature Background image feature to check for.
108
+ *
109
+ * @return {boolean} Whether there is support.
110
+ */
111
+ export function hasDimensionsSupport(blockName, feature = 'any') {
112
+ if (Platform.OS !== 'web') {
113
+ return false;
114
+ }
115
+ const support = getBlockSupport(blockName, DIMENSIONS_SUPPORT_KEY);
116
+ if (support === true) {
117
+ return true;
118
+ }
119
+ if (feature === 'any') {
120
+ return !!(support?.aspectRatio || !!support?.minHeight);
121
+ }
122
+ return !!support?.[feature];
123
+ }
124
+ export default {
125
+ useBlockProps,
126
+ attributeKeys: ['minHeight', 'style'],
127
+ hasSupport(name) {
128
+ return hasDimensionsSupport(name, 'aspectRatio');
129
+ }
130
+ };
131
+ function useBlockProps({
132
+ name,
133
+ minHeight,
134
+ style
135
+ }) {
136
+ if (!hasDimensionsSupport(name, 'aspectRatio') || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio')) {
137
+ return {};
138
+ }
139
+ const className = classnames({
140
+ 'has-aspect-ratio': !!style?.dimensions?.aspectRatio
141
+ });
142
+
143
+ // Allow dimensions-based inline style overrides to override any global styles rules that
144
+ // might be set for the block, and therefore affect the display of the aspect ratio.
145
+ const inlineStyleOverrides = {};
146
+
147
+ // Apply rules to unset incompatible styles.
148
+ // Note that a set `aspectRatio` will win out if both an aspect ratio and a minHeight are set.
149
+ // This is because the aspect ratio is a newer block support, so (in theory) any aspect ratio
150
+ // that is set should be intentional and should override any existing minHeight. The Cover block
151
+ // and dimensions controls have logic that will manually clear the aspect ratio if a minHeight
152
+ // is set.
153
+ if (style?.dimensions?.aspectRatio) {
154
+ // To ensure the aspect ratio does not get overridden by `minHeight` unset any existing rule.
155
+ inlineStyleOverrides.minHeight = 'unset';
156
+ } else if (minHeight || style?.dimensions?.minHeight) {
157
+ // To ensure the minHeight does not get overridden by `aspectRatio` unset any existing rule.
158
+ inlineStyleOverrides.aspectRatio = 'unset';
159
+ }
160
+ return {
161
+ className,
162
+ style: inlineStyleOverrides
163
+ };
164
+ }
165
+
98
166
  /**
99
167
  * @deprecated
100
168
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useEffect","useCallback","useDispatch","useSelect","getBlockSupport","deprecated","InspectorControls","DimensionsPanel","StylesDimensionsPanel","useHasDimensionsPanel","MarginVisualizer","PaddingVisualizer","store","blockEditorStore","unlock","cleanEmptyObject","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizer","property","setProperty","hideBlockInterface","showBlockInterface","DimensionsInspectorControl","children","resetAllFilter","attributesResetAllFilter","attributes","existingStyle","style","updatedStyle","createElement","group","clientId","name","setAttributes","settings","isEnabled","value","select","getBlockAttributes","visualizedProperty","setVisualizedProperty","onChange","newStyle","defaultDimensionsControls","defaultSpacingControls","defaultControls","Fragment","as","panelId","onVisualize","spacing","padding","forceShow","margin","useCustomSides","since","version"],"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tDimensionsPanel as StylesDimensionsPanel,\n\tuseHasDimensionsPanel,\n} from '../components/global-styles';\nimport { MarginVisualizer } from './margin';\nimport { PaddingVisualizer } from './padding';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nimport { cleanEmptyObject } from './utils';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizer() {\n\tconst [ property, setProperty ] = useState( false );\n\tconst { hideBlockInterface, showBlockInterface } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tuseEffect( () => {\n\t\tif ( ! property ) {\n\t\t\tshowBlockInterface();\n\t\t} else {\n\t\t\thideBlockInterface();\n\t\t}\n\t}, [ property, showBlockInterface, hideBlockInterface ] );\n\n\treturn [ property, setProperty ];\n}\n\nfunction DimensionsInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributes.style;\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tstyle: updatedStyle,\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"dimensions\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function DimensionsPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasDimensionsPanel( settings );\n\tconst value = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\tconst [ visualizedProperty, setVisualizedProperty ] = useVisualizer();\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultSpacingControls = getBlockSupport( name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultControls = {\n\t\t...defaultDimensionsControls,\n\t\t...defaultSpacingControls,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<StylesDimensionsPanel\n\t\t\t\tas={ DimensionsInspectorControl }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\tonVisualize={ setVisualizedProperty }\n\t\t\t/>\n\t\t\t{ !! settings?.spacing?.padding && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'padding' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! settings?.spacing?.margin && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'margin' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function useCustomSides() {\n\tdeprecated( 'wp.blockEditor.__experimentalUseCustomSides', {\n\t\tsince: '6.3',\n\t\tversion: '6.4',\n\t} );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AACrE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,SACCC,eAAe,IAAIC,qBAAqB,EACxCC,qBAAqB,QACf,6BAA6B;AACpC,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,iBAAiB,QAAQ,WAAW;AAC7C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,SAASC,gBAAgB,QAAQ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AO,CACf,CACD,EACC,CAAC,CAAEF,QAAQ,EAAEgB,OAAO,EAAEG,MAAM,IAC7BxB,aAAA,CAACvB,gBAAgB;IAChB8C,SAAS,EAAGb,kBAAkB,KAAK,QAAU;IAC7CR,QAAQ,EAAGA,QAAU;IACrBK,KAAK,EAAGA;EAAO,CACf,CAED,CAAC;AAEL;;AAEA;AACA;AACA;AACA,OAAO,SAASkB,cAAcA,CAAA,EAAG;EAChCrD,UAAU,CAAE,6CAA6C,EAAE;IAC1DsD,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["classnames","Platform","useState","useEffect","useCallback","useDispatch","useSelect","getBlockSupport","deprecated","InspectorControls","DimensionsPanel","StylesDimensionsPanel","useHasDimensionsPanel","MarginVisualizer","PaddingVisualizer","store","blockEditorStore","unlock","cleanEmptyObject","shouldSkipSerialization","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizer","property","setProperty","hideBlockInterface","showBlockInterface","DimensionsInspectorControl","children","resetAllFilter","attributesResetAllFilter","attributes","existingStyle","style","updatedStyle","createElement","group","clientId","name","setAttributes","settings","isEnabled","value","select","getBlockAttributes","visualizedProperty","setVisualizedProperty","onChange","newStyle","defaultDimensionsControls","defaultSpacingControls","defaultControls","Fragment","as","panelId","onVisualize","spacing","padding","forceShow","margin","hasDimensionsSupport","blockName","feature","OS","support","aspectRatio","minHeight","useBlockProps","attributeKeys","hasSupport","className","dimensions","inlineStyleOverrides","useCustomSides","since","version"],"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useState, useEffect, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tDimensionsPanel as StylesDimensionsPanel,\n\tuseHasDimensionsPanel,\n} from '../components/global-styles';\nimport { MarginVisualizer } from './margin';\nimport { PaddingVisualizer } from './padding';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport { cleanEmptyObject, shouldSkipSerialization } from './utils';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizer() {\n\tconst [ property, setProperty ] = useState( false );\n\tconst { hideBlockInterface, showBlockInterface } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tuseEffect( () => {\n\t\tif ( ! property ) {\n\t\t\tshowBlockInterface();\n\t\t} else {\n\t\t\thideBlockInterface();\n\t\t}\n\t}, [ property, showBlockInterface, hideBlockInterface ] );\n\n\treturn [ property, setProperty ];\n}\n\nfunction DimensionsInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributes.style;\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tstyle: updatedStyle,\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"dimensions\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function DimensionsPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasDimensionsPanel( settings );\n\tconst value = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\tconst [ visualizedProperty, setVisualizedProperty ] = useVisualizer();\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultSpacingControls = getBlockSupport( name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultControls = {\n\t\t...defaultDimensionsControls,\n\t\t...defaultSpacingControls,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<StylesDimensionsPanel\n\t\t\t\tas={ DimensionsInspectorControl }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\tonVisualize={ setVisualizedProperty }\n\t\t\t/>\n\t\t\t{ !! settings?.spacing?.padding && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'padding' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! settings?.spacing?.margin && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'margin' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Determine whether there is block support for dimensions.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasDimensionsSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, DIMENSIONS_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! ( support?.aspectRatio || !! support?.minHeight );\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'minHeight', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasDimensionsSupport( name, 'aspectRatio' );\n\t},\n};\n\nfunction useBlockProps( { name, minHeight, style } ) {\n\tif (\n\t\t! hasDimensionsSupport( name, 'aspectRatio' ) ||\n\t\tshouldSkipSerialization( name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio' )\n\t) {\n\t\treturn {};\n\t}\n\n\tconst className = classnames( {\n\t\t'has-aspect-ratio': !! style?.dimensions?.aspectRatio,\n\t} );\n\n\t// Allow dimensions-based inline style overrides to override any global styles rules that\n\t// might be set for the block, and therefore affect the display of the aspect ratio.\n\tconst inlineStyleOverrides = {};\n\n\t// Apply rules to unset incompatible styles.\n\t// Note that a set `aspectRatio` will win out if both an aspect ratio and a minHeight are set.\n\t// This is because the aspect ratio is a newer block support, so (in theory) any aspect ratio\n\t// that is set should be intentional and should override any existing minHeight. The Cover block\n\t// and dimensions controls have logic that will manually clear the aspect ratio if a minHeight\n\t// is set.\n\tif ( style?.dimensions?.aspectRatio ) {\n\t\t// To ensure the aspect ratio does not get overridden by `minHeight` unset any existing rule.\n\t\tinlineStyleOverrides.minHeight = 'unset';\n\t} else if ( minHeight || style?.dimensions?.minHeight ) {\n\t\t// To ensure the minHeight does not get overridden by `aspectRatio` unset any existing rule.\n\t\tinlineStyleOverrides.aspectRatio = 'unset';\n\t}\n\n\treturn { className, style: inlineStyleOverrides };\n}\n\n/**\n * @deprecated\n */\nexport function useCustomSides() {\n\tdeprecated( 'wp.blockEditor.__experimentalUseCustomSides', {\n\t\tsince: '6.3',\n\t\tversion: '6.4',\n\t} );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SA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e;EACdK,aAAa;EACbC,aAAa,EAAE,CAAE,WAAW,EAAE,OAAO,CAAE;EACvCC,UAAUA,CAAE/B,IAAI,EAAG;IAClB,OAAOsB,oBAAoB,CAAEtB,IAAI,EAAE,aAAc,CAAC;EACnD;AACD,CAAC;AAED,SAAS6B,aAAaA,CAAE;EAAE7B,IAAI;EAAE4B,SAAS;EAAEjC;AAAM,CAAC,EAAG;EACpD,IACC,CAAE2B,oBAAoB,CAAEtB,IAAI,EAAE,aAAc,CAAC,IAC7CrB,uBAAuB,CAAEqB,IAAI,EAAEpB,sBAAsB,EAAE,aAAc,CAAC,EACrE;IACD,OAAO,CAAC,CAAC;EACV;EAEA,MAAMoD,SAAS,GAAGxE,UAAU,CAAE;IAC7B,kBAAkB,EAAE,CAAC,CAAEmC,KAAK,EAAEsC,UAAU,EAAEN;EAC3C,CAAE,CAAC;;EAEH;EACA;EACA,MAAMO,oBAAoB,GAAG,CAAC,CAAC;;EAE/B;EACA;EACA;EACA;EACA;EACA;EACA,IAAKvC,KAAK,EAAEsC,UAAU,EAAEN,WAAW,EAAG;IACrC;IACAO,oBAAoB,CAACN,SAAS,GAAG,OAAO;EACzC,CAAC,MAAM,IAAKA,SAAS,IAAIjC,KAAK,EAAEsC,UAAU,EAAEL,SAAS,EAAG;IACvD;IACAM,oBAAoB,CAACP,WAAW,GAAG,OAAO;EAC3C;EAEA,OAAO;IAAEK,SAAS;IAAErC,KAAK,EAAEuC;EAAqB,CAAC;AAClD;;AAEA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAChCnE,UAAU,CAAE,6CAA6C,EAAE;IAC1DoE,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
@@ -12,6 +12,7 @@ import './generated-class-name';
12
12
  import style from './style';
13
13
  import './settings';
14
14
  import color from './color';
15
+ import dimensions from './dimensions';
15
16
  import duotone from './duotone';
16
17
  import fontFamily from './font-family';
17
18
  import fontSize from './font-size';
@@ -25,12 +26,12 @@ import blockHooks from './block-hooks';
25
26
  import blockRenaming from './block-renaming';
26
27
  import './use-bindings-attributes';
27
28
  createBlockEditFilter([align, anchor, customClassName, style, duotone, position, layout, contentLockUI, blockHooks, blockRenaming].filter(Boolean));
28
- createBlockListBlockFilter([align, style, color, duotone, fontFamily, fontSize, border, position, childLayout]);
29
+ createBlockListBlockFilter([align, style, color, dimensions, duotone, fontFamily, fontSize, border, position, childLayout]);
29
30
  createBlockSaveFilter([align, anchor, ariaLabel, customClassName, border, color, style, fontFamily, fontSize]);
30
31
  export { useCustomSides } from './dimensions';
31
32
  export { useLayoutClasses, useLayoutStyles } from './layout';
32
33
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
33
- export { getShadowClassesAndStyles, useShadowProps } from './use-shadow-props';
34
+ export { getShadowClassesAndStyles } from './use-shadow-props';
34
35
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
35
36
  export { getSpacingClassesAndStyles } from './use-spacing-props';
36
37
  export { getTypographyClassesAndStyles } from './use-typography-props';
@@ -1 +1 @@
1
- {"version":3,"names":["createBlockEditFilter","createBlockListBlockFilter","createBlockSaveFilter","align","anchor","ariaLabel","customClassName","style","color","duotone","fontFamily","fontSize","border","position","layout","childLayout","contentLockUI","blockHooks","blockRenaming","filter","Boolean","useCustomSides","useLayoutClasses","useLayoutStyles","getBorderClassesAndStyles","useBorderProps","getShadowClassesAndStyles","useShadowProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","getTypographyClassesAndStyles","getGapCSSValue","useCachedTruthy"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport border from './border';\nimport position from './position';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockRenaming from './block-renaming';\nimport './use-bindings-attributes';\n\ncreateBlockEditFilter(\n\t[\n\t\talign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tblockRenaming,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\tstyle,\n\tcolor,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles, useShadowProps } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,qBAAqB,EACrBC,0BAA0B,EAC1BC,qBAAqB,QACf,SAAS;AAChB,OAAO,UAAU;AACjB,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAO,QAAQ;AACf,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAO,wBAAwB;AAC/B,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAO,Y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,QAAQ,qBAAqB"}
1
+ {"version":3,"names":["createBlockEditFilter","createBlockListBlockFilter","createBlockSaveFilter","align","anchor","ariaLabel","customClassName","style","color","dimensions","duotone","fontFamily","fontSize","border","position","layout","childLayout","contentLockUI","blockHooks","blockRenaming","filter","Boolean","useCustomSides","useLayoutClasses","useLayoutStyles","getBorderClassesAndStyles","useBorderProps","getShadowClassesAndStyles","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","getTypographyClassesAndStyles","getGapCSSValue","useCachedTruthy"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport dimensions from './dimensions';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport border from './border';\nimport position from './position';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockRenaming from './block-renaming';\nimport './use-bindings-attributes';\n\ncreateBlockEditFilter(\n\t[\n\t\talign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tblockRenaming,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\tstyle,\n\tcolor,\n\tdimensions,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,qBAAqB,EACrBC,0BAA0B,EAC1BC,qBAAqB,QACf,SAAS;AAChB,OAAO,UAAU;AACjB,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAO,QAAQ;AACf,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAO,wBAAwB;AAC/B,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAO,YAAY;AACnB,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAO,YAAY;AACnB,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAO,2BAA2B;AAElCnB,qBAAqB,CACpB,CACCG,KAAK,EACLC,MAAM,EACNE,eAAe,EACfC,KAAK,EACLG,OAAO,EACPI,QAAQ,EACRC,MAAM,EACNE,aAAa,EACbC,UAAU,EACVC,aAAa,CACb,CAACC,MAAM,CAAEC,OAAQ,CACnB,CAAC;AACDpB,0BAA0B,CAAE,CAC3BE,KAAK,EACLI,KAAK,EACLC,KAAK,EACLC,UAAU,EACVC,OAAO,EACPC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRE,WAAW,CACV,CAAC;AACHd,qBAAqB,CAAE,CACtBC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,eAAe,EACfO,MAAM,EACNL,KAAK,EACLD,KAAK,EACLI,UAAU,EACVC,QAAQ,CACP,CAAC;AAEH,SAASU,cAAc,QAAQ,cAAc;AAC7C,SAASC,gBAAgB,EAAEC,eAAe,QAAQ,UAAU;AAC5D,SAASC,yBAAyB,EAAEC,cAAc,QAAQ,oBAAoB;AAC9E,SAASC,yBAAyB,QAAQ,oBAAoB;AAC9D,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,mBAAmB;AAC3E,SAASC,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,cAAc,QAAQ,OAAO;AACtC,SAASC,eAAe,QAAQ,qBAAqB"}
@@ -15,7 +15,7 @@ createBlockEditFilter([align, anchor, style]);
15
15
  createBlockListBlockFilter([align, style, color, fontSize]);
16
16
  createBlockSaveFilter([align, anchor, customClassName, color, style, fontSize]);
17
17
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
18
- export { getShadowClassesAndStyles, useShadowProps } from './use-shadow-props';
18
+ export { getShadowClassesAndStyles } from './use-shadow-props';
19
19
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
20
20
  export { getSpacingClassesAndStyles } from './use-spacing-props';
21
21
  export { useCachedTruthy } from './use-cached-truthy';
@@ -1 +1 @@
1
- {"version":3,"names":["createBlockEditFilter","createBlockListBlockFilter","createBlockSaveFilter","align","anchor","customClassName","style","color","fontSize","getBorderClassesAndStyles","useBorderProps","getShadowClassesAndStyles","useShadowProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","useCachedTruthy","useEditorWrapperStyles"],"sources":["@wordpress/block-editor/src/hooks/index.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport anchor from './anchor';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport color from './color';\nimport fontSize from './font-size';\nimport './layout';\n\ncreateBlockEditFilter( [ align, anchor, style ] );\ncreateBlockListBlockFilter( [ align, style, color, fontSize ] );\ncreateBlockSaveFilter( [\n\talign,\n\tanchor,\n\tcustomClassName,\n\tcolor,\n\tstyle,\n\tfontSize,\n] );\n\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles, useShadowProps } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\nexport { useEditorWrapperStyles } from './use-editor-wrapper-styles';\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,qBAAqB,EACrBC,0BAA0B,EAC1BC,qBAAqB,QACf,SAAS;AAChB,OAAO,UAAU;AACjB,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAO,wBAAwB;AAC/B,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAO,UAAU;AAEjBR,qBAAqB,CAAE,CAAEG,KAAK,EAAEC,MAAM,EAAEE,KAAK,CAAG,CAAC;AACjDL,0BAA0B,CAAE,CAAEE,KAAK,EAAEG,KAAK,EAAEC,KAAK,EAAEC,QAAQ,CAAG,CAAC;AAC/DN,qBAAqB,CAAE,CACtBC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfE,KAAK,EACLD,KAAK,EACLE,QAAQ,CACP,CAAC;AAEH,SAASC,yBAAyB,EAAEC,cAAc,QAAQ,oBAAoB;AAC9E,SAASC,yBAAyB,EAAEC,cAAc,QAAQ,oBAAoB;AAC9E,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,mBAAmB;AAC3E,SAASC,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,sBAAsB,QAAQ,6BAA6B"}
1
+ {"version":3,"names":["createBlockEditFilter","createBlockListBlockFilter","createBlockSaveFilter","align","anchor","customClassName","style","color","fontSize","getBorderClassesAndStyles","useBorderProps","getShadowClassesAndStyles","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","useCachedTruthy","useEditorWrapperStyles"],"sources":["@wordpress/block-editor/src/hooks/index.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport anchor from './anchor';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport color from './color';\nimport fontSize from './font-size';\nimport './layout';\n\ncreateBlockEditFilter( [ align, anchor, style ] );\ncreateBlockListBlockFilter( [ align, style, color, fontSize ] );\ncreateBlockSaveFilter( [\n\talign,\n\tanchor,\n\tcustomClassName,\n\tcolor,\n\tstyle,\n\tfontSize,\n] );\n\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\nexport { useEditorWrapperStyles } from './use-editor-wrapper-styles';\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,qBAAqB,EACrBC,0BAA0B,EAC1BC,qBAAqB,QACf,SAAS;AAChB,OAAO,UAAU;AACjB,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAO,wBAAwB;AAC/B,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAO,UAAU;AAEjBR,qBAAqB,CAAE,CAAEG,KAAK,EAAEC,MAAM,EAAEE,KAAK,CAAG,CAAC;AACjDL,0BAA0B,CAAE,CAAEE,KAAK,EAAEG,KAAK,EAAEC,KAAK,EAAEC,QAAQ,CAAG,CAAC;AAC/DN,qBAAqB,CAAE,CACtBC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfE,KAAK,EACLD,KAAK,EACLE,QAAQ,CACP,CAAC;AAEH,SAASC,yBAAyB,EAAEC,cAAc,QAAQ,oBAAoB;AAC9E,SAASC,yBAAyB,QAAQ,oBAAoB;AAC9D,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,mBAAmB;AAC3E,SAASC,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,sBAAsB,QAAQ,6BAA6B"}
@@ -93,10 +93,13 @@ const skipSerializationPathsEdit = {
93
93
  */
94
94
  const skipSerializationPathsSave = {
95
95
  ...skipSerializationPathsEdit,
96
+ [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`],
97
+ // Skip serialization of aspect ratio in save mode.
96
98
  [`${BACKGROUND_SUPPORT_KEY}`]: [BACKGROUND_SUPPORT_KEY] // Skip serialization of background support in save mode.
97
99
  };
98
100
 
99
101
  const skipSerializationPathsSaveChecks = {
102
+ [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: true,
100
103
  [`${BACKGROUND_SUPPORT_KEY}`]: true
101
104
  };
102
105