UNPKG

@wordpress/block-library

Version:
1 lines • 1.85 kB
{"version":3,"file":"edit.cjs","names":["useBlockProps","useInnerBlocksProps","TabToolbarControls"],"sources":["../../src/tabs/edit.jsx"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,KAAM,EAAE,YAAa;CAC7B,CAAA,GAAA,6BAAA,QAAA,CAAqB,QAAS;CAE9B,MAAM,cAAA,GAAaA,wBAAAA,cAAAA,CAAc;CAcjC,MAAM,mBAAA,GAAkBC,wBAAAA,oBAAAA,CAAqB,YAAY;EACxD,+BAA+B;EAC/B,cAAc;EACd,gBAAgB;CACjB,CAAE;CAEF,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,GAAK;EAAV,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,2BAAAA,SAAD,EAAoB,cAAe,SAAY,CAAA,GAC7C,gBAAgB,QACd;;AAEP"}