@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 1.76 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/tabs/edit.js"],
"sourcesContent": ["import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport TabToolbarControls from './tab-toolbar-controls';\nimport useTabListItemsSync from './use-tab-list-items-sync';\n\nfunction Edit( { clientId } ) {\n\tuseTabListItemsSync( clientId );\n\n\tconst blockProps = useBlockProps();\n\n\t// The template in the block type settings only specifies the two\n\t// structural child blocks, without inner block entries for\n\t// core/tab-list or core/tab-panels.\n\t//\n\t// If inner blocks were included in that template,\n\t// `synchronizeBlocksWithTemplate` (called whenever templateLock === 'all')\n\t// would recurse into the containers and truncate them to the template\n\t// count, causing data loss when a saved block with more than two tabs is\n\t// re-opened in the editor.\n\t//\n\t// Initial tab/panel creation is delegated to the tab-panels template\n\t// (templateLock: false, applied only when empty).\n\tconst innerBlockProps = useInnerBlocksProps( blockProps, {\n\t\t__experimentalCaptureToolbars: true,\n\t\ttemplateLock: 'all',\n\t\trenderAppender: false,\n\t} );\n\n\treturn (\n\t\t<div { ...innerBlockProps }>\n\t\t\t<TabToolbarControls tabsClientId={ clientId } />\n\t\t\t{ innerBlockProps.children }\n\t\t</div>\n\t);\n}\n\nexport default Edit;\n"],
"mappings": ";AAAA,SAAS,eAAe,2BAA2B;AACnD,OAAO,wBAAwB;AAC/B,OAAO,yBAAyB;AA0B9B,SACC,KADD;AAxBF,SAAS,KAAM,EAAE,SAAS,GAAI;AAC7B,sBAAqB,QAAS;AAE9B,QAAM,aAAa,cAAc;AAcjC,QAAM,kBAAkB,oBAAqB,YAAY;AAAA,IACxD,+BAA+B;AAAA,IAC/B,cAAc;AAAA,IACd,gBAAgB;AAAA,EACjB,CAAE;AAEF,SACC,qBAAC,SAAM,GAAG,iBACT;AAAA,wBAAC,sBAAmB,cAAe,UAAW;AAAA,IAC5C,gBAAgB;AAAA,KACnB;AAEF;AAEA,IAAO,eAAQ;",
"names": []
}