@wordpress/block-library 8.31.0 → 8.32.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 +5 -8
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.native.js +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/image/edit.js +10 -39
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +27 -6
- package/build/image/image.js.map +1 -1
- package/build/navigation/view.js +12 -2
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +41 -18
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +27 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/edit.js +3 -1
- package/build/pattern/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +12 -3
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +8 -3
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-featured-image/overlay-controls.js +82 -0
- package/build/post-featured-image/overlay-controls.js.map +1 -0
- package/build/post-featured-image/overlay.js +5 -54
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/quote/edit.js +18 -23
- package/build/quote/edit.js.map +1 -1
- package/build/site-tagline/edit.js +13 -4
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-tagline/index.js +4 -0
- package/build/site-tagline/index.js.map +1 -1
- package/build/template-part/edit/index.js +55 -47
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +106 -10
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +1 -9
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/utils/caption.js +19 -13
- package/build/utils/caption.js.map +1 -1
- package/build/utils/hooks.js +1 -0
- package/build/utils/hooks.js.map +1 -1
- package/build-module/block/edit.js +5 -8
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.native.js +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/image/edit.js +11 -40
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +27 -6
- package/build-module/image/image.js.map +1 -1
- package/build-module/navigation/view.js +12 -2
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +43 -20
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +27 -9
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/edit.js +3 -1
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +12 -3
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +8 -3
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-featured-image/overlay-controls.js +75 -0
- package/build-module/post-featured-image/overlay-controls.js.map +1 -0
- package/build-module/post-featured-image/overlay.js +7 -56
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/quote/edit.js +20 -25
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/site-tagline/edit.js +14 -5
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +4 -0
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/template-part/edit/index.js +58 -50
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +108 -12
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +2 -10
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/utils/caption.js +19 -13
- package/build-module/utils/caption.js.map +1 -1
- package/build-module/utils/hooks.js +1 -0
- package/build-module/utils/hooks.js.map +1 -1
- package/build-style/audio/theme-rtl.css +1 -1
- package/build-style/audio/theme.css +1 -1
- package/build-style/cover/style-rtl.css +5 -2
- package/build-style/cover/style.css +5 -2
- package/build-style/editor-rtl.css +12 -8
- package/build-style/editor.css +12 -8
- package/build-style/embed/theme-rtl.css +1 -1
- package/build-style/embed/theme.css +1 -1
- package/build-style/image/theme-rtl.css +1 -1
- package/build-style/image/theme.css +1 -1
- package/build-style/pullquote/theme-rtl.css +2 -1
- package/build-style/pullquote/theme.css +2 -1
- package/build-style/quote/theme-rtl.css +6 -6
- package/build-style/quote/theme.css +6 -6
- package/build-style/search/style-rtl.css +10 -0
- package/build-style/search/style.css +10 -0
- package/build-style/social-links/editor-rtl.css +0 -4
- package/build-style/social-links/editor.css +0 -4
- package/build-style/style-rtl.css +15 -2
- package/build-style/style.css +15 -2
- package/build-style/table/theme-rtl.css +4 -3
- package/build-style/table/theme.css +4 -3
- package/build-style/template-part/editor-rtl.css +12 -4
- package/build-style/template-part/editor.css +12 -4
- package/build-style/template-part/theme-rtl.css +1 -1
- package/build-style/template-part/theme.css +1 -1
- package/build-style/theme-rtl.css +17 -15
- package/build-style/theme.css +17 -15
- package/build-style/video/theme-rtl.css +1 -1
- package/build-style/video/theme.css +1 -1
- package/package.json +34 -34
- package/src/audio/theme.scss +1 -1
- package/src/block/edit.js +5 -17
- package/src/button/edit.native.js +1 -1
- package/src/cover/style.scss +6 -2
- package/src/embed/theme.scss +1 -1
- package/src/gallery/editor.scss +1 -1
- package/src/gallery/index.php +1 -1
- package/src/image/edit.js +11 -40
- package/src/image/editor.scss +2 -2
- package/src/image/image.js +25 -7
- package/src/image/theme.scss +1 -1
- package/src/navigation/index.php +8 -0
- package/src/navigation/view.js +11 -2
- package/src/navigation-link/edit.js +53 -27
- package/src/navigation-submenu/edit.js +30 -10
- package/src/pattern/edit.js +4 -0
- package/src/post-featured-image/block.json +8 -3
- package/src/post-featured-image/edit.js +12 -1
- package/src/post-featured-image/editor.scss +1 -1
- package/src/post-featured-image/overlay-controls.js +88 -0
- package/src/post-featured-image/overlay.js +17 -84
- package/src/pullquote/theme.scss +3 -1
- package/src/query-no-results/index.php +2 -0
- package/src/query-pagination-next/index.php +2 -0
- package/src/query-pagination-numbers/index.php +2 -0
- package/src/quote/edit.js +27 -43
- package/src/quote/test/edit.native.js +4 -6
- package/src/quote/theme.scss +1 -2
- package/src/search/style.scss +11 -0
- package/src/site-logo/editor.scss +2 -2
- package/src/site-tagline/block.json +4 -0
- package/src/site-tagline/edit.js +16 -3
- package/src/site-tagline/index.php +9 -1
- package/src/social-links/editor.scss +1 -9
- package/src/table/theme.scss +4 -2
- package/src/template-part/edit/index.js +87 -79
- package/src/template-part/edit/inner-blocks.js +126 -13
- package/src/template-part/edit/selection-modal.js +1 -22
- package/src/template-part/editor.scss +11 -3
- package/src/template-part/index.php +2 -0
- package/src/template-part/theme.scss +1 -1
- package/src/utils/caption.js +19 -16
- package/src/utils/hooks.js +1 -0
- package/src/video/editor.scss +2 -2
- package/src/video/theme.scss +1 -1
|
@@ -15,11 +15,11 @@ import { __ } from '@wordpress/i18n';
|
|
|
15
15
|
import { BlockControls, InspectorControls, RichText, useBlockProps, store as blockEditorStore, getColorClassName, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
16
16
|
import { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';
|
|
17
17
|
import { useState, useEffect, useRef } from '@wordpress/element';
|
|
18
|
-
import {
|
|
18
|
+
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
19
19
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
20
20
|
import { link as linkIcon, addSubmenu } from '@wordpress/icons';
|
|
21
21
|
import { store as coreStore } from '@wordpress/core-data';
|
|
22
|
-
import { useMergeRefs } from '@wordpress/compose';
|
|
22
|
+
import { useMergeRefs, usePrevious } from '@wordpress/compose';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
@@ -75,7 +75,7 @@ const useIsDraggingWithin = elementRef => {
|
|
|
75
75
|
ownerDocument.removeEventListener('dragend', handleDragEnd);
|
|
76
76
|
ownerDocument.removeEventListener('dragenter', handleDragEnter);
|
|
77
77
|
};
|
|
78
|
-
}, []);
|
|
78
|
+
}, [elementRef]);
|
|
79
79
|
return isDraggingWithin;
|
|
80
80
|
};
|
|
81
81
|
const useIsInvalidLink = (kind, type, id) => {
|
|
@@ -154,9 +154,12 @@ export default function NavigationLinkEdit({
|
|
|
154
154
|
} = context;
|
|
155
155
|
const {
|
|
156
156
|
replaceBlock,
|
|
157
|
-
__unstableMarkNextChangeAsNotPersistent
|
|
157
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
158
|
+
selectPreviousBlock
|
|
158
159
|
} = useDispatch(blockEditorStore);
|
|
159
160
|
const [isLinkOpen, setIsLinkOpen] = useState(false);
|
|
161
|
+
// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)
|
|
162
|
+
const [openedBy, setOpenedBy] = useState(null);
|
|
160
163
|
// Use internal state instead of a ref to make sure that the component
|
|
161
164
|
// re-renders when the popover's anchor updates.
|
|
162
165
|
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
@@ -164,6 +167,7 @@ export default function NavigationLinkEdit({
|
|
|
164
167
|
const isDraggingWithin = useIsDraggingWithin(listItemRef);
|
|
165
168
|
const itemLabelPlaceholder = __('Add label…');
|
|
166
169
|
const ref = useRef();
|
|
170
|
+
const prevUrl = usePrevious(url);
|
|
167
171
|
|
|
168
172
|
// Change the label using inspector causes rich text to change focus on firefox.
|
|
169
173
|
// This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text.
|
|
@@ -195,10 +199,10 @@ export default function NavigationLinkEdit({
|
|
|
195
199
|
/**
|
|
196
200
|
* Transform to submenu block.
|
|
197
201
|
*/
|
|
198
|
-
|
|
202
|
+
const transformToSubmenu = () => {
|
|
199
203
|
const newSubmenu = createBlock('core/navigation-submenu', attributes, innerBlocks.length > 0 ? innerBlocks : [createBlock('core/navigation-link')]);
|
|
200
204
|
replaceBlock(clientId, newSubmenu);
|
|
201
|
-
}
|
|
205
|
+
};
|
|
202
206
|
useEffect(() => {
|
|
203
207
|
// Show the LinkControl on mount if the URL is empty
|
|
204
208
|
// ( When adding a new menu item)
|
|
@@ -230,17 +234,12 @@ export default function NavigationLinkEdit({
|
|
|
230
234
|
|
|
231
235
|
// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.
|
|
232
236
|
useEffect(() => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
selectLabelText();
|
|
238
|
-
} else {
|
|
239
|
-
// Focus it (but do not select).
|
|
240
|
-
placeCaretAtHorizontalEdge(ref.current, true);
|
|
241
|
-
}
|
|
237
|
+
// We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL
|
|
238
|
+
if (!prevUrl && url && isLinkOpen && isURL(prependHTTP(label)) && /^.+\.[a-z]+/.test(label)) {
|
|
239
|
+
// Focus and select the label text.
|
|
240
|
+
selectLabelText();
|
|
242
241
|
}
|
|
243
|
-
}, [url, isLinkOpen, label]);
|
|
242
|
+
}, [prevUrl, url, isLinkOpen, label]);
|
|
244
243
|
|
|
245
244
|
/**
|
|
246
245
|
* Focus the Link label text and select it.
|
|
@@ -294,7 +293,10 @@ export default function NavigationLinkEdit({
|
|
|
294
293
|
// as it shares the CMD+K shortcut.
|
|
295
294
|
// See https://github.com/WordPress/gutenberg/pull/59845.
|
|
296
295
|
event.preventDefault();
|
|
296
|
+
// If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover
|
|
297
|
+
event.stopPropagation();
|
|
297
298
|
setIsLinkOpen(true);
|
|
299
|
+
setOpenedBy(ref.current);
|
|
298
300
|
}
|
|
299
301
|
}
|
|
300
302
|
const blockProps = useBlockProps({
|
|
@@ -326,6 +328,7 @@ export default function NavigationLinkEdit({
|
|
|
326
328
|
if (!url || isInvalid || isDraft) {
|
|
327
329
|
blockProps.onClick = () => {
|
|
328
330
|
setIsLinkOpen(true);
|
|
331
|
+
setOpenedBy(ref.current);
|
|
329
332
|
};
|
|
330
333
|
}
|
|
331
334
|
const classes = classnames('wp-block-navigation-item__content', {
|
|
@@ -340,7 +343,10 @@ export default function NavigationLinkEdit({
|
|
|
340
343
|
icon: linkIcon,
|
|
341
344
|
title: __('Link'),
|
|
342
345
|
shortcut: displayShortcut.primary('k'),
|
|
343
|
-
onClick:
|
|
346
|
+
onClick: event => {
|
|
347
|
+
setIsLinkOpen(true);
|
|
348
|
+
setOpenedBy(event.currentTarget);
|
|
349
|
+
}
|
|
344
350
|
}), !isAtMaxNesting && createElement(ToolbarButton, {
|
|
345
351
|
name: "submenu",
|
|
346
352
|
icon: addSubmenu,
|
|
@@ -350,25 +356,27 @@ export default function NavigationLinkEdit({
|
|
|
350
356
|
title: __('Settings')
|
|
351
357
|
}, createElement(TextControl, {
|
|
352
358
|
__nextHasNoMarginBottom: true,
|
|
359
|
+
__next40pxDefaultSize: true,
|
|
353
360
|
value: label ? stripHTML(label) : '',
|
|
354
361
|
onChange: labelValue => {
|
|
355
362
|
setAttributes({
|
|
356
363
|
label: labelValue
|
|
357
364
|
});
|
|
358
365
|
},
|
|
359
|
-
label: __('
|
|
366
|
+
label: __('Text'),
|
|
360
367
|
autoComplete: "off",
|
|
361
368
|
onFocus: () => setIsLabelFieldFocused(true),
|
|
362
369
|
onBlur: () => setIsLabelFieldFocused(false)
|
|
363
370
|
}), createElement(TextControl, {
|
|
364
371
|
__nextHasNoMarginBottom: true,
|
|
372
|
+
__next40pxDefaultSize: true,
|
|
365
373
|
value: url ? safeDecodeURI(url) : '',
|
|
366
374
|
onChange: urlValue => {
|
|
367
375
|
updateAttributes({
|
|
368
376
|
url: urlValue
|
|
369
377
|
}, setAttributes, attributes);
|
|
370
378
|
},
|
|
371
|
-
label: __('
|
|
379
|
+
label: __('Link'),
|
|
372
380
|
autoComplete: "off"
|
|
373
381
|
}), createElement(TextareaControl, {
|
|
374
382
|
__nextHasNoMarginBottom: true,
|
|
@@ -382,6 +390,7 @@ export default function NavigationLinkEdit({
|
|
|
382
390
|
help: __('The description will be displayed in the menu if the current theme supports it.')
|
|
383
391
|
}), createElement(TextControl, {
|
|
384
392
|
__nextHasNoMarginBottom: true,
|
|
393
|
+
__next40pxDefaultSize: true,
|
|
385
394
|
value: title || '',
|
|
386
395
|
onChange: titleValue => {
|
|
387
396
|
setAttributes({
|
|
@@ -393,6 +402,7 @@ export default function NavigationLinkEdit({
|
|
|
393
402
|
help: __('Additional information to help clarify the purpose of the link.')
|
|
394
403
|
}), createElement(TextControl, {
|
|
395
404
|
__nextHasNoMarginBottom: true,
|
|
405
|
+
__next40pxDefaultSize: true,
|
|
396
406
|
value: rel || '',
|
|
397
407
|
onChange: relValue => {
|
|
398
408
|
setAttributes({
|
|
@@ -446,10 +456,23 @@ export default function NavigationLinkEdit({
|
|
|
446
456
|
// If there is no link then remove the auto-inserted block.
|
|
447
457
|
// This avoids empty blocks which can provided a poor UX.
|
|
448
458
|
if (!url) {
|
|
449
|
-
//
|
|
459
|
+
// Select the previous block to keep focus nearby
|
|
460
|
+
selectPreviousBlock(clientId, true);
|
|
461
|
+
// Remove the link.
|
|
450
462
|
onReplace([]);
|
|
463
|
+
return;
|
|
451
464
|
}
|
|
452
465
|
setIsLinkOpen(false);
|
|
466
|
+
if (openedBy) {
|
|
467
|
+
openedBy.focus();
|
|
468
|
+
setOpenedBy(null);
|
|
469
|
+
} else if (ref.current) {
|
|
470
|
+
// select the ref when adding a new link
|
|
471
|
+
ref.current.focus();
|
|
472
|
+
} else {
|
|
473
|
+
// Fallback
|
|
474
|
+
selectPreviousBlock(clientId, true);
|
|
475
|
+
}
|
|
453
476
|
},
|
|
454
477
|
anchor: popoverAnchor,
|
|
455
478
|
onRemove: removeLink,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","createBlock","useSelect","useDispatch","PanelBody","TextControl","TextareaControl","ToolbarButton","Tooltip","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","useInnerBlocksProps","isURL","prependHTTP","safeDecodeURI","useState","useEffect","useRef","placeCaretAtHorizontalEdge","__unstableStripHTML","stripHTML","decodeEntities","link","linkIcon","addSubmenu","coreStore","useMergeRefs","LinkUI","updateAttributes","getColors","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","isPostType","hasId","Number","isInteger","postStatus","select","getEntityRecord","status","isInvalid","isDraft","getMissingText","missingText","NavigationLinkEdit","attributes","isSelected","setAttributes","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","isLinkOpen","setIsLinkOpen","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","isLabelFieldFocused","setIsLabelFieldFocused","innerBlocks","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","getBlocks","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","length","transformToSubmenu","newSubmenu","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","opensInNewTab","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","blockProps","className","style","color","innerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","tooltipText","createElement","Fragment","icon","shortcut","__nextHasNoMarginBottom","value","onChange","labelValue","autoComplete","onFocus","onBlur","urlValue","descriptionValue","help","titleValue","relValue","text","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","allowedFormats","trim","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 {\n\tplaceCaretAtHorizontalEdge,\n\t__unstableStripHTML as stripHTML,\n} 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 } 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}, [] );\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 { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\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\tinnerBlocks,\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\tgetBlocks,\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\tinnerBlocks: getBlocks( clientId ),\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\n\t/**\n\t * Transform to submenu block.\n\t */\n\tfunction transformToSubmenu() {\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\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ 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\tsetIsLinkOpen( true );\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};\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={ () => setIsLinkOpen( true ) }\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\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={ __( 'Label' ) }\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\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={ __( 'URL' ) }\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\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\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// Need to handle refocusing the Nav block or the inserter?\n\t\t\t\t\t\t\t\t\tonReplace( [] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\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\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8D,aAAA;IAAMX,SAAS,EAAC;EAAuC,GACpDnD,WACG,CAEN,CACF,EACA,CAAEf,SAAS,IACZC,OAAO,IACP2B,mBAAmB,KACnBiD,aAAA;IAAKX,SAAS,EAAC;EAA4E,GAC1FW,aAAA,CAACxI,OAAO;IAACwJ,IAAI,EAAGjB;EAAa,GAC5BC,aAAA;IACC,cAAapI,EAAE,CACd,sBACD;EAAG;EAGF;EACA;EACA;EACA;EACA;EACC,GAAGkB,cAAc,CAAEkD,KAAM,CAAG,IAC5Bb,SAAS,IAAIC,OAAO,GACjB0E,eAAe,GACf,EACH,EAAC,CAACyB,IAAI,CAAC,CAEJ,CACE,CACL,CAEL,CACF,EACC/E,UAAU,IACXwD,aAAA,CAAC5G,MAAM;IACN2C,QAAQ,EAAGA,QAAU;IACrBhD,IAAI,EAAGyC,UAAY;IACnBgG,OAAO,EAAGA,CAAA,KAAM;MACf;MACA;MACA,IAAK,CAAEvF,GAAG,EAAG;QACZ;QACAJ,SAAS,CAAE,EAAG,CAAC;MAChB;MACAY,aAAa,CAAE,KAAM,CAAC;IACvB,CAAG;IACHgF,MAAM,EAAG/E,aAAe;IACxBgF,QAAQ,EAAGhD,UAAY;IACvB4B,QAAQ,EAAKqB,YAAY,IAAM;MAC9BtI,gBAAgB,CACfsI,YAAY,EACZjG,aAAa,EACbF,UACD,CAAC;IACF;EAAG,CACH,CAEA,CAAC,EACJwE,aAAA;IAAA,GAAUR;EAAgB,CAAI,CAC1B,CACJ,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["classnames","createBlock","useSelect","useDispatch","PanelBody","TextControl","TextareaControl","ToolbarButton","Tooltip","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","useInnerBlocksProps","isURL","prependHTTP","safeDecodeURI","useState","useEffect","useRef","__unstableStripHTML","stripHTML","decodeEntities","link","linkIcon","addSubmenu","coreStore","useMergeRefs","usePrevious","LinkUI","updateAttributes","getColors","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","isPostType","hasId","Number","isInteger","postStatus","select","getEntityRecord","status","isInvalid","isDraft","getMissingText","missingText","NavigationLinkEdit","attributes","isSelected","setAttributes","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectPreviousBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","prevUrl","isLabelFieldFocused","setIsLabelFieldFocused","innerBlocks","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","getBlocks","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","length","transformToSubmenu","newSubmenu","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","opensInNewTab","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","tooltipText","createElement","Fragment","icon","shortcut","currentTarget","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","onFocus","onBlur","urlValue","descriptionValue","help","titleValue","relValue","text","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","allowedFormats","trim","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\tinnerBlocks,\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\tgetBlocks,\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\tinnerBlocks: getBlocks( clientId ),\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\n\t/**\n\t * Transform to submenu block.\n\t */\n\tconst transformToSubmenu = () => {\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":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,SAAS,EACTC,WAAW,EACXC,eAAe,EACfC,aAAa,EAC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AAUR;EAAgB,CAAI,CAC1B,CACJ,CAAC;AAEL"}
|
|
@@ -14,7 +14,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
14
14
|
import { BlockControls, InnerBlocks, useInnerBlocksProps, InspectorControls, RichText, useBlockProps, store as blockEditorStore, getColorClassName } from '@wordpress/block-editor';
|
|
15
15
|
import { isURL, prependHTTP } from '@wordpress/url';
|
|
16
16
|
import { useState, useEffect, useRef } from '@wordpress/element';
|
|
17
|
-
import { placeCaretAtHorizontalEdge } from '@wordpress/dom';
|
|
18
17
|
import { link as linkIcon, removeSubmenu } from '@wordpress/icons';
|
|
19
18
|
import { useResourcePermissions } from '@wordpress/core-data';
|
|
20
19
|
import { speak } from '@wordpress/a11y';
|
|
@@ -124,9 +123,12 @@ export default function NavigationSubmenuEdit({
|
|
|
124
123
|
} = context;
|
|
125
124
|
const {
|
|
126
125
|
__unstableMarkNextChangeAsNotPersistent,
|
|
127
|
-
replaceBlock
|
|
126
|
+
replaceBlock,
|
|
127
|
+
selectBlock
|
|
128
128
|
} = useDispatch(blockEditorStore);
|
|
129
129
|
const [isLinkOpen, setIsLinkOpen] = useState(false);
|
|
130
|
+
// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)
|
|
131
|
+
const [openedBy, setOpenedBy] = useState(null);
|
|
130
132
|
// Use internal state instead of a ref to make sure that the component
|
|
131
133
|
// re-renders when the popover's anchor updates.
|
|
132
134
|
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
@@ -201,9 +203,6 @@ export default function NavigationSubmenuEdit({
|
|
|
201
203
|
if (isURL(prependHTTP(label)) && /^.+\.[a-z]+/.test(label)) {
|
|
202
204
|
// Focus and select the label text.
|
|
203
205
|
selectLabelText();
|
|
204
|
-
} else {
|
|
205
|
-
// Focus it (but do not select).
|
|
206
|
-
placeCaretAtHorizontalEdge(ref.current, true);
|
|
207
206
|
}
|
|
208
207
|
}
|
|
209
208
|
}, [url]);
|
|
@@ -244,7 +243,10 @@ export default function NavigationSubmenuEdit({
|
|
|
244
243
|
// as it shares the CMD+K shortcut.
|
|
245
244
|
// See https://github.com/WordPress/gutenberg/pull/59845.
|
|
246
245
|
event.preventDefault();
|
|
246
|
+
// If we don't stop propogation, this event bubbles up to the parent submenu item
|
|
247
|
+
event.stopPropagation();
|
|
247
248
|
setIsLinkOpen(true);
|
|
249
|
+
setOpenedBy(ref.current);
|
|
248
250
|
}
|
|
249
251
|
}
|
|
250
252
|
const blockProps = useBlockProps({
|
|
@@ -303,7 +305,10 @@ export default function NavigationSubmenuEdit({
|
|
|
303
305
|
icon: linkIcon,
|
|
304
306
|
title: __('Link'),
|
|
305
307
|
shortcut: displayShortcut.primary('k'),
|
|
306
|
-
onClick:
|
|
308
|
+
onClick: event => {
|
|
309
|
+
setIsLinkOpen(true);
|
|
310
|
+
setOpenedBy(event.currentTarget);
|
|
311
|
+
}
|
|
307
312
|
}), createElement(ToolbarButton, {
|
|
308
313
|
name: "revert",
|
|
309
314
|
icon: removeSubmenu,
|
|
@@ -315,23 +320,25 @@ export default function NavigationSubmenuEdit({
|
|
|
315
320
|
title: __('Settings')
|
|
316
321
|
}, createElement(TextControl, {
|
|
317
322
|
__nextHasNoMarginBottom: true,
|
|
323
|
+
__next40pxDefaultSize: true,
|
|
318
324
|
value: label || '',
|
|
319
325
|
onChange: labelValue => {
|
|
320
326
|
setAttributes({
|
|
321
327
|
label: labelValue
|
|
322
328
|
});
|
|
323
329
|
},
|
|
324
|
-
label: __('
|
|
330
|
+
label: __('Text'),
|
|
325
331
|
autoComplete: "off"
|
|
326
332
|
}), createElement(TextControl, {
|
|
327
333
|
__nextHasNoMarginBottom: true,
|
|
334
|
+
__next40pxDefaultSize: true,
|
|
328
335
|
value: url || '',
|
|
329
336
|
onChange: urlValue => {
|
|
330
337
|
setAttributes({
|
|
331
338
|
url: urlValue
|
|
332
339
|
});
|
|
333
340
|
},
|
|
334
|
-
label: __('
|
|
341
|
+
label: __('Link'),
|
|
335
342
|
autoComplete: "off"
|
|
336
343
|
}), createElement(TextareaControl, {
|
|
337
344
|
__nextHasNoMarginBottom: true,
|
|
@@ -345,6 +352,7 @@ export default function NavigationSubmenuEdit({
|
|
|
345
352
|
help: __('The description will be displayed in the menu if the current theme supports it.')
|
|
346
353
|
}), createElement(TextControl, {
|
|
347
354
|
__nextHasNoMarginBottom: true,
|
|
355
|
+
__next40pxDefaultSize: true,
|
|
348
356
|
value: title || '',
|
|
349
357
|
onChange: titleValue => {
|
|
350
358
|
setAttributes({
|
|
@@ -356,6 +364,7 @@ export default function NavigationSubmenuEdit({
|
|
|
356
364
|
help: __('Additional information to help clarify the purpose of the link.')
|
|
357
365
|
}), createElement(TextControl, {
|
|
358
366
|
__nextHasNoMarginBottom: true,
|
|
367
|
+
__next40pxDefaultSize: true,
|
|
359
368
|
value: rel || '',
|
|
360
369
|
onChange: relValue => {
|
|
361
370
|
setAttributes({
|
|
@@ -386,12 +395,21 @@ export default function NavigationSubmenuEdit({
|
|
|
386
395
|
onClick: () => {
|
|
387
396
|
if (!openSubmenusOnClick && !url) {
|
|
388
397
|
setIsLinkOpen(true);
|
|
398
|
+
setOpenedBy(ref.current);
|
|
389
399
|
}
|
|
390
400
|
}
|
|
391
401
|
}), !openSubmenusOnClick && isLinkOpen && createElement(LinkUI, {
|
|
392
402
|
clientId: clientId,
|
|
393
403
|
link: attributes,
|
|
394
|
-
onClose: () =>
|
|
404
|
+
onClose: () => {
|
|
405
|
+
setIsLinkOpen(false);
|
|
406
|
+
if (openedBy) {
|
|
407
|
+
openedBy.focus();
|
|
408
|
+
setOpenedBy(null);
|
|
409
|
+
} else {
|
|
410
|
+
selectBlock(clientId);
|
|
411
|
+
}
|
|
412
|
+
},
|
|
395
413
|
anchor: popoverAnchor,
|
|
396
414
|
hasCreateSuggestion: userCanCreate,
|
|
397
415
|
onRemove: () => {
|