@wordpress/block-library 9.40.1 → 9.40.2-next.v.202602271551.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/build/accordion/view.cjs +0 -34
- package/build/accordion/view.cjs.map +2 -2
- package/build/icon/block.json +9 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs +1 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
- package/build/icon/components/custom-inserter/index.cjs +1 -1
- package/build/icon/components/custom-inserter/index.cjs.map +2 -2
- package/build/icon/edit.cjs +15 -7
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/edit.cjs +1 -1
- package/build/image/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +4 -2
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/leaf-more-menu.cjs +68 -6
- package/build/navigation/edit/leaf-more-menu.cjs.map +3 -3
- package/build/navigation/edit/menu-inspector-controls.cjs +20 -91
- package/build/navigation/edit/menu-inspector-controls.cjs.map +3 -3
- package/build/navigation/edit/navigation-link-ui.cjs +97 -0
- package/build/navigation/edit/navigation-link-ui.cjs.map +7 -0
- package/build/navigation/edit/navigation-list-view-header.cjs +86 -0
- package/build/navigation/edit/navigation-list-view-header.cjs.map +7 -0
- package/build/navigation/edit/navigation-menu-selector.cjs +4 -2
- package/build/navigation/edit/navigation-menu-selector.cjs.map +3 -3
- package/build/navigation/edit/placeholder/index.cjs +2 -2
- package/build/navigation/edit/placeholder/index.cjs.map +3 -3
- package/build/navigation-link/shared/controls.cjs +29 -52
- package/build/navigation-link/shared/controls.cjs.map +3 -3
- package/build/navigation-link/shared/use-link-preview.cjs +7 -8
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/navigation-overlay-close/edit.cjs +2 -3
- package/build/navigation-overlay-close/edit.cjs.map +2 -2
- package/build/page-list-item/edit.cjs +6 -3
- package/build/page-list-item/edit.cjs.map +2 -2
- package/build/post-navigation-link/block.json +1 -3
- package/build/post-navigation-link/deprecated.cjs +100 -0
- package/build/post-navigation-link/deprecated.cjs.map +7 -0
- package/build/post-navigation-link/edit.cjs +2 -36
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-navigation-link/index.cjs +2 -0
- package/build/post-navigation-link/index.cjs.map +3 -3
- package/build/post-title/block.json +1 -3
- package/build/post-title/deprecated.cjs +82 -1
- package/build/post-title/deprecated.cjs.map +3 -3
- package/build/post-title/edit.cjs +10 -36
- package/build/post-title/edit.cjs.map +3 -3
- package/build/pullquote/deprecated.cjs +6 -6
- package/build/pullquote/deprecated.cjs.map +2 -2
- package/build/query/block.json +1 -2
- package/build/query-title/block.json +1 -3
- package/build/query-title/deprecated.cjs +70 -1
- package/build/query-title/deprecated.cjs.map +3 -3
- package/build/query-title/edit.cjs +17 -35
- package/build/query-title/edit.cjs.map +3 -3
- package/build/site-tagline/block.json +6 -4
- package/build/site-tagline/deprecated.cjs +66 -1
- package/build/site-tagline/deprecated.cjs.map +3 -3
- package/build/site-tagline/edit.cjs +14 -28
- package/build/site-tagline/edit.cjs.map +3 -3
- package/build/site-title/block.json +1 -3
- package/build/site-title/deprecated.cjs +79 -1
- package/build/site-title/deprecated.cjs.map +3 -3
- package/build/site-title/edit.cjs +14 -30
- package/build/site-title/edit.cjs.map +3 -3
- package/build/tabs-menu-item/block.json +1 -26
- package/build/tabs-menu-item/controls.cjs +2 -100
- package/build/tabs-menu-item/controls.cjs.map +3 -3
- package/build/tabs-menu-item/edit.cjs +6 -65
- package/build/tabs-menu-item/edit.cjs.map +2 -2
- package/build/tabs-menu-item/save.cjs +1 -15
- package/build/tabs-menu-item/save.cjs.map +2 -2
- package/build-module/accordion/view.mjs +1 -35
- package/build-module/accordion/view.mjs.map +2 -2
- package/build-module/icon/block.json +9 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs +1 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +1 -1
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +15 -7
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/edit.mjs +1 -1
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +4 -2
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/leaf-more-menu.mjs +73 -7
- package/build-module/navigation/edit/leaf-more-menu.mjs.map +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.mjs +21 -101
- package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-link-ui.mjs +76 -0
- package/build-module/navigation/edit/navigation-link-ui.mjs.map +7 -0
- package/build-module/navigation/edit/navigation-list-view-header.mjs +58 -0
- package/build-module/navigation/edit/navigation-list-view-header.mjs.map +7 -0
- package/build-module/navigation/edit/navigation-menu-selector.mjs +5 -3
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +29 -53
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +7 -8
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-overlay-close/edit.mjs +2 -3
- package/build-module/navigation-overlay-close/edit.mjs.map +2 -2
- package/build-module/page-list-item/edit.mjs +6 -3
- package/build-module/page-list-item/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/block.json +1 -3
- package/build-module/post-navigation-link/deprecated.mjs +69 -0
- package/build-module/post-navigation-link/deprecated.mjs.map +7 -0
- package/build-module/post-navigation-link/edit.mjs +3 -30
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/index.mjs +2 -0
- package/build-module/post-navigation-link/index.mjs.map +2 -2
- package/build-module/post-title/block.json +1 -3
- package/build-module/post-title/deprecated.mjs +82 -1
- package/build-module/post-title/deprecated.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +10 -27
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/pullquote/deprecated.mjs +6 -6
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/query/block.json +1 -2
- package/build-module/query-title/block.json +1 -3
- package/build-module/query-title/deprecated.mjs +70 -1
- package/build-module/query-title/deprecated.mjs.map +2 -2
- package/build-module/query-title/edit.mjs +17 -36
- package/build-module/query-title/edit.mjs.map +2 -2
- package/build-module/site-tagline/block.json +6 -4
- package/build-module/site-tagline/deprecated.mjs +66 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +14 -29
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/block.json +1 -3
- package/build-module/site-title/deprecated.mjs +79 -1
- package/build-module/site-title/deprecated.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +14 -31
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/block.json +1 -26
- package/build-module/tabs-menu-item/controls.mjs +3 -104
- package/build-module/tabs-menu-item/controls.mjs.map +2 -2
- package/build-module/tabs-menu-item/edit.mjs +6 -66
- package/build-module/tabs-menu-item/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/save.mjs +1 -15
- package/build-module/tabs-menu-item/save.mjs.map +2 -2
- package/build-style/editor-rtl.css +10 -5
- package/build-style/editor.css +10 -5
- package/build-style/navigation-link/editor-rtl.css +10 -0
- package/build-style/navigation-link/editor.css +10 -0
- package/build-style/style-rtl.css +3 -12
- package/build-style/style.css +3 -12
- package/build-style/tabs-menu-item/editor-rtl.css +0 -5
- package/build-style/tabs-menu-item/editor.css +0 -5
- package/build-style/tabs-menu-item/style-rtl.css +3 -12
- package/build-style/tabs-menu-item/style.css +3 -12
- package/package.json +38 -38
- package/src/accordion/view.js +1 -44
- package/src/accordion-item/index.php +0 -1
- package/src/cover/index.php +4 -4
- package/src/icon/block.json +9 -1
- package/src/icon/components/custom-inserter/icon-grid.js +1 -1
- package/src/icon/components/custom-inserter/index.js +1 -1
- package/src/icon/edit.js +20 -10
- package/src/icon/index.php +1 -3
- package/src/image/edit.js +1 -1
- package/src/image/index.php +1 -4
- package/src/navigation/edit/index.js +4 -2
- package/src/navigation/edit/leaf-more-menu.js +86 -11
- package/src/navigation/edit/menu-inspector-controls.js +23 -142
- package/src/navigation/edit/navigation-link-ui.js +115 -0
- package/src/navigation/edit/navigation-list-view-header.js +62 -0
- package/src/navigation/edit/navigation-menu-selector.js +5 -3
- package/src/navigation/edit/placeholder/index.js +3 -2
- package/src/navigation/edit/test/navigation-menu-selector.js +23 -20
- package/src/navigation-link/editor.scss +18 -0
- package/src/navigation-link/shared/controls.js +35 -62
- package/src/navigation-link/shared/test/controls.js +5 -5
- package/src/navigation-link/shared/test/use-link-preview.test.js +10 -1
- package/src/navigation-link/shared/use-link-preview.js +13 -11
- package/src/navigation-overlay-close/edit.js +4 -3
- package/src/page-list/index.php +1 -1
- package/src/page-list-item/edit.js +8 -7
- package/src/post-featured-image/index.php +2 -4
- package/src/post-navigation-link/block.json +1 -3
- package/src/post-navigation-link/deprecated.js +72 -0
- package/src/post-navigation-link/edit.js +2 -35
- package/src/post-navigation-link/index.js +2 -0
- package/src/post-title/block.json +1 -3
- package/src/post-title/deprecated.js +86 -1
- package/src/post-title/edit.js +2 -18
- package/src/pullquote/deprecated.js +3 -3
- package/src/query/block.json +1 -2
- package/src/query-title/block.json +1 -3
- package/src/query-title/deprecated.js +74 -1
- package/src/query-title/edit.js +11 -27
- package/src/query-title/index.php +1 -1
- package/src/site-tagline/block.json +6 -4
- package/src/site-tagline/deprecated.js +70 -1
- package/src/site-tagline/edit.js +9 -22
- package/src/site-title/block.json +1 -3
- package/src/site-title/deprecated.js +83 -1
- package/src/site-title/edit.js +9 -22
- package/src/tabs-menu-item/block.json +1 -26
- package/src/tabs-menu-item/controls.js +0 -108
- package/src/tabs-menu-item/edit.js +6 -79
- package/src/tabs-menu-item/editor.scss +0 -6
- package/src/tabs-menu-item/save.js +1 -26
- package/src/tabs-menu-item/style.scss +3 -14
- package/build/navigation/use-navigation-entities.cjs +0 -67
- package/build/navigation/use-navigation-entities.cjs.map +0 -7
- package/build-module/navigation/use-navigation-entities.mjs +0 -46
- package/build-module/navigation/use-navigation-entities.mjs.map +0 -7
- package/src/navigation/use-navigation-entities.js +0 -72
|
@@ -37,7 +37,7 @@ var { useRemoteUrlData, isHashLink, isRelativePath } = (0, import_lock_unlock.un
|
|
|
37
37
|
function capitalize(str) {
|
|
38
38
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
39
39
|
}
|
|
40
|
-
function computeDisplayUrl({ linkUrl,
|
|
40
|
+
function computeDisplayUrl({ linkUrl, homeUrl } = {}) {
|
|
41
41
|
if (!linkUrl) {
|
|
42
42
|
return { displayUrl: "", isExternal: false };
|
|
43
43
|
}
|
|
@@ -48,7 +48,7 @@ function computeDisplayUrl({ linkUrl, siteUrl } = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
try {
|
|
50
50
|
const parsedUrl = new URL(linkUrl);
|
|
51
|
-
const siteDomain =
|
|
51
|
+
const siteDomain = homeUrl ? new URL(homeUrl).origin : window.location.origin;
|
|
52
52
|
if (parsedUrl.origin === siteDomain) {
|
|
53
53
|
let path = parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;
|
|
54
54
|
if (path.endsWith("/") && path.length > 1) {
|
|
@@ -126,18 +126,17 @@ function useLinkPreview({
|
|
|
126
126
|
hasBinding,
|
|
127
127
|
isEntityAvailable
|
|
128
128
|
}) {
|
|
129
|
-
const
|
|
130
|
-
|
|
129
|
+
const homeUrl = (0, import_data.useSelect)((select) => {
|
|
130
|
+
return select(import_core_data.store).getEntityRecord(
|
|
131
131
|
"root",
|
|
132
|
-
"
|
|
133
|
-
);
|
|
134
|
-
return siteEntity?.url;
|
|
132
|
+
"__unstableBase"
|
|
133
|
+
)?.home;
|
|
135
134
|
}, []);
|
|
136
135
|
const title = entityRecord?.title?.rendered || entityRecord?.title || entityRecord?.name;
|
|
137
136
|
const { richData } = useRemoteUrlData(title ? null : url);
|
|
138
137
|
const { displayUrl, isExternal } = computeDisplayUrl({
|
|
139
138
|
linkUrl: url,
|
|
140
|
-
|
|
139
|
+
homeUrl
|
|
141
140
|
});
|
|
142
141
|
const image = (0, import_data.useSelect)(
|
|
143
142
|
(select) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation-link/shared/use-link-preview.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURI } from '@wordpress/url';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useRemoteUrlData, isHashLink, isRelativePath } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Capitalize the first letter of a string.\n *\n * @param {string} str - The string to capitalize\n * @return {string} Capitalized string\n */\nfunction capitalize( str ) {\n\treturn str.charAt( 0 ).toUpperCase() + str.slice( 1 );\n}\n\n/**\n * Compute display URL - strips site URL if internal, shows full URL if external.\n *\n * @param {Object} options - Parameters object\n * @param {string} options.linkUrl - The URL to process\n * @param {string} options.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,iBAA8B;AAC9B,0BAAsD;AACtD,kBAA0B;AAC1B,uBAAuC;AAKvC,yBAAuB;AAEvB,IAAM,EAAE,kBAAkB,YAAY,eAAe,QAAI;AAAA,EACxD,oBAAAA;AACD;AAQA,SAAS,WAAY,KAAM;AAC1B,SAAO,IAAI,OAAQ,CAAE,EAAE,YAAY,IAAI,IAAI,MAAO,CAAE;AACrD;AAUO,SAAS,kBAAmB,EAAE,SAAS,QAAQ,IAAI,CAAC,GAAI;AAC9D,MAAK,CAAE,SAAU;AAChB,WAAO,EAAE,YAAY,IAAI,YAAY,MAAM;AAAA,EAC5C;AAEA,MAAI,iBAAa,0BAAe,OAAQ;AACxC,MAAI,aAAa;AAGjB,MAAK,eAAgB,OAAQ,KAAK,WAAY,OAAQ,GAAI;AACzD,WAAO,EAAE,YAAY,YAAY,MAAM;AAAA,EACxC;AAIA,MAAI;AACH,UAAM,YAAY,IAAI,IAAK,OAAQ;AAEnC,UAAM,aAAa,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURI } from '@wordpress/url';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useRemoteUrlData, isHashLink, isRelativePath } = unlock(\n\tblockEditorPrivateApis\n);\n\n/**\n * Capitalize the first letter of a string.\n *\n * @param {string} str - The string to capitalize\n * @return {string} Capitalized string\n */\nfunction capitalize( str ) {\n\treturn str.charAt( 0 ).toUpperCase() + str.slice( 1 );\n}\n\n/**\n * Compute display URL - strips site URL if internal, shows full URL if external.\n *\n * @param {Object} options - Parameters object\n * @param {string} options.linkUrl - The URL to process\n * @param {string} options.homeUrl - The WordPress site URL (falls back to window.location.origin)\n * @return {Object} Object with displayUrl and isExternal flag\n */\nexport function computeDisplayUrl( { linkUrl, homeUrl } = {} ) {\n\tif ( ! linkUrl ) {\n\t\treturn { displayUrl: '', isExternal: false };\n\t}\n\n\tlet displayUrl = safeDecodeURI( linkUrl );\n\tlet isExternal = false;\n\n\t// Check hash links and relative paths first - these are always internal\n\tif ( isRelativePath( linkUrl ) || isHashLink( linkUrl ) ) {\n\t\treturn { displayUrl, isExternal: false };\n\t}\n\n\t// Try to parse as a full URL to determine if it's actually external\n\t// This must happen before trusting the type attribute\n\ttry {\n\t\tconst parsedUrl = new URL( linkUrl );\n\t\t// Use provided homeUrl or fall back to window.location.origin\n\t\tconst siteDomain = homeUrl\n\t\t\t? new URL( homeUrl ).origin\n\t\t\t: window.location.origin;\n\n\t\tif ( parsedUrl.origin === siteDomain ) {\n\t\t\t// Show only the pathname (and search/hash if present)\n\t\t\tlet path = parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;\n\t\t\t// Remove trailing slash\n\t\t\tif ( path.endsWith( '/' ) && path.length > 1 ) {\n\t\t\t\tpath = path.slice( 0, -1 );\n\t\t\t}\n\t\t\tdisplayUrl = path;\n\t\t} else {\n\t\t\t// Different origin - this is an external link\n\t\t\tisExternal = true;\n\t\t}\n\t} catch ( e ) {\n\t\t// URL parsing failed - this means it's likely a URL without a protocol (e.g., \"www.example.com\")\n\t\t// Since we already checked for relative paths and hash links above, treat as external\n\t\tisExternal = true;\n\t}\n\n\treturn { displayUrl, isExternal };\n}\n\n/**\n * Compute badges for the link preview.\n *\n * @param {Object} options - Options object\n * @param {string} options.url - Link URL\n * @param {string} options.type - Entity type (page, post, etc.)\n * @param {boolean} options.isExternal - Whether link is external\n * @param {string} options.entityStatus - Entity status (publish, draft, etc.)\n * @param {boolean} options.hasBinding - Whether link has entity binding\n * @param {boolean} options.isEntityAvailable - Whether bound entity exists\n * @return {Array} Array of badge objects with label and intent\n */\nexport function computeBadges( {\n\turl,\n\ttype,\n\tisExternal,\n\tentityStatus,\n\thasBinding,\n\tisEntityAvailable,\n} ) {\n\tconst badges = [];\n\n\t// Kind badge\n\tif ( url ) {\n\t\tif ( isExternal ) {\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'External link' ),\n\t\t\t\tintent: 'default',\n\t\t\t} );\n\t\t} else if ( isHashLink( url ) ) {\n\t\t\t// Hash links should be detected before type check\n\t\t\t// because they're not entity links even if type is set\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Internal link' ),\n\t\t\t\tintent: 'default',\n\t\t\t} );\n\t\t} else if ( type && type !== 'custom' ) {\n\t\t\t// Show entity type badge (page, post, category, etc.)\n\t\t\t// but not 'custom' since that's just a manual link\n\t\t\tbadges.push( { label: capitalize( type ), intent: 'default' } );\n\t\t} else {\n\t\t\t// Internal link (not external, not hash, not entity)\n\t\t\tbadges.push( {\n\t\t\t\tlabel: __( 'Page' ),\n\t\t\t\tintent: 'default',\n\t\t\t} );\n\t\t}\n\t}\n\n\t// Status badge\n\tif ( hasBinding && ! isEntityAvailable ) {\n\t\tbadges.push( {\n\t\t\tlabel: sprintf(\n\t\t\t\t/* translators: %s is the entity type (e.g., \"page\", \"post\", \"category\") */\n\t\t\t\t__( 'Missing %s' ),\n\t\t\t\ttype\n\t\t\t),\n\t\t\tintent: 'error',\n\t\t} );\n\t} else if ( ! url ) {\n\t\tbadges.push( { label: __( 'No link selected' ), intent: 'error' } );\n\t} else if ( entityStatus ) {\n\t\tconst statusMap = {\n\t\t\tpublish: { label: __( 'Published' ), intent: 'success' },\n\t\t\tfuture: { label: __( 'Scheduled' ), intent: 'warning' },\n\t\t\tdraft: { label: __( 'Draft' ), intent: 'warning' },\n\t\t\tpending: { label: __( 'Pending' ), intent: 'warning' },\n\t\t\tprivate: { label: __( 'Private' ), intent: 'default' },\n\t\t\ttrash: { label: __( 'Trash' ), intent: 'error' },\n\t\t};\n\t\tconst badge = statusMap[ entityStatus ];\n\t\tif ( badge ) {\n\t\t\tbadges.push( badge );\n\t\t}\n\t}\n\n\treturn badges;\n}\n\n/**\n * Hook to compute link preview data for display.\n *\n * This hook takes raw link data and entity information and computes\n * presentation-ready preview data including formatted title, URL, and badges.\n *\n * @param {Object} options - Options object\n * @param {string} options.url - Link URL\n * @param {string} options.type - Entity type (page, post, etc.)\n * @param {Object} options.entityRecord - Entity record\n * @param {boolean} options.hasBinding - Whether link has entity binding\n * @param {boolean} options.isEntityAvailable - Whether bound entity exists\n * @return {Object} Preview data object with title, url, image, and badges\n */\nexport function useLinkPreview( {\n\turl,\n\tentityRecord,\n\ttype,\n\thasBinding,\n\tisEntityAvailable,\n} ) {\n\t// Get the WordPress homepage URL from settings\n\tconst homeUrl = useSelect( ( select ) => {\n\t\treturn select( coreDataStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t)?.home;\n\t}, [] );\n\n\tconst title =\n\t\tentityRecord?.title?.rendered ||\n\t\tentityRecord?.title ||\n\t\tentityRecord?.name;\n\n\t// Fetch rich URL data if we don't have a title. Internal links should have passed a title.\n\tconst { richData } = useRemoteUrlData( title ? null : url );\n\n\t// Compute display URL and external flag\n\tconst { displayUrl, isExternal } = computeDisplayUrl( {\n\t\tlinkUrl: url,\n\t\thomeUrl,\n\t} );\n\n\tconst image = useSelect(\n\t\t( select ) => {\n\t\t\t// Only fetch for post-type entities with featured media\n\t\t\tif ( ! entityRecord?.featured_media ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getEntityRecord } = select( coreDataStore );\n\n\t\t\t// Get the media entity to fetch the image URL\n\t\t\tconst media = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tentityRecord.featured_media\n\t\t\t);\n\n\t\t\t// Return the thumbnail or medium size URL, fallback to source_url\n\t\t\treturn (\n\t\t\t\tmedia?.media_details?.sizes?.thumbnail?.source_url ||\n\t\t\t\tmedia?.media_details?.sizes?.medium?.source_url ||\n\t\t\t\tmedia?.source_url ||\n\t\t\t\tnull\n\t\t\t);\n\t\t},\n\t\t[ entityRecord?.featured_media ]\n\t);\n\n\t// Compute badges\n\tconst badges = computeBadges( {\n\t\turl,\n\t\ttype,\n\t\tisExternal,\n\t\tentityStatus: entityRecord?.status,\n\t\thasBinding,\n\t\tisEntityAvailable,\n\t} );\n\n\t// Get display title - use provided title, fallback to rich data, or URL\n\tconst displayTitle = url\n\t\t?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|
"names": ["blockEditorPrivateApis", "coreDataStore"]
|
|
7
7
|
}
|
|
@@ -36,6 +36,7 @@ function NavigationOverlayCloseEdit({
|
|
|
36
36
|
const { displayMode, text } = attributes;
|
|
37
37
|
const showIcon = displayMode === "icon" || displayMode === "both";
|
|
38
38
|
const showText = displayMode === "text" || displayMode === "both";
|
|
39
|
+
const displayText = text || (0, import_i18n.__)("Close");
|
|
39
40
|
const blockProps = (0, import_block_editor.useBlockProps)({
|
|
40
41
|
className: "wp-block-navigation-overlay-close"
|
|
41
42
|
});
|
|
@@ -103,10 +104,8 @@ function NavigationOverlayCloseEdit({
|
|
|
103
104
|
import_block_editor.RichText,
|
|
104
105
|
{
|
|
105
106
|
identifier: "text",
|
|
106
|
-
value:
|
|
107
|
+
value: displayText,
|
|
107
108
|
onChange: (value) => setAttributes({ text: value }),
|
|
108
|
-
placeholder: (0, import_i18n.__)("Close"),
|
|
109
|
-
withoutInteractiveFormatting: true,
|
|
110
109
|
tagName: "span",
|
|
111
110
|
className: "wp-block-navigation-overlay-close__text",
|
|
112
111
|
allowedFormats: ["core/bold", "core/italic"]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/navigation-overlay-close/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function NavigationOverlayCloseEdit( {\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { displayMode, text } = attributes;\n\tconst showIcon = displayMode === 'icon' || displayMode === 'both';\n\tconst showText = displayMode === 'text' || displayMode === 'both';\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-navigation-overlay-close',\n\t} );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => setAttributes( { displayMode: 'icon' } ) }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display Mode' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => displayMode !== 'icon' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayMode: 'icon' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Mode' ) }\n\t\t\t\t\t\t\tvalue={ displayMode }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { displayMode: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"icon\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Icon' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"both\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Both' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<button\n\t\t\t\t{ ...blockProps }\n\t\t\t\ttype=\"button\"\n\t\t\t\taria-label={ ! showText ? __( 'Close' ) : undefined }\n\t\t\t>\n\t\t\t\t{ showIcon && <Icon icon={ close } /> }\n\t\t\t\t{ showText && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t\t\tvalue={
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAIO;AACP,wBAKO;AACP,kBAAmB;AACnB,mBAA4B;AAK5B,mBAA+C;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function NavigationOverlayCloseEdit( {\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { displayMode, text } = attributes;\n\tconst showIcon = displayMode === 'icon' || displayMode === 'both';\n\tconst showText = displayMode === 'text' || displayMode === 'both';\n\n\t// Use translated default if text is empty\n\tconst displayText = text || __( 'Close' );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-navigation-overlay-close',\n\t} );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => setAttributes( { displayMode: 'icon' } ) }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display Mode' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => displayMode !== 'icon' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayMode: 'icon' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Mode' ) }\n\t\t\t\t\t\t\tvalue={ displayMode }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { displayMode: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"icon\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Icon' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"both\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Both' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<button\n\t\t\t\t{ ...blockProps }\n\t\t\t\ttype=\"button\"\n\t\t\t\taria-label={ ! showText ? __( 'Close' ) : undefined }\n\t\t\t>\n\t\t\t\t{ showIcon && <Icon icon={ close } /> }\n\t\t\t\t{ showText && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t\t\tvalue={ displayText }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { text: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-overlay-close__text\"\n\t\t\t\t\t\tallowedFormats={ [ 'core/bold', 'core/italic' ] }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</button>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAIO;AACP,wBAKO;AACP,kBAAmB;AACnB,mBAA4B;AAK5B,mBAA+C;AAoB7C;AAlBa,SAAR,2BAA6C;AAAA,EACnD;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,aAAa,KAAK,IAAI;AAC9B,QAAM,WAAW,gBAAgB,UAAU,gBAAgB;AAC3D,QAAM,WAAW,gBAAgB,UAAU,gBAAgB;AAG3D,QAAM,cAAc,YAAQ,gBAAI,OAAQ;AAExC,QAAM,iBAAa,mCAAe;AAAA,IACjC,WAAW;AAAA,EACZ,CAAE;AAEF,QAAM,wBAAoB,6CAA+B;AAEzD,SACC,4EACC;AAAA,gDAAC,yCACA;AAAA,MAAC,kBAAAA;AAAA,MAAA;AAAA,QACA,WAAQ,gBAAI,UAAW;AAAA,QACvB,UAAW,MAAM,cAAe,EAAE,aAAa,OAAO,CAAE;AAAA,QACxD;AAAA,QAEA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,cAAe;AAAA,YAC3B,kBAAgB;AAAA,YAChB,UAAW,MAAM,gBAAgB;AAAA,YACjC,YAAa,MACZ,c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_block_editor = require("@wordpress/block-editor");
|
|
38
38
|
var import_data = require("@wordpress/data");
|
|
39
39
|
var import_core_data = require("@wordpress/core-data");
|
|
40
|
-
var import_element = require("@wordpress/element");
|
|
41
40
|
var import_dom = require("@wordpress/dom");
|
|
42
41
|
var import_icons = require("../navigation-link/icons.cjs");
|
|
43
42
|
var import_utils = require("../navigation/edit/utils.cjs");
|
|
@@ -88,7 +87,9 @@ function PageListItemEdit({ context, attributes }) {
|
|
|
88
87
|
type: "button",
|
|
89
88
|
className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle",
|
|
90
89
|
"aria-expanded": "false",
|
|
91
|
-
|
|
90
|
+
dangerouslySetInnerHTML: {
|
|
91
|
+
__html: (0, import_dom.safeHTML)(label)
|
|
92
|
+
}
|
|
92
93
|
}
|
|
93
94
|
),
|
|
94
95
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ItemSubmenuIcon, {}) })
|
|
@@ -99,7 +100,9 @@ function PageListItemEdit({ context, attributes }) {
|
|
|
99
100
|
"wp-block-navigation-item__content": isNavigationChild
|
|
100
101
|
}),
|
|
101
102
|
href: link,
|
|
102
|
-
|
|
103
|
+
dangerouslySetInnerHTML: {
|
|
104
|
+
__html: (0, import_dom.safeHTML)(title)
|
|
105
|
+
}
|
|
103
106
|
}
|
|
104
107
|
),
|
|
105
108
|
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/page-list-item/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,0BAAmD;AACnD,kBAA0B;AAC1B,uBAAmC;AACnC,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { safeHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from '../navigation-link/icons';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\n\nfunction useFrontPageId() {\n\treturn useSelect( ( select ) => {\n\t\tconst canReadSettings = select( coreStore ).canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tif ( ! canReadSettings ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst site = select( coreStore ).getEntityRecord( 'root', 'site' );\n\t\treturn site?.show_on_front === 'page' && site?.page_on_front;\n\t}, [] );\n}\n\nexport default function PageListItemEdit( { context, attributes } ) {\n\tconst { id, label, link, hasChildren, title } = attributes;\n\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\tconst frontPageId = useFrontPageId();\n\n\t// Get submenu visibility from context. The Navigation block handles\n\t// backward compatibility by migrating openSubmenusOnClick to submenuVisibility\n\t// via its deprecation handler before this context is received.\n\tconst submenuVisibility = context.submenuVisibility;\n\n\tconst openOnClick = submenuVisibility === 'click';\n\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst blockProps = useBlockProps( navigationChildBlockProps, {\n\t\tclassName: 'wp-block-pages-list__item',\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps );\n\n\treturn (\n\t\t<li\n\t\t\tkey={ id }\n\t\t\tclassName={ clsx( 'wp-block-pages-list__item', {\n\t\t\t\t'has-child': hasChildren,\n\t\t\t\t'wp-block-navigation-item': isNavigationChild,\n\t\t\t\t// Class assignment logic matches PHP rendering in page-list/index.php\n\t\t\t\t'open-on-click': openOnClick,\n\t\t\t\t'open-always': submenuVisibility === 'always',\n\t\t\t\t// Must check hover mode explicitly to match PHP elseif structure (index.php:212)\n\t\t\t\t'open-on-hover-click':\n\t\t\t\t\tsubmenuVisibility === 'hover' && context.showSubmenuIcon,\n\t\t\t\t'menu-item-home': id === frontPageId,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ hasChildren && openOnClick ? (\n\t\t\t\t<>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle\"\n\t\t\t\t\t\taria-expanded=\"false\"\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: safeHTML( label ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<a\n\t\t\t\t\tclassName={ clsx( 'wp-block-pages-list__item__link', {\n\t\t\t\t\t\t'wp-block-navigation-item__content': isNavigationChild,\n\t\t\t\t\t} ) }\n\t\t\t\t\thref={ link }\n\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t__html: safeHTML( title ),\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasChildren && (\n\t\t\t\t<>\n\t\t\t\t\t{ ! openOnClick && context.showSubmenuIcon && (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\"\n\t\t\t\t\t\t\taria-expanded=\"false\"\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t) }\n\t\t\t\t\t<ul { ...innerBlocksProps }></ul>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</li>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,0BAAmD;AACnD,kBAA0B;AAC1B,uBAAmC;AACnC,iBAAyB;AAKzB,mBAAgC;AAChC,mBAGO;AAuDH;AArDJ,SAAS,iBAAiB;AACzB,aAAO,uBAAW,CAAE,WAAY;AAC/B,UAAM,kBAAkB,OAAQ,iBAAAA,KAAU,EAAE,QAAS,QAAQ;AAAA,MAC5D,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE;AACF,QAAK,CAAE,iBAAkB;AACxB,aAAO;AAAA,IACR;AAEA,UAAM,OAAO,OAAQ,iBAAAA,KAAU,EAAE,gBAAiB,QAAQ,MAAO;AACjE,WAAO,MAAM,kBAAkB,UAAU,MAAM;AAAA,EAChD,GAAG,CAAC,CAAE;AACP;AAEe,SAAR,iBAAmC,EAAE,SAAS,WAAW,GAAI;AACnE,QAAM,EAAE,IAAI,OAAO,MAAM,aAAa,MAAM,IAAI;AAChD,QAAM,oBAAoB,qBAAqB;AAC/C,QAAM,cAAc,eAAe;AAKnC,QAAM,oBAAoB,QAAQ;AAElC,QAAM,cAAc,sBAAsB;AAE1C,QAAM,wBAAoB,wBAAW,SAAS,IAAK;AAEnD,QAAM,gCACL,2CAA8B,iBAAkB;AACjD,QAAM,iBAAa,mCAAe,2BAA2B;AAAA,IAC5D,WAAW;AAAA,EACZ,CAAE;AAEF,QAAM,uBAAmB,yCAAqB,UAAW;AAEzD,SACC;AAAA,IAAC;AAAA;AAAA,MAEA,eAAY,YAAAC,SAAM,6BAA6B;AAAA,QAC9C,aAAa;AAAA,QACb,4BAA4B;AAAA;AAAA,QAE5B,iBAAiB;AAAA,QACjB,eAAe,sBAAsB;AAAA;AAAA,QAErC,uBACC,sBAAsB,WAAW,QAAQ;AAAA,QAC1C,kBAAkB,OAAO;AAAA,MAC1B,CAAE;AAAA,MAEA;AAAA,uBAAe,cAChB,4EACC;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,MAAK;AAAA,cACL,WAAU;AAAA,cACV,iBAAc;AAAA,cACd,yBAA0B;AAAA,gBACzB,YAAQ,qBAAU,KAAM;AAAA,cACzB;AAAA;AAAA,UACD;AAAA,UACA,4CAAC,UAAK,WAAU,sEACf,sDAAC,gCAAgB,GAClB;AAAA,WACD,IAEA;AAAA,UAAC;AAAA;AAAA,YACA,eAAY,YAAAA,SAAM,mCAAmC;AAAA,cACpD,qCAAqC;AAAA,YACtC,CAAE;AAAA,YACF,MAAO;AAAA,YACP,yBAA0B;AAAA,cACzB,YAAQ,qBAAU,KAAM;AAAA,YACzB;AAAA;AAAA,QACD;AAAA,QAEC,eACD,4EACG;AAAA,WAAE,eAAe,QAAQ,mBAC1B;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,iBAAc;AAAA,cACd,MAAK;AAAA,cAEL,sDAAC,gCAAgB;AAAA;AAAA,UAClB;AAAA,UAED,4CAAC,QAAK,GAAG,kBAAmB;AAAA,WAC7B;AAAA;AAAA;AAAA,IAlDK;AAAA,EAoDP;AAEF;",
|
|
6
6
|
"names": ["coreStore", "clsx"]
|
|
7
7
|
}
|
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
"description": "Displays the next or previous post link that is adjacent to the current post.",
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"attributes": {
|
|
10
|
-
"textAlign": {
|
|
11
|
-
"type": "string"
|
|
12
|
-
},
|
|
13
10
|
"type": {
|
|
14
11
|
"type": "string",
|
|
15
12
|
"default": "next"
|
|
@@ -46,6 +43,7 @@
|
|
|
46
43
|
"typography": {
|
|
47
44
|
"fontSize": true,
|
|
48
45
|
"lineHeight": true,
|
|
46
|
+
"textAlign": true,
|
|
49
47
|
"__experimentalFontFamily": true,
|
|
50
48
|
"__experimentalFontWeight": true,
|
|
51
49
|
"__experimentalFontStyle": true,
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/block-library/src/post-navigation-link/deprecated.js
|
|
31
|
+
var deprecated_exports = {};
|
|
32
|
+
__export(deprecated_exports, {
|
|
33
|
+
default: () => deprecated_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(deprecated_exports);
|
|
36
|
+
var import_migrate_text_align = __toESM(require("../utils/migrate-text-align.cjs"));
|
|
37
|
+
var v1 = {
|
|
38
|
+
attributes: {
|
|
39
|
+
textAlign: {
|
|
40
|
+
type: "string"
|
|
41
|
+
},
|
|
42
|
+
type: {
|
|
43
|
+
type: "string",
|
|
44
|
+
default: "next"
|
|
45
|
+
},
|
|
46
|
+
label: {
|
|
47
|
+
type: "string",
|
|
48
|
+
role: "content"
|
|
49
|
+
},
|
|
50
|
+
showTitle: {
|
|
51
|
+
type: "boolean",
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
linkLabel: {
|
|
55
|
+
type: "boolean",
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
arrow: {
|
|
59
|
+
type: "string",
|
|
60
|
+
default: "none"
|
|
61
|
+
},
|
|
62
|
+
taxonomy: {
|
|
63
|
+
type: "string",
|
|
64
|
+
default: ""
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
supports: {
|
|
68
|
+
anchor: true,
|
|
69
|
+
reusable: false,
|
|
70
|
+
html: false,
|
|
71
|
+
color: {
|
|
72
|
+
link: true
|
|
73
|
+
},
|
|
74
|
+
typography: {
|
|
75
|
+
fontSize: true,
|
|
76
|
+
lineHeight: true,
|
|
77
|
+
__experimentalFontFamily: true,
|
|
78
|
+
__experimentalFontWeight: true,
|
|
79
|
+
__experimentalFontStyle: true,
|
|
80
|
+
__experimentalTextTransform: true,
|
|
81
|
+
__experimentalTextDecoration: true,
|
|
82
|
+
__experimentalLetterSpacing: true,
|
|
83
|
+
__experimentalDefaultControls: {
|
|
84
|
+
fontSize: true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
interactivity: {
|
|
88
|
+
clientNavigation: true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
migrate: import_migrate_text_align.default,
|
|
92
|
+
isEligible(attributes) {
|
|
93
|
+
return !!attributes.textAlign || !!attributes.className?.match(
|
|
94
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
95
|
+
);
|
|
96
|
+
},
|
|
97
|
+
save: () => null
|
|
98
|
+
};
|
|
99
|
+
var deprecated_default = [v1];
|
|
100
|
+
//# sourceMappingURL=deprecated.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/post-navigation-link/deprecated.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\ttype: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'next',\n\t\t},\n\t\tlabel: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\tshowTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tlinkLabel: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tarrow: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'none',\n\t\t},\n\t\ttaxonomy: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\treusable: false,\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n\tsave: () => null,\n};\n\nexport default [ v1 ];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA6B;AAE7B,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,MAAM;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,UAAU;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,MACN,MAAM;AAAA,IACP;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,8BAA8B;AAAA,MAC9B,6BAA6B;AAAA,MAC7B,+BAA+B;AAAA,QAC9B,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,eAAe;AAAA,MACd,kBAAkB;AAAA,IACnB;AAAA,EACD;AAAA,EACA,SAAS,0BAAAA;AAAA,EACT,WAAY,YAAa;AACxB,WACC,CAAC,CAAE,WAAW,aACd,CAAC,CAAE,WAAW,WAAW;AAAA,MACxB;AAAA,IACD;AAAA,EAEF;AAAA,EACA,MAAM,MAAM;AACb;AAEA,IAAO,qBAAQ,CAAE,EAAG;",
|
|
6
|
+
"names": ["migrateTextAlign"]
|
|
7
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// packages/block-library/src/post-navigation-link/edit.js
|
|
@@ -33,7 +23,6 @@ __export(edit_exports, {
|
|
|
33
23
|
default: () => PostNavigationLinkEdit
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(edit_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
26
|
var import_components = require("@wordpress/components");
|
|
38
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
39
28
|
var import_i18n = require("@wordpress/i18n");
|
|
@@ -43,19 +32,9 @@ var import_hooks = require("../utils/hooks.cjs");
|
|
|
43
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
33
|
function PostNavigationLinkEdit({
|
|
45
34
|
context: { postType },
|
|
46
|
-
attributes: {
|
|
47
|
-
type,
|
|
48
|
-
label,
|
|
49
|
-
showTitle,
|
|
50
|
-
textAlign,
|
|
51
|
-
linkLabel,
|
|
52
|
-
arrow,
|
|
53
|
-
taxonomy
|
|
54
|
-
},
|
|
35
|
+
attributes: { type, label, showTitle, linkLabel, arrow, taxonomy },
|
|
55
36
|
setAttributes
|
|
56
37
|
}) {
|
|
57
|
-
const blockEditingMode = (0, import_block_editor.useBlockEditingMode)();
|
|
58
|
-
const showControls = blockEditingMode === "default";
|
|
59
38
|
const isNext = type === "next";
|
|
60
39
|
let placeholder = isNext ? (0, import_i18n.__)("Next") : (0, import_i18n.__)("Previous");
|
|
61
40
|
const arrowMap = {
|
|
@@ -74,11 +53,7 @@ function PostNavigationLinkEdit({
|
|
|
74
53
|
);
|
|
75
54
|
}
|
|
76
55
|
const ariaLabel = isNext ? (0, import_i18n.__)("Next post") : (0, import_i18n.__)("Previous post");
|
|
77
|
-
const blockProps = (0, import_block_editor.useBlockProps)(
|
|
78
|
-
className: (0, import_clsx.default)({
|
|
79
|
-
[`has-text-align-${textAlign}`]: textAlign
|
|
80
|
-
})
|
|
81
|
-
});
|
|
56
|
+
const blockProps = (0, import_block_editor.useBlockProps)();
|
|
82
57
|
const taxonomies = (0, import_data.useSelect)(
|
|
83
58
|
(select) => {
|
|
84
59
|
const { getTaxonomies } = select(import_core_data.store);
|
|
@@ -237,15 +212,6 @@ function PostNavigationLinkEdit({
|
|
|
237
212
|
)
|
|
238
213
|
}
|
|
239
214
|
) }),
|
|
240
|
-
showControls && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
241
|
-
import_block_editor.AlignmentToolbar,
|
|
242
|
-
{
|
|
243
|
-
value: textAlign,
|
|
244
|
-
onChange: (nextAlign) => {
|
|
245
|
-
setAttributes({ textAlign: nextAlign });
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
) }),
|
|
249
215
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...blockProps, children: [
|
|
250
216
|
!isNext && displayArrow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
251
217
|
"span",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-navigation-link/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostNavigationLinkEdit( {\n\tcontext: { postType },\n\tattributes: { type, label, showTitle, linkLabel, arrow, taxonomy },\n\tsetAttributes,\n} ) {\n\tconst isNext = type === 'next';\n\tlet placeholder = isNext ? __( 'Next' ) : __( 'Previous' );\n\n\tconst arrowMap = {\n\t\tnone: '',\n\t\tarrow: isNext ? '\u2192' : '\u2190',\n\t\tchevron: isNext ? '\u00BB' : '\u00AB',\n\t};\n\n\tconst displayArrow = arrowMap[ arrow ];\n\n\tif ( showTitle ) {\n\t\tplaceholder = isNext\n\t\t\t? /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Next: ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t\t\t: /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Previous: ' ); // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t}\n\n\tconst ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' );\n\tconst blockProps = useBlockProps();\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( 'Unfiltered' ),\n\t\t\tvalue: '',\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( { visibility } ) => !! visibility?.publicly_queryable )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tshowTitle: false,\n\t\t\t\t\t\t\tlinkLabel: false,\n\t\t\t\t\t\t\tarrow: 'none',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showTitle }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTitle: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'If you have entered a custom label, it will be prepended before the title.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! showTitle }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowTitle: ! showTitle,\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</ToolsPanelItem>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! linkLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkLabel: false } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ !! linkLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkLabel: ! linkLabel,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => arrow !== 'none' }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { arrow: 'none' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\t\tvalue={ arrow }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { arrow: value } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'A decorative arrow for the next and previous link.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"none\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'None',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"arrow\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Arrow',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"chevron\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Chevron',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Filter by taxonomy' ) }\n\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttaxonomy: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ ! isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ showTitle && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\"#post-navigation-pseudo-link\"\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'An example title' ) }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,0BAIO;AACP,kBAAuB;AACvB,kBAA0B;AAC1B,uBAAmC;AAKnC,mBAA+C;AA2D7C;AAzDa,SAAR,uBAAyC;AAAA,EAC/C,SAAS,EAAE,SAAS;AAAA,EACpB,YAAY,EAAE,MAAM,OAAO,WAAW,WAAW,OAAO,SAAS;AAAA,EACjE;AACD,GAAI;AACH,QAAM,SAAS,SAAS;AACxB,MAAI,cAAc,aAAS,gBAAI,MAAO,QAAI,gBAAI,UAAW;AAEzD,QAAM,WAAW;AAAA,IAChB,MAAM;AAAA,IACN,OAAO,SAAS,WAAM;AAAA,IACtB,SAAS,SAAS,SAAM;AAAA,EACzB;AAEA,QAAM,eAAe,SAAU,KAAM;AAErC,MAAK,WAAY;AAChB,kBAAc;AAAA;AAAA,UAEX,gBAAI,QAAS;AAAA;AAAA;AAAA,UAEb,gBAAI,YAAa;AAAA;AAAA,EACrB;AAEA,QAAM,YAAY,aAAS,gBAAI,WAAY,QAAI,gBAAI,eAAgB;AACn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AAC,kBAAAA;AAAA,sBAAA;AAAA,wBACA,OAAM;AAAA,wBACN,WAAQ;AAAA,0BACP;AAAA,0BACA;AAAA,wBACD;AAAA;AAAA,oBACD;AAAA;AAAA;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACA,4CAAC,yCAAkB,OAAM,YACxB;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,WAAQ,gBAAI,oBAAqB;AAAA,QACjC,OAAQ;AAAA,QACR,SAAU,mBAAmB;AAAA,QAC7B,UAAW,CAAE,UACZ,cAAe;AAAA,UACd,UAAU;AAAA,QACX,CAAE;AAAA,QAEH,UAAO;AAAA,UACN;AAAA,QACD;AAAA;AAAA,IACD,GACD;AAAA,IACA,6CAAC,SAAM,GAAG,YACP;AAAA,OAAE,UAAU,gBACb;AAAA,QAAC;AAAA;AAAA,UACA,WAAY,0DAA2D,KAAM;AAAA,UAE3E;AAAA;AAAA,MACH;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACA,SAAQ;AAAA,UACR,YAAW;AAAA,UACX,cAAa;AAAA,UACb;AAAA,UACA,OAAQ;AAAA,UACR,8BAA4B;AAAA,UAC5B,UAAW,CAAE,aACZ,cAAe,EAAE,OAAO,SAAS,CAAE;AAAA;AAAA,MAErC;AAAA,MACE,aACD;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,UAE1C,8BAAI,kBAAmB;AAAA;AAAA,MAC1B;AAAA,MAEC,UAAU,gBACX;AAAA,QAAC;AAAA;AAAA,UACA,WAAY,sDAAuD,KAAM;AAAA,UACzE,eAAW;AAAA,UAET;AAAA;AAAA,MACH;AAAA,OAEF;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem", "ToggleGroupControl", "ToggleGroupControlOption"]
|
|
7
7
|
}
|
|
@@ -41,10 +41,12 @@ var import_init_block = __toESM(require("../utils/init-block.cjs"));
|
|
|
41
41
|
var import_block = __toESM(require("./block.json"));
|
|
42
42
|
var import_edit = __toESM(require("./edit.cjs"));
|
|
43
43
|
var import_variations = __toESM(require("./variations.cjs"));
|
|
44
|
+
var import_deprecated = __toESM(require("./deprecated.cjs"));
|
|
44
45
|
var { name } = import_block.default;
|
|
45
46
|
var settings = {
|
|
46
47
|
edit: import_edit.default,
|
|
47
48
|
variations: import_variations.default,
|
|
49
|
+
deprecated: import_deprecated.default,
|
|
48
50
|
example: {
|
|
49
51
|
attributes: {
|
|
50
52
|
label: (0, import_i18n.__)("Next post"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-navigation-link/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tvariations,\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: __( 'Next post' ),\n\t\t\tarrow: 'arrow',\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAKnB,wBAAsB;AACtB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AAEvB,IAAM,EAAE,KAAK,IAAI,aAAAA;AAGV,IAAM,WAAW;AAAA,EACvB,kBAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,WAAO,gBAAI,WAAY;AAAA,MACvB,OAAO;AAAA,IACR;AAAA,EACD;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
-
"names": ["metadata", "edit", "variations", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tvariations,\n\tdeprecated,\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: __( 'Next post' ),\n\t\t\tarrow: 'arrow',\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAKnB,wBAAsB;AACtB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,wBAAuB;AAEvB,IAAM,EAAE,KAAK,IAAI,aAAAA;AAGV,IAAM,WAAW;AAAA,EACvB,kBAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,WAAO,gBAAI,WAAY;AAAA,MACvB,OAAO;AAAA,IACR;AAAA,EACD;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "edit", "variations", "deprecated", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"usesContext": [ "postId", "postType", "queryId" ],
|
|
10
10
|
"attributes": {
|
|
11
|
-
"textAlign": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
11
|
"level": {
|
|
15
12
|
"type": "number",
|
|
16
13
|
"default": 2
|
|
@@ -58,6 +55,7 @@
|
|
|
58
55
|
"typography": {
|
|
59
56
|
"fontSize": true,
|
|
60
57
|
"lineHeight": true,
|
|
58
|
+
"textAlign": true,
|
|
61
59
|
"__experimentalFontFamily": true,
|
|
62
60
|
"__experimentalFontWeight": true,
|
|
63
61
|
"__experimentalFontStyle": true,
|