@wordpress/block-editor 12.18.1 → 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.
- package/build/components/global-styles/hooks.js +2 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +14 -31
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +55 -34
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/index.js +3 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/url-popover/link-editor.js +2 -1
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/url-popover/link-viewer.js +2 -1
- package/build/components/url-popover/link-viewer.js.map +1 -1
- package/build/hooks/index.js +0 -6
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +0 -6
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +2 -2
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-shadow-props.js +0 -15
- package/build/hooks/use-shadow-props.js.map +1 -1
- package/build/hooks/utils.js +3 -6
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +0 -7
- package/build/index.js.map +1 -1
- package/build/utils/object.js +0 -17
- package/build/utils/object.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +2 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +15 -32
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +57 -36
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -1
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +2 -1
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +2 -1
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -1
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +2 -2
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-shadow-props.js +0 -14
- package/build-module/hooks/use-shadow-props.js.map +1 -1
- package/build-module/hooks/utils.js +3 -6
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/object.js +0 -16
- package/build-module/utils/object.js.map +1 -1
- package/build-style/style-rtl.css +48 -31
- package/build-style/style.css +48 -31
- package/package.json +2 -2
- package/src/components/block-canvas/style.scss +2 -2
- package/src/components/global-styles/hooks.js +0 -2
- package/src/components/global-styles/typography-panel.js +13 -45
- package/src/components/media-replace-flow/style.scss +1 -1
- package/src/components/rich-text/index.js +1 -2
- package/src/components/url-popover/image-url-input-ui.js +86 -37
- package/src/components/url-popover/index.js +2 -0
- package/src/components/url-popover/link-editor.js +1 -0
- package/src/components/url-popover/link-viewer.js +1 -0
- package/src/components/url-popover/style.scss +51 -31
- package/src/hooks/index.js +1 -1
- package/src/hooks/index.native.js +1 -1
- package/src/hooks/use-bindings-attributes.js +2 -5
- package/src/hooks/use-shadow-props.js +0 -14
- package/src/hooks/utils.js +4 -16
- package/src/index.js +0 -1
- package/src/utils/object.js +0 -16
|
@@ -24,17 +24,6 @@ const LINK_DESTINATION_CUSTOM = 'custom';
|
|
|
24
24
|
const LINK_DESTINATION_MEDIA = 'media';
|
|
25
25
|
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
|
26
26
|
const NEW_TAB_REL = ['noreferrer', 'noopener'];
|
|
27
|
-
const icon = (0, _react.createElement)(_components.SVG, {
|
|
28
|
-
viewBox: "0 0 24 24",
|
|
29
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
30
|
-
}, (0, _react.createElement)(_components.Path, {
|
|
31
|
-
d: "M0,0h24v24H0V0z",
|
|
32
|
-
fill: "none"
|
|
33
|
-
}), (0, _react.createElement)(_components.Path, {
|
|
34
|
-
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"
|
|
35
|
-
}), (0, _react.createElement)(_components.Path, {
|
|
36
|
-
d: "m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"
|
|
37
|
-
}));
|
|
38
27
|
const ImageURLInputUI = ({
|
|
39
28
|
linkDestination,
|
|
40
29
|
onChangeUrl,
|
|
@@ -44,7 +33,10 @@ const ImageURLInputUI = ({
|
|
|
44
33
|
mediaLink,
|
|
45
34
|
linkTarget,
|
|
46
35
|
linkClass,
|
|
47
|
-
rel
|
|
36
|
+
rel,
|
|
37
|
+
showLightboxSetting,
|
|
38
|
+
lightboxEnabled,
|
|
39
|
+
onSetLightbox
|
|
48
40
|
}) => {
|
|
49
41
|
const [isOpen, setIsOpen] = (0, _element.useState)(false);
|
|
50
42
|
// Use internal state instead of a ref to make sure that the component
|
|
@@ -113,7 +105,10 @@ const ImageURLInputUI = ({
|
|
|
113
105
|
const selectedDestination = getLinkDestinations().find(destination => destination.url === urlInput)?.linkDestination || LINK_DESTINATION_CUSTOM;
|
|
114
106
|
onChangeUrl({
|
|
115
107
|
href: urlInput,
|
|
116
|
-
linkDestination: selectedDestination
|
|
108
|
+
linkDestination: selectedDestination,
|
|
109
|
+
lightbox: {
|
|
110
|
+
enabled: false
|
|
111
|
+
}
|
|
117
112
|
});
|
|
118
113
|
}
|
|
119
114
|
stopEditLink();
|
|
@@ -130,24 +125,16 @@ const ImageURLInputUI = ({
|
|
|
130
125
|
const getLinkDestinations = () => {
|
|
131
126
|
const linkDestinations = [{
|
|
132
127
|
linkDestination: LINK_DESTINATION_MEDIA,
|
|
133
|
-
title: (0, _i18n.__)('
|
|
128
|
+
title: (0, _i18n.__)('Link to image file'),
|
|
134
129
|
url: mediaType === 'image' ? mediaUrl : undefined,
|
|
135
|
-
icon
|
|
130
|
+
icon: _icons.image
|
|
136
131
|
}];
|
|
137
132
|
if (mediaType === 'image' && mediaLink) {
|
|
138
133
|
linkDestinations.push({
|
|
139
134
|
linkDestination: LINK_DESTINATION_ATTACHMENT,
|
|
140
|
-
title: (0, _i18n.__)('
|
|
135
|
+
title: (0, _i18n.__)('Link to attachment page'),
|
|
141
136
|
url: mediaType === 'image' ? mediaLink : undefined,
|
|
142
|
-
icon:
|
|
143
|
-
viewBox: "0 0 24 24",
|
|
144
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
145
|
-
}, (0, _react.createElement)(_components.Path, {
|
|
146
|
-
d: "M0 0h24v24H0V0z",
|
|
147
|
-
fill: "none"
|
|
148
|
-
}), (0, _react.createElement)(_components.Path, {
|
|
149
|
-
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"
|
|
150
|
-
}))
|
|
137
|
+
icon: _icons.page
|
|
151
138
|
});
|
|
152
139
|
}
|
|
153
140
|
return linkDestinations;
|
|
@@ -197,16 +184,17 @@ const ImageURLInputUI = ({
|
|
|
197
184
|
onChange: onSetLinkRel
|
|
198
185
|
}), (0, _react.createElement)(_components.TextControl, {
|
|
199
186
|
__nextHasNoMarginBottom: true,
|
|
200
|
-
label: (0, _i18n.__)('Link CSS
|
|
187
|
+
label: (0, _i18n.__)('Link CSS class'),
|
|
201
188
|
value: linkClass || '',
|
|
202
189
|
onChange: onSetLinkClass
|
|
203
190
|
}));
|
|
204
191
|
const linkEditorValue = urlInput !== null ? urlInput : url;
|
|
192
|
+
const showLinkEditor = (!linkEditorValue && !lightboxEnabled) === true;
|
|
205
193
|
const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title;
|
|
206
194
|
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarButton, {
|
|
207
195
|
icon: _icons.link,
|
|
208
196
|
className: "components-toolbar__control",
|
|
209
|
-
label: url ? (0, _i18n.__)('Edit link') : (0, _i18n.__)('
|
|
197
|
+
label: url ? (0, _i18n.__)('Edit link') : (0, _i18n.__)('Add link'),
|
|
210
198
|
"aria-expanded": isOpen,
|
|
211
199
|
onClick: openLinkUI,
|
|
212
200
|
ref: setPopoverAnchor,
|
|
@@ -215,31 +203,64 @@ const ImageURLInputUI = ({
|
|
|
215
203
|
anchor: popoverAnchor,
|
|
216
204
|
onFocusOutside: onFocusOutside(),
|
|
217
205
|
onClose: closeLinkUI,
|
|
218
|
-
renderSettings: () => advancedOptions,
|
|
219
|
-
additionalControls:
|
|
206
|
+
renderSettings: !lightboxEnabled ? () => advancedOptions : null,
|
|
207
|
+
additionalControls: showLinkEditor && (0, _react.createElement)(_components.MenuGroup, null, getLinkDestinations().map(link => (0, _react.createElement)(_components.MenuItem, {
|
|
220
208
|
key: link.linkDestination,
|
|
221
209
|
icon: link.icon,
|
|
210
|
+
iconPosition: "left",
|
|
222
211
|
onClick: () => {
|
|
223
212
|
setUrlInput(null);
|
|
224
213
|
onSetHref(link.url);
|
|
225
214
|
stopEditLink();
|
|
226
215
|
}
|
|
227
|
-
}, link.title)))
|
|
228
|
-
|
|
216
|
+
}, link.title)), showLightboxSetting && (0, _react.createElement)(_components.MenuItem, {
|
|
217
|
+
key: "expand-on-click",
|
|
218
|
+
className: "block-editor-url-popover__expand-on-click",
|
|
219
|
+
icon: _icons.fullscreen,
|
|
220
|
+
info: (0, _i18n.__)('Scale the image with a lightbox effect.'),
|
|
221
|
+
iconPosition: "left",
|
|
222
|
+
onClick: () => {
|
|
223
|
+
setUrlInput(null);
|
|
224
|
+
onChangeUrl({
|
|
225
|
+
linkDestination: LINK_DESTINATION_NONE,
|
|
226
|
+
href: ''
|
|
227
|
+
});
|
|
228
|
+
onSetLightbox(true);
|
|
229
|
+
stopEditLink();
|
|
230
|
+
}
|
|
231
|
+
}, (0, _i18n.__)('Expand on click')))
|
|
232
|
+
}, (!url || isEditingLink) && !lightboxEnabled && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkEditor, {
|
|
229
233
|
className: "block-editor-format-toolbar__link-container-content",
|
|
230
234
|
value: linkEditorValue,
|
|
231
235
|
onChangeInputValue: setUrlInput,
|
|
232
236
|
onSubmit: onSubmitLinkChange(),
|
|
233
237
|
autocompleteRef: autocompleteRef
|
|
234
|
-
}), url && !isEditingLink && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkViewer, {
|
|
238
|
+
})), url && !isEditingLink && !lightboxEnabled && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkViewer, {
|
|
235
239
|
className: "block-editor-format-toolbar__link-container-content",
|
|
236
240
|
url: url,
|
|
237
241
|
onEditLinkClick: startEditLink,
|
|
238
242
|
urlLabel: urlLabel
|
|
239
243
|
}), (0, _react.createElement)(_components.Button, {
|
|
240
|
-
icon: _icons.
|
|
244
|
+
icon: _icons.linkOff,
|
|
241
245
|
label: (0, _i18n.__)('Remove link'),
|
|
242
|
-
onClick: onLinkRemove
|
|
246
|
+
onClick: onLinkRemove,
|
|
247
|
+
size: "compact"
|
|
248
|
+
})), !url && !isEditingLink && lightboxEnabled && (0, _react.createElement)("div", {
|
|
249
|
+
className: "block-editor-url-popover__expand-on-click"
|
|
250
|
+
}, (0, _react.createElement)("div", {
|
|
251
|
+
className: "fullscreen-icon"
|
|
252
|
+
}, _icons.fullscreen), (0, _react.createElement)("div", {
|
|
253
|
+
className: "text"
|
|
254
|
+
}, (0, _react.createElement)("p", null, (0, _i18n.__)('Expand on click')), (0, _react.createElement)("p", {
|
|
255
|
+
className: "description"
|
|
256
|
+
}, (0, _i18n.__)('Scales the image with a lightbox effect'))), (0, _react.createElement)(_components.Button, {
|
|
257
|
+
icon: _icons.linkOff,
|
|
258
|
+
className: "remove-link",
|
|
259
|
+
label: (0, _i18n.__)('Disable expand on click'),
|
|
260
|
+
onClick: () => {
|
|
261
|
+
onSetLightbox(false);
|
|
262
|
+
},
|
|
263
|
+
size: "compact"
|
|
243
264
|
}))));
|
|
244
265
|
};
|
|
245
266
|
exports.__experimentalImageURLInputUI = ImageURLInputUI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_components","_icons","_index","_interopRequireDefault","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","icon","_react","createElement","SVG","viewBox","xmlns","Path","d","fill","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","isOpen","setIsOpen","useState","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","useRef","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","__experimentalVStack","spacing","ToggleControl","__nextHasNoMarginBottom","label","onChange","checked","TextControl","linkEditorValue","urlLabel","Fragment","ToolbarButton","linkIcon","className","onClick","ref","isActive","default","anchor","onClose","renderSettings","additionalControls","NavigableMenu","map","link","MenuItem","key","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","Button","close","exports","__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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAWA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AArBA;AACA;AACA;;AAgBA;AACA;AACA;;AAGA,MAAMM,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,GACT,IAAAC,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAY,GAAG;EAACC,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AAe,EAAGA;EAAiB,CACnC,CACD,EACCjB,GAAG,IAAI,CAAEa,aAAa,IACvB,IAAAxB,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAiF,QAAA,QACC,IAAAjF,MAAA,CAAAC,aAAA,EAACT,MAAA,CAAAgG,OAAU,CAACa,UAAU;IACrBjB,SAAS,EAAC,qDAAqD;IAC/DzE,GAAG,EAAGA,GAAK;IACX2F,eAAe,EAAGxE,aAAe;IACjCkD,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACF,IAAAhF,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAiH,MAAM;IACNxG,IAAI,EAAGyG,YAAO;IACd7B,KAAK,EAAG,IAAAZ,QAAE,EAAE,aAAc,CAAG;IAC7BsB,OAAO,EAAGzB;EAAc,CACxB,CACA,CAEQ,CAEZ,CAAC;AAEL,CAAC;AAAC6C,OAAA,CAAAC,6BAAA,GAAAlG,eAAA"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_components","_icons","_index","_interopRequireDefault","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","useState","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","useRef","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","image","page","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","_react","createElement","__experimentalVStack","spacing","ToggleControl","__nextHasNoMarginBottom","label","onChange","checked","TextControl","linkEditorValue","showLinkEditor","urlLabel","Fragment","ToolbarButton","linkIcon","className","onClick","ref","isActive","default","anchor","onClose","renderSettings","additionalControls","MenuGroup","map","link","MenuItem","key","iconPosition","fullscreen","info","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","Button","linkOff","size","exports","__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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAC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B,GAC7Be,iBACE,CAAC,EACN,IAAA/B,MAAA,CAAAC,aAAA;IAAKe,SAAS,EAAC;EAAM,GACpB,IAAAhB,MAAA,CAAAC,aAAA,aAAK,IAAAZ,QAAE,EAAE,iBAAkB,CAAM,CAAC,EAClC,IAAAW,MAAA,CAAAC,aAAA;IAAGe,SAAS,EAAC;EAAa,GACvB,IAAA3B,QAAE,EACH,yCACD,CACE,CACC,CAAC,EACN,IAAAW,MAAA,CAAAC,aAAA,EAACjF,WAAA,CAAAsH,MAAM;IACNhD,IAAI,EAAGiD,cAAS;IAChBvB,SAAS,EAAC,aAAa;IACvBV,KAAK,EAAG,IAAAjB,QAAE,EAAE,yBAA0B,CAAG;IACzC4B,OAAO,EAAGA,CAAA,KAAM;MACf5E,aAAa,CAAE,KAAM,CAAC;IACvB,CAAG;IACHmG,IAAI,EAAC;EAAS,CACd,CACG,CAEK,CAEZ,CAAC;AAEL,CAAC;AAACC,OAAA,CAAAC,6BAAA,GAAAjH,eAAA"}
|
|
@@ -66,6 +66,7 @@ function URLPopover({
|
|
|
66
66
|
focusOnMount: focusOnMount,
|
|
67
67
|
placement: computedPlacement,
|
|
68
68
|
shift: true,
|
|
69
|
+
variant: "toolbar",
|
|
69
70
|
...popoverProps
|
|
70
71
|
}, (0, _react.createElement)("div", {
|
|
71
72
|
className: "block-editor-url-popover__input-container"
|
|
@@ -76,7 +77,8 @@ function URLPopover({
|
|
|
76
77
|
icon: _icons.chevronDown,
|
|
77
78
|
label: (0, _i18n.__)('Link settings'),
|
|
78
79
|
onClick: toggleSettingsVisibility,
|
|
79
|
-
"aria-expanded": isSettingsExpanded
|
|
80
|
+
"aria-expanded": isSettingsExpanded,
|
|
81
|
+
size: "compact"
|
|
80
82
|
})), showSettings && (0, _react.createElement)("div", {
|
|
81
83
|
className: "block-editor-url-popover__row block-editor-url-popover__settings"
|
|
82
84
|
}, renderSettings())), additionalControls && !showSettings && (0, _react.createElement)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_components","_icons","_deprecated","_interopRequireDefault","_linkViewer","_linkEditor","_lockUnlock","__experimentalPopoverLegacyPositionToPlacement","unlock","componentsPrivateApis","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","undefined","deprecated","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","useState","showSettings","toggleSettingsVisibility","_react","createElement","Popover","className","shift","Button","icon","chevronDown","label","__","onClick","LinkEditor","LinkViewer","_default","exports","default"],"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"],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H,qBAAqB,CAAE,CAAED,kBAAmB,CAAC;EAC9C,CAAC;EAED,OACC,IAAAK,MAAA,CAAAC,aAAA,EAAC9B,WAAA,CAAA+B,OAAO;IACPC,SAAS,EAAC,0BAA0B;IACpChB,YAAY,EAAGA,YAAc;IAC7BD,SAAS,EAAGQ,iBAAmB;IAC/BU,KAAK;IAAA,
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_components","_icons","_deprecated","_interopRequireDefault","_linkViewer","_linkEditor","_lockUnlock","__experimentalPopoverLegacyPositionToPlacement","unlock","componentsPrivateApis","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","undefined","deprecated","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","useState","showSettings","toggleSettingsVisibility","_react","createElement","Popover","className","shift","variant","Button","icon","chevronDown","label","__","onClick","size","LinkEditor","LinkViewer","_default","exports","default"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,WAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAWA;AACA;AACA;;AAKA,MAAM;EAAES;AAA+C,CAAC,GAAG,IAAAC,kBAAM,EAChEC,uBACD,CAAC;AAED,MAAMC,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;IAC7B,IAAAC,mBAAU,EAAE,8CAA8C,EAAE;MAC3DC,KAAK,EAAE,KAAK;MACZC,WAAW,EAAE;IACd,CAAE,CAAC;EACJ;;EAEA;EACA;EACA;EACA;EACA,IAAIC,iBAAiB;EACrB,IAAKR,SAAS,KAAKI,SAAS,EAAG;IAC9BI,iBAAiB,GAAGR,SAAS;EAC9B,CAAC,MAAM,IAAKE,QAAQ,KAAKE,SAAS,EAAG;IACpCI,iBAAiB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AAU,GAAGA,mBAAU;AAElC/B,UAAU,CAACgC,UAAU,GAAGA,mBAAU;;AAElC;AACA;AACA;AAFA,IAAAC,QAAA,GAGejC,UAAU;AAAAkC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_urlInput","LinkEditor","autocompleteRef","className","onChangeInputValue","value","props","_react","createElement","classnames","default","__nextHasNoMarginBottom","onChange","Button","icon","keyboardReturn","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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,eAAe;EACfC,SAAS;EACTC,kBAAkB;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCL,SAAS,EAAG,IAAAM,mBAAU,EACrB,uCAAuC,EACvCN,SACD,CAAG;IAAA,GACEG;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACR,SAAA,CAAAU,OAAQ;IACRC,uBAAuB;IACvBN,KAAK,EAAGA,KAAO;IACfO,QAAQ,EAAGR,kBAAoB;IAC/BF,eAAe,EAAGA;EAAiB,CACnC,CAAC,EACF,IAAAK,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAe,MAAM;IACNC,IAAI,EAAGC,qBAAgB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAQ,CAAG;IACvBC,IAAI,EAAC;
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_urlInput","LinkEditor","autocompleteRef","className","onChangeInputValue","value","props","_react","createElement","classnames","default","__nextHasNoMarginBottom","onChange","Button","icon","keyboardReturn","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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,eAAe;EACfC,SAAS;EACTC,kBAAkB;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCL,SAAS,EAAG,IAAAM,mBAAU,EACrB,uCAAuC,EACvCN,SACD,CAAG;IAAA,GACEG;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACR,SAAA,CAAAU,OAAQ;IACRC,uBAAuB;IACvBN,KAAK,EAAGA,KAAO;IACfO,QAAQ,EAAGR,kBAAoB;IAC/BF,eAAe,EAAGA;EAAiB,CACnC,CAAC,EACF,IAAAK,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAe,MAAM;IACNC,IAAI,EAAGC,qBAAgB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAQ,CAAG;IACvBC,IAAI,EAAC,QAAQ;IACbC,IAAI,EAAC;EAAS,CACd,CACI,CAAC;AAET"}
|
|
@@ -41,7 +41,8 @@ function LinkViewer({
|
|
|
41
41
|
}), onEditLinkClick && (0, _react.createElement)(_components.Button, {
|
|
42
42
|
icon: _icons.edit,
|
|
43
43
|
label: (0, _i18n.__)('Edit'),
|
|
44
|
-
onClick: onEditLinkClick
|
|
44
|
+
onClick: onEditLinkClick,
|
|
45
|
+
size: "compact"
|
|
45
46
|
}));
|
|
46
47
|
}
|
|
47
48
|
//# sourceMappingURL=link-viewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_linkViewerUrl","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","_react","createElement","classnames","default","Button","icon","edit","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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCP,SAAS,EAAG,IAAAQ,mBAAU,EACrB,uCAAuC,EACvCR,SACD,CAAG;IAAA,GACEK;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACT,cAAA,CAAAW,OAAa;IACbN,GAAG,EAAGA,GAAK;IACXC,QAAQ,EAAGA,QAAU;IACrBJ,SAAS,EAAGC;EAAe,CAC3B,CAAC,EACAC,eAAe,IAChB,IAAAI,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAc,MAAM;IACNC,IAAI,EAAGC,WAAM;IACbC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,OAAO,EAAGb;
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_linkViewerUrl","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","_react","createElement","classnames","default","Button","icon","edit","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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCP,SAAS,EAAG,IAAAQ,mBAAU,EACrB,uCAAuC,EACvCR,SACD,CAAG;IAAA,GACEK;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACT,cAAA,CAAAW,OAAa;IACbN,GAAG,EAAGA,GAAK;IACXC,QAAQ,EAAGA,QAAU;IACrBJ,SAAS,EAAGC;EAAe,CAC3B,CAAC,EACAC,eAAe,IAChB,IAAAI,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAc,MAAM;IACNC,IAAI,EAAGC,WAAM;IACbC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,OAAO,EAAGb,eAAiB;IAC3Bc,IAAI,EAAC;EAAS,CACd,CAEE,CAAC;AAER"}
|
package/build/hooks/index.js
CHANGED
|
@@ -76,12 +76,6 @@ Object.defineProperty(exports, "useLayoutStyles", {
|
|
|
76
76
|
return _layout.useLayoutStyles;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
Object.defineProperty(exports, "useShadowProps", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get: function () {
|
|
82
|
-
return _useShadowProps.useShadowProps;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
79
|
var _utils = require("./utils");
|
|
86
80
|
require("./compat");
|
|
87
81
|
var _align = _interopRequireDefault(require("./align"));
|
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","_align","_interopRequireDefault","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_interopRequireWildcard","_duotone","_fontFamily","_fontSize","_border","_position","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockRenaming","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","createBlockEditFilter","align","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","blockRenaming","filter","Boolean","createBlockListBlockFilter","color","dimensions","fontFamily","fontSize","border","childLayout","createBlockSaveFilter","ariaLabel"],"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
|
|
1
|
+
{"version":3,"names":["_utils","require","_align","_interopRequireDefault","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_interopRequireWildcard","_duotone","_fontFamily","_fontSize","_border","_position","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockRenaming","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","createBlockEditFilter","align","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","blockRenaming","filter","Boolean","createBlockListBlockFilter","color","dimensions","fontFamily","fontSize","border","childLayout","createBlockSaveFilter","ariaLabel"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EC,OAAQ,CACnB,CAAC;AACD,IAAAC,iCAA0B,EAAE,CAC3BZ,cAAK,EACLG,cAAK,EACLU,cAAK,EACLC,mBAAU,EACVV,gBAAO,EACPW,mBAAU,EACVC,iBAAQ,EACRC,eAAM,EACNZ,iBAAQ,EACRa,oBAAW,CACV,CAAC;AACH,IAAAC,4BAAqB,EAAE,CACtBnB,cAAK,EACLC,eAAM,EACNmB,kBAAS,EACTlB,wBAAe,EACfe,eAAM,EACNJ,cAAK,EACLV,cAAK,EACLY,mBAAU,EACVC,iBAAQ,CACP,CAAC"}
|
|
@@ -52,12 +52,6 @@ Object.defineProperty(exports, "useEditorWrapperStyles", {
|
|
|
52
52
|
return _useEditorWrapperStyles.useEditorWrapperStyles;
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
Object.defineProperty(exports, "useShadowProps", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function () {
|
|
58
|
-
return _useShadowProps.useShadowProps;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
55
|
var _utils = require("./utils");
|
|
62
56
|
require("./compat");
|
|
63
57
|
var _align = _interopRequireDefault(require("./align"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","_align","_interopRequireDefault","_anchor","_customClassName","_style","_color","_fontSize","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useCachedTruthy","_useEditorWrapperStyles","createBlockEditFilter","align","anchor","style","createBlockListBlockFilter","color","fontSize","createBlockSaveFilter","customClassName"],"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
|
|
1
|
+
{"version":3,"names":["_utils","require","_align","_interopRequireDefault","_anchor","_customClassName","_style","_color","_fontSize","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useCachedTruthy","_useEditorWrapperStyles","createBlockEditFilter","align","anchor","style","createBlockListBlockFilter","color","fontSize","createBlockSaveFilter","customClassName"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKAA,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,gBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACAA,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,SAAA,GAAAL,sBAAA,CAAAF,OAAA;AACAA,OAAA;AAaA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,cAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAX,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AACA,IAAAa,uBAAA,GAAAb,OAAA;AAlCA;AACA;AACA;;AAgBA,IAAAc,4BAAqB,EAAE,CAAEC,cAAK,EAAEC,eAAM,EAAEC,cAAK,CAAG,CAAC;AACjD,IAAAC,iCAA0B,EAAE,CAAEH,cAAK,EAAEE,cAAK,EAAEE,cAAK,EAAEC,iBAAQ,CAAG,CAAC;AAC/D,IAAAC,4BAAqB,EAAE,CACtBN,cAAK,EACLC,eAAM,EACNM,wBAAe,EACfH,cAAK,EACLF,cAAK,EACLG,iBAAQ,CACP,CAAC"}
|
|
@@ -47,13 +47,13 @@ const createEditFunctionWithBindingsAttribute = () => (0, _compose.createHigherO
|
|
|
47
47
|
const updatedAttributes = getBlockAttributes(clientId);
|
|
48
48
|
if (updatedAttributes?.metadata?.bindings) {
|
|
49
49
|
Object.entries(updatedAttributes.metadata.bindings).forEach(([attributeName, settings]) => {
|
|
50
|
-
const source = getBlockBindingsSource(settings.source
|
|
50
|
+
const source = getBlockBindingsSource(settings.source);
|
|
51
51
|
if (source) {
|
|
52
52
|
// Second argument (`updateMetaValue`) will be used to update the value in the future.
|
|
53
53
|
const {
|
|
54
54
|
placeholder,
|
|
55
55
|
useValue: [metaValue = null] = []
|
|
56
|
-
} = source.useSource(props, settings.
|
|
56
|
+
} = source.useSource(props, settings.args);
|
|
57
57
|
if (placeholder && !metaValue) {
|
|
58
58
|
// If the attribute is `src` or `href`, a placeholder can't be used because it is not a valid url.
|
|
59
59
|
// Adding this workaround until attributes and metadata fields types are improved and include `url`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_compose","_data","_hooks","_store","_context","_lockUnlock","BLOCK_BINDINGS_ALLOWED_BLOCKS","createEditFunctionWithBindingsAttribute","createHigherOrderComponent","BlockEdit","props","clientId","name","blockName","useBlockEditContext","getBlockBindingsSource","unlock","useSelect","blockEditorStore","getBlockAttributes","updateBlockAttributes","updatedAttributes","metadata","bindings","Object","entries","forEach","attributeName","settings","source","placeholder","useValue","metaValue","useSource","
|
|
1
|
+
{"version":3,"names":["_blocks","require","_compose","_data","_hooks","_store","_context","_lockUnlock","BLOCK_BINDINGS_ALLOWED_BLOCKS","createEditFunctionWithBindingsAttribute","createHigherOrderComponent","BlockEdit","props","clientId","name","blockName","useBlockEditContext","getBlockBindingsSource","unlock","useSelect","blockEditorStore","getBlockAttributes","updateBlockAttributes","updatedAttributes","metadata","bindings","Object","entries","forEach","attributeName","settings","source","placeholder","useValue","metaValue","useSource","args","htmlAttribute","getBlockType","attributes","attribute","registry","useRegistry","_react","createElement","Fragment","key","setAttributes","newAttributes","blockId","batch","shimAttributeSource","edit","addFilter","contextItems","usesContextArray","usesContext","oldUsesContextArray","Set","item","has","push"],"sources":["@wordpress/block-editor/src/hooks/use-bindings-attributes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit/context';\nimport { unlock } from '../lock-unlock';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Given a binding of block attributes, returns a higher order component that\n * overrides its `attributes` and `setAttributes` props to sync any changes needed.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\n\nconst BLOCK_BINDINGS_ALLOWED_BLOCKS = {\n\t'core/paragraph': [ 'content' ],\n\t'core/heading': [ 'content' ],\n\t'core/image': [ 'url', 'title', 'alt' ],\n\t'core/button': [ 'url', 'text', 'linkTarget' ],\n};\n\nconst createEditFunctionWithBindingsAttribute = () =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) => ( props ) => {\n\t\t\tconst { clientId, name: blockName } = useBlockEditContext();\n\t\t\tconst { getBlockBindingsSource } = unlock(\n\t\t\t\tuseSelect( blockEditorStore )\n\t\t\t);\n\t\t\tconst { getBlockAttributes, updateBlockAttributes } =\n\t\t\t\tuseSelect( blockEditorStore );\n\n\t\t\tconst updatedAttributes = getBlockAttributes( clientId );\n\t\t\tif ( updatedAttributes?.metadata?.bindings ) {\n\t\t\t\tObject.entries( updatedAttributes.metadata.bindings ).forEach(\n\t\t\t\t\t( [ attributeName, settings ] ) => {\n\t\t\t\t\t\tconst source = getBlockBindingsSource(\n\t\t\t\t\t\t\tsettings.source\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( source ) {\n\t\t\t\t\t\t\t// Second argument (`updateMetaValue`) will be used to update the value in the future.\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\tuseValue: [ metaValue = null ] = [],\n\t\t\t\t\t\t\t} = source.useSource( props, settings.args );\n\n\t\t\t\t\t\t\tif ( placeholder && ! metaValue ) {\n\t\t\t\t\t\t\t\t// If the attribute is `src` or `href`, a placeholder can't be used because it is not a valid url.\n\t\t\t\t\t\t\t\t// Adding this workaround until attributes and metadata fields types are improved and include `url`.\n\t\t\t\t\t\t\t\tconst htmlAttribute =\n\t\t\t\t\t\t\t\t\tgetBlockType( blockName ).attributes[\n\t\t\t\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t\t\t\t].attribute;\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\thtmlAttribute === 'src' ||\n\t\t\t\t\t\t\t\t\thtmlAttribute === 'href'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tupdatedAttributes[ attributeName ] = null;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tupdatedAttributes[ attributeName ] =\n\t\t\t\t\t\t\t\t\t\tplaceholder;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( metaValue ) {\n\t\t\t\t\t\t\t\tupdatedAttributes[ attributeName ] = metaValue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst registry = useRegistry();\n\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tkey=\"edit\"\n\t\t\t\t\t\tattributes={ updatedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( newAttributes, blockId ) =>\n\t\t\t\t\t\t\tregistry.batch( () =>\n\t\t\t\t\t\t\t\tupdateBlockAttributes( blockId, newAttributes )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t},\n\t\t'useBoundAttributes'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade bound attributes.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\tif ( ! ( settings.name in BLOCK_BINDINGS_ALLOWED_BLOCKS ) ) {\n\t\treturn settings;\n\t}\n\tsettings.edit = createEditFunctionWithBindingsAttribute()( settings.edit );\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// Add the context to all blocks.\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/block-bindings-ui',\n\t( settings, name ) => {\n\t\tif ( ! ( name in BLOCK_BINDINGS_ALLOWED_BLOCKS ) ) {\n\t\t\treturn settings;\n\t\t}\n\t\tconst contextItems = [ 'postId', 'postType', 'queryId' ];\n\t\tconst usesContextArray = settings.usesContext;\n\t\tconst oldUsesContextArray = new Set( usesContextArray );\n\t\tcontextItems.forEach( ( item ) => {\n\t\t\tif ( ! oldUsesContextArray.has( item ) ) {\n\t\t\t\tusesContextArray.push( item );\n\t\t\t}\n\t\t} );\n\t\tsettings.usesContext = usesContextArray;\n\t\treturn settings;\n\t}\n);\n"],"mappings":";;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAIA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMO,6BAA6B,GAAG;EACrC,gBAAgB,EAAE,CAAE,SAAS,CAAE;EAC/B,cAAc,EAAE,CAAE,SAAS,CAAE;EAC7B,YAAY,EAAE,CAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAE;EACvC,aAAa,EAAE,CAAE,KAAK,EAAE,MAAM,EAAE,YAAY;AAC7C,CAAC;AAED,MAAMC,uCAAuC,GAAGA,CAAA,KAC/C,IAAAC,mCAA0B,EACvBC,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAM;IAAEC,QAAQ;IAAEC,IAAI,EAAEC;EAAU,CAAC,GAAG,IAAAC,4BAAmB,EAAC,CAAC;EAC3D,MAAM;IAAEC;EAAuB,CAAC,GAAG,IAAAC,k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D,gBAAgB;EACvC,OAAOzB,QAAQ;AAChB,CACD,CAAC"}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getShadowClassesAndStyles = getShadowClassesAndStyles;
|
|
7
|
-
exports.useShadowProps = useShadowProps;
|
|
8
7
|
var _style = require("./style");
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
@@ -24,23 +23,9 @@ var _style = require("./style");
|
|
|
24
23
|
function getShadowClassesAndStyles(attributes) {
|
|
25
24
|
const shadow = attributes.style?.shadow || '';
|
|
26
25
|
return {
|
|
27
|
-
className: undefined,
|
|
28
26
|
style: (0, _style.getInlineStyles)({
|
|
29
27
|
shadow
|
|
30
28
|
})
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Derives the shadow related props for a block from its shadow block support
|
|
36
|
-
* attributes.
|
|
37
|
-
*
|
|
38
|
-
* @param {Object} attributes Block attributes.
|
|
39
|
-
*
|
|
40
|
-
* @return {Object} ClassName & style props from shadow block support.
|
|
41
|
-
*/
|
|
42
|
-
function useShadowProps(attributes) {
|
|
43
|
-
const shadowProps = getShadowClassesAndStyles(attributes);
|
|
44
|
-
return shadowProps;
|
|
45
|
-
}
|
|
46
31
|
//# sourceMappingURL=use-shadow-props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_style","require","getShadowClassesAndStyles","attributes","shadow","style","
|
|
1
|
+
{"version":3,"names":["_style","require","getShadowClassesAndStyles","attributes","shadow","style","getInlineStyles"],"sources":["@wordpress/block-editor/src/hooks/use-shadow-props.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\n\n// This utility is intended to assist where the serialization of the shadow\n// block support is being skipped for a block but the shadow related CSS classes\n// & styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's shadow support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Shadow block support derived CSS classes & styles.\n */\nexport function getShadowClassesAndStyles( attributes ) {\n\tconst shadow = attributes.style?.shadow || '';\n\n\treturn {\n\t\tstyle: getInlineStyles( { shadow } ),\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CAAEC,UAAU,EAAG;EACvD,MAAMC,MAAM,GAAGD,UAAU,CAACE,KAAK,EAAED,MAAM,IAAI,EAAE;EAE7C,OAAO;IACNC,KAAK,EAAE,IAAAC,sBAAe,EAAE;MAAEF;IAAO,CAAE;EACpC,CAAC;AACF"}
|
package/build/hooks/utils.js
CHANGED
|
@@ -149,7 +149,7 @@ function useStyleOverride({
|
|
|
149
149
|
* @return {Object} Settings object.
|
|
150
150
|
*/
|
|
151
151
|
function useBlockSettings(name, parentLayout) {
|
|
152
|
-
const [backgroundImage, backgroundSize, fontFamilies,
|
|
152
|
+
const [backgroundImage, backgroundSize, fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = (0, _components.useSettings)('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies', 'typography.fontSizes', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.spacingSizes', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow');
|
|
153
153
|
const rawSettings = (0, _element.useMemo)(() => {
|
|
154
154
|
return {
|
|
155
155
|
background: {
|
|
@@ -189,12 +189,9 @@ function useBlockSettings(name, parentLayout) {
|
|
|
189
189
|
custom: fontFamilies
|
|
190
190
|
},
|
|
191
191
|
fontSizes: {
|
|
192
|
-
custom:
|
|
193
|
-
theme: themeFontSizes,
|
|
194
|
-
default: defaultFontSizes
|
|
192
|
+
custom: fontSizes
|
|
195
193
|
},
|
|
196
194
|
customFontSize,
|
|
197
|
-
defaultFontSizes: defaultFontSizesEnabled,
|
|
198
195
|
fontStyle,
|
|
199
196
|
fontWeight,
|
|
200
197
|
lineHeight,
|
|
@@ -227,7 +224,7 @@ function useBlockSettings(name, parentLayout) {
|
|
|
227
224
|
parentLayout,
|
|
228
225
|
shadow
|
|
229
226
|
};
|
|
230
|
-
}, [backgroundImage, backgroundSize, fontFamilies,
|
|
227
|
+
}, [backgroundImage, backgroundSize, fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow]);
|
|
231
228
|
return (0, _hooks2.useSettingsForBlockElement)(rawSettings, name);
|
|
232
229
|
}
|
|
233
230
|
function createBlockEditFilter(features) {
|