@wordpress/block-library 9.26.0 → 9.27.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/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/cover/edit/block-controls.js +4 -2
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/index.js +6 -3
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +11 -4
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit/poster-image.js +81 -0
- package/build/cover/edit/poster-image.js.map +1 -0
- package/build/cover/index.js +6 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +3 -1
- package/build/cover/save.js.map +1 -1
- package/build/details/index.js +1 -1
- package/build/details/index.js.map +1 -1
- package/build/gallery/constants.js +2 -1
- package/build/gallery/constants.js.map +1 -1
- package/build/gallery/edit.js +93 -15
- package/build/gallery/edit.js.map +1 -1
- package/build/image/edit.js +6 -0
- package/build/image/edit.js.map +1 -1
- package/build/list/index.js +0 -1
- package/build/list/index.js.map +1 -1
- package/build/media-text/edit.js +2 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/more/edit.native.js +17 -32
- package/build/more/edit.native.js.map +1 -1
- package/build/navigation-link/edit.js +49 -16
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/update-attributes.js +112 -14
- package/build/navigation-link/update-attributes.js.map +1 -1
- package/build/navigation-submenu/edit.js +19 -2
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/post-author/edit.js +78 -35
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-content/edit.js +78 -16
- package/build/post-content/edit.js.map +1 -1
- package/build/post-content/index.js +6 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/separator/edit.js +5 -30
- package/build/separator/edit.js.map +1 -1
- package/build/site-logo/edit.js +16 -5
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-tagline/index.js +1 -1
- package/build/video/edit.js +2 -5
- package/build/video/edit.js.map +1 -1
- package/build/video/poster-image.js +25 -25
- package/build/video/poster-image.js.map +1 -1
- package/build/video/tracks-editor.js +95 -104
- package/build/video/tracks-editor.js.map +1 -1
- package/build/video/tracks.js +6 -2
- package/build/video/tracks.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +4 -2
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/index.js +6 -3
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +10 -4
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit/poster-image.js +74 -0
- package/build-module/cover/edit/poster-image.js.map +1 -0
- package/build-module/cover/index.js +6 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +3 -1
- package/build-module/cover/save.js.map +1 -1
- package/build-module/details/index.js +1 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/gallery/constants.js +1 -0
- package/build-module/gallery/constants.js.map +1 -1
- package/build-module/gallery/edit.js +95 -17
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/image/edit.js +6 -0
- package/build-module/image/edit.js.map +1 -1
- package/build-module/list/index.js +0 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/media-text/edit.js +2 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/more/edit.native.js +16 -30
- package/build-module/more/edit.native.js.map +1 -1
- package/build-module/navigation-link/edit.js +50 -17
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +113 -15
- package/build-module/navigation-link/update-attributes.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +20 -3
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/post-author/edit.js +78 -35
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +1 -1
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-content/edit.js +80 -18
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-content/index.js +6 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/search/edit.js +1 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/edit.js +6 -31
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +17 -6
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -1
- package/build-module/video/edit.js +2 -5
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/poster-image.js +26 -26
- package/build-module/video/poster-image.js.map +1 -1
- package/build-module/video/tracks-editor.js +96 -105
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-module/video/tracks.js +6 -2
- package/build-module/video/tracks.js.map +1 -1
- package/build-style/archives/editor-rtl.css +0 -4
- package/build-style/archives/editor.css +0 -4
- package/build-style/editor-rtl.css +0 -21
- package/build-style/editor.css +0 -21
- package/build-style/file/style-rtl.css +1 -1
- package/build-style/file/style.css +1 -1
- package/build-style/gallery/editor-rtl.css +0 -13
- package/build-style/gallery/editor.css +0 -13
- package/build-style/navigation/style-rtl.css +2 -0
- package/build-style/navigation/style.css +2 -0
- package/build-style/style-rtl.css +3 -1
- package/build-style/style.css +3 -1
- package/build-style/video/editor-rtl.css +0 -4
- package/build-style/video/editor.css +0 -4
- package/package.json +35 -35
- package/src/archives/editor.scss +0 -4
- package/src/button/edit.js +1 -1
- package/src/comments-pagination/index.php +7 -2
- package/src/cover/block.json +6 -0
- package/src/cover/edit/block-controls.js +22 -17
- package/src/cover/edit/index.js +4 -1
- package/src/cover/edit/inspector-controls.js +12 -3
- package/src/cover/edit/poster-image.js +91 -0
- package/src/cover/save.js +2 -0
- package/src/details/index.js +1 -1
- package/src/file/style.scss +1 -1
- package/src/gallery/constants.js +1 -0
- package/src/gallery/edit.js +182 -68
- package/src/gallery/editor.scss +0 -17
- package/src/image/edit.js +12 -0
- package/src/list/block.json +0 -1
- package/src/media-text/edit.js +1 -1
- package/src/more/edit.native.js +19 -33
- package/src/navigation/style.scss +2 -0
- package/src/navigation-link/edit.js +46 -17
- package/src/navigation-link/test/edit.js +738 -6
- package/src/navigation-link/update-attributes.js +125 -12
- package/src/navigation-submenu/edit.js +21 -1
- package/src/post-author/edit.js +91 -40
- package/src/post-comments-form/form.js +1 -1
- package/src/post-content/block.json +6 -0
- package/src/post-content/edit.js +71 -19
- package/src/post-content/index.php +11 -4
- package/src/post-featured-image/edit.js +1 -0
- package/src/post-featured-image/index.php +3 -2
- package/src/rss/index.php +2 -1
- package/src/search/edit.js +1 -1
- package/src/separator/edit.js +8 -43
- package/src/site-logo/edit.js +22 -10
- package/src/site-tagline/block.json +1 -1
- package/src/video/edit.js +1 -4
- package/src/video/editor.scss +0 -6
- package/src/video/poster-image.js +29 -24
- package/src/video/tracks-editor.js +93 -103
- package/src/video/tracks.js +2 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { Component } from '@wordpress/element';
|
|
6
5
|
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
7
6
|
import { HorizontalRule } from '@wordpress/components';
|
|
8
7
|
|
|
@@ -11,35 +10,22 @@ import { HorizontalRule } from '@wordpress/components';
|
|
|
11
10
|
*/
|
|
12
11
|
import styles from './editor.scss';
|
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
defaultText
|
|
31
|
-
} = this.state;
|
|
32
|
-
const content = customText || defaultText;
|
|
33
|
-
const textStyle = getStylesFromColorScheme(styles.moreText, styles.moreTextDark);
|
|
34
|
-
const lineStyle = getStylesFromColorScheme(styles.moreLine, styles.moreLineDark);
|
|
35
|
-
return /*#__PURE__*/_jsx(HorizontalRule, {
|
|
36
|
-
text: content,
|
|
37
|
-
marginLeft: 0,
|
|
38
|
-
marginRight: 0,
|
|
39
|
-
textStyle: textStyle,
|
|
40
|
-
lineStyle: lineStyle
|
|
41
|
-
});
|
|
42
|
-
}
|
|
13
|
+
function MoreEdit({
|
|
14
|
+
attributes,
|
|
15
|
+
getStylesFromColorScheme
|
|
16
|
+
}) {
|
|
17
|
+
const {
|
|
18
|
+
customText
|
|
19
|
+
} = attributes;
|
|
20
|
+
const textStyle = getStylesFromColorScheme(styles.moreText, styles.moreTextDark);
|
|
21
|
+
const lineStyle = getStylesFromColorScheme(styles.moreLine, styles.moreLineDark);
|
|
22
|
+
return /*#__PURE__*/_jsx(HorizontalRule, {
|
|
23
|
+
text: customText || __('Read more'),
|
|
24
|
+
marginLeft: 0,
|
|
25
|
+
marginRight: 0,
|
|
26
|
+
textStyle: textStyle,
|
|
27
|
+
lineStyle: lineStyle
|
|
28
|
+
});
|
|
43
29
|
}
|
|
44
30
|
export default withPreferredColorScheme(MoreEdit);
|
|
45
31
|
//# sourceMappingURL=edit.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","
|
|
1
|
+
{"version":3,"names":["__","withPreferredColorScheme","HorizontalRule","styles","jsx","_jsx","MoreEdit","attributes","getStylesFromColorScheme","customText","textStyle","moreText","moreTextDark","lineStyle","moreLine","moreLineDark","text","marginLeft","marginRight"],"sources":["@wordpress/block-library/src/more/edit.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { HorizontalRule } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './editor.scss';\n\nfunction MoreEdit( { attributes, getStylesFromColorScheme } ) {\n\tconst { customText } = attributes;\n\n\tconst textStyle = getStylesFromColorScheme(\n\t\tstyles.moreText,\n\t\tstyles.moreTextDark\n\t);\n\tconst lineStyle = getStylesFromColorScheme(\n\t\tstyles.moreLine,\n\t\tstyles.moreLineDark\n\t);\n\n\treturn (\n\t\t<HorizontalRule\n\t\t\ttext={ customText || __( 'Read more' ) }\n\t\t\tmarginLeft={ 0 }\n\t\t\tmarginRight={ 0 }\n\t\t\ttextStyle={ textStyle }\n\t\t\tlineStyle={ lineStyle }\n\t\t/>\n\t);\n}\n\nexport default withPreferredColorScheme( MoreEdit );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,cAAc,QAAQ,uBAAuB;;AAEtD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,SAASC,QAAQA,CAAE;EAAEC,UAAU;EAAEC;AAAyB,CAAC,EAAG;EAC7D,MAAM;IAAEC;EAAW,CAAC,GAAGF,UAAU;EAEjC,MAAMG,SAAS,GAAGF,wBAAwB,CACzCL,MAAM,CAACQ,QAAQ,EACfR,MAAM,CAACS,YACR,CAAC;EACD,MAAMC,SAAS,GAAGL,wBAAwB,CACzCL,MAAM,CAACW,QAAQ,EACfX,MAAM,CAACY,YACR,CAAC;EAED,oBACCV,IAAA,CAACH,cAAc;IACdc,IAAI,EAAGP,UAAU,IAAIT,EAAE,CAAE,WAAY,CAAG;IACxCiB,UAAU,EAAG,CAAG;IAChBC,WAAW,EAAG,CAAG;IACjBR,SAAS,EAAGA,SAAW;IACvBG,SAAS,EAAGA;EAAW,CACvB,CAAC;AAEJ;AAEA,eAAeZ,wBAAwB,CAAEK,QAAS,CAAC","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ import clsx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
import { createBlock } from '@wordpress/blocks';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
|
-
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, TextControl, TextareaControl, ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
11
|
+
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, CheckboxControl, TextControl, TextareaControl, ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
12
12
|
import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { BlockControls, InspectorControls, RichText, useBlockProps, store as blockEditorStore, getColorClassName, useInnerBlocksProps, useBlockEditingMode } from '@wordpress/block-editor';
|
|
@@ -147,14 +147,16 @@ function getMissingText(type) {
|
|
|
147
147
|
function Controls({
|
|
148
148
|
attributes,
|
|
149
149
|
setAttributes,
|
|
150
|
-
|
|
150
|
+
setIsEditingControl
|
|
151
151
|
}) {
|
|
152
152
|
const {
|
|
153
153
|
label,
|
|
154
154
|
url,
|
|
155
155
|
description,
|
|
156
|
-
rel
|
|
156
|
+
rel,
|
|
157
|
+
opensInNewTab
|
|
157
158
|
} = attributes;
|
|
159
|
+
const lastURLRef = useRef(url);
|
|
158
160
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
159
161
|
return /*#__PURE__*/_jsxs(ToolsPanel, {
|
|
160
162
|
label: __('Settings'),
|
|
@@ -163,7 +165,8 @@ function Controls({
|
|
|
163
165
|
label: '',
|
|
164
166
|
url: '',
|
|
165
167
|
description: '',
|
|
166
|
-
rel: ''
|
|
168
|
+
rel: '',
|
|
169
|
+
opensInNewTab: false
|
|
167
170
|
});
|
|
168
171
|
},
|
|
169
172
|
dropdownMenuProps: dropdownMenuProps,
|
|
@@ -185,8 +188,8 @@ function Controls({
|
|
|
185
188
|
});
|
|
186
189
|
},
|
|
187
190
|
autoComplete: "off",
|
|
188
|
-
onFocus: () =>
|
|
189
|
-
onBlur: () =>
|
|
191
|
+
onFocus: () => setIsEditingControl(true),
|
|
192
|
+
onBlur: () => setIsEditingControl(false)
|
|
190
193
|
})
|
|
191
194
|
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
192
195
|
hasValue: () => !!url,
|
|
@@ -201,12 +204,41 @@ function Controls({
|
|
|
201
204
|
label: __('Link'),
|
|
202
205
|
value: url ? safeDecodeURI(url) : '',
|
|
203
206
|
onChange: urlValue => {
|
|
204
|
-
|
|
205
|
-
url: urlValue
|
|
206
|
-
}
|
|
207
|
+
setAttributes({
|
|
208
|
+
url: encodeURI(safeDecodeURI(urlValue))
|
|
209
|
+
});
|
|
207
210
|
},
|
|
208
211
|
autoComplete: "off",
|
|
209
|
-
type: "url"
|
|
212
|
+
type: "url",
|
|
213
|
+
onFocus: () => {
|
|
214
|
+
lastURLRef.current = url;
|
|
215
|
+
setIsEditingControl(true);
|
|
216
|
+
},
|
|
217
|
+
onBlur: () => {
|
|
218
|
+
// Defer the updateAttributes call to ensure entity connection isn't severed by accident.
|
|
219
|
+
updateAttributes({
|
|
220
|
+
url: !url ? lastURLRef.current : url
|
|
221
|
+
}, setAttributes, {
|
|
222
|
+
...attributes,
|
|
223
|
+
url: lastURLRef.current
|
|
224
|
+
});
|
|
225
|
+
setIsEditingControl(false);
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
229
|
+
hasValue: () => !!opensInNewTab,
|
|
230
|
+
label: __('Open in new tab'),
|
|
231
|
+
onDeselect: () => setAttributes({
|
|
232
|
+
opensInNewTab: false
|
|
233
|
+
}),
|
|
234
|
+
isShownByDefault: true,
|
|
235
|
+
children: /*#__PURE__*/_jsx(CheckboxControl, {
|
|
236
|
+
__nextHasNoMarginBottom: true,
|
|
237
|
+
label: __('Open in new tab'),
|
|
238
|
+
checked: opensInNewTab,
|
|
239
|
+
onChange: value => setAttributes({
|
|
240
|
+
opensInNewTab: value
|
|
241
|
+
})
|
|
210
242
|
})
|
|
211
243
|
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
212
244
|
hasValue: () => !!description,
|
|
@@ -290,9 +322,10 @@ export default function NavigationLinkEdit({
|
|
|
290
322
|
const linkUIref = useRef();
|
|
291
323
|
const prevUrl = usePrevious(url);
|
|
292
324
|
|
|
293
|
-
// Change the label using inspector causes
|
|
294
|
-
// This is a workaround to keep the focus on the
|
|
295
|
-
|
|
325
|
+
// Change the `label` and `url` using inspector causes RichText to change focus.
|
|
326
|
+
// This is a workaround to keep the focus on the field when it's focused we don't render the RichText.
|
|
327
|
+
// See: https://github.com/WordPress/gutenberg/pull/61374.
|
|
328
|
+
const [isEditingControl, setIsEditingControl] = useState(false);
|
|
296
329
|
const {
|
|
297
330
|
isAtMaxNesting,
|
|
298
331
|
isTopLevelLink,
|
|
@@ -478,19 +511,19 @@ export default function NavigationLinkEdit({
|
|
|
478
511
|
children: /*#__PURE__*/_jsx(Controls, {
|
|
479
512
|
attributes: attributes,
|
|
480
513
|
setAttributes: setAttributes,
|
|
481
|
-
|
|
514
|
+
setIsEditingControl: setIsEditingControl
|
|
482
515
|
})
|
|
483
516
|
}), /*#__PURE__*/_jsxs("div", {
|
|
484
517
|
...blockProps,
|
|
485
518
|
children: [/*#__PURE__*/_jsxs("a", {
|
|
486
519
|
className: classes,
|
|
487
|
-
children: [!url ? /*#__PURE__*/_jsx("div", {
|
|
520
|
+
children: [!url && !isEditingControl ? /*#__PURE__*/_jsx("div", {
|
|
488
521
|
className: "wp-block-navigation-link__placeholder-text",
|
|
489
522
|
children: /*#__PURE__*/_jsx("span", {
|
|
490
523
|
children: missingText
|
|
491
524
|
})
|
|
492
525
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
493
|
-
children: [!isInvalid && !isDraft && !
|
|
526
|
+
children: [!isInvalid && !isDraft && !isEditingControl && /*#__PURE__*/_jsxs(_Fragment, {
|
|
494
527
|
children: [/*#__PURE__*/_jsx(RichText, {
|
|
495
528
|
ref: ref,
|
|
496
529
|
identifier: "label",
|
|
@@ -509,7 +542,7 @@ export default function NavigationLinkEdit({
|
|
|
509
542
|
className: "wp-block-navigation-item__description",
|
|
510
543
|
children: description
|
|
511
544
|
})]
|
|
512
|
-
}), (isInvalid || isDraft ||
|
|
545
|
+
}), (isInvalid || isDraft || isEditingControl) && /*#__PURE__*/_jsx("div", {
|
|
513
546
|
className: clsx('wp-block-navigation-link__placeholder-text', 'wp-block-navigation-link__label', {
|
|
514
547
|
'is-invalid': isInvalid,
|
|
515
548
|
'is-draft': isDraft
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","createBlock","useSelect","useDispatch","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","useInnerBlocksProps","useBlockEditingMode","isURL","prependHTTP","safeDecodeURI","useState","useEffect","useRef","__unstableStripHTML","stripHTML","decodeEntities","link","linkIcon","addSubmenu","coreStore","useMergeRefs","usePrevious","LinkUI","updateAttributes","getColors","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULT_BLOCK","name","NESTING_BLOCK_NAMES","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","enabled","isPostType","hasId","Number","isInteger","blockEditingMode","postStatus","select","getEntityRecord","status","isInvalid","isDraft","getMissingText","missingText","Controls","attributes","setAttributes","setIsLabelFieldFocused","label","url","description","rel","dropdownMenuProps","resetAll","children","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","onFocus","onBlur","urlValue","descriptionValue","help","relValue","NavigationLinkEdit","isSelected","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectBlock","selectPreviousBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","linkUIref","prevUrl","isLabelFieldFocused","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","validateLinkStatus","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","getSelectedBlockClientId","rootClientId","isTopLevel","selectedBlockClientId","rootNavigationClientId","enableLinkStatusValidation","length","getBlocks","transformToSubmenu","innerBlocks","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","icon","title","shortcut","currentTarget","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","trim","onClose","window","document","activeElement","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\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\tuseBlockEditingMode,\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';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\nconst NESTING_BLOCK_NAMES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\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, enabled ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Fetching the posts status is an \"expensive\" operation. Especially for sites with large navigations.\n\t\t\t// When the block is rendered in a template or other disabled contexts we can skip this check in order\n\t\t\t// to avoid all these additional requests that don't really add any value in that mode.\n\t\t\tif ( blockEditingMode === 'disabled' || ! enabled ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, blockEditingMode, enabled, 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 reusing this components for both blocks.\n */\nfunction Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {\n\tconst { label, url, description, rel } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tlabel: '',\n\t\t\t\t\turl: '',\n\t\t\t\t\tdescription: '',\n\t\t\t\t\trel: '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! label }\n\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tonFocus={ () => setIsLabelFieldFocused( true ) }\n\t\t\t\t\tonBlur={ () => setIsLabelFieldFocused( false ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! url }\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { url: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\tvalue={ url ? safeDecodeURI( url ) : '' }\n\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t{ url: urlValue },\n\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! description }\n\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { description: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextareaControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\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) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! rel }\n\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\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\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 linkUIref = 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\tvalidateLinkStatus,\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\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst isTopLevel =\n\t\t\t\tgetBlockName( rootClientId ) === 'core/navigation';\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst rootNavigationClientId = isTopLevel\n\t\t\t\t? rootClientId\n\t\t\t\t: getBlockParentsByBlockName(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'core/navigation'\n\t\t\t\t )[ 0 ];\n\n\t\t\t// Enable when the root Navigation block is selected or any of its inner blocks.\n\t\t\tconst enableLinkStatusValidation =\n\t\t\t\tselectedBlockClientId === rootNavigationClientId ||\n\t\t\t\thasSelectedInnerBlock( rootNavigationClientId, true );\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, NESTING_BLOCK_NAMES )\n\t\t\t\t\t\t.length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink: isTopLevel,\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\tvalidateLinkStatus: enableLinkStatusValidation,\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tkind,\n\t\ttype,\n\t\tid,\n\t\tvalidateLinkStatus\n\t);\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: clsx( '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 = clsx( '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\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<span>{ missingText }</span>\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/>\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\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__placeholder-text',\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__label',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-invalid': isInvalid,\n\t\t\t\t\t\t\t\t\t\t\t'is-draft': isDraft,\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\t\t<span>\n\t\t\t\t\t\t\t\t\t\t{\n\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// Ideally they would be stored in a raw, unescaped form.\n\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// so they display without encoding.\n\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`${ decodeEntities( label ) } ${\n\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? placeholderText\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}`.trim()\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</span>\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\tref={ linkUIref }\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// Fixes https://github.com/WordPress/gutenberg/issues/61361\n\t\t\t\t\t\t\t\t\t// There's a chance we're closing due to the user selecting the browse all button.\n\t\t\t\t\t\t\t\t\t// Only move focus if the focus is still within the popover ui. If it's not within\n\t\t\t\t\t\t\t\t\t// the popover, it's because something has taken the focus from the popover, and\n\t\t\t\t\t\t\t\t\t// we don't want to steal it back.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tlinkUIref.current.contains(\n\t\t\t\t\t\t\t\t\t\t\twindow.document.activeElement\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t// Select the previous block to keep focus nearby\n\t\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t\t}\n\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,I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names":["clsx","createBlock","useSelect","useDispatch","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","CheckboxControl","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","useInnerBlocksProps","useBlockEditingMode","isURL","prependHTTP","safeDecodeURI","useState","useEffect","useRef","__unstableStripHTML","stripHTML","decodeEntities","link","linkIcon","addSubmenu","coreStore","useMergeRefs","usePrevious","LinkUI","updateAttributes","getColors","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULT_BLOCK","name","NESTING_BLOCK_NAMES","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","enabled","isPostType","hasId","Number","isInteger","blockEditingMode","postStatus","select","getEntityRecord","status","isInvalid","isDraft","getMissingText","missingText","Controls","attributes","setAttributes","setIsEditingControl","label","url","description","rel","opensInNewTab","lastURLRef","dropdownMenuProps","resetAll","children","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","onFocus","onBlur","urlValue","encodeURI","checked","descriptionValue","help","relValue","NavigationLinkEdit","isSelected","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectBlock","selectPreviousBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","linkUIref","prevUrl","isEditingControl","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","validateLinkStatus","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","getSelectedBlockClientId","rootClientId","isTopLevel","selectedBlockClientId","rootNavigationClientId","enableLinkStatusValidation","length","getBlocks","transformToSubmenu","innerBlocks","newSubmenu","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","icon","title","shortcut","currentTarget","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","trim","onClose","window","document","activeElement","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tCheckboxControl,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\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\tuseBlockEditingMode,\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';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\nconst NESTING_BLOCK_NAMES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\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, enabled ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Fetching the posts status is an \"expensive\" operation. Especially for sites with large navigations.\n\t\t\t// When the block is rendered in a template or other disabled contexts we can skip this check in order\n\t\t\t// to avoid all these additional requests that don't really add any value in that mode.\n\t\t\tif ( blockEditingMode === 'disabled' || ! enabled ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, blockEditingMode, enabled, 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 reusing this components for both blocks.\n */\nfunction Controls( { attributes, setAttributes, setIsEditingControl } ) {\n\tconst { label, url, description, rel, opensInNewTab } = attributes;\n\tconst lastURLRef = useRef( url );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tlabel: '',\n\t\t\t\t\turl: '',\n\t\t\t\t\tdescription: '',\n\t\t\t\t\trel: '',\n\t\t\t\t\topensInNewTab: false,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! label }\n\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tonFocus={ () => setIsEditingControl( true ) }\n\t\t\t\t\tonBlur={ () => setIsEditingControl( false ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! url }\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { url: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\tvalue={ url ? safeDecodeURI( url ) : '' }\n\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\turl: encodeURI( safeDecodeURI( urlValue ) ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t\tonFocus={ () => {\n\t\t\t\t\t\tlastURLRef.current = url;\n\t\t\t\t\t\tsetIsEditingControl( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t// Defer the updateAttributes call to ensure entity connection isn't severed by accident.\n\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t{ url: ! url ? lastURLRef.current : url },\n\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t{ ...attributes, url: lastURLRef.current }\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetIsEditingControl( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! opensInNewTab }\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { opensInNewTab: false } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\tchecked={ opensInNewTab }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { opensInNewTab: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! description }\n\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { description: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextareaControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\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) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! rel }\n\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\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\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 linkUIref = useRef();\n\tconst prevUrl = usePrevious( url );\n\n\t// Change the `label` and `url` using inspector causes RichText to change focus.\n\t// This is a workaround to keep the focus on the field when it's focused we don't render the RichText.\n\t// See: https://github.com/WordPress/gutenberg/pull/61374.\n\tconst [ isEditingControl, setIsEditingControl ] = useState( false );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t\tvalidateLinkStatus,\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\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst isTopLevel =\n\t\t\t\tgetBlockName( rootClientId ) === 'core/navigation';\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst rootNavigationClientId = isTopLevel\n\t\t\t\t? rootClientId\n\t\t\t\t: getBlockParentsByBlockName(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'core/navigation'\n\t\t\t\t )[ 0 ];\n\n\t\t\t// Enable when the root Navigation block is selected or any of its inner blocks.\n\t\t\tconst enableLinkStatusValidation =\n\t\t\t\tselectedBlockClientId === rootNavigationClientId ||\n\t\t\t\thasSelectedInnerBlock( rootNavigationClientId, true );\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, NESTING_BLOCK_NAMES )\n\t\t\t\t\t\t.length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink: isTopLevel,\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\tvalidateLinkStatus: enableLinkStatusValidation,\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tkind,\n\t\ttype,\n\t\tid,\n\t\tvalidateLinkStatus\n\t);\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: clsx( '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 = clsx( '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\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\tsetIsEditingControl={ setIsEditingControl }\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 && ! isEditingControl ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<span>{ missingText }</span>\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! isEditingControl && (\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/>\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 || isDraft || isEditingControl ) && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__placeholder-text',\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__label',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-invalid': isInvalid,\n\t\t\t\t\t\t\t\t\t\t\t'is-draft': isDraft,\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\t\t<span>\n\t\t\t\t\t\t\t\t\t\t{\n\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// Ideally they would be stored in a raw, unescaped form.\n\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// so they display without encoding.\n\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`${ decodeEntities( label ) } ${\n\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? placeholderText\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}`.trim()\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</span>\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\tref={ linkUIref }\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// Fixes https://github.com/WordPress/gutenberg/issues/61361\n\t\t\t\t\t\t\t\t\t// There's a chance we're closing due to the user selecting the browse all button.\n\t\t\t\t\t\t\t\t\t// Only move focus if the focus is still within the popover ui. If it's not within\n\t\t\t\t\t\t\t\t\t// the popover, it's because something has taken the focus from the popover, and\n\t\t\t\t\t\t\t\t\t// we don't want to steal it back.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tlinkUIref.current.contains(\n\t\t\t\t\t\t\t\t\t\t\twindow.document.activeElement\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t// Select the previous block to keep focus nearby\n\t\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t\t}\n\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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","ignoreList":[]}
|
|
@@ -1,8 +1,82 @@
|
|
|
1
|
+
/* wp:polyfill */
|
|
1
2
|
/**
|
|
2
3
|
* WordPress dependencies
|
|
3
4
|
*/
|
|
4
5
|
import { escapeHTML } from '@wordpress/escape-html';
|
|
5
|
-
import { safeDecodeURI } from '@wordpress/url';
|
|
6
|
+
import { safeDecodeURI, getPath } from '@wordpress/url';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Determines if an entity link should be severed based on URL changes.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} originalUrl - The original URL
|
|
12
|
+
* @param {string} newUrl - The new URL
|
|
13
|
+
* @return {boolean} True if the entity link should be severed
|
|
14
|
+
*/
|
|
15
|
+
const shouldSeverEntityLink = (originalUrl, newUrl) => {
|
|
16
|
+
if (!originalUrl || !newUrl) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const normalizePath = path => {
|
|
20
|
+
if (!path) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
return path.replace(/\/+$/, ''); // Remove trailing slashes
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Helper function to create URL objects with proper base handling
|
|
27
|
+
const createUrlObject = (url, baseUrl = null) => {
|
|
28
|
+
try {
|
|
29
|
+
// Always provide a base URL - it will be ignored for absolute URLs
|
|
30
|
+
// Use window.location.origin in browser, fallback for Node/tests
|
|
31
|
+
const base = baseUrl || (typeof window !== 'undefined' ? window.location.origin : 'https://wordpress.org');
|
|
32
|
+
return new URL(url, base);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// If URL construction still fails, it's likely an invalid URL
|
|
35
|
+
// and we should sever the entity link
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const originalUrlObj = createUrlObject(originalUrl);
|
|
40
|
+
if (!originalUrlObj) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
const newUrlObj = createUrlObject(newUrl, originalUrl);
|
|
44
|
+
if (!newUrlObj) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Move these declarations here, after the null checks
|
|
49
|
+
const originalHostname = originalUrlObj.hostname;
|
|
50
|
+
const newHostname = newUrlObj.hostname;
|
|
51
|
+
const originalPath = normalizePath(getPath(originalUrlObj.toString()));
|
|
52
|
+
const newPath = normalizePath(getPath(newUrlObj.toString()));
|
|
53
|
+
|
|
54
|
+
// If hostname or path changed, sever the entity link
|
|
55
|
+
if (originalHostname !== newHostname || originalPath !== newPath) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Special handling for plain permalinks (query string post IDs)
|
|
60
|
+
const originalP = originalUrlObj.searchParams.get('p');
|
|
61
|
+
const newP = newUrlObj.searchParams.get('p');
|
|
62
|
+
|
|
63
|
+
// If both are plain permalinks (with ?p= or ?page_id=), compare the IDs
|
|
64
|
+
if (originalP && newP && originalP !== newP) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
const originalPageId = originalUrlObj.searchParams.get('page_id');
|
|
68
|
+
const newPageId = newUrlObj.searchParams.get('page_id');
|
|
69
|
+
if (originalPageId && newPageId && originalPageId !== newPageId) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
// If switching between ?p= and ?page_id=, or one is missing, sever
|
|
73
|
+
if (originalP && newPageId || originalPageId && newP) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// If only query string or fragment changed, preserve the entity link
|
|
78
|
+
return false;
|
|
79
|
+
};
|
|
6
80
|
|
|
7
81
|
/**
|
|
8
82
|
* @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind
|
|
@@ -30,6 +104,7 @@ import { safeDecodeURI } from '@wordpress/url';
|
|
|
30
104
|
*/
|
|
31
105
|
|
|
32
106
|
export const updateAttributes = (updatedValue = {}, setAttributes, blockAttributes = {}) => {
|
|
107
|
+
var _newUrl$replace;
|
|
33
108
|
const {
|
|
34
109
|
label: originalLabel = '',
|
|
35
110
|
kind: originalKind = '',
|
|
@@ -38,15 +113,20 @@ export const updateAttributes = (updatedValue = {}, setAttributes, blockAttribut
|
|
|
38
113
|
const {
|
|
39
114
|
title: newLabel = '',
|
|
40
115
|
// the title of any provided Post.
|
|
41
|
-
|
|
116
|
+
label: newLabelFromLabel = '',
|
|
117
|
+
// alternative to title
|
|
118
|
+
url: newUrl,
|
|
42
119
|
opensInNewTab,
|
|
43
|
-
id,
|
|
120
|
+
id: newID,
|
|
44
121
|
kind: newKind = originalKind,
|
|
45
122
|
type: newType = originalType
|
|
46
123
|
} = updatedValue;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
124
|
+
|
|
125
|
+
// Use title if provided, otherwise fall back to label
|
|
126
|
+
const finalNewLabel = newLabel || newLabelFromLabel;
|
|
127
|
+
const newLabelWithoutHttp = finalNewLabel.replace(/http(s?):\/\//gi, '');
|
|
128
|
+
const newUrlWithoutHttp = (_newUrl$replace = newUrl?.replace(/http(s?):\/\//gi, '')) !== null && _newUrl$replace !== void 0 ? _newUrl$replace : '';
|
|
129
|
+
const useNewLabel = finalNewLabel && finalNewLabel !== originalLabel &&
|
|
50
130
|
// LinkControl without the title field relies
|
|
51
131
|
// on the check below. Specifically, it assumes that
|
|
52
132
|
// the URL is the same as a title.
|
|
@@ -64,33 +144,51 @@ export const updateAttributes = (updatedValue = {}, setAttributes, blockAttribut
|
|
|
64
144
|
// See also:
|
|
65
145
|
// - https://github.com/WordPress/gutenberg/pull/41063
|
|
66
146
|
// - https://github.com/WordPress/gutenberg/pull/18617.
|
|
67
|
-
const label = useNewLabel ? escapeHTML(
|
|
147
|
+
const label = useNewLabel ? escapeHTML(finalNewLabel) : originalLabel || escapeHTML(newUrlWithoutHttp);
|
|
68
148
|
|
|
69
149
|
// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use "tag" in favor of "post_tag"
|
|
70
150
|
const type = newType === 'post_tag' ? 'tag' : newType.replace('-', '_');
|
|
71
151
|
const isBuiltInType = ['post', 'page', 'tag', 'category'].indexOf(type) > -1;
|
|
72
152
|
const isCustomLink = !newKind && !isBuiltInType || newKind === 'custom';
|
|
73
153
|
const kind = isCustomLink ? 'custom' : newKind;
|
|
74
|
-
|
|
154
|
+
const attributes = {
|
|
75
155
|
// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.
|
|
76
|
-
...(newUrl
|
|
77
|
-
url: encodeURI(safeDecodeURI(newUrl))
|
|
78
|
-
}),
|
|
156
|
+
...(newUrl !== undefined ? {
|
|
157
|
+
url: newUrl ? encodeURI(safeDecodeURI(newUrl)) : newUrl
|
|
158
|
+
} : {}),
|
|
79
159
|
...(label && {
|
|
80
160
|
label
|
|
81
161
|
}),
|
|
82
162
|
...(undefined !== opensInNewTab && {
|
|
83
163
|
opensInNewTab
|
|
84
164
|
}),
|
|
85
|
-
...(id && Number.isInteger(id) && {
|
|
86
|
-
id
|
|
87
|
-
}),
|
|
88
165
|
...(kind && {
|
|
89
166
|
kind
|
|
90
167
|
}),
|
|
91
168
|
...(type && type !== 'URL' && {
|
|
92
169
|
type
|
|
93
170
|
})
|
|
94
|
-
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// If the block's id is set then the menu item is linking to an entity.
|
|
174
|
+
// Therefore, if the URL is set but a new ID is not provided, check if
|
|
175
|
+
// the entity link should be severed based on URL changes.
|
|
176
|
+
if (newUrl && !newID && blockAttributes.id) {
|
|
177
|
+
const shouldSever = shouldSeverEntityLink(blockAttributes.url, newUrl);
|
|
178
|
+
if (shouldSever) {
|
|
179
|
+
attributes.id = undefined; // explicitly "unset" the ID.
|
|
180
|
+
// When URL is manually changed in a way that severs the entity link,
|
|
181
|
+
// update kind and type to "custom" to indicate this is now a custom link.
|
|
182
|
+
attributes.kind = 'custom';
|
|
183
|
+
attributes.type = 'custom';
|
|
184
|
+
}
|
|
185
|
+
} else if (newID && Number.isInteger(newID)) {
|
|
186
|
+
attributes.id = newID;
|
|
187
|
+
} else if (blockAttributes.id) {
|
|
188
|
+
// If we have an existing ID and no URL change, ensure kind and type are preserved
|
|
189
|
+
attributes.kind = kind;
|
|
190
|
+
attributes.type = type;
|
|
191
|
+
}
|
|
192
|
+
setAttributes(attributes);
|
|
95
193
|
};
|
|
96
194
|
//# sourceMappingURL=update-attributes.js.map
|