@wordpress/block-library 9.35.0 → 9.35.1-next.dc3f6d3c1.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/audio/index.js +26 -0
- package/build/audio/index.js.map +2 -2
- package/build/breadcrumbs/edit.js +1 -1
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/button/index.js +22 -0
- package/build/button/index.js.map +2 -2
- package/build/code/index.js +12 -0
- package/build/code/index.js.map +2 -2
- package/build/cover/index.js +22 -0
- package/build/cover/index.js.map +2 -2
- package/build/details/index.js +12 -0
- package/build/details/index.js.map +2 -2
- package/build/file/index.js +33 -0
- package/build/file/index.js.map +2 -2
- package/build/heading/index.js +12 -0
- package/build/heading/index.js.map +2 -2
- package/build/html/modal.js +126 -144
- package/build/html/modal.js.map +2 -2
- package/build/image/index.js +46 -0
- package/build/image/index.js.map +2 -2
- package/build/list-item/index.js +13 -0
- package/build/list-item/index.js.map +2 -2
- package/build/media-text/index.js +28 -0
- package/build/media-text/index.js.map +2 -2
- package/build/more/index.js +13 -0
- package/build/more/index.js.map +2 -2
- package/build/navigation/block.json +2 -2
- package/build/navigation-link/block.json +2 -1
- package/build/navigation-link/edit.js +6 -0
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/index.js +22 -0
- package/build/navigation-link/index.js.map +2 -2
- package/build/navigation-link/shared/controls.js +15 -19
- package/build/navigation-link/shared/controls.js.map +2 -2
- package/build/navigation-link/shared/index.js +4 -0
- package/build/navigation-link/shared/index.js.map +2 -2
- package/build/navigation-link/shared/use-entity-binding.js +3 -2
- package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build/navigation-submenu/block.json +2 -1
- package/build/navigation-submenu/index.js +22 -0
- package/build/navigation-submenu/index.js.map +2 -2
- package/build/paragraph/index.js +12 -0
- package/build/paragraph/index.js.map +2 -2
- package/build/post-comments-count/edit.js +1 -2
- package/build/post-comments-count/edit.js.map +2 -2
- package/build/post-comments-link/edit.js +10 -7
- package/build/post-comments-link/edit.js.map +2 -2
- package/build/preformatted/index.js +12 -0
- package/build/preformatted/index.js.map +2 -2
- package/build/pullquote/block.json +3 -2
- package/build/pullquote/index.js +20 -0
- package/build/pullquote/index.js.map +2 -2
- package/build/pullquote/transforms.js +0 -31
- package/build/pullquote/transforms.js.map +2 -2
- package/build/quote/transforms.js +0 -20
- package/build/quote/transforms.js.map +2 -2
- package/build/search/index.js +28 -0
- package/build/search/index.js.map +2 -2
- package/build/social-link/index.js +22 -0
- package/build/social-link/index.js.map +2 -2
- package/build/social-links/edit.js +1 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/tabs/view.js +17 -4
- package/build/tabs/view.js.map +2 -2
- package/build/verse/index.js +12 -0
- package/build/verse/index.js.map +2 -2
- package/build/video/index.js +27 -0
- package/build/video/index.js.map +2 -2
- package/build-module/audio/index.js +26 -0
- package/build-module/audio/index.js.map +2 -2
- package/build-module/breadcrumbs/edit.js +1 -1
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +22 -0
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +12 -0
- package/build-module/code/index.js.map +2 -2
- package/build-module/cover/index.js +22 -0
- package/build-module/cover/index.js.map +2 -2
- package/build-module/details/index.js +12 -0
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +34 -1
- package/build-module/file/index.js.map +2 -2
- package/build-module/heading/index.js +12 -0
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +127 -145
- package/build-module/html/modal.js.map +2 -2
- package/build-module/image/index.js +46 -0
- package/build-module/image/index.js.map +2 -2
- package/build-module/list-item/index.js +13 -0
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/media-text/index.js +28 -0
- package/build-module/media-text/index.js.map +2 -2
- package/build-module/more/index.js +13 -0
- package/build-module/more/index.js.map +2 -2
- package/build-module/navigation/block.json +2 -2
- package/build-module/navigation-link/block.json +2 -1
- package/build-module/navigation-link/edit.js +20 -4
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/index.js +23 -1
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-link/shared/controls.js +12 -18
- package/build-module/navigation-link/shared/controls.js.map +2 -2
- package/build-module/navigation-link/shared/index.js +3 -1
- package/build-module/navigation-link/shared/index.js.map +2 -2
- package/build-module/navigation-link/shared/use-entity-binding.js +3 -2
- package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build-module/navigation-submenu/block.json +2 -1
- package/build-module/navigation-submenu/index.js +23 -1
- package/build-module/navigation-submenu/index.js.map +2 -2
- package/build-module/paragraph/index.js +12 -0
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/post-comments-count/edit.js +1 -3
- package/build-module/post-comments-count/edit.js.map +2 -2
- package/build-module/post-comments-link/edit.js +10 -8
- package/build-module/post-comments-link/edit.js.map +2 -2
- package/build-module/preformatted/index.js +12 -0
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/block.json +3 -2
- package/build-module/pullquote/index.js +20 -0
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/pullquote/transforms.js +0 -31
- package/build-module/pullquote/transforms.js.map +2 -2
- package/build-module/quote/transforms.js +0 -20
- package/build-module/quote/transforms.js.map +2 -2
- package/build-module/search/index.js +28 -0
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +22 -0
- package/build-module/social-link/index.js.map +2 -2
- package/build-module/social-links/edit.js +1 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/tabs/view.js +17 -4
- package/build-module/tabs/view.js.map +2 -2
- package/build-module/verse/index.js +12 -0
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +27 -0
- package/build-module/video/index.js.map +2 -2
- package/package.json +37 -37
- package/src/audio/index.js +27 -0
- package/src/breadcrumbs/edit.js +4 -2
- package/src/breadcrumbs/index.php +112 -30
- package/src/button/index.js +23 -0
- package/src/code/index.js +13 -0
- package/src/cover/index.js +23 -0
- package/src/details/index.js +13 -0
- package/src/file/index.js +35 -1
- package/src/heading/index.js +13 -0
- package/src/heading/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/heading/test/transforms.native.js +1 -5
- package/src/html/modal.js +8 -28
- package/src/image/index.js +47 -0
- package/src/list-item/index.js +14 -0
- package/src/media-text/index.js +29 -0
- package/src/more/index.js +14 -0
- package/src/navigation/block.json +2 -2
- package/src/navigation-link/block.json +2 -1
- package/src/navigation-link/edit.js +27 -4
- package/src/navigation-link/index.js +24 -1
- package/src/navigation-link/shared/controls.js +13 -17
- package/src/navigation-link/shared/index.js +1 -1
- package/src/navigation-link/shared/use-entity-binding.js +5 -2
- package/src/navigation-submenu/block.json +2 -1
- package/src/navigation-submenu/index.js +24 -1
- package/src/paragraph/index.js +13 -0
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/paragraph/test/transforms.native.js +0 -1
- package/src/post-comments-count/edit.js +1 -9
- package/src/post-comments-link/edit.js +8 -18
- package/src/preformatted/index.js +13 -0
- package/src/pullquote/block.json +3 -2
- package/src/pullquote/index.js +21 -0
- package/src/pullquote/test/__snapshots__/transforms.native.js.snap +5 -5
- package/src/pullquote/test/transforms.native.js +1 -1
- package/src/pullquote/transforms.js +0 -31
- package/src/quote/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/quote/test/transforms.native.js +1 -5
- package/src/quote/transforms.js +0 -25
- package/src/search/index.js +29 -0
- package/src/social-link/index.js +23 -0
- package/src/social-links/edit.js +1 -1
- package/src/tabs/view.js +19 -4
- package/src/utils/transformation-categories.native.js +0 -1
- package/src/verse/index.js +13 -0
- package/src/video/index.js +28 -0
- package/src/pullquote/test/edit.native.js +0 -73
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tabs/view.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\twithSyncEvent,\n} from '@wordpress/interactivity';\n\nfunction createReadOnlyProxy( obj ) {\n\treturn new Proxy( obj, {\n\t\tget( target, prop ) {\n\t\t\tconst value = target[ prop ];\n\t\t\tif ( typeof value === 'object' && value !== null ) {\n\t\t\t\treturn createReadOnlyProxy( value );\n\t\t\t}\n\t\t\treturn value;\n\t\t},\n\t\tset() {\n\t\t\treturn false;\n\t\t},\n\t\tdeleteProperty() {\n\t\t\treturn false;\n\t\t},\n\t} );\n}\n\n// Private store for internal tabs functionality and security.\nconst { actions: privateActions, state: privateState } = store(\n\t'core/tabs/private',\n\t{\n\t\tstate: {\n\t\t\t/**\n\t\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t\t *\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tget tabsList() {\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst tabsId = context?.tabsId;\n\t\t\t\tconst tabsList = privateState[ tabsId ];\n\t\t\t\treturn tabsList;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Gets the index of the active tab element whether it\n\t\t\t * is a tab label or tab panel.\n\t\t\t *\n\t\t\t * @type {number|null}\n\t\t\t */\n\t\t\tget tabIndex() {\n\t\t\t\tconst { attributes } = getElement();\n\t\t\t\tconst tabId = attributes?.id?.replace( 'tab__', '' ) || null;\n\t\t\t\tif ( ! tabId ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\treturn tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether the tab panel or tab label is the active tab.\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tget isActiveTab() {\n\t\t\t\tconst { activeTabIndex } = getContext();\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\treturn activeTabIndex === tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * The value of the tabindex attribute.\n\t\t\t *\n\t\t\t * @type {false|string}\n\t\t\t */\n\t\t\tget tabIndexAttribute() {\n\t\t\t\treturn privateState.isActiveTab ? -1 : 0;\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\t/**\n\t\t\t * Handles the keydown events for the tab label and tabs controller.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t\t */\n\t\t\thandleTabKeyDown: withSyncEvent( ( event ) => {\n\t\t\t\t// If this is the enter key then lets get the tab index from context and set the active tab to that index.\n\t\t\t\tconst { isVertical } = getContext();\n\t\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowRight' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowLeft' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowDown' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowUp' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Handles the click event for the tab label.\n\t\t\t *\n\t\t\t * @param {MouseEvent} event The click event.\n\t\t\t */\n\t\t\thandleTabClick: withSyncEvent( ( event ) => {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Sets the active tab index (internal implementation).\n\t\t\t *\n\t\t\t * @param {number} tabIndex The index of the active tab.\n\t\t\t * @param {boolean} scrollToTab Whether to scroll to the tab element.\n\t\t\t */\n\t\t\tsetActiveTab: ( tabIndex, scrollToTab = false ) => {\n\t\t\t\tconst context = getContext();\n\t\t\t\tcontext.activeTabIndex = tabIndex;\n\t\t\t\tif ( scrollToTab ) {\n\t\t\t\t\tconst tabId = privateState.tabsList[ tabIndex ].id;\n\t\t\t\t\tconst tabElement = document.getElementById( tabId );\n\t\t\t\t\tif ( tabElement ) {\n\t\t\t\t\t\tsetTimeout( () => {\n\t\t\t\t\t\t\ttabElement.scrollIntoView( { behavior: 'smooth' } );\n\t\t\t\t\t\t}, 100 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\t/**\n\t\t\t * When the tabs are initialized, we need to check if there is a hash in the url and if so if it exists in the current tabsList, set the active tab to that index.\n\t\t\t *\n\t\t\t */\n\t\t\tonTabsInit: () => {\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tif ( tabsList.length === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst { hash } = window.location;\n\t\t\t\tconst tabId = hash.replace( '#', '' );\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\t// Check if tabIndex is a positive number and if so we'll auto activate that tab.\n\t\t\t\tif ( tabIndex >= 0 ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex, true );\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tlock: true,\n\t}\n);\n\n// Public store for third-party extensibility.\nstore( 'core/tabs', {\n\tstate: {\n\t\t/**\n\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t * Public API for third-party access.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tget tabsList() {\n\t\t\treturn createReadOnlyProxy( privateState.tabsList );\n\t\t},\n\t\t/**\n\t\t * Gets the index of the active tab element whether it\n\t\t * is a tab label or tab panel.\n\t\t
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,oBAAqB,KAAM;AACnC,SAAO,IAAI,MAAO,KAAK;AAAA,IACtB,IAAK,QAAQ,MAAO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\twithSyncEvent,\n} from '@wordpress/interactivity';\n\nfunction createReadOnlyProxy( obj ) {\n\tconst arrayMutationMethods = new Set( [\n\t\t'push',\n\t\t'pop',\n\t\t'shift',\n\t\t'unshift',\n\t\t'splice',\n\t\t'sort',\n\t\t'reverse',\n\t\t'copyWithin',\n\t\t'fill',\n\t] );\n\n\treturn new Proxy( obj, {\n\t\tget( target, prop ) {\n\t\t\t// If accessing an array mutation method, return a no-op function.\n\t\t\tif ( Array.isArray( target ) && arrayMutationMethods.has( prop ) ) {\n\t\t\t\treturn () => {};\n\t\t\t}\n\n\t\t\tconst value = target[ prop ];\n\t\t\tif ( typeof value === 'object' && value !== null ) {\n\t\t\t\treturn createReadOnlyProxy( value );\n\t\t\t}\n\t\t\treturn value;\n\t\t},\n\t\tset() {\n\t\t\treturn false;\n\t\t},\n\t\tdeleteProperty() {\n\t\t\treturn false;\n\t\t},\n\t} );\n}\n\n// Private store for internal tabs functionality and security.\nconst { actions: privateActions, state: privateState } = store(\n\t'core/tabs/private',\n\t{\n\t\tstate: {\n\t\t\t/**\n\t\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t\t *\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tget tabsList() {\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst tabsId = context?.tabsId;\n\t\t\t\tconst tabsList = privateState[ tabsId ];\n\t\t\t\treturn tabsList;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Gets the index of the active tab element whether it\n\t\t\t * is a tab label or tab panel.\n\t\t\t *\n\t\t\t * @type {number|null}\n\t\t\t */\n\t\t\tget tabIndex() {\n\t\t\t\tconst { attributes } = getElement();\n\t\t\t\tconst tabId = attributes?.id?.replace( 'tab__', '' ) || null;\n\t\t\t\tif ( ! tabId ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\treturn tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether the tab panel or tab label is the active tab.\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tget isActiveTab() {\n\t\t\t\tconst { activeTabIndex } = getContext();\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\treturn activeTabIndex === tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * The value of the tabindex attribute.\n\t\t\t *\n\t\t\t * @type {false|string}\n\t\t\t */\n\t\t\tget tabIndexAttribute() {\n\t\t\t\treturn privateState.isActiveTab ? -1 : 0;\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\t/**\n\t\t\t * Handles the keydown events for the tab label and tabs controller.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t\t */\n\t\t\thandleTabKeyDown: withSyncEvent( ( event ) => {\n\t\t\t\t// If this is the enter key then lets get the tab index from context and set the active tab to that index.\n\t\t\t\tconst { isVertical } = getContext();\n\t\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowRight' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowLeft' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowDown' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowUp' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Handles the click event for the tab label.\n\t\t\t *\n\t\t\t * @param {MouseEvent} event The click event.\n\t\t\t */\n\t\t\thandleTabClick: withSyncEvent( ( event ) => {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Sets the active tab index (internal implementation).\n\t\t\t *\n\t\t\t * @param {number} tabIndex The index of the active tab.\n\t\t\t * @param {boolean} scrollToTab Whether to scroll to the tab element.\n\t\t\t */\n\t\t\tsetActiveTab: ( tabIndex, scrollToTab = false ) => {\n\t\t\t\tconst context = getContext();\n\t\t\t\tcontext.activeTabIndex = tabIndex;\n\t\t\t\tif ( scrollToTab ) {\n\t\t\t\t\tconst tabId = privateState.tabsList[ tabIndex ].id;\n\t\t\t\t\tconst tabElement = document.getElementById( tabId );\n\t\t\t\t\tif ( tabElement ) {\n\t\t\t\t\t\tsetTimeout( () => {\n\t\t\t\t\t\t\ttabElement.scrollIntoView( { behavior: 'smooth' } );\n\t\t\t\t\t\t}, 100 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\t/**\n\t\t\t * When the tabs are initialized, we need to check if there is a hash in the url and if so if it exists in the current tabsList, set the active tab to that index.\n\t\t\t *\n\t\t\t */\n\t\t\tonTabsInit: () => {\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tif ( tabsList.length === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst { hash } = window.location;\n\t\t\t\tconst tabId = hash.replace( '#', '' );\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\t// Check if tabIndex is a positive number and if so we'll auto activate that tab.\n\t\t\t\tif ( tabIndex >= 0 ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex, true );\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tlock: true,\n\t}\n);\n\n// Public store for third-party extensibility.\nstore( 'core/tabs', {\n\tstate: {\n\t\t/**\n\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t * Public API for third-party access.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tget tabsList() {\n\t\t\treturn createReadOnlyProxy( privateState.tabsList );\n\t\t},\n\t\t/**\n\t\t * Gets the index of the active tab element whether it\n\t\t * is a tab label or tab panel.\n\t\t *\n\t\t * @type {number|null}\n\t\t */\n\t\tget tabIndex() {\n\t\t\treturn privateState.tabIndex;\n\t\t},\n\t\t/**\n\t\t * Whether the tab panel or tab label is the active tab.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tget isActiveTab() {\n\t\t\treturn privateState.isActiveTab;\n\t\t},\n\t},\n\tactions: {\n\t\t/**\n\t\t * Sets the active tab index.\n\t\t * Public API for third-party programmatic tab activation.\n\t\t *\n\t\t * @param {number} tabIndex The index of the active tab.\n\t\t * @param {boolean} scrollToTab Whether to scroll to the tab element.\n\t\t */\n\t\tsetActiveTab: ( tabIndex, scrollToTab = false ) => {\n\t\t\tprivateActions.setActiveTab( tabIndex, scrollToTab );\n\t\t},\n\t},\n} );\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -30,6 +30,18 @@ var settings = {
|
|
|
30
30
|
edit,
|
|
31
31
|
save
|
|
32
32
|
};
|
|
33
|
+
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
34
|
+
settings.fields = [
|
|
35
|
+
{
|
|
36
|
+
label: __("Content"),
|
|
37
|
+
type: "RichText",
|
|
38
|
+
shownByDefault: true,
|
|
39
|
+
mapping: {
|
|
40
|
+
value: "content"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
}
|
|
33
45
|
var init = () => initBlock({ name, metadata, settings });
|
|
34
46
|
export {
|
|
35
47
|
init,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/verse/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { verse as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Verse block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'WHAT was he doing, the great god Pan,\\n\tDown in the reeds by the river?\\nSpreading ruin and scattering ban,\\nSplashing and paddling with hoofs of a goat,\\nAnd breaking the golden lilies afloat\\n With the dragon-fly on the river.'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAK9B,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,SAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { verse as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Verse block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'WHAT was he doing, the great god Pan,\\n\tDown in the reeds by the river?\\nSpreading ruin and scattering ban,\\nSplashing and paddling with hoofs of a goat,\\nAnd breaking the golden lilies afloat\\n With the dragon-fly on the river.'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings.fields = [\n\t\t{\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: true,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'content',\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAK9B,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,SAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAS,SAAS;AAAA,IACjB;AAAA,MACC,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,6 +22,33 @@ var settings = {
|
|
|
22
22
|
edit,
|
|
23
23
|
save
|
|
24
24
|
};
|
|
25
|
+
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
26
|
+
settings.fields = [
|
|
27
|
+
{
|
|
28
|
+
label: __("Video"),
|
|
29
|
+
type: "Media",
|
|
30
|
+
shownByDefault: true,
|
|
31
|
+
mapping: {
|
|
32
|
+
id: "id",
|
|
33
|
+
src: "src",
|
|
34
|
+
caption: "caption",
|
|
35
|
+
poster: "poster"
|
|
36
|
+
},
|
|
37
|
+
args: {
|
|
38
|
+
allowedTypes: ["video"],
|
|
39
|
+
multiple: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: __("Caption"),
|
|
44
|
+
type: "RichText",
|
|
45
|
+
shownByDefault: false,
|
|
46
|
+
mapping: {
|
|
47
|
+
value: "caption"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
}
|
|
25
52
|
var init = () => initBlock({ name, metadata, settings });
|
|
26
53
|
export {
|
|
27
54
|
init,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/video/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { video as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',\n\t\t\t// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.\n\t\t\tcaption: __( 'Wood thrush singing in Central Park, NYC.' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAK9B,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,KAAK;AAAA;AAAA,MAEL,SAAS,GAAI,2CAA4C;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { video as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',\n\t\t\t// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.\n\t\t\tcaption: __( 'Wood thrush singing in Central Park, NYC.' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings.fields = [\n\t\t{\n\t\t\tlabel: __( 'Video' ),\n\t\t\ttype: 'Media',\n\t\t\tshownByDefault: true,\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\tsrc: 'src',\n\t\t\t\tcaption: 'caption',\n\t\t\t\tposter: 'poster',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Caption' ),\n\t\t\ttype: 'RichText',\n\t\t\tshownByDefault: false,\n\t\t\tmapping: {\n\t\t\t\tvalue: 'caption',\n\t\t\t},\n\t\t},\n\t];\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAK9B,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,KAAK;AAAA;AAAA,MAEL,SAAS,GAAI,2CAA4C;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAS,SAAS;AAAA,IACjB;AAAA,MACC,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,IAAI;AAAA,QACJ,KAAK;AAAA,QACL,SAAS;AAAA,QACT,QAAQ;AAAA,MACT;AAAA,MACA,MAAM;AAAA,QACL,cAAc,CAAE,OAAQ;AAAA,QACxB,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,SAAS;AAAA,QACR,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.35.0",
|
|
3
|
+
"version": "9.35.1-next.dc3f6d3c1.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -82,41 +82,41 @@
|
|
|
82
82
|
"{src,build,build-module}/*/init.js"
|
|
83
83
|
],
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@wordpress/a11y": "^4.35.0",
|
|
86
|
-
"@wordpress/api-fetch": "^7.35.0",
|
|
87
|
-
"@wordpress/autop": "^4.35.0",
|
|
88
|
-
"@wordpress/base-styles": "^6.11.0",
|
|
89
|
-
"@wordpress/blob": "^4.35.0",
|
|
90
|
-
"@wordpress/block-editor": "^15.8.0",
|
|
91
|
-
"@wordpress/blocks": "^15.8.0",
|
|
92
|
-
"@wordpress/components": "^30.8.0",
|
|
93
|
-
"@wordpress/compose": "^7.35.0",
|
|
94
|
-
"@wordpress/core-data": "^7.35.0",
|
|
95
|
-
"@wordpress/data": "^10.35.0",
|
|
96
|
-
"@wordpress/date": "^5.35.0",
|
|
97
|
-
"@wordpress/deprecated": "^4.35.0",
|
|
98
|
-
"@wordpress/dom": "^4.35.0",
|
|
99
|
-
"@wordpress/element": "^6.35.0",
|
|
100
|
-
"@wordpress/escape-html": "^3.35.0",
|
|
101
|
-
"@wordpress/hooks": "^4.35.0",
|
|
102
|
-
"@wordpress/html-entities": "^4.35.0",
|
|
103
|
-
"@wordpress/i18n": "^6.8.0",
|
|
104
|
-
"@wordpress/icons": "^11.2.0",
|
|
105
|
-
"@wordpress/interactivity": "^6.35.0",
|
|
106
|
-
"@wordpress/interactivity-router": "^2.35.0",
|
|
107
|
-
"@wordpress/keyboard-shortcuts": "^5.35.0",
|
|
108
|
-
"@wordpress/keycodes": "^4.35.0",
|
|
109
|
-
"@wordpress/latex-to-mathml": "^1.3.0",
|
|
110
|
-
"@wordpress/notices": "^5.35.0",
|
|
111
|
-
"@wordpress/patterns": "^2.35.0",
|
|
112
|
-
"@wordpress/primitives": "^4.35.0",
|
|
113
|
-
"@wordpress/private-apis": "^1.35.0",
|
|
114
|
-
"@wordpress/reusable-blocks": "^5.35.0",
|
|
115
|
-
"@wordpress/rich-text": "^7.35.0",
|
|
116
|
-
"@wordpress/server-side-render": "^6.11.0",
|
|
117
|
-
"@wordpress/url": "^4.35.0",
|
|
118
|
-
"@wordpress/viewport": "^6.35.0",
|
|
119
|
-
"@wordpress/wordcount": "^4.35.0",
|
|
85
|
+
"@wordpress/a11y": "^4.35.1-next.dc3f6d3c1.0",
|
|
86
|
+
"@wordpress/api-fetch": "^7.35.1-next.dc3f6d3c1.0",
|
|
87
|
+
"@wordpress/autop": "^4.35.1-next.dc3f6d3c1.0",
|
|
88
|
+
"@wordpress/base-styles": "^6.11.1-next.dc3f6d3c1.0",
|
|
89
|
+
"@wordpress/blob": "^4.35.1-next.dc3f6d3c1.0",
|
|
90
|
+
"@wordpress/block-editor": "^15.8.1-next.dc3f6d3c1.0",
|
|
91
|
+
"@wordpress/blocks": "^15.8.1-next.dc3f6d3c1.0",
|
|
92
|
+
"@wordpress/components": "^30.8.2-next.dc3f6d3c1.0",
|
|
93
|
+
"@wordpress/compose": "^7.35.1-next.dc3f6d3c1.0",
|
|
94
|
+
"@wordpress/core-data": "^7.35.1-next.dc3f6d3c1.0",
|
|
95
|
+
"@wordpress/data": "^10.35.1-next.dc3f6d3c1.0",
|
|
96
|
+
"@wordpress/date": "^5.35.1-next.dc3f6d3c1.0",
|
|
97
|
+
"@wordpress/deprecated": "^4.35.1-next.dc3f6d3c1.0",
|
|
98
|
+
"@wordpress/dom": "^4.35.1-next.dc3f6d3c1.0",
|
|
99
|
+
"@wordpress/element": "^6.35.1-next.dc3f6d3c1.0",
|
|
100
|
+
"@wordpress/escape-html": "^3.35.1-next.dc3f6d3c1.0",
|
|
101
|
+
"@wordpress/hooks": "^4.35.1-next.dc3f6d3c1.0",
|
|
102
|
+
"@wordpress/html-entities": "^4.35.1-next.dc3f6d3c1.0",
|
|
103
|
+
"@wordpress/i18n": "^6.8.1-next.dc3f6d3c1.0",
|
|
104
|
+
"@wordpress/icons": "^11.2.1-next.dc3f6d3c1.0",
|
|
105
|
+
"@wordpress/interactivity": "^6.35.1-next.dc3f6d3c1.0",
|
|
106
|
+
"@wordpress/interactivity-router": "^2.35.1-next.dc3f6d3c1.0",
|
|
107
|
+
"@wordpress/keyboard-shortcuts": "^5.35.1-next.dc3f6d3c1.0",
|
|
108
|
+
"@wordpress/keycodes": "^4.35.1-next.dc3f6d3c1.0",
|
|
109
|
+
"@wordpress/latex-to-mathml": "^1.3.1-next.dc3f6d3c1.0",
|
|
110
|
+
"@wordpress/notices": "^5.35.1-next.dc3f6d3c1.0",
|
|
111
|
+
"@wordpress/patterns": "^2.35.1-next.dc3f6d3c1.0",
|
|
112
|
+
"@wordpress/primitives": "^4.35.1-next.dc3f6d3c1.0",
|
|
113
|
+
"@wordpress/private-apis": "^1.35.1-next.dc3f6d3c1.0",
|
|
114
|
+
"@wordpress/reusable-blocks": "^5.35.1-next.dc3f6d3c1.0",
|
|
115
|
+
"@wordpress/rich-text": "^7.35.1-next.dc3f6d3c1.0",
|
|
116
|
+
"@wordpress/server-side-render": "^6.11.1-next.dc3f6d3c1.0",
|
|
117
|
+
"@wordpress/url": "^4.35.1-next.dc3f6d3c1.0",
|
|
118
|
+
"@wordpress/viewport": "^6.35.1-next.dc3f6d3c1.0",
|
|
119
|
+
"@wordpress/wordcount": "^4.35.1-next.dc3f6d3c1.0",
|
|
120
120
|
"change-case": "^4.1.2",
|
|
121
121
|
"clsx": "^2.1.1",
|
|
122
122
|
"colord": "^2.7.0",
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
"publishConfig": {
|
|
135
135
|
"access": "public"
|
|
136
136
|
},
|
|
137
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "f73b5e69b34fbaccfb8c47783f4f993059ff1a41"
|
|
138
138
|
}
|
package/src/audio/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
4
5
|
import { audio as icon } from '@wordpress/icons';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -31,4 +32,30 @@ export const settings = {
|
|
|
31
32
|
save,
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
36
|
+
settings.fields = [
|
|
37
|
+
{
|
|
38
|
+
label: __( 'Audio' ),
|
|
39
|
+
type: 'Media',
|
|
40
|
+
shownByDefault: true,
|
|
41
|
+
mapping: {
|
|
42
|
+
id: 'id',
|
|
43
|
+
src: 'src',
|
|
44
|
+
},
|
|
45
|
+
args: {
|
|
46
|
+
allowedTypes: [ 'audio' ],
|
|
47
|
+
multiple: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: __( 'Caption' ),
|
|
52
|
+
type: 'RichText',
|
|
53
|
+
shownByDefault: false,
|
|
54
|
+
mapping: {
|
|
55
|
+
value: 'caption',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
|
|
34
61
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/breadcrumbs/edit.js
CHANGED
|
@@ -116,9 +116,11 @@ export default function BreadcrumbEdit( {
|
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
//
|
|
119
|
+
// Try to determine breadcrumb type for more accurate previews.
|
|
120
120
|
let _showTerms;
|
|
121
|
-
|
|
121
|
+
// Some non-hierarchical post types (e.g., attachments) can have parents.
|
|
122
|
+
// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.
|
|
123
|
+
if ( ! isPostTypeHierarchical && ! post?.parent ) {
|
|
122
124
|
_showTerms = true;
|
|
123
125
|
} else if ( ! postTypeHasTaxonomies ) {
|
|
124
126
|
// Hierarchical post type without taxonomies can only use ancestors.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/breadcrumbs` block on the server.
|
|
10
10
|
*
|
|
11
|
-
* @since
|
|
11
|
+
* @since 7.0.0
|
|
12
12
|
*
|
|
13
13
|
* @param array $attributes Block attributes.
|
|
14
14
|
* @param string $content Block default content.
|
|
@@ -76,25 +76,55 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
76
76
|
return '';
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
//
|
|
79
|
+
// For non-hierarchical post types with parents (e.g., attachments), build trail for the parent.
|
|
80
|
+
$post_parent = $post->post_parent;
|
|
81
|
+
$parent_post = null;
|
|
82
|
+
if ( ! is_post_type_hierarchical( $post_type ) && $post_parent ) {
|
|
83
|
+
$parent_post = get_post( $post_parent );
|
|
84
|
+
if ( $parent_post ) {
|
|
85
|
+
$post_id = $parent_post->ID;
|
|
86
|
+
$post_type = $parent_post->post_type;
|
|
87
|
+
$post_parent = $parent_post->post_parent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Determine breadcrumb type.
|
|
92
|
+
// Some non-hierarchical post types (e.g., attachments) can have parents.
|
|
93
|
+
// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.
|
|
80
94
|
$show_terms = false;
|
|
81
|
-
if ( ! is_post_type_hierarchical( $post_type ) ) {
|
|
95
|
+
if ( ! is_post_type_hierarchical( $post_type ) && ! $post_parent ) {
|
|
82
96
|
$show_terms = true;
|
|
83
97
|
} elseif ( empty( get_object_taxonomies( $post_type, 'objects' ) ) ) {
|
|
84
|
-
// Hierarchical post type without taxonomies can only use ancestors.
|
|
85
98
|
$show_terms = false;
|
|
86
99
|
} else {
|
|
87
|
-
// For hierarchical post types with taxonomies, use the attribute.
|
|
88
100
|
$show_terms = $attributes['prefersTaxonomy'];
|
|
89
101
|
}
|
|
90
102
|
|
|
103
|
+
// Build breadcrumb trail.
|
|
91
104
|
if ( ! $show_terms ) {
|
|
92
105
|
$breadcrumb_items = array_merge( $breadcrumb_items, block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id ) );
|
|
93
106
|
} else {
|
|
94
107
|
$breadcrumb_items = array_merge( $breadcrumb_items, block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) );
|
|
95
108
|
}
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
|
|
110
|
+
// Add post title: linked when viewing a paginated page, plain text otherwise.
|
|
111
|
+
$is_paged = (int) get_query_var( 'page' ) > 1;
|
|
112
|
+
$title = block_core_breadcrumbs_get_post_title( $post );
|
|
113
|
+
|
|
114
|
+
if ( $is_paged ) {
|
|
115
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_link(
|
|
116
|
+
get_permalink( $post ),
|
|
117
|
+
$title,
|
|
118
|
+
true
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_page_number_item( 'page' );
|
|
122
|
+
} else {
|
|
123
|
+
$breadcrumb_items[] = block_core_breadcrumbs_create_current_item(
|
|
124
|
+
$title,
|
|
125
|
+
true
|
|
126
|
+
);
|
|
127
|
+
}
|
|
98
128
|
}
|
|
99
129
|
|
|
100
130
|
// Remove last item if disabled.
|
|
@@ -133,7 +163,7 @@ function render_block_core_breadcrumbs( $attributes, $content, $block ) {
|
|
|
133
163
|
/**
|
|
134
164
|
* Checks if we're on a paginated view (page 2 or higher).
|
|
135
165
|
*
|
|
136
|
-
* @since
|
|
166
|
+
* @since 7.0.0
|
|
137
167
|
*
|
|
138
168
|
* @return bool True if paged > 1, false otherwise.
|
|
139
169
|
*/
|
|
@@ -145,12 +175,13 @@ function block_core_breadcrumbs_is_paged() {
|
|
|
145
175
|
/**
|
|
146
176
|
* Creates a "Page X" breadcrumb item for paginated views.
|
|
147
177
|
*
|
|
148
|
-
* @since
|
|
149
|
-
*
|
|
178
|
+
* @since 7.0.0
|
|
179
|
+
* @param string $query_var Optional. Query variable to get current page number. Default 'paged'.
|
|
150
180
|
* @return string The "Page X" breadcrumb HTML.
|
|
151
181
|
*/
|
|
152
|
-
function block_core_breadcrumbs_create_page_number_item() {
|
|
153
|
-
$paged = (int) get_query_var(
|
|
182
|
+
function block_core_breadcrumbs_create_page_number_item( $query_var = 'paged' ) {
|
|
183
|
+
$paged = (int) get_query_var( $query_var );
|
|
184
|
+
|
|
154
185
|
return block_core_breadcrumbs_create_current_item(
|
|
155
186
|
/* translators: %s: page number */
|
|
156
187
|
sprintf( __( 'Page %s' ), number_format_i18n( $paged ) )
|
|
@@ -160,7 +191,7 @@ function block_core_breadcrumbs_create_page_number_item() {
|
|
|
160
191
|
/**
|
|
161
192
|
* Creates a breadcrumb link item.
|
|
162
193
|
*
|
|
163
|
-
* @since
|
|
194
|
+
* @since 7.0.0
|
|
164
195
|
*
|
|
165
196
|
* @param string $url The URL for the link (will be escaped).
|
|
166
197
|
* @param string $text The link text (will be escaped).
|
|
@@ -179,7 +210,7 @@ function block_core_breadcrumbs_create_link( $url, $text, $allow_html = false )
|
|
|
179
210
|
/**
|
|
180
211
|
* Creates a breadcrumb current page item.
|
|
181
212
|
*
|
|
182
|
-
* @since
|
|
213
|
+
* @since 7.0.0
|
|
183
214
|
*
|
|
184
215
|
* @param string $text The text content (will be escaped).
|
|
185
216
|
* @param bool $allow_html Whether to allow HTML in the text. If true, uses wp_kses_post(), otherwise uses esc_html(). Default false.
|
|
@@ -199,7 +230,7 @@ function block_core_breadcrumbs_create_current_item( $text, $allow_html = false
|
|
|
199
230
|
* When paginated (is_paged is true), creates a link to page 1.
|
|
200
231
|
* Otherwise, creates a span marked as the current page.
|
|
201
232
|
*
|
|
202
|
-
* @since
|
|
233
|
+
* @since 7.0.0
|
|
203
234
|
*
|
|
204
235
|
* @param string $text The text content (will be escaped).
|
|
205
236
|
* @param bool $is_paged Whether we're on a paginated view.
|
|
@@ -217,7 +248,7 @@ function block_core_breadcrumbs_create_item( $text, $is_paged = false, $allow_ht
|
|
|
217
248
|
/**
|
|
218
249
|
* Gets a post title with fallback for empty titles.
|
|
219
250
|
*
|
|
220
|
-
* @since
|
|
251
|
+
* @since 7.0.0
|
|
221
252
|
*
|
|
222
253
|
* @param int|WP_Post $post_id_or_object The post ID or post object.
|
|
223
254
|
*
|
|
@@ -234,9 +265,9 @@ function block_core_breadcrumbs_get_post_title( $post_id_or_object ) {
|
|
|
234
265
|
/**
|
|
235
266
|
* Generates breadcrumb items from hierarchical post type ancestors.
|
|
236
267
|
*
|
|
237
|
-
* @since
|
|
268
|
+
* @since 7.0.0
|
|
238
269
|
*
|
|
239
|
-
* @param int
|
|
270
|
+
* @param int $post_id The post ID.
|
|
240
271
|
*
|
|
241
272
|
* @return array Array of breadcrumb HTML items.
|
|
242
273
|
*/
|
|
@@ -260,7 +291,7 @@ function block_core_breadcrumbs_get_hierarchical_post_type_breadcrumbs( $post_id
|
|
|
260
291
|
*
|
|
261
292
|
* For hierarchical taxonomies, retrieves and formats ancestor terms as breadcrumb links.
|
|
262
293
|
*
|
|
263
|
-
* @since
|
|
294
|
+
* @since 7.0.0
|
|
264
295
|
*
|
|
265
296
|
* @param int $term_id The term ID.
|
|
266
297
|
* @param string $taxonomy The taxonomy name.
|
|
@@ -294,7 +325,7 @@ function block_core_breadcrumbs_get_term_ancestors_items( $term_id, $taxonomy )
|
|
|
294
325
|
* Handles taxonomy archives, post type archives, date archives, and author archives.
|
|
295
326
|
* For hierarchical taxonomies, includes ancestor terms in the breadcrumb trail.
|
|
296
327
|
*
|
|
297
|
-
* @since
|
|
328
|
+
* @since 7.0.0
|
|
298
329
|
*
|
|
299
330
|
* @return array Array of breadcrumb HTML items.
|
|
300
331
|
*/
|
|
@@ -426,7 +457,7 @@ function block_core_breadcrumbs_get_archive_breadcrumbs() {
|
|
|
426
457
|
* Finds the first publicly queryable taxonomy with terms assigned to the post
|
|
427
458
|
* and generates breadcrumb links, including hierarchical term ancestors if applicable.
|
|
428
459
|
*
|
|
429
|
-
* @since
|
|
460
|
+
* @since 7.0.0
|
|
430
461
|
*
|
|
431
462
|
* @param int $post_id The post ID.
|
|
432
463
|
* @param string $post_type The post type name.
|
|
@@ -448,21 +479,72 @@ function block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) {
|
|
|
448
479
|
return array();
|
|
449
480
|
}
|
|
450
481
|
|
|
451
|
-
|
|
482
|
+
/**
|
|
483
|
+
* Filters breadcrumb settings on a per-post-type basis.
|
|
484
|
+
*
|
|
485
|
+
* Allow developers to customize breadcrumb behavior for specific post types.
|
|
486
|
+
*
|
|
487
|
+
* @since 7.0.0
|
|
488
|
+
*
|
|
489
|
+
* @param array $settings {
|
|
490
|
+
* Array of breadcrumb settings. Default empty array.
|
|
491
|
+
*
|
|
492
|
+
* @type string $taxonomy Optional. Taxonomy slug to use for breadcrumbs.
|
|
493
|
+
* The taxonomy must be registered for the post type and have
|
|
494
|
+
* terms assigned to the post. If not found or has no terms,
|
|
495
|
+
* fall back to the first available taxonomy with terms.
|
|
496
|
+
* @type string $term Optional. Term slug to use when the post has multiple terms
|
|
497
|
+
* in the selected taxonomy. If the term is not found or not
|
|
498
|
+
* assigned to the post, fall back to the first term. If the
|
|
499
|
+
* post has only one term, that term is used regardless.
|
|
500
|
+
* }
|
|
501
|
+
* @param string $post_type The post type slug.
|
|
502
|
+
*/
|
|
503
|
+
$settings = apply_filters( 'block_core_breadcrumbs_post_type_settings', array(), $post_type );
|
|
504
|
+
|
|
452
505
|
$taxonomy_name = null;
|
|
453
506
|
$terms = array();
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
$
|
|
459
|
-
|
|
507
|
+
|
|
508
|
+
// Try preferred taxonomy first if specified.
|
|
509
|
+
if ( ! empty( $settings['taxonomy'] ) ) {
|
|
510
|
+
foreach ( $taxonomies as $taxonomy ) {
|
|
511
|
+
if ( $taxonomy->name === $settings['taxonomy'] ) {
|
|
512
|
+
$post_terms = get_the_terms( $post_id, $taxonomy->name );
|
|
513
|
+
if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
|
|
514
|
+
$taxonomy_name = $taxonomy->name;
|
|
515
|
+
$terms = $post_terms;
|
|
516
|
+
}
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// If no preferred taxonomy or it didn't have terms, find the first taxonomy with terms.
|
|
523
|
+
if ( empty( $terms ) ) {
|
|
524
|
+
foreach ( $taxonomies as $taxonomy ) {
|
|
525
|
+
$post_terms = get_the_terms( $post_id, $taxonomy->name );
|
|
526
|
+
if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
|
|
527
|
+
$taxonomy_name = $taxonomy->name;
|
|
528
|
+
$terms = $post_terms;
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
460
531
|
}
|
|
461
532
|
}
|
|
462
533
|
|
|
463
534
|
if ( ! empty( $terms ) ) {
|
|
464
|
-
//
|
|
535
|
+
// Select which term to use.
|
|
465
536
|
$term = reset( $terms );
|
|
537
|
+
|
|
538
|
+
// Try preferred term if specified and post has multiple terms.
|
|
539
|
+
if ( ! empty( $settings['term'] ) && count( $terms ) > 1 ) {
|
|
540
|
+
foreach ( $terms as $candidate_term ) {
|
|
541
|
+
if ( $candidate_term->slug === $settings['term'] ) {
|
|
542
|
+
$term = $candidate_term;
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
466
548
|
// Add hierarchical term ancestors if applicable.
|
|
467
549
|
$breadcrumb_items = array_merge(
|
|
468
550
|
$breadcrumb_items,
|
|
@@ -479,7 +561,7 @@ function block_core_breadcrumbs_get_terms_breadcrumbs( $post_id, $post_type ) {
|
|
|
479
561
|
/**
|
|
480
562
|
* Registers the `core/breadcrumbs` block on the server.
|
|
481
563
|
*
|
|
482
|
-
* @since
|
|
564
|
+
* @since 7.0.0
|
|
483
565
|
*/
|
|
484
566
|
function register_block_core_breadcrumbs() {
|
|
485
567
|
register_block_type_from_metadata(
|
package/src/button/index.js
CHANGED
|
@@ -34,4 +34,27 @@ export const settings = {
|
|
|
34
34
|
} ),
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
38
|
+
settings.fields = [
|
|
39
|
+
{
|
|
40
|
+
label: __( 'Content' ),
|
|
41
|
+
type: 'RichText',
|
|
42
|
+
shownByDefault: true,
|
|
43
|
+
mapping: {
|
|
44
|
+
value: 'text',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: __( 'Link' ),
|
|
49
|
+
type: 'Link',
|
|
50
|
+
shownByDefault: false,
|
|
51
|
+
mapping: {
|
|
52
|
+
href: 'url',
|
|
53
|
+
rel: 'rel',
|
|
54
|
+
target: 'linkTarget',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
|
|
37
60
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/code/index.js
CHANGED
|
@@ -39,4 +39,17 @@ export const settings = {
|
|
|
39
39
|
save,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
43
|
+
settings.fields = [
|
|
44
|
+
{
|
|
45
|
+
label: __( 'Code' ),
|
|
46
|
+
type: 'RichText',
|
|
47
|
+
shownByDefault: true,
|
|
48
|
+
mapping: {
|
|
49
|
+
value: 'content',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/cover/index.js
CHANGED
|
@@ -52,4 +52,27 @@ export const settings = {
|
|
|
52
52
|
variations,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
56
|
+
settings.fields = [
|
|
57
|
+
{
|
|
58
|
+
label: __( 'Background' ),
|
|
59
|
+
type: 'Media',
|
|
60
|
+
shownByDefault: true,
|
|
61
|
+
mapping: {
|
|
62
|
+
type: 'backgroundType',
|
|
63
|
+
id: 'id',
|
|
64
|
+
src: 'url',
|
|
65
|
+
alt: 'alt',
|
|
66
|
+
featuredImage: 'useFeaturedImage',
|
|
67
|
+
},
|
|
68
|
+
args: {
|
|
69
|
+
// TODO - How to support custom gradient?
|
|
70
|
+
// Build it into Media, or use a custom control?
|
|
71
|
+
allowedTypes: [ 'image', 'video' ],
|
|
72
|
+
multiple: false,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
55
78
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/details/index.js
CHANGED
|
@@ -61,4 +61,17 @@ export const settings = {
|
|
|
61
61
|
transforms,
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
65
|
+
settings.fields = [
|
|
66
|
+
{
|
|
67
|
+
label: __( 'Summary' ),
|
|
68
|
+
type: 'RichText',
|
|
69
|
+
shownByDefault: true,
|
|
70
|
+
mapping: {
|
|
71
|
+
value: 'summary',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
|
|
64
77
|
export const init = () => initBlock( { name, metadata, settings } );
|