@wordpress/block-library 8.33.0 → 8.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/block/edit.js +15 -8
- package/build/block/edit.js.map +1 -1
- package/build/block-keyboard-shortcuts/index.js +95 -0
- package/build/block-keyboard-shortcuts/index.js.map +1 -0
- package/build/column/edit.js +28 -19
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +3 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/edit.js +69 -53
- package/build/columns/edit.js.map +1 -1
- package/build/columns/variations.js +18 -28
- package/build/columns/variations.js.map +1 -1
- package/build/comment-template/util.js +3 -1
- package/build/comment-template/util.js.map +1 -1
- package/build/cover/shared.js +3 -1
- package/build/cover/shared.js.map +1 -1
- package/build/embed/embed-placeholder.js +8 -3
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/util.js +3 -1
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +3 -1
- package/build/embed/variations.js.map +1 -1
- package/build/embed/wp-embed-preview.js +6 -2
- package/build/embed/wp-embed-preview.js.map +1 -1
- package/build/group/index.js +0 -8
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +18 -19
- package/build/group/placeholder.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +3 -1
- package/build/image/view.js.map +1 -1
- package/build/index.js +9 -1
- package/build/index.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +12 -4
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +15 -5
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/navigation/edit/are-blocks-dirty.js +9 -3
- package/build/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +3 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +1 -1
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/index.js +0 -9
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view.js +3 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +94 -85
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +2 -7
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/paragraph/index.js +0 -1
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +0 -1
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-excerpt/edit.js +3 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +3 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-navigation-link/variations.js +3 -1
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-template/edit.js +18 -8
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +3 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/private-apis.js +21 -0
- package/build/private-apis.js.map +1 -0
- package/build/query/edit/enhanced-pagination-modal.js +1 -1
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +6 -2
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +18 -6
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/utils.js +3 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-title/variations.js +3 -1
- package/build/query-title/variations.js.map +1 -1
- package/build/social-link/edit.js +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/variations.js +3 -1
- package/build/social-link/variations.js.map +1 -1
- package/build/template-part/variations.js +6 -2
- package/build/template-part/variations.js.map +1 -1
- package/build-module/block/edit.js +15 -8
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block-keyboard-shortcuts/index.js +88 -0
- package/build-module/block-keyboard-shortcuts/index.js.map +1 -0
- package/build-module/column/edit.js +28 -19
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +3 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/edit.js +69 -53
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/variations.js +18 -28
- package/build-module/columns/variations.js.map +1 -1
- package/build-module/comment-template/util.js +3 -1
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/cover/shared.js +3 -1
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +9 -4
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/util.js +3 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +3 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/embed/wp-embed-preview.js +6 -2
- package/build-module/embed/wp-embed-preview.js.map +1 -1
- package/build-module/group/index.js +0 -8
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +18 -19
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +3 -1
- package/build-module/image/view.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +12 -4
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +15 -5
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/navigation/edit/are-blocks-dirty.js +9 -3
- package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +3 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/index.js +0 -9
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view.js +3 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +94 -85
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +3 -8
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/paragraph/index.js +0 -1
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +0 -1
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-excerpt/edit.js +3 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +3 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +3 -1
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-template/edit.js +18 -8
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +3 -1
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/private-apis.js +14 -0
- package/build-module/private-apis.js.map +1 -0
- package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +6 -2
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +18 -6
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/utils.js +3 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-title/variations.js +3 -1
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/social-link/edit.js +1 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/variations.js +3 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/template-part/variations.js +6 -2
- package/build-module/template-part/variations.js.map +1 -1
- package/build-style/editor-rtl.css +15 -49
- package/build-style/editor.css +15 -49
- package/build-style/embed/editor-rtl.css +0 -3
- package/build-style/embed/editor.css +0 -3
- package/build-style/group/editor-rtl.css +0 -44
- package/build-style/group/editor.css +0 -44
- package/build-style/group/style-rtl.css +4 -0
- package/build-style/group/style.css +4 -0
- package/build-style/navigation-link/style-rtl.css +0 -8
- package/build-style/navigation-link/style.css +0 -8
- package/build-style/post-featured-image/editor-rtl.css +1 -0
- package/build-style/post-featured-image/editor.css +1 -0
- package/build-style/site-logo/editor-rtl.css +1 -0
- package/build-style/site-logo/editor.css +1 -0
- package/build-style/social-link/editor-rtl.css +13 -2
- package/build-style/social-link/editor.css +13 -2
- package/build-style/style-rtl.css +4 -8
- package/build-style/style.css +4 -8
- package/package.json +35 -34
- package/src/block/edit.js +19 -12
- package/src/block-keyboard-shortcuts/index.js +113 -0
- package/src/column/edit.js +26 -20
- package/src/column/edit.native.js +3 -1
- package/src/columns/edit.js +93 -83
- package/src/columns/variations.js +12 -34
- package/src/comment-template/util.js +3 -1
- package/src/cover/shared.js +3 -1
- package/src/embed/editor.scss +0 -2
- package/src/embed/embed-placeholder.js +21 -9
- package/src/embed/util.js +3 -1
- package/src/embed/variations.js +3 -1
- package/src/embed/wp-embed-preview.js +6 -2
- package/src/gallery/test/helpers.native.js +3 -3
- package/src/group/editor.scss +0 -47
- package/src/group/index.js +0 -8
- package/src/group/placeholder.js +18 -18
- package/src/group/style.scss +5 -0
- package/src/image/image.js +3 -1
- package/src/image/view.js +3 -1
- package/src/index.js +2 -0
- package/src/list-item/hooks/use-merge.js +12 -4
- package/src/list-item/hooks/use-outdent-list-item.js +15 -5
- package/src/navigation/block.json +0 -9
- package/src/navigation/edit/are-blocks-dirty.js +8 -3
- package/src/navigation/edit/deleted-navigation-warning.js +1 -1
- package/src/navigation/edit/menu-inspector-controls.js +3 -1
- package/src/navigation/edit/navigation-menu-selector.js +1 -1
- package/src/navigation/edit/test/navigation-menu-selector.js +5 -5
- package/src/navigation/view.js +3 -1
- package/src/navigation-link/edit.js +91 -91
- package/src/navigation-link/link-ui.js +74 -89
- package/src/navigation-link/style.scss +0 -12
- package/src/paragraph/block.json +0 -1
- package/src/post-excerpt/edit.js +3 -1
- package/src/post-featured-image/dimension-controls.js +3 -1
- package/src/post-featured-image/editor.scss +1 -0
- package/src/post-navigation-link/variations.js +3 -1
- package/src/post-template/edit.js +9 -4
- package/src/post-terms/edit.js +3 -1
- package/src/private-apis.js +13 -0
- package/src/query/edit/enhanced-pagination-modal.js +5 -1
- package/src/query/edit/inspector-controls/author-control.js +6 -2
- package/src/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +13 -3
- package/src/query/edit/inspector-controls/parent-control.js +18 -6
- package/src/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/src/query/index.php +1 -1
- package/src/query/utils.js +3 -1
- package/src/query-title/variations.js +3 -1
- package/src/site-logo/editor.scss +1 -0
- package/src/social-link/edit.js +2 -2
- package/src/social-link/editor.scss +25 -11
- package/src/social-link/variations.js +3 -1
- package/src/template-part/variations.js +6 -2
|
@@ -136,6 +136,86 @@ function getMissingText(type) {
|
|
|
136
136
|
}
|
|
137
137
|
return missingText;
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
/*
|
|
141
|
+
* Warning, this duplicated in
|
|
142
|
+
* packages/block-library/src/navigation-submenu/edit.js
|
|
143
|
+
* Consider reuseing this components for both blocks.
|
|
144
|
+
*/
|
|
145
|
+
function Controls({
|
|
146
|
+
attributes,
|
|
147
|
+
setAttributes,
|
|
148
|
+
setIsLabelFieldFocused
|
|
149
|
+
}) {
|
|
150
|
+
const {
|
|
151
|
+
label,
|
|
152
|
+
url,
|
|
153
|
+
description,
|
|
154
|
+
title,
|
|
155
|
+
rel
|
|
156
|
+
} = attributes;
|
|
157
|
+
return (0, _react.createElement)(_components.PanelBody, {
|
|
158
|
+
title: (0, _i18n.__)('Settings')
|
|
159
|
+
}, (0, _react.createElement)(_components.TextControl, {
|
|
160
|
+
__nextHasNoMarginBottom: true,
|
|
161
|
+
__next40pxDefaultSize: true,
|
|
162
|
+
value: label ? (0, _dom.__unstableStripHTML)(label) : '',
|
|
163
|
+
onChange: labelValue => {
|
|
164
|
+
setAttributes({
|
|
165
|
+
label: labelValue
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
label: (0, _i18n.__)('Text'),
|
|
169
|
+
autoComplete: "off",
|
|
170
|
+
onFocus: () => setIsLabelFieldFocused(true),
|
|
171
|
+
onBlur: () => setIsLabelFieldFocused(false)
|
|
172
|
+
}), (0, _react.createElement)(_components.TextControl, {
|
|
173
|
+
__nextHasNoMarginBottom: true,
|
|
174
|
+
__next40pxDefaultSize: true,
|
|
175
|
+
value: url ? (0, _url.safeDecodeURI)(url) : '',
|
|
176
|
+
onChange: urlValue => {
|
|
177
|
+
(0, _updateAttributes.updateAttributes)({
|
|
178
|
+
url: urlValue
|
|
179
|
+
}, setAttributes, attributes);
|
|
180
|
+
},
|
|
181
|
+
label: (0, _i18n.__)('Link'),
|
|
182
|
+
autoComplete: "off"
|
|
183
|
+
}), (0, _react.createElement)(_components.TextareaControl, {
|
|
184
|
+
__nextHasNoMarginBottom: true,
|
|
185
|
+
value: description || '',
|
|
186
|
+
onChange: descriptionValue => {
|
|
187
|
+
setAttributes({
|
|
188
|
+
description: descriptionValue
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
label: (0, _i18n.__)('Description'),
|
|
192
|
+
help: (0, _i18n.__)('The description will be displayed in the menu if the current theme supports it.')
|
|
193
|
+
}), (0, _react.createElement)(_components.TextControl, {
|
|
194
|
+
__nextHasNoMarginBottom: true,
|
|
195
|
+
__next40pxDefaultSize: true,
|
|
196
|
+
value: title || '',
|
|
197
|
+
onChange: titleValue => {
|
|
198
|
+
setAttributes({
|
|
199
|
+
title: titleValue
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
label: (0, _i18n.__)('Title attribute'),
|
|
203
|
+
autoComplete: "off",
|
|
204
|
+
help: (0, _i18n.__)('Additional information to help clarify the purpose of the link.')
|
|
205
|
+
}), (0, _react.createElement)(_components.TextControl, {
|
|
206
|
+
__nextHasNoMarginBottom: true,
|
|
207
|
+
__next40pxDefaultSize: true,
|
|
208
|
+
value: rel || '',
|
|
209
|
+
onChange: relValue => {
|
|
210
|
+
setAttributes({
|
|
211
|
+
rel: relValue
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
label: (0, _i18n.__)('Rel attribute'),
|
|
215
|
+
autoComplete: "off",
|
|
216
|
+
help: (0, _i18n.__)('The relationship of the linked URL as space-separated link types.')
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
139
219
|
function NavigationLinkEdit({
|
|
140
220
|
attributes,
|
|
141
221
|
isSelected,
|
|
@@ -152,8 +232,6 @@ function NavigationLinkEdit({
|
|
|
152
232
|
type,
|
|
153
233
|
url,
|
|
154
234
|
description,
|
|
155
|
-
rel,
|
|
156
|
-
title,
|
|
157
235
|
kind
|
|
158
236
|
} = attributes;
|
|
159
237
|
const [isInvalid, isDraft] = useIsInvalidLink(kind, type, id);
|
|
@@ -163,9 +241,11 @@ function NavigationLinkEdit({
|
|
|
163
241
|
const {
|
|
164
242
|
replaceBlock,
|
|
165
243
|
__unstableMarkNextChangeAsNotPersistent,
|
|
244
|
+
selectBlock,
|
|
166
245
|
selectPreviousBlock
|
|
167
246
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
168
|
-
|
|
247
|
+
// Have the link editing ui open on mount when lacking a url and selected.
|
|
248
|
+
const [isLinkOpen, setIsLinkOpen] = (0, _element.useState)(isSelected && !url);
|
|
169
249
|
// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)
|
|
170
250
|
const [openedBy, setOpenedBy] = (0, _element.useState)(null);
|
|
171
251
|
// Use internal state instead of a ref to make sure that the component
|
|
@@ -208,19 +288,14 @@ function NavigationLinkEdit({
|
|
|
208
288
|
* Transform to submenu block.
|
|
209
289
|
*/
|
|
210
290
|
const transformToSubmenu = () => {
|
|
211
|
-
|
|
212
|
-
|
|
291
|
+
let innerBlocks = getBlocks(clientId);
|
|
292
|
+
if (innerBlocks.length === 0) {
|
|
293
|
+
innerBlocks = [(0, _blocks.createBlock)('core/navigation-link')];
|
|
294
|
+
selectBlock(innerBlocks[0].clientId);
|
|
295
|
+
}
|
|
296
|
+
const newSubmenu = (0, _blocks.createBlock)('core/navigation-submenu', attributes, innerBlocks);
|
|
213
297
|
replaceBlock(clientId, newSubmenu);
|
|
214
298
|
};
|
|
215
|
-
(0, _element.useEffect)(() => {
|
|
216
|
-
// Show the LinkControl on mount if the URL is empty
|
|
217
|
-
// ( When adding a new menu item)
|
|
218
|
-
// This can't be done in the useState call because it conflicts
|
|
219
|
-
// with the autofocus behavior of the BlockListBlock component.
|
|
220
|
-
if (!url) {
|
|
221
|
-
setIsLinkOpen(true);
|
|
222
|
-
}
|
|
223
|
-
}, [url]);
|
|
224
299
|
(0, _element.useEffect)(() => {
|
|
225
300
|
// If block has inner blocks, transform to Submenu.
|
|
226
301
|
if (hasChildren) {
|
|
@@ -231,16 +306,6 @@ function NavigationLinkEdit({
|
|
|
231
306
|
}
|
|
232
307
|
}, [hasChildren]);
|
|
233
308
|
|
|
234
|
-
/**
|
|
235
|
-
* The hook shouldn't be necessary but due to a focus loss happening
|
|
236
|
-
* when selecting a suggestion in the link popover, we force close on block unselection.
|
|
237
|
-
*/
|
|
238
|
-
(0, _element.useEffect)(() => {
|
|
239
|
-
if (!isSelected) {
|
|
240
|
-
setIsLinkOpen(false);
|
|
241
|
-
}
|
|
242
|
-
}, [isSelected]);
|
|
243
|
-
|
|
244
309
|
// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.
|
|
245
310
|
(0, _element.useEffect)(() => {
|
|
246
311
|
// We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL
|
|
@@ -361,67 +426,11 @@ function NavigationLinkEdit({
|
|
|
361
426
|
icon: _icons.addSubmenu,
|
|
362
427
|
title: (0, _i18n.__)('Add submenu'),
|
|
363
428
|
onClick: transformToSubmenu
|
|
364
|
-
}))), (0, _react.createElement)(_blockEditor.InspectorControls, null, (0, _react.createElement)(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
value: label ? (0, _dom.__unstableStripHTML)(label) : '',
|
|
370
|
-
onChange: labelValue => {
|
|
371
|
-
setAttributes({
|
|
372
|
-
label: labelValue
|
|
373
|
-
});
|
|
374
|
-
},
|
|
375
|
-
label: (0, _i18n.__)('Text'),
|
|
376
|
-
autoComplete: "off",
|
|
377
|
-
onFocus: () => setIsLabelFieldFocused(true),
|
|
378
|
-
onBlur: () => setIsLabelFieldFocused(false)
|
|
379
|
-
}), (0, _react.createElement)(_components.TextControl, {
|
|
380
|
-
__nextHasNoMarginBottom: true,
|
|
381
|
-
__next40pxDefaultSize: true,
|
|
382
|
-
value: url ? (0, _url.safeDecodeURI)(url) : '',
|
|
383
|
-
onChange: urlValue => {
|
|
384
|
-
(0, _updateAttributes.updateAttributes)({
|
|
385
|
-
url: urlValue
|
|
386
|
-
}, setAttributes, attributes);
|
|
387
|
-
},
|
|
388
|
-
label: (0, _i18n.__)('Link'),
|
|
389
|
-
autoComplete: "off"
|
|
390
|
-
}), (0, _react.createElement)(_components.TextareaControl, {
|
|
391
|
-
__nextHasNoMarginBottom: true,
|
|
392
|
-
value: description || '',
|
|
393
|
-
onChange: descriptionValue => {
|
|
394
|
-
setAttributes({
|
|
395
|
-
description: descriptionValue
|
|
396
|
-
});
|
|
397
|
-
},
|
|
398
|
-
label: (0, _i18n.__)('Description'),
|
|
399
|
-
help: (0, _i18n.__)('The description will be displayed in the menu if the current theme supports it.')
|
|
400
|
-
}), (0, _react.createElement)(_components.TextControl, {
|
|
401
|
-
__nextHasNoMarginBottom: true,
|
|
402
|
-
__next40pxDefaultSize: true,
|
|
403
|
-
value: title || '',
|
|
404
|
-
onChange: titleValue => {
|
|
405
|
-
setAttributes({
|
|
406
|
-
title: titleValue
|
|
407
|
-
});
|
|
408
|
-
},
|
|
409
|
-
label: (0, _i18n.__)('Title attribute'),
|
|
410
|
-
autoComplete: "off",
|
|
411
|
-
help: (0, _i18n.__)('Additional information to help clarify the purpose of the link.')
|
|
412
|
-
}), (0, _react.createElement)(_components.TextControl, {
|
|
413
|
-
__nextHasNoMarginBottom: true,
|
|
414
|
-
__next40pxDefaultSize: true,
|
|
415
|
-
value: rel || '',
|
|
416
|
-
onChange: relValue => {
|
|
417
|
-
setAttributes({
|
|
418
|
-
rel: relValue
|
|
419
|
-
});
|
|
420
|
-
},
|
|
421
|
-
label: (0, _i18n.__)('Rel attribute'),
|
|
422
|
-
autoComplete: "off",
|
|
423
|
-
help: (0, _i18n.__)('The relationship of the linked URL as space-separated link types.')
|
|
424
|
-
}))), (0, _react.createElement)("div", {
|
|
429
|
+
}))), (0, _react.createElement)(_blockEditor.InspectorControls, null, (0, _react.createElement)(Controls, {
|
|
430
|
+
attributes: attributes,
|
|
431
|
+
setAttributes: setAttributes,
|
|
432
|
+
setIsLabelFieldFocused: setIsLabelFieldFocused
|
|
433
|
+
})), (0, _react.createElement)("div", {
|
|
425
434
|
...blockProps
|
|
426
435
|
}, (0, _react.createElement)("a", {
|
|
427
436
|
className: classes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blocks","_data","_components","_keycodes","_i18n","_blockEditor","_url","_element","_dom","_htmlEntities","_icons","_coreData","_compose","_linkUi","_updateAttributes","_utils","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","useState","useEffect","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","isPostType","hasId","Number","isInteger","postStatus","useSelect","select","getEntityRecord","coreStore","status","isInvalid","isDraft","getMissingText","missingText","__","NavigationLinkEdit","attributes","isSelected","setAttributes","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectPreviousBlock","useDispatch","blockEditorStore","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","useRef","itemLabelPlaceholder","ref","prevUrl","usePrevious","isLabelFieldFocused","setIsLabelFieldFocused","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","length","getBlocks","transformToSubmenu","innerBlocks","newSubmenu","createBlock","isURL","prependHTTP","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","opensInNewTab","textColor","customTextColor","backgroundColor","customBackgroundColor","getColors","onKeyDown","isKeyboardEvent","primary","preventDefault","stopPropagation","blockProps","useBlockProps","useMergeRefs","className","classnames","getColorClassName","style","color","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","tooltipText","_react","createElement","Fragment","BlockControls","ToolbarGroup","ToolbarButton","icon","linkIcon","shortcut","displayShortcut","currentTarget","addSubmenu","InspectorControls","PanelBody","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","stripHTML","onChange","labelValue","autoComplete","onFocus","onBlur","safeDecodeURI","urlValue","updateAttributes","TextareaControl","descriptionValue","help","titleValue","relValue","Tooltip","text","RichText","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","allowedFormats","decodeEntities","trim","LinkUI","link","onClose","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tTooltip,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { LinkUI } from './link-ui';\nimport { updateAttributes } from './update-attributes';\nimport { getColors } from '../navigation/edit/utils';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [ elementRef ] );\n\n\treturn isDraggingWithin;\n};\n\nconst useIsInvalidLink = ( kind, type, id ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, type, id ]\n\t);\n\n\t// Check Navigation Link validity if:\n\t// 1. Link is 'post-type'.\n\t// 2. It has an id.\n\t// 3. It's neither null, nor undefined, as valid items might be either of those while loading.\n\t// If those conditions are met, check if\n\t// 1. The post status is published.\n\t// 2. The Navigation Link item has no label.\n\t// If either of those is true, invalidate.\n\tconst isInvalid =\n\t\tisPostType && hasId && postStatus && 'trash' === postStatus;\n\tconst isDraft = 'draft' === postStatus;\n\n\treturn [ isInvalid, isDraft ];\n};\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, rel, title, kind } = attributes;\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink( kind, type, id );\n\tconst { maxNestingLevel } = context;\n\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tselectPreviousBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\tconst prevUrl = usePrevious( url );\n\n\t// Change the label using inspector causes rich text to change focus on firefox.\n\t// This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text.\n\tconst [ isLabelFieldFocused, setIsLabelFieldFocused ] = useState( false );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, [\n\t\t\t\t\t\t'core/navigation-link',\n\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t] ).length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink:\n\t\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t\t'core/navigation',\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tconst transformToSubmenu = () => {\n\t\tconst innerBlocks = getBlocks( clientId );\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks.length > 0\n\t\t\t\t? innerBlocks\n\t\t\t\t: [ createBlock( 'core/navigation-link' ) ]\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t};\n\n\tuseEffect( () => {\n\t\t// Show the LinkControl on mount if the URL is empty\n\t\t// ( When adding a new menu item)\n\t\t// This can't be done in the useState call because it conflicts\n\t\t// with the autofocus behavior of the BlockListBlock component.\n\t\tif ( ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [ url ] );\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [ hasChildren ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\t// We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL\n\t\tif (\n\t\t\t! prevUrl &&\n\t\t\turl &&\n\t\t\tisLinkOpen &&\n\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t) {\n\t\t\t// Focus and select the label text.\n\t\t\tselectLabelText();\n\t\t}\n\t}, [ prevUrl, url, isLinkOpen, label ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\t// It is critical that all attributes are reset\n\t\t// to their default values otherwise this may\n\t\t// in advertently trigger side effects because\n\t\t// the values will have \"changed\".\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlabel: undefined,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\topensInNewTab: false,\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\t...blockProps,\n\t\t\tclassName: 'remove-outline', // Remove the outline from the inner blocks container.\n\t\t},\n\t\t{\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: true,\n\t\t\trenderAppender: false,\n\t\t}\n\t);\n\n\tif ( ! url || isInvalid || isDraft ) {\n\t\tblockProps.onClick = () => {\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t};\n\t}\n\n\tconst classes = classnames( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\t/* translators: Whether the navigation link is Invalid or a Draft. */\n\tconst placeholderText = `(${\n\t\tisInvalid ? __( 'Invalid' ) : __( 'Draft' )\n\t})`;\n\tconst tooltipText =\n\t\tisInvalid || isDraft\n\t\t\t? __( 'This item has been deleted, or is a draft' )\n\t\t\t: __( 'This item is missing a link' );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tonFocus={ () => setIsLabelFieldFocused( true ) }\n\t\t\t\t\t\tonBlur={ () => setIsLabelFieldFocused( false ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ url ? safeDecodeURI( url ) : '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t{ url: urlValue },\n\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Additional information to help clarify the purpose of the link.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid &&\n\t\t\t\t\t\t\t\t! isDraft &&\n\t\t\t\t\t\t\t\t! isLabelFieldFocused && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ description && (\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isInvalid ||\n\t\t\t\t\t\t\t\tisDraft ||\n\t\t\t\t\t\t\t\tisLabelFieldFocused ) && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text wp-block-navigation-link__label\">\n\t\t\t\t\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t\t\t\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t\t\t\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t\t\t\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t\t\t\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t\t\t\t\t\t\t\t`${ decodeEntities( label ) } ${\n\t\t\t\t\t\t\t\t\t\t\t\t\tisInvalid || isDraft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? placeholderText\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t\t\t\t\t\t}`.trim()\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t</div>\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{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\t// If there is no link then remove the auto-inserted block.\n\t\t\t\t\t\t\t\t// This avoids empty blocks which can provided a poor UX.\n\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\t// Select the previous block to keep focus nearby\n\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t\t// Remove the link.\n\t\t\t\t\t\t\t\t\tonReplace( [] );\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else if ( ref.current ) {\n\t\t\t\t\t\t\t\t\t// select the ref when adding a new link\n\t\t\t\t\t\t\t\t\tref.current.focus();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Fallback\n\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ removeLink }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AASA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,IAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,QAAA,GAAAb,OAAA;AAKA,IAAAc,OAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AA1CA;AACA;AACA;;AAGA;AACA;AACA;;AA8BA;AACA;AACA;;AAKA,MAAMiB,aAAa,GAAG;EAAEC,IAAI,EAAE;AAAuB,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAKC,UAAU,IAAM;EAC7C,MAAM,CAAEC,gBAAgB,EAAEC,mBAAmB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAEnE,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAM;MAAEC;I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a,EACbF,UACD,CAAC;IACF;EAAG,CACH,CAEA,CAAC,EACJ,IAAA2F,MAAA,CAAAC,aAAA;IAAA,GAAUV;EAAgB,CAAI,CAC1B,CACJ,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blocks","_data","_components","_keycodes","_i18n","_blockEditor","_url","_element","_dom","_htmlEntities","_icons","_coreData","_compose","_linkUi","_updateAttributes","_utils","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","useState","useEffect","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","isPostType","hasId","Number","isInteger","postStatus","useSelect","select","getEntityRecord","coreStore","status","isInvalid","isDraft","getMissingText","missingText","__","Controls","attributes","setAttributes","setIsLabelFieldFocused","label","url","description","title","rel","_react","createElement","PanelBody","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","stripHTML","onChange","labelValue","autoComplete","onFocus","onBlur","safeDecodeURI","urlValue","updateAttributes","TextareaControl","descriptionValue","help","titleValue","relValue","NavigationLinkEdit","isSelected","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectBlock","selectPreviousBlock","useDispatch","blockEditorStore","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","useRef","itemLabelPlaceholder","ref","prevUrl","usePrevious","isLabelFieldFocused","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","length","getBlocks","transformToSubmenu","innerBlocks","createBlock","newSubmenu","isURL","prependHTTP","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","opensInNewTab","textColor","customTextColor","backgroundColor","customBackgroundColor","getColors","onKeyDown","isKeyboardEvent","primary","preventDefault","stopPropagation","blockProps","useBlockProps","useMergeRefs","className","classnames","getColorClassName","style","color","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","tooltipText","Fragment","BlockControls","ToolbarGroup","ToolbarButton","icon","linkIcon","shortcut","displayShortcut","currentTarget","addSubmenu","InspectorControls","Tooltip","text","RichText","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","allowedFormats","decodeEntities","trim","LinkUI","link","onClose","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tTooltip,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { LinkUI } from './link-ui';\nimport { updateAttributes } from './update-attributes';\nimport { getColors } from '../navigation/edit/utils';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [ elementRef ] );\n\n\treturn isDraggingWithin;\n};\n\nconst useIsInvalidLink = ( kind, type, id ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, type, id ]\n\t);\n\n\t// Check Navigation Link validity if:\n\t// 1. Link is 'post-type'.\n\t// 2. It has an id.\n\t// 3. It's neither null, nor undefined, as valid items might be either of those while loading.\n\t// If those conditions are met, check if\n\t// 1. The post status is published.\n\t// 2. The Navigation Link item has no label.\n\t// If either of those is true, invalidate.\n\tconst isInvalid =\n\t\tisPostType && hasId && postStatus && 'trash' === postStatus;\n\tconst isDraft = 'draft' === postStatus;\n\n\treturn [ isInvalid, isDraft ];\n};\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\n/*\n * Warning, this duplicated in\n * packages/block-library/src/navigation-submenu/edit.js\n * Consider reuseing this components for both blocks.\n */\nfunction Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {\n\tconst { label, url, description, title, rel } = attributes;\n\treturn (\n\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\tonFocus={ () => setIsLabelFieldFocused( true ) }\n\t\t\t\tonBlur={ () => setIsLabelFieldFocused( false ) }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvalue={ url ? safeDecodeURI( url ) : '' }\n\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t{ url: urlValue },\n\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\tattributes\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ description || '' }\n\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvalue={ title || '' }\n\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Additional information to help clarify the purpose of the link.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvalue={ rel || '' }\n\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\thelp={ __(\n\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, kind } = attributes;\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink( kind, type, id );\n\tconst { maxNestingLevel } = context;\n\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tselectBlock,\n\t\tselectPreviousBlock,\n\t} = useDispatch( blockEditorStore );\n\t// Have the link editing ui open on mount when lacking a url and selected.\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( isSelected && ! url );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\tconst prevUrl = usePrevious( url );\n\n\t// Change the label using inspector causes rich text to change focus on firefox.\n\t// This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text.\n\tconst [ isLabelFieldFocused, setIsLabelFieldFocused ] = useState( false );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, [\n\t\t\t\t\t\t'core/navigation-link',\n\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t] ).length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink:\n\t\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t\t'core/navigation',\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tconst transformToSubmenu = () => {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tif ( innerBlocks.length === 0 ) {\n\t\t\tinnerBlocks = [ createBlock( 'core/navigation-link' ) ];\n\t\t\tselectBlock( innerBlocks[ 0 ].clientId );\n\t\t}\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t};\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [ hasChildren ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\t// We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL\n\t\tif (\n\t\t\t! prevUrl &&\n\t\t\turl &&\n\t\t\tisLinkOpen &&\n\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t) {\n\t\t\t// Focus and select the label text.\n\t\t\tselectLabelText();\n\t\t}\n\t}, [ prevUrl, url, isLinkOpen, label ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\t// It is critical that all attributes are reset\n\t\t// to their default values otherwise this may\n\t\t// in advertently trigger side effects because\n\t\t// the values will have \"changed\".\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlabel: undefined,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\topensInNewTab: false,\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\t...blockProps,\n\t\t\tclassName: 'remove-outline', // Remove the outline from the inner blocks container.\n\t\t},\n\t\t{\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: true,\n\t\t\trenderAppender: false,\n\t\t}\n\t);\n\n\tif ( ! url || isInvalid || isDraft ) {\n\t\tblockProps.onClick = () => {\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t};\n\t}\n\n\tconst classes = classnames( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\t/* translators: Whether the navigation link is Invalid or a Draft. */\n\tconst placeholderText = `(${\n\t\tisInvalid ? __( 'Invalid' ) : __( 'Draft' )\n\t})`;\n\tconst tooltipText =\n\t\tisInvalid || isDraft\n\t\t\t? __( 'This item has been deleted, or is a draft' )\n\t\t\t: __( 'This item is missing a link' );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<Controls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tsetIsLabelFieldFocused={ setIsLabelFieldFocused }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid &&\n\t\t\t\t\t\t\t\t! isDraft &&\n\t\t\t\t\t\t\t\t! isLabelFieldFocused && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ description && (\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isInvalid ||\n\t\t\t\t\t\t\t\tisDraft ||\n\t\t\t\t\t\t\t\tisLabelFieldFocused ) && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text wp-block-navigation-link__label\">\n\t\t\t\t\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t\t\t\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t\t\t\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t\t\t\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t\t\t\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t\t\t\t\t\t\t\t`${ decodeEntities( label ) } ${\n\t\t\t\t\t\t\t\t\t\t\t\t\tisInvalid || isDraft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? placeholderText\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t\t\t\t\t\t}`.trim()\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t</div>\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{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\t// If there is no link then remove the auto-inserted block.\n\t\t\t\t\t\t\t\t// This avoids empty blocks which can provided a poor UX.\n\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\t// Select the previous block to keep focus nearby\n\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t\t// Remove the link.\n\t\t\t\t\t\t\t\t\tonReplace( [] );\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else if ( ref.current ) {\n\t\t\t\t\t\t\t\t\t// select the ref when adding a new link\n\t\t\t\t\t\t\t\t\tref.current.focus();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Fallback\n\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ removeLink }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</a>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AAC;AAEL","ignoreList":[]}
|
|
@@ -136,7 +136,6 @@ function LinkUIBlockInserter({
|
|
|
136
136
|
function LinkUI(props) {
|
|
137
137
|
const [addingBlock, setAddingBlock] = (0, _element.useState)(false);
|
|
138
138
|
const [focusAddBlockButton, setFocusAddBlockButton] = (0, _element.useState)(false);
|
|
139
|
-
const [showBackdrop, setShowBackdrop] = (0, _element.useState)(true);
|
|
140
139
|
const {
|
|
141
140
|
saveEntityRecord
|
|
142
141
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
@@ -195,11 +194,7 @@ function LinkUI(props) {
|
|
|
195
194
|
const {
|
|
196
195
|
onClose: onSelectBlock
|
|
197
196
|
} = props;
|
|
198
|
-
return (0, _react.createElement)(
|
|
199
|
-
className: "components-popover-pointer-events-trap",
|
|
200
|
-
"aria-hidden": "true",
|
|
201
|
-
onClick: () => setShowBackdrop(false)
|
|
202
|
-
}), (0, _react.createElement)(_components.Popover, {
|
|
197
|
+
return (0, _react.createElement)(_components.Popover, {
|
|
203
198
|
placement: "bottom",
|
|
204
199
|
onClose: props.onClose,
|
|
205
200
|
anchor: props.anchor,
|
|
@@ -252,7 +247,7 @@ function LinkUI(props) {
|
|
|
252
247
|
setFocusAddBlockButton(true);
|
|
253
248
|
},
|
|
254
249
|
onSelectBlock: onSelectBlock
|
|
255
|
-
}))
|
|
250
|
+
}));
|
|
256
251
|
}
|
|
257
252
|
const LinkUITools = ({
|
|
258
253
|
setAddingBlock,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dom","require","_components","_i18n","_blockEditor","_element","_coreData","_htmlEntities","_data","_icons","_compose","_lockUnlock","PrivateQuickInserter","QuickInserter","unlock","blockEditorPrivateApis","getSuggestionsQuery","type","kind","subtype","initialSuggestionsSearchOptions","perPage","LinkUIBlockInserter","clientId","onBack","onSelectBlock","rootBlockClientId","useSelect","select","getBlockRootClientId","blockEditorStore","focusOnMountRef","useFocusOnMount","dialogTitleId","useInstanceId","LinkControl","dialogDescritionId","_react","createElement","className","role","ref","VisuallyHidden","id","__","Button","icon","chevronLeftSmall","onClick","e","preventDefault","size","rootClientId","isAppender","prioritizePatterns","selectBlockOnInsert","hasSearch","onSelect","LinkUI","props","addingBlock","setAddingBlock","useState","focusAddBlockButton","setFocusAddBlockButton","showBackdrop","setShowBackdrop","saveEntityRecord","useDispatch","coreStore","pagesPermissions","useResourcePermissions","postsPermissions","handleCreate","pageTitle","postType","link","page","title","status","decodeEntities","rendered","url","label","opensInNewTab","userCanCreate","canCreate","useMemo","stripHTML","onClose","Fragment","Popover","placement","anchor","shift","__experimentalLinkControl","hasTextControl","hasRichPreviews","value","showInitialSuggestions","withCreateSuggestion","createSuggestion","createSuggestionButtonText","searchTerm","format","createInterpolateElement","sprintf","mark","noDirectEntry","noURLSuggestion","suggestionsQuery","onChange","onRemove","onCancel","renderControlBottom","length","LinkUITools","blockInserterAriaRole","addBlockButtonRef","useRef","useEffect","current","focus","__experimentalVStack","plus","_default","exports","default"],"sources":["@wordpress/block-library/src/navigation-link/link-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tPopover,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalLinkControl as LinkControl,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tcreateInterpolateElement,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport {\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { chevronLeftSmall, plus } from '@wordpress/icons';\nimport { useInstanceId, useFocusOnMount } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { PrivateQuickInserter: QuickInserter } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nexport function getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t// for custom link which has no type\n\t\t\t\t// always show pages as initial suggestions\n\t\t\t\tinitialSuggestionsSearchOptions: {\n\t\t\t\t\ttype: 'post',\n\t\t\t\t\tsubtype: 'page',\n\t\t\t\t\tperPage: 20,\n\t\t\t\t},\n\t\t\t};\n\t}\n}\n\nfunction LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {\n\tconst { rootBlockClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\trootBlockClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__title`\n\t);\n\tconst dialogDescritionId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__description`\n\t);\n\n\tif ( ! clientId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"link-ui-block-inserter\"\n\t\t\trole=\"dialog\"\n\t\t\taria-labelledby={ dialogTitleId }\n\t\t\taria-describedby={ dialogDescritionId }\n\t\t\tref={ focusOnMountRef }\n\t\t>\n\t\t\t<VisuallyHidden>\n\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add block' ) }</h2>\n\n\t\t\t\t<p id={ dialogDescritionId }>\n\t\t\t\t\t{ __( 'Choose a block to add to your Navigation.' ) }\n\t\t\t\t</p>\n\t\t\t</VisuallyHidden>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"link-ui-block-inserter__back\"\n\t\t\t\ticon={ chevronLeftSmall }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tonBack();\n\t\t\t\t} }\n\t\t\t\tsize=\"small\"\n\t\t\t>\n\t\t\t\t{ __( 'Back' ) }\n\t\t\t</Button>\n\n\t\t\t<QuickInserter\n\t\t\t\trootClientId={ rootBlockClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ false }\n\t\t\t\tprioritizePatterns={ false }\n\t\t\t\tselectBlockOnInsert\n\t\t\t\thasSearch={ false }\n\t\t\t\tonSelect={ onSelectBlock }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport function LinkUI( props ) {\n\tconst [ addingBlock, setAddingBlock ] = useState( false );\n\tconst [ focusAddBlockButton, setFocusAddBlockButton ] = useState( false );\n\tconst [ showBackdrop, setShowBackdrop ] = useState( true );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst pagesPermissions = useResourcePermissions( 'pages' );\n\tconst postsPermissions = useResourcePermissions( 'posts' );\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = props.link.type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\t// Make `title` property consistent with that in `fetchLinkSuggestions` where the `rendered` title (containing HTML entities)\n\t\t\t// is also being decoded. By being consistent in both locations we avoid having to branch in the rendering output code.\n\t\t\t// Ideally in the future we will update both APIs to utilise the \"raw\" form of the title which is better suited to edit contexts.\n\t\t\t// e.g.\n\t\t\t// - title.raw = \"Yes & No\"\n\t\t\t// - title.rendered = \"Yes & No\"\n\t\t\t// - decodeEntities( title.rendered ) = \"Yes & No\"\n\t\t\t// See:\n\t\t\t// - https://github.com/WordPress/gutenberg/pull/41063\n\t\t\t// - https://github.com/WordPress/gutenberg/blob/a1e1fdc0e6278457e9f4fc0b31ac6d2095f5450b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js#L212-L218\n\t\t\ttitle: decodeEntities( page.title.rendered ),\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst { label, url, opensInNewTab, type, kind } = props.link;\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = pagesPermissions.canCreate;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = postsPermissions.canCreate;\n\t}\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.\n\tconst link = useMemo(\n\t\t() => ( {\n\t\t\turl,\n\t\t\topensInNewTab,\n\t\t\ttitle: label && stripHTML( label ),\n\t\t} ),\n\t\t[ label, opensInNewTab, url ]\n\t);\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__title`\n\t);\n\tconst dialogDescritionId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__description`\n\t);\n\n\t// Selecting a block should close the popover and also remove the (previously) automatically inserted\n\t// link block so that the newly selected block can be inserted in its place.\n\tconst { onClose: onSelectBlock } = props;\n\n\treturn (\n\t\t<>\n\t\t\t{ showBackdrop && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-popover-pointer-events-trap\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tonClick={ () => setShowBackdrop( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<Popover\n\t\t\t\tplacement=\"bottom\"\n\t\t\t\tonClose={ props.onClose }\n\t\t\t\tanchor={ props.anchor }\n\t\t\t\tshift\n\t\t\t>\n\t\t\t\t{ ! addingBlock && (\n\t\t\t\t\t<div\n\t\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\t\taria-labelledby={ dialogTitleId }\n\t\t\t\t\t\taria-describedby={ dialogDescritionId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>\n\n\t\t\t\t\t\t\t<p id={ dialogDescritionId }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Search for and add a link to your Navigation.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\tlet format;\n\n\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmark: <mark />,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonChange={ props.onChange }\n\t\t\t\t\t\t\tonRemove={ props.onRemove }\n\t\t\t\t\t\t\tonCancel={ props.onCancel }\n\t\t\t\t\t\t\trenderControlBottom={ () =>\n\t\t\t\t\t\t\t\t! link?.url?.length && (\n\t\t\t\t\t\t\t\t\t<LinkUITools\n\t\t\t\t\t\t\t\t\t\tfocusAddBlockButton={\n\t\t\t\t\t\t\t\t\t\t\tfocusAddBlockButton\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetAddingBlock={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t\t\t\t\t\t\tsetFocusAddBlockButton( false );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\n\t\t\t\t{ addingBlock && (\n\t\t\t\t\t<LinkUIBlockInserter\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\t\tsetAddingBlock( false );\n\t\t\t\t\t\t\tsetFocusAddBlockButton( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonSelectBlock={ onSelectBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Popover>\n\t\t</>\n\t);\n}\n\nconst LinkUITools = ( { setAddingBlock, focusAddBlockButton } ) => {\n\tconst blockInserterAriaRole = 'listbox';\n\tconst addBlockButtonRef = useRef();\n\n\t// Focus the add block button when the popover is opened.\n\tuseEffect( () => {\n\t\tif ( focusAddBlockButton ) {\n\t\t\taddBlockButtonRef.current?.focus();\n\t\t}\n\t}, [ focusAddBlockButton ] );\n\n\treturn (\n\t\t<VStack className=\"link-ui-tools\">\n\t\t\t<Button\n\t\t\t\tref={ addBlockButtonRef }\n\t\t\t\ticon={ plus }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t} }\n\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t>\n\t\t\t\t{ __( 'Add block' ) }\n\t\t\t</Button>\n\t\t</VStack>\n\t);\n};\n\nexport default LinkUITools;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,SAAA,GAAAL,OAAA;AAIA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AAnCA;AACA;AACA;;AA8BA;AACA;AACA;;AAGA,MAAM;EAAEW,oBAAoB,EAAEC;AAAc,CAAC,GAAG,IAAAC,kBAAM,EACrDC,wBACD,CAAC;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,WAAW,IACZ,IAAAvB,MAAA,CAAAC,aAAA,EAAChB,mBAAmB;IACnBC,QAAQ,EAAGoC,KAAK,CAACpC,QAAU;IAC3BC,MAAM,EAAGA,CAAA,KAAM;MACdqC,cAAc,CAAE,KAAM,CAAC;MACvBG,sBAAsB,CAAE,IAAK,CAAC;IAC/B,CAAG;IACHvC,aAAa,EAAGA;EAAe,CAC/B,CAEM,CACR,CAAC;AAEL;AAEA,MAAM2F,WAAW,GAAGA,CAAE;EAAEvD,cAAc;EAAEE;AAAoB,CAAC,KAAM;EAClE,MAAMsD,qBAAqB,GAAG,SAAS;EACvC,MAAMC,iBAAiB,GAAG,IAAAC,eAAM,EAAC,CAAC;;EAElC;EACA,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKzD,mBAAmB,EAAG;MAC1BuD,iBAAiB,CAACG,OAAO,EAAEC,KAAK,CAAC,CAAC;IACnC;EACD,CAAC,EAAE,CAAE3D,mBAAmB,CAAG,CAAC;EAE5B,OACC,IAAA1B,MAAA,CAAAC,aAAA,EAACpC,WAAA,CAAAyH,oBAAM;IAACpF,SAAS,EAAC;EAAe,GAChC,IAAAF,MAAA,CAAAC,aAAA,EAACpC,WAAA,CAAA2C,MAAM;IACNJ,GAAG,EAAG6E,iBAAmB;IACzBxE,IAAI,EAAG8E,WAAM;IACb5E,OAAO,EAAKC,CAAC,IAAM;MAClBA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClBW,cAAc,CAAE,IAAK,CAAC;IACvB,CAAG;IACH,iBAAgBwD;EAAuB,GAErC,IAAAzE,QAAE,EAAE,WAAY,CACX,CACD,CAAC;AAEX,CAAC;AAAC,IAAAiF,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaX,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_dom","require","_components","_i18n","_blockEditor","_element","_coreData","_htmlEntities","_data","_icons","_compose","_lockUnlock","PrivateQuickInserter","QuickInserter","unlock","blockEditorPrivateApis","getSuggestionsQuery","type","kind","subtype","initialSuggestionsSearchOptions","perPage","LinkUIBlockInserter","clientId","onBack","onSelectBlock","rootBlockClientId","useSelect","select","getBlockRootClientId","blockEditorStore","focusOnMountRef","useFocusOnMount","dialogTitleId","useInstanceId","LinkControl","dialogDescritionId","_react","createElement","className","role","ref","VisuallyHidden","id","__","Button","icon","chevronLeftSmall","onClick","e","preventDefault","size","rootClientId","isAppender","prioritizePatterns","selectBlockOnInsert","hasSearch","onSelect","LinkUI","props","addingBlock","setAddingBlock","useState","focusAddBlockButton","setFocusAddBlockButton","saveEntityRecord","useDispatch","coreStore","pagesPermissions","useResourcePermissions","postsPermissions","handleCreate","pageTitle","postType","link","page","title","status","decodeEntities","rendered","url","label","opensInNewTab","userCanCreate","canCreate","useMemo","stripHTML","onClose","Popover","placement","anchor","shift","__experimentalLinkControl","hasTextControl","hasRichPreviews","value","showInitialSuggestions","withCreateSuggestion","createSuggestion","createSuggestionButtonText","searchTerm","format","createInterpolateElement","sprintf","mark","noDirectEntry","noURLSuggestion","suggestionsQuery","onChange","onRemove","onCancel","renderControlBottom","length","LinkUITools","blockInserterAriaRole","addBlockButtonRef","useRef","useEffect","current","focus","__experimentalVStack","plus","_default","exports","default"],"sources":["@wordpress/block-library/src/navigation-link/link-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tPopover,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalLinkControl as LinkControl,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tcreateInterpolateElement,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport {\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { chevronLeftSmall, plus } from '@wordpress/icons';\nimport { useInstanceId, useFocusOnMount } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { PrivateQuickInserter: QuickInserter } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nexport function getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t// for custom link which has no type\n\t\t\t\t// always show pages as initial suggestions\n\t\t\t\tinitialSuggestionsSearchOptions: {\n\t\t\t\t\ttype: 'post',\n\t\t\t\t\tsubtype: 'page',\n\t\t\t\t\tperPage: 20,\n\t\t\t\t},\n\t\t\t};\n\t}\n}\n\nfunction LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {\n\tconst { rootBlockClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\trootBlockClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__title`\n\t);\n\tconst dialogDescritionId = useInstanceId(\n\t\tLinkControl,\n\t\t`link-ui-block-inserter__description`\n\t);\n\n\tif ( ! clientId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"link-ui-block-inserter\"\n\t\t\trole=\"dialog\"\n\t\t\taria-labelledby={ dialogTitleId }\n\t\t\taria-describedby={ dialogDescritionId }\n\t\t\tref={ focusOnMountRef }\n\t\t>\n\t\t\t<VisuallyHidden>\n\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add block' ) }</h2>\n\n\t\t\t\t<p id={ dialogDescritionId }>\n\t\t\t\t\t{ __( 'Choose a block to add to your Navigation.' ) }\n\t\t\t\t</p>\n\t\t\t</VisuallyHidden>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"link-ui-block-inserter__back\"\n\t\t\t\ticon={ chevronLeftSmall }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tonBack();\n\t\t\t\t} }\n\t\t\t\tsize=\"small\"\n\t\t\t>\n\t\t\t\t{ __( 'Back' ) }\n\t\t\t</Button>\n\n\t\t\t<QuickInserter\n\t\t\t\trootClientId={ rootBlockClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ false }\n\t\t\t\tprioritizePatterns={ false }\n\t\t\t\tselectBlockOnInsert\n\t\t\t\thasSearch={ false }\n\t\t\t\tonSelect={ onSelectBlock }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport function LinkUI( props ) {\n\tconst [ addingBlock, setAddingBlock ] = useState( false );\n\tconst [ focusAddBlockButton, setFocusAddBlockButton ] = useState( false );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst pagesPermissions = useResourcePermissions( 'pages' );\n\tconst postsPermissions = useResourcePermissions( 'posts' );\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = props.link.type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\t// Make `title` property consistent with that in `fetchLinkSuggestions` where the `rendered` title (containing HTML entities)\n\t\t\t// is also being decoded. By being consistent in both locations we avoid having to branch in the rendering output code.\n\t\t\t// Ideally in the future we will update both APIs to utilise the \"raw\" form of the title which is better suited to edit contexts.\n\t\t\t// e.g.\n\t\t\t// - title.raw = \"Yes & No\"\n\t\t\t// - title.rendered = \"Yes & No\"\n\t\t\t// - decodeEntities( title.rendered ) = \"Yes & No\"\n\t\t\t// See:\n\t\t\t// - https://github.com/WordPress/gutenberg/pull/41063\n\t\t\t// - https://github.com/WordPress/gutenberg/blob/a1e1fdc0e6278457e9f4fc0b31ac6d2095f5450b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js#L212-L218\n\t\t\ttitle: decodeEntities( page.title.rendered ),\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst { label, url, opensInNewTab, type, kind } = props.link;\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = pagesPermissions.canCreate;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = postsPermissions.canCreate;\n\t}\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.\n\tconst link = useMemo(\n\t\t() => ( {\n\t\t\turl,\n\t\t\topensInNewTab,\n\t\t\ttitle: label && stripHTML( label ),\n\t\t} ),\n\t\t[ label, opensInNewTab, url ]\n\t);\n\n\tconst dialogTitleId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__title`\n\t);\n\tconst dialogDescritionId = useInstanceId(\n\t\tLinkUI,\n\t\t`link-ui-link-control__description`\n\t);\n\n\t// Selecting a block should close the popover and also remove the (previously) automatically inserted\n\t// link block so that the newly selected block can be inserted in its place.\n\tconst { onClose: onSelectBlock } = props;\n\n\treturn (\n\t\t<Popover\n\t\t\tplacement=\"bottom\"\n\t\t\tonClose={ props.onClose }\n\t\t\tanchor={ props.anchor }\n\t\t\tshift\n\t\t>\n\t\t\t{ ! addingBlock && (\n\t\t\t\t<div\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\taria-labelledby={ dialogTitleId }\n\t\t\t\t\taria-describedby={ dialogDescritionId }\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>\n\n\t\t\t\t\t\t<p id={ dialogDescritionId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Search for and add a link to your Navigation.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t<LinkControl\n\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\tlet format;\n\n\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\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\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmark: <mark />,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery( type, kind ) }\n\t\t\t\t\t\tonChange={ props.onChange }\n\t\t\t\t\t\tonRemove={ props.onRemove }\n\t\t\t\t\t\tonCancel={ props.onCancel }\n\t\t\t\t\t\trenderControlBottom={ () =>\n\t\t\t\t\t\t\t! link?.url?.length && (\n\t\t\t\t\t\t\t\t<LinkUITools\n\t\t\t\t\t\t\t\t\tfocusAddBlockButton={ focusAddBlockButton }\n\t\t\t\t\t\t\t\t\tsetAddingBlock={ () => {\n\t\t\t\t\t\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t\t\t\t\t\t\tsetFocusAddBlockButton( false );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ addingBlock && (\n\t\t\t\t<LinkUIBlockInserter\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tonBack={ () => {\n\t\t\t\t\t\tsetAddingBlock( false );\n\t\t\t\t\t\tsetFocusAddBlockButton( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonSelectBlock={ onSelectBlock }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nconst LinkUITools = ( { setAddingBlock, focusAddBlockButton } ) => {\n\tconst blockInserterAriaRole = 'listbox';\n\tconst addBlockButtonRef = useRef();\n\n\t// Focus the add block button when the popover is opened.\n\tuseEffect( () => {\n\t\tif ( focusAddBlockButton ) {\n\t\t\taddBlockButtonRef.current?.focus();\n\t\t}\n\t}, [ focusAddBlockButton ] );\n\n\treturn (\n\t\t<VStack className=\"link-ui-tools\">\n\t\t\t<Button\n\t\t\t\tref={ addBlockButtonRef }\n\t\t\t\ticon={ plus }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tsetAddingBlock( true );\n\t\t\t\t} }\n\t\t\t\taria-haspopup={ blockInserterAriaRole }\n\t\t\t>\n\t\t\t\t{ __( 'Add block' ) }\n\t\t\t</Button>\n\t\t</VStack>\n\t);\n};\n\nexport default LinkUITools;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,SAAA,GAAAL,OAAA;AAIA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AAnCA;AACA;AACA;;AA8BA;AACA;AACA;;AAGA,MAAM;EAAEW,oBAAoB,EAAEC;AAAc,CAAC,GAAG,IAAAC,kBAAM,EACrDC,wBACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EACjD,QAASD,IAAI;IACZ,KAAK,MAAM;IACX,KAAK,MAAM;MACV,OAAO;QAAEA,IAAI,EAAE,MAAM;QAAEE,OAAO,EAAEF;MAAK,CAAC;IACvC,KAAK,UAAU;MACd,OAAO;QAAEA,IAAI,EAAE,MAAM;QAAEE,OAAO,EAAE;MAAW,CAAC;IAC7C,KAAK,KAAK;MACT,OAAO;QAAEF,IAAI,EAAE,MAAM;QAAEE,OAAO,EAAE;MAAW,CAAC;IAC7C,KAAK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,MAAA,CAAAC,aAAA,EAACpC,WAAA,CAAA2C,MAAM;IACNJ,GAAG,EAAG0E,iBAAmB;IACzBrE,IAAI,EAAG2E,WAAM;IACbzE,OAAO,EAAKC,CAAC,IAAM;MAClBA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClBW,cAAc,CAAE,IAAK,CAAC;IACvB,CAAG;IACH,iBAAgBqD;EAAuB,GAErC,IAAAtE,QAAE,EAAE,WAAY,CACX,CACD,CAAC;AAEX,CAAC;AAAC,IAAA8E,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaX,WAAW","ignoreList":[]}
|
package/build/paragraph/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","align","type","content","source","selector","__experimentalRole","dropCap","placeholder","direction","supports","anchor","className","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalTextDecoration","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalWritingMode","__experimentalSelector","__unstablePasteTextInline","interactivity","clientNavigation","editorStyle","style","settings","icon","example","__","__experimentalLabel","context","customName","length","transforms","deprecated","merge","attributesToMerge","edit","save","init","initBlock"],"sources":["@wordpress/block-library/src/paragraph/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { paragraph as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __(\n\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t),\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\tif ( customName ) {\n\t\t\t\treturn customName;\n\t\t\t}\n\n\t\t\tconst { content } = attributes;\n\t\t\treturn ! content || content.length === 0 ? __( 'Empty' ) : content;\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAQ,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,O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AOA,UAAU;MAClB;MAEA,MAAM;QAAEzC;MAAQ,CAAC,GAAGH,UAAU;MAC9B,OAAO,CAAEG,OAAO,IAAIA,OAAO,CAAC0C,MAAM,KAAK,CAAC,GAAG,IAAAJ,QAAE,EAAE,OAAQ,CAAC,GAAGtC,OAAO;IACnE;EACD,CAAC;EACD2C,UAAU,EAAVA,mBAAU;EACVC,UAAU,EAAVA,mBAAU;EACVC,KAAKA,CAAEhD,UAAU,EAAEiD,iBAAiB,EAAG;IACtC,OAAO;MACN9C,OAAO,EACN,CAAEH,UAAU,CAACG,OAAO,IAAI,EAAE,KACxB8C,iBAAiB,CAAC9C,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACD+C,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAE3D,IAAI;EAAEJ,QAAQ;EAAEgD;AAAS,CAAE,CAAC;AAAC/C,OAAA,CAAA6D,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","name","$schema","apiVersion","title","category","description","keywords","textdomain","
|
|
1
|
+
{"version":3,"names":["_blocks","require","name","$schema","apiVersion","title","category","description","keywords","textdomain","attributes","align","type","content","source","selector","__experimentalRole","dropCap","placeholder","direction","supports","anchor","className","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalTextDecoration","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalWritingMode","__experimentalSelector","__unstablePasteTextInline","interactivity","clientNavigation","editorStyle","style","transforms","from","priority","schema","phrasingContentSchema","isPaste","p","children","transform","node","getBlockAttributes","outerHTML","textAlign","createBlock","_default","exports","default"],"sources":["@wordpress/block-library/src/paragraph/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock, getBlockAttributes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { name } from './block.json';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\t// Paragraph is a fallback and should be matched last.\n\t\t\tpriority: 20,\n\t\t\tselector: 'p',\n\t\t\tschema: ( { phrasingContentSchema, isPaste } ) => ( {\n\t\t\t\tp: {\n\t\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\t\tattributes: isPaste ? [] : [ 'style', 'id' ],\n\t\t\t\t},\n\t\t\t} ),\n\t\t\ttransform( node ) {\n\t\t\t\tconst attributes = getBlockAttributes( name, node.outerHTML );\n\t\t\t\tconst { textAlign } = node.style || {};\n\n\t\t\t\tif (\n\t\t\t\t\ttextAlign === 'left' ||\n\t\t\t\t\ttextAlign === 'center' ||\n\t\t\t\t\ttextAlign === 'right'\n\t\t\t\t) {\n\t\t\t\t\tattributes.align = textAlign;\n\t\t\t\t}\n\n\t\t\t\treturn createBlock( name, attributes );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAHA;AACA;AACA;AAGA;AACA;AACA;AAFA;EAAAC,IAAA,EAAAA;AAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAF,IAAA;EAAAG,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,OAAA;MAAAD,IAAA;MAAAE,MAAA;MAAAC,QAAA;MAAAC,kBAAA;IAAA;IAAAC,OAAA;MAAAL,IAAA;MAAA;IAAA;IAAAM,WAAA;MAAAN,IAAA;IAAA;IAAAO,SAAA;MAAAP,IAAA;MAAA;IAAA;EAAA;EAAAQ,QAAA;IAAAC,MAAA;IAAAC,SAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;Q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":[]}
|
|
@@ -91,7 +91,9 @@ function PostExcerptEditor({
|
|
|
91
91
|
* excerpt has been produced from the content.
|
|
92
92
|
*/
|
|
93
93
|
const strippedRenderedExcerpt = (0, _element.useMemo)(() => {
|
|
94
|
-
if (!renderedExcerpt)
|
|
94
|
+
if (!renderedExcerpt) {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
95
97
|
const document = new window.DOMParser().parseFromString(renderedExcerpt, 'text/html');
|
|
96
98
|
return document.body.textContent || document.body.innerText || '';
|
|
97
99
|
}, [renderedExcerpt]);
|