@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 1.85 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;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAmD;AACnD,kCAA+B;AAC/B,qCAAgC;AA0B9B;AAxBF,SAAS,KAAM,EAAE,SAAS,GAAI;AAC7B,qCAAAA,SAAqB,QAAS;AAE9B,QAAM,iBAAa,mCAAc;AAcjC,QAAM,sBAAkB,yCAAqB,YAAY;AAAA,IACxD,+BAA+B;AAAA,IAC/B,cAAc;AAAA,IACd,gBAAgB;AAAA,EACjB,CAAE;AAEF,SACC,6CAAC,SAAM,GAAG,iBACT;AAAA,gDAAC,4BAAAC,SAAA,EAAmB,cAAe,UAAW;AAAA,IAC5C,gBAAgB;AAAA,KACnB;AAEF;AAEA,IAAO,eAAQ;",
"names": ["useTabListItemsSync", "TabToolbarControls"]
}