@wordpress/block-library 9.45.0 → 9.45.1-next.v.202605131006.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/breadcrumbs/edit.cjs +1 -1
- package/build/breadcrumbs/edit.cjs.map +1 -1
- package/build/buttons/edit.cjs +0 -13
- package/build/buttons/edit.cjs.map +3 -3
- package/build/comment-reply-link/edit.cjs +2 -1
- package/build/comment-reply-link/edit.cjs.map +2 -2
- package/build/comments/edit/placeholder.cjs +2 -1
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/embed/transforms.cjs +24 -1
- package/build/embed/transforms.cjs.map +2 -2
- package/build/freeform/convert-to-blocks-button.cjs +2 -14
- package/build/freeform/convert-to-blocks-button.cjs.map +3 -3
- package/build/freeform/edit.cjs +43 -15
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/index.cjs +7 -1
- package/build/freeform/index.cjs.map +3 -3
- package/build/freeform/migration-notice.cjs +58 -0
- package/build/freeform/migration-notice.cjs.map +7 -0
- package/build/image/image.cjs +16 -52
- package/build/image/image.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +239 -0
- package/build/image/use-open-image-media-editor-modal.cjs.map +7 -0
- package/build/index.cjs +1 -5
- package/build/index.cjs.map +2 -2
- package/build/shortcode/transforms.cjs +27 -1
- package/build/shortcode/transforms.cjs.map +2 -2
- package/build/site-logo/edit.cjs +1 -0
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/table/edit.cjs +2 -2
- package/build/table/edit.cjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +1 -1
- package/build-module/breadcrumbs/edit.mjs.map +1 -1
- package/build-module/buttons/edit.mjs +0 -13
- package/build-module/buttons/edit.mjs.map +2 -2
- package/build-module/comment-reply-link/edit.mjs +3 -2
- package/build-module/comment-reply-link/edit.mjs.map +2 -2
- package/build-module/comments/edit/placeholder.mjs +3 -2
- package/build-module/comments/edit/placeholder.mjs.map +2 -2
- package/build-module/embed/transforms.mjs +24 -1
- package/build-module/embed/transforms.mjs.map +2 -2
- package/build-module/freeform/convert-to-blocks-button.mjs +3 -15
- package/build-module/freeform/convert-to-blocks-button.mjs.map +2 -2
- package/build-module/freeform/edit.mjs +44 -16
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/index.mjs +7 -1
- package/build-module/freeform/index.mjs.map +2 -2
- package/build-module/freeform/migration-notice.mjs +37 -0
- package/build-module/freeform/migration-notice.mjs.map +7 -0
- package/build-module/image/image.mjs +16 -52
- package/build-module/image/image.mjs.map +3 -3
- package/build-module/image/use-open-image-media-editor-modal.mjs +215 -0
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +7 -0
- package/build-module/index.mjs +1 -5
- package/build-module/index.mjs.map +2 -2
- package/build-module/shortcode/transforms.mjs +27 -1
- package/build-module/shortcode/transforms.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +1 -0
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/table/edit.mjs +3 -3
- package/build-module/table/edit.mjs.map +2 -2
- package/build-types/table-of-contents/list.d.ts +1 -1
- package/build-types/table-of-contents/list.d.ts.map +1 -1
- package/package.json +41 -40
- package/src/breadcrumbs/edit.js +1 -1
- package/src/buttons/edit.js +0 -13
- package/src/comment-reply-link/edit.js +5 -2
- package/src/comments/edit/placeholder.js +5 -2
- package/src/cover/editor.scss +2 -2
- package/src/cover/style.scss +10 -6
- package/src/embed/transforms.js +30 -4
- package/src/freeform/convert-to-blocks-button.js +3 -18
- package/src/freeform/edit.js +40 -7
- package/src/freeform/index.js +9 -1
- package/src/freeform/migration-notice.js +51 -0
- package/src/image/image.js +14 -63
- package/src/image/test/use-open-image-media-editor-modal.js +791 -0
- package/src/image/use-open-image-media-editor-modal.js +337 -0
- package/src/index.js +3 -16
- package/src/navigation/index.php +11 -1
- package/src/query/editor.scss +1 -2
- package/src/shortcode/transforms.js +37 -0
- package/src/site-logo/edit.js +5 -0
- package/src/table/edit.js +3 -3
- package/src/template-part/editor.scss +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n\tregisterBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDisabled } from '@wordpress/compose';\nimport { select } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HtmlRenderer from './utils/html-renderer';\n\n/**\n * Internal dependencies\n */\n// When IS_GUTENBERG_PLUGIN is set to false, imports of experimental blocks\n// are transformed by packages/block-library/src/index.js as follows:\n// import * as experimentalBlock from './experimental-block'\n// becomes\n// const experimentalBlock = null;\n// This enables webpack to eliminate the experimental blocks code from the\n// production build to make the final bundle smaller.\n//\n// See https://github.com/WordPress/gutenberg/pull/40655 for more context.\nimport * as accordion from './accordion';\nimport * as accordionItem from './accordion-item';\nimport * as accordionHeading from './accordion-heading';\nimport * as accordionPanel from './accordion-panel';\nimport * as archives from './archives';\nimport * as avatar from './avatar';\nimport * as audio from './audio';\nimport * as breadcrumbs from './breadcrumbs';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as comments from './comments';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as commentsTitle from './comments-title';\nimport * as cover from './cover';\nimport * as details from './details';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as form from './form';\nimport * as formInput from './form-input';\nimport * as formSubmitButton from './form-submit-button';\nimport * as formSubmissionNotification from './form-submission-notification';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as icon from './icon';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as math from './math';\nimport * as listItem from './list-item';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as navigationOverlayClose from './navigation-overlay-close';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\nimport * as playlist from './playlist';\nimport * as playlistTrack from './playlist-track';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTimeToRead from './post-time-to-read';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryNoResults from './query-no-results';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as queryTotal from './query-total';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as tab from './tab';\nimport * as tabPanel from './tab-panel';\nimport * as tabPanels from './tab-panels';\nimport * as table from './table';\nimport * as tableOfContents from './table-of-contents';\nimport * as tabList from './tab-list';\nimport * as tabs from './tabs';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termCount from './term-count';\nimport * as termDescription from './term-description';\nimport * as termName from './term-name';\nimport * as termsQuery from './terms-query';\nimport * as termTemplate from './term-template';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\nimport * as footnotes from './footnotes';\n\nimport isBlockMetadataExperimental from './utils/is-block-metadata-experimental';\nimport { unlock } from './lock-unlock';\n\n/**\n * Function to get all the block-library blocks in an array\n */\nconst getAllBlocks = () => {\n\tconst blocks = [\n\t\t// Common blocks are grouped at the top to prioritize their display\n\t\t// in various contexts \u2014 like the inserter and auto-complete components.\n\t\tparagraph,\n\t\timage,\n\t\theading,\n\t\tgallery,\n\t\tlist,\n\t\tlistItem,\n\t\tquote,\n\n\t\t// Register all remaining core blocks.\n\t\taccordion,\n\t\taccordionItem,\n\t\taccordionHeading,\n\t\taccordionPanel,\n\t\tarchives,\n\t\taudio,\n\t\tbutton,\n\t\tbuttons,\n\t\tcalendar,\n\t\tcategories,\n\t\tcode,\n\t\tcolumn,\n\t\tcolumns,\n\t\tcommentAuthorAvatar,\n\t\tcover,\n\t\tdetails,\n\t\tembed,\n\t\tfile,\n\t\tgroup,\n\t\thtml,\n\t\tmath,\n\t\tlatestComments,\n\t\tlatestPosts,\n\t\tmediaText,\n\t\tmissing,\n\t\tmore,\n\t\tnextpage,\n\t\tpageList,\n\t\tpageListItem,\n\t\tpattern,\n\t\tpreformatted,\n\t\tpullquote,\n\t\treusableBlock,\n\t\trss,\n\t\tsearch,\n\t\tseparator,\n\t\tshortcode,\n\t\tsocialLink,\n\t\tsocialLinks,\n\t\tspacer,\n\t\ttable,\n\t\ttagCloud,\n\t\ttextColumns,\n\t\tverse,\n\t\tvideo,\n\t\tfootnotes,\n\n\t\t// theme blocks\n\t\tnavigation,\n\t\tnavigationLink,\n\t\tnavigationSubmenu,\n\t\tsiteLogo,\n\t\tsiteTitle,\n\t\tsiteTagline,\n\t\tquery,\n\t\ttemplatePart,\n\t\tavatar,\n\t\tpostTitle,\n\t\tpostExcerpt,\n\t\tpostFeaturedImage,\n\t\tpostContent,\n\t\tpostAuthor,\n\t\tpostAuthorName,\n\t\tpostComment,\n\t\tpostCommentsCount,\n\t\tpostCommentsLink,\n\t\tpostDate,\n\t\tpostTerms,\n\t\tpostNavigationLink,\n\t\tpostTemplate,\n\t\tpostTimeToRead,\n\t\tqueryPagination,\n\t\tqueryPaginationNext,\n\t\tqueryPaginationNumbers,\n\t\tqueryPaginationPrevious,\n\t\tqueryNoResults,\n\t\tqueryTotal,\n\t\treadMore,\n\t\tcomments,\n\t\tcommentAuthorName,\n\t\tcommentContent,\n\t\tcommentDate,\n\t\tcommentEditLink,\n\t\tcommentReplyLink,\n\t\tcommentTemplate,\n\t\tcommentsTitle,\n\t\tcommentsPagination,\n\t\tcommentsPaginationNext,\n\t\tcommentsPaginationNumbers,\n\t\tcommentsPaginationPrevious,\n\t\tpostCommentsForm,\n\t\ttableOfContents,\n\t\thomeLink,\n\t\ticon,\n\t\tlogInOut,\n\t\tnavigationOverlayClose,\n\t\ttermCount,\n\t\ttermDescription,\n\t\ttermName,\n\t\ttermsQuery,\n\t\ttermTemplate,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\n\t\tbreadcrumbs,\n\t];\n\n\tif ( window?.__experimentalEnableFormBlocks ) {\n\t\tblocks.push( form );\n\t\tblocks.push( formInput );\n\t\tblocks.push( formSubmitButton );\n\t\tblocks.push( formSubmissionNotification );\n\t}\n\n\tif ( window?.__experimentalEnableBlockExperiments ) {\n\t\tblocks.push( tab );\n\t\tblocks.push( tabList );\n\t\tblocks.push( tabs );\n\t\tblocks.push( tabPanel );\n\t\tblocks.push( tabPanels );\n\t\tblocks.push( playlist );\n\t\tblocks.push( playlistTrack );\n\t}\n\n\t// When in a WordPress context, conditionally\n\t// add the classic block and TinyMCE editor\n\t// under any of the following conditions:\n\t// - the current post contains a classic block\n\t// - the experiment to disable TinyMCE isn't active.\n\t// - a query argument specifies that TinyMCE should be loaded\n\tif (\n\t\twindow?.wp?.oldEditor &&\n\t\t( window?.wp?.needsClassicBlock ||\n\t\t\t! window?.__experimentalDisableTinymce ||\n\t\t\t!! new URLSearchParams( window?.location?.search ).get(\n\t\t\t\t'requiresTinymce'\n\t\t\t) )\n\t) {\n\t\tblocks.push( classic );\n\t}\n\n\treturn blocks.filter( Boolean );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () =>\n\tgetAllBlocks().filter(\n\t\t( { metadata } ) => ! isBlockMetadataExperimental( metadata )\n\t);\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( ( { init } ) => init() );\n\n\t// Auto-register PHP-only blocks with ServerSideRender\n\tif ( window.__unstableAutoRegisterBlocks ) {\n\t\twindow.__unstableAutoRegisterBlocks.forEach( ( blockName ) => {\n\t\t\tconst bootstrappedBlockType = unlock(\n\t\t\t\tselect( blocksStore )\n\t\t\t).getBootstrappedBlockType( blockName );\n\n\t\t\tregisterBlockType( blockName, {\n\t\t\t\t// Use all metadata from PHP registration,\n\t\t\t\t// but fall back title to block name if not provided,\n\t\t\t\t// ensure minimum apiVersion 3 for block wrapper support,\n\t\t\t\t// and override with a ServerSideRender-based edit function.\n\t\t\t\t...bootstrappedBlockType,\n\t\t\t\ttitle: bootstrappedBlockType?.title || blockName,\n\t\t\t\t...( ( bootstrappedBlockType?.apiVersion ?? 0 ) < 3 && {\n\t\t\t\t\tapiVersion: 3,\n\t\t\t\t} ),\n\t\t\t\t// Inspector controls are rendered by the auto-register hook in block-editor\n\t\t\t\tedit: function Edit( { attributes } ) {\n\t\t\t\t\tconst disabledRef = useDisabled();\n\t\t\t\t\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\t\t\t\t\tconst { content, status, error } = useServerSideRender( {\n\t\t\t\t\t\tblock: blockName,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( status === 'loading' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>{ __( 'Loading\u2026' ) }</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( status === 'error' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: error message describing the problem */\n\t\t\t\t\t\t\t\t\t__( 'Error loading block: %s' ),\n\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\t\twrapperProps={ blockProps }\n\t\t\t\t\t\t\thtml={ content }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tsave: () => null,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tsetDefaultBlockName( paragraph.name );\n\tif (\n\t\twindow.wp &&\n\t\twindow.wp.oldEditor &&\n\t\tblocks.some( ( { name } ) => name === classic.name )\n\t) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks =\n\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\t\tconst enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];\n\t\t\t\tgetAllBlocks()\n\t\t\t\t\t.filter( ( { metadata } ) =>\n\t\t\t\t\t\tisBlockMetadataExperimental( metadata )\n\t\t\t\t\t)\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { metadata: { __experimental } } ) =>\n\t\t\t\t\t\t\t__experimental === true ||\n\t\t\t\t\t\t\tenabledExperiments.includes( __experimental )\n\t\t\t\t\t)\n\t\t\t\t\t.forEach( ( { init } ) => init() );\n\t\t }\n\t\t: undefined;\n\nexport { privateApis } from './private-apis';\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,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CAAiC;AACxC,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n\tregisterBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDisabled } from '@wordpress/compose';\nimport { select } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HtmlRenderer from './utils/html-renderer';\n\n/**\n * Internal dependencies\n */\n// When IS_GUTENBERG_PLUGIN is set to false, imports of experimental blocks\n// are transformed by packages/block-library/src/index.js as follows:\n// import * as experimentalBlock from './experimental-block'\n// becomes\n// const experimentalBlock = null;\n// This enables webpack to eliminate the experimental blocks code from the\n// production build to make the final bundle smaller.\n//\n// See https://github.com/WordPress/gutenberg/pull/40655 for more context.\nimport * as accordion from './accordion';\nimport * as accordionItem from './accordion-item';\nimport * as accordionHeading from './accordion-heading';\nimport * as accordionPanel from './accordion-panel';\nimport * as archives from './archives';\nimport * as avatar from './avatar';\nimport * as audio from './audio';\nimport * as breadcrumbs from './breadcrumbs';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as comments from './comments';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as commentsTitle from './comments-title';\nimport * as cover from './cover';\nimport * as details from './details';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as form from './form';\nimport * as formInput from './form-input';\nimport * as formSubmitButton from './form-submit-button';\nimport * as formSubmissionNotification from './form-submission-notification';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as icon from './icon';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as math from './math';\nimport * as listItem from './list-item';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as navigationOverlayClose from './navigation-overlay-close';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\nimport * as playlist from './playlist';\nimport * as playlistTrack from './playlist-track';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTimeToRead from './post-time-to-read';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryNoResults from './query-no-results';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as queryTotal from './query-total';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as tab from './tab';\nimport * as tabPanel from './tab-panel';\nimport * as tabPanels from './tab-panels';\nimport * as table from './table';\nimport * as tableOfContents from './table-of-contents';\nimport * as tabList from './tab-list';\nimport * as tabs from './tabs';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termCount from './term-count';\nimport * as termDescription from './term-description';\nimport * as termName from './term-name';\nimport * as termsQuery from './terms-query';\nimport * as termTemplate from './term-template';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\nimport * as footnotes from './footnotes';\n\nimport isBlockMetadataExperimental from './utils/is-block-metadata-experimental';\nimport { unlock } from './lock-unlock';\n\n/**\n * Function to get all the block-library blocks in an array\n */\nconst getAllBlocks = () => {\n\tconst blocks = [\n\t\t// Common blocks are grouped at the top to prioritize their display\n\t\t// in various contexts \u2014 like the inserter and auto-complete components.\n\t\tparagraph,\n\t\timage,\n\t\theading,\n\t\tgallery,\n\t\tlist,\n\t\tlistItem,\n\t\tquote,\n\n\t\t// Register all remaining core blocks.\n\t\taccordion,\n\t\taccordionItem,\n\t\taccordionHeading,\n\t\taccordionPanel,\n\t\tarchives,\n\t\taudio,\n\t\tbutton,\n\t\tbuttons,\n\t\tcalendar,\n\t\tcategories,\n\t\tcode,\n\t\tcolumn,\n\t\tcolumns,\n\t\tcommentAuthorAvatar,\n\t\tcover,\n\t\tdetails,\n\t\tembed,\n\t\tfile,\n\t\tgroup,\n\t\thtml,\n\t\tmath,\n\t\tlatestComments,\n\t\tlatestPosts,\n\t\tmediaText,\n\t\tmissing,\n\t\tmore,\n\t\tnextpage,\n\t\tpageList,\n\t\tpageListItem,\n\t\tpattern,\n\t\tpreformatted,\n\t\tpullquote,\n\t\treusableBlock,\n\t\trss,\n\t\tsearch,\n\t\tseparator,\n\t\tshortcode,\n\t\tsocialLink,\n\t\tsocialLinks,\n\t\tspacer,\n\t\ttable,\n\t\ttagCloud,\n\t\ttextColumns,\n\t\tverse,\n\t\tvideo,\n\t\tfootnotes,\n\n\t\t// theme blocks\n\t\tnavigation,\n\t\tnavigationLink,\n\t\tnavigationSubmenu,\n\t\tsiteLogo,\n\t\tsiteTitle,\n\t\tsiteTagline,\n\t\tquery,\n\t\ttemplatePart,\n\t\tavatar,\n\t\tpostTitle,\n\t\tpostExcerpt,\n\t\tpostFeaturedImage,\n\t\tpostContent,\n\t\tpostAuthor,\n\t\tpostAuthorName,\n\t\tpostComment,\n\t\tpostCommentsCount,\n\t\tpostCommentsLink,\n\t\tpostDate,\n\t\tpostTerms,\n\t\tpostNavigationLink,\n\t\tpostTemplate,\n\t\tpostTimeToRead,\n\t\tqueryPagination,\n\t\tqueryPaginationNext,\n\t\tqueryPaginationNumbers,\n\t\tqueryPaginationPrevious,\n\t\tqueryNoResults,\n\t\tqueryTotal,\n\t\treadMore,\n\t\tcomments,\n\t\tcommentAuthorName,\n\t\tcommentContent,\n\t\tcommentDate,\n\t\tcommentEditLink,\n\t\tcommentReplyLink,\n\t\tcommentTemplate,\n\t\tcommentsTitle,\n\t\tcommentsPagination,\n\t\tcommentsPaginationNext,\n\t\tcommentsPaginationNumbers,\n\t\tcommentsPaginationPrevious,\n\t\tpostCommentsForm,\n\t\ttableOfContents,\n\t\thomeLink,\n\t\ticon,\n\t\tlogInOut,\n\t\tnavigationOverlayClose,\n\t\ttermCount,\n\t\ttermDescription,\n\t\ttermName,\n\t\ttermsQuery,\n\t\ttermTemplate,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\n\t\tbreadcrumbs,\n\t];\n\n\tif ( window?.__experimentalEnableFormBlocks ) {\n\t\tblocks.push( form );\n\t\tblocks.push( formInput );\n\t\tblocks.push( formSubmitButton );\n\t\tblocks.push( formSubmissionNotification );\n\t}\n\n\tif ( window?.__experimentalEnableBlockExperiments ) {\n\t\tblocks.push( tab );\n\t\tblocks.push( tabList );\n\t\tblocks.push( tabs );\n\t\tblocks.push( tabPanel );\n\t\tblocks.push( tabPanels );\n\t\tblocks.push( playlist );\n\t\tblocks.push( playlistTrack );\n\t}\n\n\t// Always register the classic block. Inserter availability is controlled\n\t// by the block's `supports.inserter` value in `freeform/init`.\n\tblocks.push( classic );\n\n\treturn blocks.filter( Boolean );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () =>\n\tgetAllBlocks().filter(\n\t\t( { metadata } ) => ! isBlockMetadataExperimental( metadata )\n\t);\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( ( { init } ) => init() );\n\n\t// Auto-register PHP-only blocks with ServerSideRender\n\tif ( window.__unstableAutoRegisterBlocks ) {\n\t\twindow.__unstableAutoRegisterBlocks.forEach( ( blockName ) => {\n\t\t\tconst bootstrappedBlockType = unlock(\n\t\t\t\tselect( blocksStore )\n\t\t\t).getBootstrappedBlockType( blockName );\n\n\t\t\tregisterBlockType( blockName, {\n\t\t\t\t// Use all metadata from PHP registration,\n\t\t\t\t// but fall back title to block name if not provided,\n\t\t\t\t// ensure minimum apiVersion 3 for block wrapper support,\n\t\t\t\t// and override with a ServerSideRender-based edit function.\n\t\t\t\t...bootstrappedBlockType,\n\t\t\t\ttitle: bootstrappedBlockType?.title || blockName,\n\t\t\t\t...( ( bootstrappedBlockType?.apiVersion ?? 0 ) < 3 && {\n\t\t\t\t\tapiVersion: 3,\n\t\t\t\t} ),\n\t\t\t\t// Inspector controls are rendered by the auto-register hook in block-editor\n\t\t\t\tedit: function Edit( { attributes } ) {\n\t\t\t\t\tconst disabledRef = useDisabled();\n\t\t\t\t\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\t\t\t\t\tconst { content, status, error } = useServerSideRender( {\n\t\t\t\t\t\tblock: blockName,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( status === 'loading' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>{ __( 'Loading\u2026' ) }</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( status === 'error' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: error message describing the problem */\n\t\t\t\t\t\t\t\t\t__( 'Error loading block: %s' ),\n\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\t\twrapperProps={ blockProps }\n\t\t\t\t\t\t\thtml={ content }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tsave: () => null,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tsetDefaultBlockName( paragraph.name );\n\tif (\n\t\twindow.wp &&\n\t\twindow.wp.oldEditor &&\n\t\tblocks.some( ( { name } ) => name === classic.name )\n\t) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks =\n\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\t\tconst enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];\n\t\t\t\tgetAllBlocks()\n\t\t\t\t\t.filter( ( { metadata } ) =>\n\t\t\t\t\t\tisBlockMetadataExperimental( metadata )\n\t\t\t\t\t)\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { metadata: { __experimental } } ) =>\n\t\t\t\t\t\t\t__experimental === true ||\n\t\t\t\t\t\t\tenabledExperiments.includes( __experimental )\n\t\t\t\t\t)\n\t\t\t\t\t.forEach( ( { init } ) => init() );\n\t\t }\n\t\t: undefined;\n\nexport { privateApis } from './private-apis';\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,IAAI,eAAe;AAK5B,OAAO,kBAAkB;AAczB,YAAY,eAAe;AAC3B,YAAY,mBAAmB;AAC/B,YAAY,sBAAsB;AAClC,YAAY,oBAAoB;AAChC,YAAY,cAAc;AAC1B,YAAY,YAAY;AACxB,YAAY,WAAW;AACvB,YAAY,iBAAiB;AAC7B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,YAAY,cAAc;AAC1B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,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MAAM;AAAA,MACb,CAAE;AAAA,IACH,CAAE;AAAA,EACH;AAEA,sBAA+B,cAAK;AACpC,MACC,OAAO,MACP,OAAO,GAAG,aACV,OAAO,KAAM,CAAE,EAAE,MAAAA,MAAK,MAAOA,UAAiB,YAAK,GAClD;AACD,kCAAuC,YAAK;AAAA,EAC7C;AACA,iCAAwC,YAAK;AAC7C,uBAA4B,UAAK;AAClC;AAaO,IAAM,+CACZ,WAAW,sBACR,CAAE,EAAE,gBAAgB,IAAI,CAAC,MAAO;AAChC,QAAM,qBAAqB,CAAE,kBAAkB,QAAQ,IAAK;AAC5D,eAAa,EACX;AAAA,IAAQ,CAAE,EAAE,SAAS,MACrB,4BAA6B,QAAS;AAAA,EACvC,EACC;AAAA,IACA,CAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAChC,mBAAmB,QACnB,mBAAmB,SAAU,cAAe;AAAA,EAC9C,EACC,QAAS,CAAE,EAAE,KAAK,MAAO,KAAK,CAAE;AAClC,IACA;",
|
|
6
6
|
"names": ["name"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
// packages/block-library/src/shortcode/transforms.js
|
|
2
2
|
import { removep, autop } from "@wordpress/autop";
|
|
3
|
+
import { getBlockTransforms, rawHandler } from "@wordpress/blocks";
|
|
4
|
+
import { next } from "@wordpress/shortcode";
|
|
5
|
+
var getShortcodeFromTransforms = () => getBlockTransforms("from").filter(
|
|
6
|
+
(transform) => transform.type === "shortcode" && transform.blockName !== "core/shortcode"
|
|
7
|
+
);
|
|
8
|
+
var isSingleShortcode = (text, tag) => {
|
|
9
|
+
const trimmed = text.trim();
|
|
10
|
+
const match = next(tag, trimmed);
|
|
11
|
+
return !!match && match.index === 0 && match.content.length === trimmed.length;
|
|
12
|
+
};
|
|
3
13
|
var transforms = {
|
|
4
14
|
from: [
|
|
5
15
|
{
|
|
@@ -22,7 +32,23 @@ var transforms = {
|
|
|
22
32
|
},
|
|
23
33
|
priority: 20
|
|
24
34
|
}
|
|
25
|
-
]
|
|
35
|
+
],
|
|
36
|
+
// One `to` transform per registered shortcode-from block. A single transform
|
|
37
|
+
// with a dynamic `blocks` list won't work: `isMatch` runs once per
|
|
38
|
+
// transform, so all targets would surface (or none) regardless of which
|
|
39
|
+
// shortcode tag the block actually contains.
|
|
40
|
+
get to() {
|
|
41
|
+
return getShortcodeFromTransforms().map((fromTransform) => ({
|
|
42
|
+
type: "block",
|
|
43
|
+
blocks: [fromTransform.blockName],
|
|
44
|
+
isMatch: ({ text }) => {
|
|
45
|
+
return [].concat(fromTransform.tag).some((tag) => isSingleShortcode(text, tag));
|
|
46
|
+
},
|
|
47
|
+
transform: ({ text }) => {
|
|
48
|
+
return rawHandler({ HTML: `<p>${text.trim()}</p>` });
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
26
52
|
};
|
|
27
53
|
var transforms_default = transforms;
|
|
28
54
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shortcode/transforms.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { removep, autop } from '@wordpress/autop';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\t// Per \"Shortcode names should be all lowercase and use all\n\t\t\t// letters, but numbers and underscores should work fine too.\n\t\t\t// Be wary of using hyphens (dashes), you'll be better off not\n\t\t\t// using them.\" in https://codex.wordpress.org/Shortcode_API\n\t\t\t// Require that the first character be a letter. This notably\n\t\t\t// prevents footnote markings ([1]) from being caught as\n\t\t\t// shortcodes.\n\t\t\ttag: '[a-z][a-z0-9_-]*',\n\t\t\tattributes: {\n\t\t\t\ttext: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tshortcode: ( attrs, { content } ) => {\n\t\t\t\t\t\treturn removep( autop( content ) );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tpriority: 20,\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,SAAS,aAAa;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { removep, autop } from '@wordpress/autop';\nimport { getBlockTransforms, rawHandler } from '@wordpress/blocks';\nimport { next } from '@wordpress/shortcode';\n\nconst getShortcodeFromTransforms = () =>\n\tgetBlockTransforms( 'from' ).filter(\n\t\t( transform ) =>\n\t\t\ttransform.type === 'shortcode' &&\n\t\t\ttransform.blockName !== 'core/shortcode'\n\t);\n\n// Single-shortcode only: keeps the transform menu honest (one block in, one\n// block out) and avoids unmatched shortcodes silently falling back to freeform.\nconst isSingleShortcode = ( text, tag ) => {\n\tconst trimmed = text.trim();\n\tconst match = next( tag, trimmed );\n\treturn (\n\t\t!! match && match.index === 0 && match.content.length === trimmed.length\n\t);\n};\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\t// Per \"Shortcode names should be all lowercase and use all\n\t\t\t// letters, but numbers and underscores should work fine too.\n\t\t\t// Be wary of using hyphens (dashes), you'll be better off not\n\t\t\t// using them.\" in https://codex.wordpress.org/Shortcode_API\n\t\t\t// Require that the first character be a letter. This notably\n\t\t\t// prevents footnote markings ([1]) from being caught as\n\t\t\t// shortcodes.\n\t\t\ttag: '[a-z][a-z0-9_-]*',\n\t\t\tattributes: {\n\t\t\t\ttext: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tshortcode: ( attrs, { content } ) => {\n\t\t\t\t\t\treturn removep( autop( content ) );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tpriority: 20,\n\t\t},\n\t],\n\t// One `to` transform per registered shortcode-from block. A single transform\n\t// with a dynamic `blocks` list won't work: `isMatch` runs once per\n\t// transform, so all targets would surface (or none) regardless of which\n\t// shortcode tag the block actually contains.\n\tget to() {\n\t\treturn getShortcodeFromTransforms().map( ( fromTransform ) => ( {\n\t\t\ttype: 'block',\n\t\t\tblocks: [ fromTransform.blockName ],\n\t\t\tisMatch: ( { text } ) => {\n\t\t\t\treturn []\n\t\t\t\t\t.concat( fromTransform.tag )\n\t\t\t\t\t.some( ( tag ) => isSingleShortcode( text, tag ) );\n\t\t\t},\n\t\t\ttransform: ( { text } ) => {\n\t\t\t\treturn rawHandler( { HTML: `<p>${ text.trim() }</p>` } );\n\t\t\t},\n\t\t} ) );\n\t},\n};\n\nexport default transforms;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,aAAa;AAC/B,SAAS,oBAAoB,kBAAkB;AAC/C,SAAS,YAAY;AAErB,IAAM,6BAA6B,MAClC,mBAAoB,MAAO,EAAE;AAAA,EAC5B,CAAE,cACD,UAAU,SAAS,eACnB,UAAU,cAAc;AAC1B;AAID,IAAM,oBAAoB,CAAE,MAAM,QAAS;AAC1C,QAAM,UAAU,KAAK,KAAK;AAC1B,QAAM,QAAQ,KAAM,KAAK,OAAQ;AACjC,SACC,CAAC,CAAE,SAAS,MAAM,UAAU,KAAK,MAAM,QAAQ,WAAW,QAAQ;AAEpE;AAEA,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,IACL;AAAA,MACC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQN,KAAK;AAAA,MACL,YAAY;AAAA,QACX,MAAM;AAAA,UACL,MAAM;AAAA,UACN,WAAW,CAAE,OAAO,EAAE,QAAQ,MAAO;AACpC,mBAAO,QAAS,MAAO,OAAQ,CAAE;AAAA,UAClC;AAAA,QACD;AAAA,MACD;AAAA,MACA,UAAU;AAAA,IACX;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,KAAK;AACR,WAAO,2BAA2B,EAAE,IAAK,CAAE,mBAAqB;AAAA,MAC/D,MAAM;AAAA,MACN,QAAQ,CAAE,cAAc,SAAU;AAAA,MAClC,SAAS,CAAE,EAAE,KAAK,MAAO;AACxB,eAAO,CAAC,EACN,OAAQ,cAAc,GAAI,EAC1B,KAAM,CAAE,QAAS,kBAAmB,MAAM,GAAI,CAAE;AAAA,MACnD;AAAA,MACA,WAAW,CAAE,EAAE,KAAK,MAAO;AAC1B,eAAO,WAAY,EAAE,MAAM,MAAO,KAAK,KAAK,CAAE,OAAO,CAAE;AAAA,MACxD;AAAA,IACD,EAAI;AAAA,EACL;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-logo/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tcreateInterpolateElement,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tRangeControl,\n\tResizableBox,\n\tSpinner,\n\tToggleControl,\n\tToolbarButton,\n\tPlaceholder,\n\tButton,\n\tDropZone,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalImageEditor as ImageEditor,\n\tuseBlockEditingMode,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { crop, upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { MIN_SIZE } from '../image/constants';\nimport { MediaControl, MediaControlPreview } from '../utils/media-control';\nimport { unlock } from '../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst { mediaEditKey, openMediaEditorModalKey } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst SiteLogo = ( {\n\talt,\n\tattributes: { align, width, height, isLink, linkTarget, shouldSyncIcon },\n\tisSelected,\n\tsetAttributes,\n\tsetLogo,\n\tlogoUrl,\n\tsiteUrl,\n\tlogoId,\n\ticonId,\n\tsetIcon,\n\tcanUserEdit,\n} ) => {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst isResizable = ! isWideAligned && isLargeViewport;\n\tconst [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst { toggleSelection } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Check if we're in contentOnly mode\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isContentOnlyMode = blockEditingMode === 'contentOnly';\n\n\tconst {\n\t\timageEditing,\n\t\tmaxWidth,\n\t\ttitle,\n\t\teditMediaEntity,\n\t\topenMediaEditorModal,\n\t} = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\tconst siteEntities = select( coreStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t);\n\t\treturn {\n\t\t\ttitle: siteEntities?.name,\n\t\t\timageEditing: settings.imageEditing,\n\t\t\tmaxWidth: settings.maxWidth,\n\t\t\teditMediaEntity: settings?.[ mediaEditKey ],\n\t\t\topenMediaEditorModal: settings?.[ openMediaEditorModalKey ],\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Turn the `Use as site icon` toggle off if it is on but the logo and icon have\n\t\t// fallen out of sync. This can happen if the toggle is saved in the `on` position,\n\t\t// but changes are later made to the site icon in the Customizer.\n\t\tif ( shouldSyncIcon && logoId !== iconId ) {\n\t\t\tsetAttributes( { shouldSyncIcon: false } );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\tconst handleMediaUpdate = ( { id: newId } ) => {\n\t\tif ( typeof newId === 'number' && newId !== logoId ) {\n\t\t\tsetLogo( newId );\n\t\t}\n\t};\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tconst img = (\n\t\t<>\n\t\t\t<img\n\t\t\t\tclassName=\"custom-logo\"\n\t\t\t\tsrc={ logoUrl }\n\t\t\t\talt={ alt }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetNaturalSize( {\n\t\t\t\t\t\tnaturalWidth: event.target.naturalWidth,\n\t\t\t\t\t\tnaturalHeight: event.target.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isBlobURL( logoUrl ) && <Spinner /> }\n\t\t</>\n\t);\n\n\tlet imgWrapper = img;\n\tif ( isLink ) {\n\t\timgWrapper = (\n\t\t\t<a\n\t\t\t\thref={ siteUrl }\n\t\t\t\tclassName=\"custom-logo-link\"\n\t\t\t\trel=\"home\"\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</a>\n\t\t);\n\t}\n\n\tif ( ! isResizable || ! naturalWidth || ! naturalHeight ) {\n\t\treturn <div style={ { width, height } }>{ imgWrapper }</div>;\n\t}\n\n\t// Set the default width to a responsible size.\n\t// Note that this width is also set in the attached frontend CSS file.\n\tconst defaultWidth = 120;\n\n\tconst currentWidth = width || defaultWidth;\n\tconst ratio = naturalWidth / naturalHeight;\n\tconst currentHeight = currentWidth / ratio;\n\tconst minWidth =\n\t\tnaturalWidth < naturalHeight ? MIN_SIZE : Math.ceil( MIN_SIZE * ratio );\n\tconst minHeight =\n\t\tnaturalHeight < naturalWidth ? MIN_SIZE : Math.ceil( MIN_SIZE / ratio );\n\n\t// With the current implementation of ResizableBox, an image needs an\n\t// explicit pixel value for the max-width. In absence of being able to\n\t// set the content-width, this max-width is currently dictated by the\n\t// vanilla editor style. The following variable adds a buffer to this\n\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t// in most cases, allow you to scale the image beyond the width of the\n\t// main column, though not infinitely.\n\t// @todo It would be good to revisit this once a content-width variable\n\t// becomes available.\n\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\tlet showRightHandle = false;\n\tlet showLeftHandle = false;\n\n\t/* eslint-disable no-lonely-if */\n\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\tif ( align === 'center' ) {\n\t\t// When the image is centered, show both handles.\n\t\tshowRightHandle = true;\n\t\tshowLeftHandle = true;\n\t} else if ( isRTL() ) {\n\t\t// In RTL mode the image is on the right by default.\n\t\t// Show the right handle and hide the left handle only when it is\n\t\t// aligned left. Otherwise always show the left handle.\n\t\tif ( align === 'left' ) {\n\t\t\tshowRightHandle = true;\n\t\t} else {\n\t\t\tshowLeftHandle = true;\n\t\t}\n\t} else {\n\t\t// Show the left handle and hide the right handle only when the\n\t\t// image is aligned right. Otherwise always show the right handle.\n\t\tif ( align === 'right' ) {\n\t\t\tshowLeftHandle = true;\n\t\t} else {\n\t\t\tshowRightHandle = true;\n\t\t}\n\t}\n\t/* eslint-enable no-lonely-if */\n\n\tconst canEditImage =\n\t\tlogoId &&\n\t\tnaturalWidth &&\n\t\tnaturalHeight &&\n\t\timageEditing &&\n\t\t!! editMediaEntity;\n\n\t// Hide crop and dimensions editing in write mode\n\tconst shouldShowCropAndDimensions = ! isContentOnlyMode;\n\n\tlet imgEdit;\n\tif ( canEditImage && isEditingImage ) {\n\t\timgEdit = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ logoId }\n\t\t\t\turl={ logoUrl }\n\t\t\t\twidth={ currentWidth }\n\t\t\t\theight={ currentHeight }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) => {\n\t\t\t\t\tsetLogo( imageAttributes.id );\n\t\t\t\t} }\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// Always render ResizableBox but disable resize functionality in contentOnly mode\n\t\timgEdit = (\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\theight: currentHeight,\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected && shouldShowCropAndDimensions }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ imgWrapper }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\t// Support the previous location for the Site Icon settings. To be removed\n\t// when the required WP core version for Gutenberg is >= 6.5.0.\n\tconst shouldUseNewUrl = ! window?.__experimentalUseCustomizerSiteLogoUrl;\n\n\tconst siteIconSettingsUrl = shouldUseNewUrl\n\t\t? siteUrl + '/wp-admin/options-general.php'\n\t\t: siteUrl + '/wp-admin/customize.php?autofocus[section]=title_tagline';\n\n\tconst syncSiteIconHelpText = createInterpolateElement(\n\t\t__(\n\t\t\t'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the <a>Site Icon settings</a>.'\n\t\t),\n\t\t{\n\t\t\ta: (\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-no-target-blank\n\t\t\t\t<a\n\t\t\t\t\thref={ siteIconSettingsUrl }\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener\"\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\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\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Image width' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { width: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Image width' ) }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { width: newWidth } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ minWidth }\n\t\t\t\t\t\t\tmax={ maxWidthBuffer }\n\t\t\t\t\t\t\tinitialPosition={ Math.min(\n\t\t\t\t\t\t\t\tdefaultWidth,\n\t\t\t\t\t\t\t\tmaxWidthBuffer\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\t\t\tdisabled={ ! isResizable }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\t\tlabel={ __( 'Link image to home' ) }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: true } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Link image to home' ) }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => linkTarget === '_blank' }\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\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={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! shouldSyncIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use as Site Icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { shouldSyncIcon: false } );\n\t\t\t\t\t\t\t\tsetIcon( undefined );\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={ __( 'Use as Site Icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { shouldSyncIcon: value } );\n\t\t\t\t\t\t\t\t\tsetIcon( value ? logoId : undefined );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchecked={ !! shouldSyncIcon }\n\t\t\t\t\t\t\t\thelp={ syncSiteIconHelpText }\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</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ canEditImage &&\n\t\t\t\t! isEditingImage &&\n\t\t\t\tshouldShowCropAndDimensions && (\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\topenMediaEditorModal && logoId\n\t\t\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\t\t\topenMediaEditorModal( {\n\t\t\t\t\t\t\t\t\t\t\t\tid: logoId,\n\t\t\t\t\t\t\t\t\t\t\t\tonUpdate: handleMediaUpdate,\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t: () => setIsEditingImage( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t{ imgEdit }\n\t\t</>\n\t);\n};\n\nexport default function LogoEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tisSelected,\n} ) {\n\tconst { width, shouldSyncIcon } = attributes;\n\tconst {\n\t\tsiteLogoId,\n\t\tcanUserEdit,\n\t\turl,\n\t\tsiteIconId,\n\t\tmediaItemData,\n\t\tisRequestingMediaItem,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst _canUserEdit = canUser( 'update', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst siteSettings = _canUserEdit\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\t\tconst _siteLogoId = _canUserEdit\n\t\t\t? siteSettings?.site_logo\n\t\t\t: siteData?.site_logo;\n\t\tconst _siteIconId = siteSettings?.site_icon;\n\t\tconst mediaItem =\n\t\t\t_siteLogoId &&\n\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\t_siteLogoId,\n\t\t\t\t{\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t}\n\t\t\t);\n\t\tconst _isRequestingMediaItem =\n\t\t\t!! _siteLogoId &&\n\t\t\t! select( coreStore ).hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\t_siteLogoId,\n\t\t\t\t{ context: 'view' },\n\t\t\t] );\n\n\t\treturn {\n\t\t\tsiteLogoId: _siteLogoId,\n\t\t\tcanUserEdit: _canUserEdit,\n\t\t\turl: siteData?.home,\n\t\t\tmediaItemData: mediaItem,\n\t\t\tisRequestingMediaItem: _isRequestingMediaItem,\n\t\t\tsiteIconId: _siteIconId,\n\t\t};\n\t}, [] );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst setLogo = ( newValue, shouldForceSync = false ) => {\n\t\t// `shouldForceSync` is used to force syncing when the attribute\n\t\t// may not have updated yet.\n\t\tif ( shouldSyncIcon || shouldForceSync ) {\n\t\t\tsetIcon( newValue );\n\t\t}\n\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_logo: newValue,\n\t\t} );\n\t};\n\n\tconst setIcon = ( newValue ) =>\n\t\t// The new value needs to be `null` to reset the Site Icon.\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_icon: newValue ?? null,\n\t\t} );\n\n\tconst { alt_text: alt, source_url: logoUrl } = mediaItemData ?? {};\n\n\tconst onInitialSelectLogo = ( media ) => {\n\t\t// Initialize the syncSiteIcon toggle. If we currently have no Site logo and no\n\t\t// site icon, automatically sync the logo to the icon.\n\t\tif ( shouldSyncIcon === undefined ) {\n\t\t\tconst shouldForceSync = ! siteIconId;\n\t\t\tsetAttributes( { shouldSyncIcon: shouldForceSync } );\n\n\t\t\t// Because we cannot rely on the `shouldSyncIcon` attribute to have updated by\n\t\t\t// the time `setLogo` is called, pass an argument to force the syncing.\n\t\t\tonSelectLogo( media, shouldForceSync );\n\t\t\treturn;\n\t\t}\n\n\t\tonSelectLogo( media );\n\t};\n\n\tconst onSelectLogo = ( media, shouldForceSync = false ) => {\n\t\tif ( ! media ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media.id && media.url ) {\n\t\t\t// This is a temporary blob image.\n\t\t\tsetTemporaryURL( media.url );\n\t\t\tsetLogo( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\tsetLogo( media.id, shouldForceSync );\n\t};\n\n\tconst onRemoveLogo = () => {\n\t\tsetLogo( null );\n\t\tsetAttributes( { width: undefined } );\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetTemporaryURL( image.url );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonInitialSelectLogo( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t\tmultiple: false,\n\t\t} );\n\t};\n\n\tconst mediaReplaceFlowProps = {\n\t\tmediaURL: logoUrl,\n\t\tname: ! logoUrl ? __( 'Choose logo' ) : __( 'Replace' ),\n\t\tonSelect: onSelectLogo,\n\t\tonError: onUploadError,\n\t\tonReset: onRemoveLogo,\n\t};\n\tconst controls = canUserEdit && (\n\t\t<BlockControls group=\"other\">\n\t\t\t<MediaReplaceFlow\n\t\t\t\t{ ...mediaReplaceFlowProps }\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tvariant=\"toolbar\"\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tlet logoImage;\n\tconst isLoading = siteLogoId === undefined || isRequestingMediaItem;\n\tif ( isLoading ) {\n\t\tlogoImage = <Spinner />;\n\t}\n\n\t// Reset temporary url when logoUrl is available.\n\tuseEffect( () => {\n\t\tif ( logoUrl && temporaryURL ) {\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}, [ logoUrl, temporaryURL ] );\n\n\tif ( !! logoUrl || !! temporaryURL ) {\n\t\tlogoImage = (\n\t\t\t<>\n\t\t\t\t<SiteLogo\n\t\t\t\t\talt={ alt }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tlogoUrl={ temporaryURL || logoUrl }\n\t\t\t\t\tsetLogo={ setLogo }\n\t\t\t\t\tlogoId={ mediaItemData?.id || siteLogoId }\n\t\t\t\t\tsiteUrl={ url }\n\t\t\t\t\tsetIcon={ setIcon }\n\t\t\t\t\ticonId={ siteIconId }\n\t\t\t\t\tcanUserEdit={ canUserEdit }\n\t\t\t\t/>\n\t\t\t\t{ canUserEdit && <DropZone onFilesDrop={ onFilesDrop } /> }\n\t\t\t</>\n\t\t);\n\t}\n\tconst placeholder = ( content ) => {\n\t\tconst placeholderClassName = clsx(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tpreview={ logoImage }\n\t\t\t\twithIllustration\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst classes = clsx( className, {\n\t\t'is-default-size': ! width,\n\t\t'is-transient': temporaryURL,\n\t} );\n\n\tconst blockProps = useBlockProps( { className: classes } );\n\n\tconst mediaInspectorPanel = ( canUserEdit || logoUrl ) && (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Media' ) }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t{ ! canUserEdit ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-library-site-logo__inspector-media-replace-container\"\n\t\t\t\t\t\tstyle={ { gridColumn: '1 / -1' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaControlPreview\n\t\t\t\t\t\t\turl={ mediaItemData?.source_url }\n\t\t\t\t\t\t\tfilename={\n\t\t\t\t\t\t\t\tmediaItemData?.media_details?.sizes?.full\n\t\t\t\t\t\t\t\t\t?.file || mediaItemData?.slug\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\titemGroupProps={ {\n\t\t\t\t\t\t\t\tisBordered: true,\n\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t'block-library-site-logo__inspector-readonly-logo-preview',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName=\"block-library-site-logo__inspector-media-replace-title\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! logoUrl }\n\t\t\t\t\t\tlabel={ __( 'Logo' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaControl\n\t\t\t\t\t\t\tmediaId={ siteLogoId }\n\t\t\t\t\t\t\tmediaUrl={ logoUrl }\n\t\t\t\t\t\t\tfilename={\n\t\t\t\t\t\t\t\tmediaItemData?.media_details?.sizes?.full\n\t\t\t\t\t\t\t\t\t?.file || mediaItemData?.slug\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\tonSelect={ onSelectLogo }\n\t\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\t\tonReset={ onRemoveLogo }\n\t\t\t\t\t\t\tisUploading={ !! temporaryURL }\n\t\t\t\t\t\t\temptyLabel={ __( 'Logo' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\t\t\t{ mediaInspectorPanel }\n\t\t\t{ ( !! logoUrl || !! temporaryURL ) && logoImage }\n\t\t\t{ ( isLoading ||\n\t\t\t\t( ! temporaryURL && ! logoUrl && ! canUserEdit ) ) && (\n\t\t\t\t<Placeholder className=\"site-logo_placeholder\" withIllustration>\n\t\t\t\t\t{ isLoading && (\n\t\t\t\t\t\t<span className=\"components-placeholder__preview\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! isLoading && ! temporaryURL && ! logoUrl && canUserEdit && (\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\tonSelect={ onInitialSelectLogo }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Choose logo' ) }\n\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,IAAI,aAAa;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,wBAAwB;AACjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,6BAA6B;AAAA,EAC7B;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,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,gBACnC,oBAAC,eAAY,WAAU,yBAAwB,kBAAgB,MAC5D,uBACD,oBAAC,UAAK,WAAU,mCACf,8BAAC,WAAQ,GACV,GAEF;AAAA,IAEC,CAAE,aAAa,CAAE,gBAAgB,CAAE,WAAW,eAC/C;AAAA,MAAC;AAAA;AAAA,QACA,UAAW;AAAA,QACX,cAAe;AAAA,QACf,SAAU;AAAA,QACV;AAAA,QACA,oBAAqB,CAAE,EAAE,KAAK,MAAO;AACpC,iBACC;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,MAAO;AAAA,cACP,SAAQ;AAAA,cACR,OAAQ,GAAI,aAAc;AAAA,cAC1B,aAAW;AAAA,cACX,iBAAgB;AAAA,cAChB,SAAU,MAAM;AACf,qBAAK;AAAA,cACN;AAAA;AAAA,UACD;AAAA,QAEF;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tcreateInterpolateElement,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tRangeControl,\n\tResizableBox,\n\tSpinner,\n\tToggleControl,\n\tToolbarButton,\n\tPlaceholder,\n\tButton,\n\tDropZone,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalImageEditor as ImageEditor,\n\tuseBlockEditingMode,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { crop, upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { MIN_SIZE } from '../image/constants';\nimport { MediaControl, MediaControlPreview } from '../utils/media-control';\nimport { unlock } from '../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst { mediaEditKey, openMediaEditorModalKey } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst SiteLogo = ( {\n\talt,\n\tattributes: { align, width, height, isLink, linkTarget, shouldSyncIcon },\n\tisSelected,\n\tsetAttributes,\n\tsetLogo,\n\tlogoUrl,\n\tsiteUrl,\n\tlogoId,\n\ticonId,\n\tsetIcon,\n\tcanUserEdit,\n} ) => {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst isResizable = ! isWideAligned && isLargeViewport;\n\tconst [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst { toggleSelection } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Check if we're in contentOnly mode\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isContentOnlyMode = blockEditingMode === 'contentOnly';\n\n\tconst {\n\t\timageEditing,\n\t\tmaxWidth,\n\t\ttitle,\n\t\teditMediaEntity,\n\t\topenMediaEditorModal,\n\t} = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\tconst siteEntities = select( coreStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t);\n\t\treturn {\n\t\t\ttitle: siteEntities?.name,\n\t\t\timageEditing: settings.imageEditing,\n\t\t\tmaxWidth: settings.maxWidth,\n\t\t\teditMediaEntity: settings?.[ mediaEditKey ],\n\t\t\topenMediaEditorModal: settings?.[ openMediaEditorModalKey ],\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Turn the `Use as site icon` toggle off if it is on but the logo and icon have\n\t\t// fallen out of sync. This can happen if the toggle is saved in the `on` position,\n\t\t// but changes are later made to the site icon in the Customizer.\n\t\tif ( shouldSyncIcon && logoId !== iconId ) {\n\t\t\tsetAttributes( { shouldSyncIcon: false } );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\tconst handleMediaUpdate = ( { id: newId } ) => {\n\t\tif ( typeof newId === 'number' && newId !== logoId ) {\n\t\t\tsetLogo( newId );\n\t\t}\n\t};\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tconst img = (\n\t\t<>\n\t\t\t<img\n\t\t\t\tclassName=\"custom-logo\"\n\t\t\t\tsrc={ logoUrl }\n\t\t\t\talt={ alt }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetNaturalSize( {\n\t\t\t\t\t\tnaturalWidth: event.target.naturalWidth,\n\t\t\t\t\t\tnaturalHeight: event.target.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isBlobURL( logoUrl ) && <Spinner /> }\n\t\t</>\n\t);\n\n\tlet imgWrapper = img;\n\tif ( isLink ) {\n\t\timgWrapper = (\n\t\t\t<a\n\t\t\t\thref={ siteUrl }\n\t\t\t\tclassName=\"custom-logo-link\"\n\t\t\t\trel=\"home\"\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</a>\n\t\t);\n\t}\n\n\tif ( ! isResizable || ! naturalWidth || ! naturalHeight ) {\n\t\treturn <div style={ { width, height } }>{ imgWrapper }</div>;\n\t}\n\n\t// Set the default width to a responsible size.\n\t// Note that this width is also set in the attached frontend CSS file.\n\tconst defaultWidth = 120;\n\n\tconst currentWidth = width || defaultWidth;\n\tconst ratio = naturalWidth / naturalHeight;\n\tconst currentHeight = currentWidth / ratio;\n\tconst minWidth =\n\t\tnaturalWidth < naturalHeight ? MIN_SIZE : Math.ceil( MIN_SIZE * ratio );\n\tconst minHeight =\n\t\tnaturalHeight < naturalWidth ? MIN_SIZE : Math.ceil( MIN_SIZE / ratio );\n\n\t// With the current implementation of ResizableBox, an image needs an\n\t// explicit pixel value for the max-width. In absence of being able to\n\t// set the content-width, this max-width is currently dictated by the\n\t// vanilla editor style. The following variable adds a buffer to this\n\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t// in most cases, allow you to scale the image beyond the width of the\n\t// main column, though not infinitely.\n\t// @todo It would be good to revisit this once a content-width variable\n\t// becomes available.\n\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\tlet showRightHandle = false;\n\tlet showLeftHandle = false;\n\n\t/* eslint-disable no-lonely-if */\n\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\tif ( align === 'center' ) {\n\t\t// When the image is centered, show both handles.\n\t\tshowRightHandle = true;\n\t\tshowLeftHandle = true;\n\t} else if ( isRTL() ) {\n\t\t// In RTL mode the image is on the right by default.\n\t\t// Show the right handle and hide the left handle only when it is\n\t\t// aligned left. Otherwise always show the left handle.\n\t\tif ( align === 'left' ) {\n\t\t\tshowRightHandle = true;\n\t\t} else {\n\t\t\tshowLeftHandle = true;\n\t\t}\n\t} else {\n\t\t// Show the left handle and hide the right handle only when the\n\t\t// image is aligned right. Otherwise always show the right handle.\n\t\tif ( align === 'right' ) {\n\t\t\tshowLeftHandle = true;\n\t\t} else {\n\t\t\tshowRightHandle = true;\n\t\t}\n\t}\n\t/* eslint-enable no-lonely-if */\n\n\tconst canEditImage =\n\t\tlogoId &&\n\t\tnaturalWidth &&\n\t\tnaturalHeight &&\n\t\timageEditing &&\n\t\t!! editMediaEntity;\n\n\t// Hide crop and dimensions editing in write mode\n\tconst shouldShowCropAndDimensions = ! isContentOnlyMode;\n\n\tlet imgEdit;\n\tif ( canEditImage && isEditingImage ) {\n\t\timgEdit = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ logoId }\n\t\t\t\turl={ logoUrl }\n\t\t\t\twidth={ currentWidth }\n\t\t\t\theight={ currentHeight }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) => {\n\t\t\t\t\tsetLogo( imageAttributes.id );\n\t\t\t\t} }\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// Always render ResizableBox but disable resize functionality in contentOnly mode\n\t\timgEdit = (\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\theight: currentHeight,\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected && shouldShowCropAndDimensions }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ imgWrapper }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\t// Support the previous location for the Site Icon settings. To be removed\n\t// when the required WP core version for Gutenberg is >= 6.5.0.\n\tconst shouldUseNewUrl = ! window?.__experimentalUseCustomizerSiteLogoUrl;\n\n\tconst siteIconSettingsUrl = shouldUseNewUrl\n\t\t? siteUrl + '/wp-admin/options-general.php'\n\t\t: siteUrl + '/wp-admin/customize.php?autofocus[section]=title_tagline';\n\n\tconst syncSiteIconHelpText = createInterpolateElement(\n\t\t__(\n\t\t\t'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the <a>Site Icon settings</a>.'\n\t\t),\n\t\t{\n\t\t\ta: (\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-no-target-blank\n\t\t\t\t<a\n\t\t\t\t\thref={ siteIconSettingsUrl }\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener\"\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\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\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Image width' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { width: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Image width' ) }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { width: newWidth } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ minWidth }\n\t\t\t\t\t\t\tmax={ maxWidthBuffer }\n\t\t\t\t\t\t\tinitialPosition={ Math.min(\n\t\t\t\t\t\t\t\tdefaultWidth,\n\t\t\t\t\t\t\t\tmaxWidthBuffer\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\t\t\tdisabled={ ! isResizable }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\t\tlabel={ __( 'Link image to home' ) }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: true } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Link image to home' ) }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => linkTarget === '_blank' }\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\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={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! shouldSyncIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use as Site Icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { shouldSyncIcon: false } );\n\t\t\t\t\t\t\t\tsetIcon( undefined );\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={ __( 'Use as Site Icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { shouldSyncIcon: value } );\n\t\t\t\t\t\t\t\t\tsetIcon( value ? logoId : undefined );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchecked={ !! shouldSyncIcon }\n\t\t\t\t\t\t\t\thelp={ syncSiteIconHelpText }\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</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ canEditImage &&\n\t\t\t\t! isEditingImage &&\n\t\t\t\tshouldShowCropAndDimensions && (\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\topenMediaEditorModal && logoId\n\t\t\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\t\t\topenMediaEditorModal( {\n\t\t\t\t\t\t\t\t\t\t\t\tid: logoId,\n\t\t\t\t\t\t\t\t\t\t\t\tonUpdate: handleMediaUpdate,\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t: () => setIsEditingImage( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-haspopup={\n\t\t\t\t\t\t\t\topenMediaEditorModal && logoId\n\t\t\t\t\t\t\t\t\t? 'dialog'\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t{ imgEdit }\n\t\t</>\n\t);\n};\n\nexport default function LogoEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tisSelected,\n} ) {\n\tconst { width, shouldSyncIcon } = attributes;\n\tconst {\n\t\tsiteLogoId,\n\t\tcanUserEdit,\n\t\turl,\n\t\tsiteIconId,\n\t\tmediaItemData,\n\t\tisRequestingMediaItem,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst _canUserEdit = canUser( 'update', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst siteSettings = _canUserEdit\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\t\tconst _siteLogoId = _canUserEdit\n\t\t\t? siteSettings?.site_logo\n\t\t\t: siteData?.site_logo;\n\t\tconst _siteIconId = siteSettings?.site_icon;\n\t\tconst mediaItem =\n\t\t\t_siteLogoId &&\n\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\t_siteLogoId,\n\t\t\t\t{\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t}\n\t\t\t);\n\t\tconst _isRequestingMediaItem =\n\t\t\t!! _siteLogoId &&\n\t\t\t! select( coreStore ).hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\t_siteLogoId,\n\t\t\t\t{ context: 'view' },\n\t\t\t] );\n\n\t\treturn {\n\t\t\tsiteLogoId: _siteLogoId,\n\t\t\tcanUserEdit: _canUserEdit,\n\t\t\turl: siteData?.home,\n\t\t\tmediaItemData: mediaItem,\n\t\t\tisRequestingMediaItem: _isRequestingMediaItem,\n\t\t\tsiteIconId: _siteIconId,\n\t\t};\n\t}, [] );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst setLogo = ( newValue, shouldForceSync = false ) => {\n\t\t// `shouldForceSync` is used to force syncing when the attribute\n\t\t// may not have updated yet.\n\t\tif ( shouldSyncIcon || shouldForceSync ) {\n\t\t\tsetIcon( newValue );\n\t\t}\n\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_logo: newValue,\n\t\t} );\n\t};\n\n\tconst setIcon = ( newValue ) =>\n\t\t// The new value needs to be `null` to reset the Site Icon.\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tsite_icon: newValue ?? null,\n\t\t} );\n\n\tconst { alt_text: alt, source_url: logoUrl } = mediaItemData ?? {};\n\n\tconst onInitialSelectLogo = ( media ) => {\n\t\t// Initialize the syncSiteIcon toggle. If we currently have no Site logo and no\n\t\t// site icon, automatically sync the logo to the icon.\n\t\tif ( shouldSyncIcon === undefined ) {\n\t\t\tconst shouldForceSync = ! siteIconId;\n\t\t\tsetAttributes( { shouldSyncIcon: shouldForceSync } );\n\n\t\t\t// Because we cannot rely on the `shouldSyncIcon` attribute to have updated by\n\t\t\t// the time `setLogo` is called, pass an argument to force the syncing.\n\t\t\tonSelectLogo( media, shouldForceSync );\n\t\t\treturn;\n\t\t}\n\n\t\tonSelectLogo( media );\n\t};\n\n\tconst onSelectLogo = ( media, shouldForceSync = false ) => {\n\t\tif ( ! media ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media.id && media.url ) {\n\t\t\t// This is a temporary blob image.\n\t\t\tsetTemporaryURL( media.url );\n\t\t\tsetLogo( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\tsetLogo( media.id, shouldForceSync );\n\t};\n\n\tconst onRemoveLogo = () => {\n\t\tsetLogo( null );\n\t\tsetAttributes( { width: undefined } );\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetTemporaryURL( image.url );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonInitialSelectLogo( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t\tmultiple: false,\n\t\t} );\n\t};\n\n\tconst mediaReplaceFlowProps = {\n\t\tmediaURL: logoUrl,\n\t\tname: ! logoUrl ? __( 'Choose logo' ) : __( 'Replace' ),\n\t\tonSelect: onSelectLogo,\n\t\tonError: onUploadError,\n\t\tonReset: onRemoveLogo,\n\t};\n\tconst controls = canUserEdit && (\n\t\t<BlockControls group=\"other\">\n\t\t\t<MediaReplaceFlow\n\t\t\t\t{ ...mediaReplaceFlowProps }\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tvariant=\"toolbar\"\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tlet logoImage;\n\tconst isLoading = siteLogoId === undefined || isRequestingMediaItem;\n\tif ( isLoading ) {\n\t\tlogoImage = <Spinner />;\n\t}\n\n\t// Reset temporary url when logoUrl is available.\n\tuseEffect( () => {\n\t\tif ( logoUrl && temporaryURL ) {\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}, [ logoUrl, temporaryURL ] );\n\n\tif ( !! logoUrl || !! temporaryURL ) {\n\t\tlogoImage = (\n\t\t\t<>\n\t\t\t\t<SiteLogo\n\t\t\t\t\talt={ alt }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tlogoUrl={ temporaryURL || logoUrl }\n\t\t\t\t\tsetLogo={ setLogo }\n\t\t\t\t\tlogoId={ mediaItemData?.id || siteLogoId }\n\t\t\t\t\tsiteUrl={ url }\n\t\t\t\t\tsetIcon={ setIcon }\n\t\t\t\t\ticonId={ siteIconId }\n\t\t\t\t\tcanUserEdit={ canUserEdit }\n\t\t\t\t/>\n\t\t\t\t{ canUserEdit && <DropZone onFilesDrop={ onFilesDrop } /> }\n\t\t\t</>\n\t\t);\n\t}\n\tconst placeholder = ( content ) => {\n\t\tconst placeholderClassName = clsx(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tpreview={ logoImage }\n\t\t\t\twithIllustration\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst classes = clsx( className, {\n\t\t'is-default-size': ! width,\n\t\t'is-transient': temporaryURL,\n\t} );\n\n\tconst blockProps = useBlockProps( { className: classes } );\n\n\tconst mediaInspectorPanel = ( canUserEdit || logoUrl ) && (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Media' ) }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t{ ! canUserEdit ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-library-site-logo__inspector-media-replace-container\"\n\t\t\t\t\t\tstyle={ { gridColumn: '1 / -1' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaControlPreview\n\t\t\t\t\t\t\turl={ mediaItemData?.source_url }\n\t\t\t\t\t\t\tfilename={\n\t\t\t\t\t\t\t\tmediaItemData?.media_details?.sizes?.full\n\t\t\t\t\t\t\t\t\t?.file || mediaItemData?.slug\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\titemGroupProps={ {\n\t\t\t\t\t\t\t\tisBordered: true,\n\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t'block-library-site-logo__inspector-readonly-logo-preview',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName=\"block-library-site-logo__inspector-media-replace-title\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! logoUrl }\n\t\t\t\t\t\tlabel={ __( 'Logo' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaControl\n\t\t\t\t\t\t\tmediaId={ siteLogoId }\n\t\t\t\t\t\t\tmediaUrl={ logoUrl }\n\t\t\t\t\t\t\tfilename={\n\t\t\t\t\t\t\t\tmediaItemData?.media_details?.sizes?.full\n\t\t\t\t\t\t\t\t\t?.file || mediaItemData?.slug\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\tonSelect={ onSelectLogo }\n\t\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\t\tonReset={ onRemoveLogo }\n\t\t\t\t\t\t\tisUploading={ !! temporaryURL }\n\t\t\t\t\t\t\temptyLabel={ __( 'Logo' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\t\t\t{ mediaInspectorPanel }\n\t\t\t{ ( !! logoUrl || !! temporaryURL ) && logoImage }\n\t\t\t{ ( isLoading ||\n\t\t\t\t( ! temporaryURL && ! logoUrl && ! canUserEdit ) ) && (\n\t\t\t\t<Placeholder className=\"site-logo_placeholder\" withIllustration>\n\t\t\t\t\t{ isLoading && (\n\t\t\t\t\t\t<span className=\"components-placeholder__preview\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! isLoading && ! temporaryURL && ! logoUrl && canUserEdit && (\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\tonSelect={ onInitialSelectLogo }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Choose logo' ) }\n\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,IAAI,aAAa;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EAC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QAAQ,eAAe;AAAA,cAE3B,cAAe;AAAA,cACf,UAAW;AAAA,cACX,SAAU;AAAA,cACV,SAAU;AAAA,cACV,aAAc,CAAC,CAAE;AAAA,cACjB,YAAa,GAAI,MAAO;AAAA;AAAA,UACzB;AAAA;AAAA,MACD;AAAA;AAAA,EAEF,GACD;AAGD,SACC,qBAAC,SAAM,GAAG,YACP;AAAA;AAAA,IACA;AAAA,KACE,CAAC,CAAE,WAAW,CAAC,CAAE,iBAAkB;AAAA,KACnC,aACD,CAAE,gBAAgB,CAAE,WAAW,CAAE,gBACnC,oBAAC,eAAY,WAAU,yBAAwB,kBAAgB,MAC5D,uBACD,oBAAC,UAAK,WAAU,mCACf,8BAAC,WAAQ,GACV,GAEF;AAAA,IAEC,CAAE,aAAa,CAAE,gBAAgB,CAAE,WAAW,eAC/C;AAAA,MAAC;AAAA;AAAA,QACA,UAAW;AAAA,QACX,cAAe;AAAA,QACf,SAAU;AAAA,QACV;AAAA,QACA,oBAAqB,CAAE,EAAE,KAAK,MAAO;AACpC,iBACC;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,MAAO;AAAA,cACP,SAAQ;AAAA,cACR,OAAQ,GAAI,aAAc;AAAA,cAC1B,aAAW;AAAA,cACX,iBAAgB;AAAA,cAChB,SAAU,MAAM;AACf,qBAAK;AAAA,cACN;AAAA;AAAA,UACD;AAAA,QAEF;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
__experimentalUseBorderProps as useBorderProps,
|
|
19
19
|
useBlockEditingMode
|
|
20
20
|
} from "@wordpress/block-editor";
|
|
21
|
-
import { __ } from "@wordpress/i18n";
|
|
21
|
+
import { __, _x } from "@wordpress/i18n";
|
|
22
22
|
import {
|
|
23
23
|
Button,
|
|
24
24
|
Placeholder,
|
|
@@ -79,8 +79,8 @@ var cellAriaLabel = {
|
|
|
79
79
|
foot: __("Footer cell text")
|
|
80
80
|
};
|
|
81
81
|
var placeholder = {
|
|
82
|
-
head:
|
|
83
|
-
foot:
|
|
82
|
+
head: _x("Header label", "table header"),
|
|
83
|
+
foot: _x("Footer label", "table footer")
|
|
84
84
|
};
|
|
85
85
|
function TSection({ name, ...props }) {
|
|
86
86
|
const TagName = `t${name}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/table/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tmemo,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\nimport { Caption } from '../utils/caption';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: __( 'Header label' ),\n\tfoot: __( 'Footer label' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected: isSingleSelected,\n} ) {\n\tconst { hasFixedLayout, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tconst onChange = useCallback(\n\t\tfunction ( content ) {\n\t\t\tif ( ! selectedCell ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetAttributes( ( currentAttributes ) =>\n\t\t\t\tupdateSelectedCell(\n\t\t\t\t\tcurrentAttributes,\n\t\t\t\t\tselectedCell,\n\t\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t\t...cellAttributes,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t} )\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ selectedCell, setAttributes ]\n\t);\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string | undefined} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSingleSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSingleSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td div[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = sections.map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map( ( cellProps, columnIndex ) => {\n\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\tselectedCell?.sectionName === name &&\n\t\t\t\t\t\t\tselectedCell?.rowIndex === rowIndex &&\n\t\t\t\t\t\t\tselectedCell?.columnIndex === columnIndex;\n\n\t\t\t\t\t\t// Important - the Cell component is memoized to improve typing performance.\n\t\t\t\t\t\t// ensure all props passed have stable references.\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\trowIndex={ rowIndex }\n\t\t\t\t\t\t\t\tcolumnIndex={ columnIndex }\n\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t// Only pass the `onChange` handler to the selectedCell.\n\t\t\t\t\t\t\t\t\t// Cell components are memoized, so it's best to avoid\n\t\t\t\t\t\t\t\t\t// passing in a value that will cause all cells to re-render\n\t\t\t\t\t\t\t\t\t// whenever it changes.\n\t\t\t\t\t\t\t\t\tisSelected ? onChange : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetSelectedCell={ setSelectedCell }\n\t\t\t\t\t\t\t\t{ ...cellProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Change column alignment' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\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\thasFixedLayout: true,\n\t\t\t\t\t\t\thead: [],\n\t\t\t\t\t\t\tfoot: [],\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\thasValue={ () => hasFixedLayout !== true }\n\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { hasFixedLayout: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => head && head.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { head: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => foot && foot.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { foot: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ isEmpty ? (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) : (\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Table caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSelected && blockEditingMode === 'default'\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nconst Cell = memo( function ( {\n\ttag: CellTag,\n\tname,\n\tscope,\n\tcolspan,\n\trowspan,\n\trowIndex,\n\tcolumnIndex,\n\talign,\n\tcontent,\n\tonChange,\n\tsetSelectedCell,\n} ) {\n\treturn (\n\t\t<CellTag\n\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\tcolSpan={ colspan }\n\t\t\trowSpan={ rowspan }\n\t\t\tclassName={ clsx(\n\t\t\t\t{\n\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t},\n\t\t\t\t'wp-block-table__cell-content'\n\t\t\t) }\n\t\t>\n\t\t\t<RichText\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonFocus={ () => {\n\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\ttype: 'cell',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\tplaceholder={ placeholder[ name ] }\n\t\t\t/>\n\t\t</CellTag>\n\t);\n} );\n\nexport default TableEdit;\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,+BAA+B;AAAA,EAC/B,gCAAgC;AAAA,EAChC;AAAA,OACM;AACP,SAAS,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tmemo,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\nimport { Caption } from '../utils/caption';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: _x( 'Header label', 'table header' ),\n\tfoot: _x( 'Footer label', 'table footer' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected: isSingleSelected,\n} ) {\n\tconst { hasFixedLayout, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tconst onChange = useCallback(\n\t\tfunction ( content ) {\n\t\t\tif ( ! selectedCell ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetAttributes( ( currentAttributes ) =>\n\t\t\t\tupdateSelectedCell(\n\t\t\t\t\tcurrentAttributes,\n\t\t\t\t\tselectedCell,\n\t\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t\t...cellAttributes,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t} )\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ selectedCell, setAttributes ]\n\t);\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string | undefined} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSingleSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSingleSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td div[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = sections.map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map( ( cellProps, columnIndex ) => {\n\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\tselectedCell?.sectionName === name &&\n\t\t\t\t\t\t\tselectedCell?.rowIndex === rowIndex &&\n\t\t\t\t\t\t\tselectedCell?.columnIndex === columnIndex;\n\n\t\t\t\t\t\t// Important - the Cell component is memoized to improve typing performance.\n\t\t\t\t\t\t// ensure all props passed have stable references.\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\trowIndex={ rowIndex }\n\t\t\t\t\t\t\t\tcolumnIndex={ columnIndex }\n\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t// Only pass the `onChange` handler to the selectedCell.\n\t\t\t\t\t\t\t\t\t// Cell components are memoized, so it's best to avoid\n\t\t\t\t\t\t\t\t\t// passing in a value that will cause all cells to re-render\n\t\t\t\t\t\t\t\t\t// whenever it changes.\n\t\t\t\t\t\t\t\t\tisSelected ? onChange : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetSelectedCell={ setSelectedCell }\n\t\t\t\t\t\t\t\t{ ...cellProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Change column alignment' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\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\thasFixedLayout: true,\n\t\t\t\t\t\t\thead: [],\n\t\t\t\t\t\t\tfoot: [],\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\thasValue={ () => hasFixedLayout !== true }\n\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { hasFixedLayout: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => head && head.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { head: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => foot && foot.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { foot: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ isEmpty ? (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) : (\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Table caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSelected && blockEditingMode === 'default'\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nconst Cell = memo( function ( {\n\ttag: CellTag,\n\tname,\n\tscope,\n\tcolspan,\n\trowspan,\n\trowIndex,\n\tcolumnIndex,\n\talign,\n\tcontent,\n\tonChange,\n\tsetSelectedCell,\n} ) {\n\treturn (\n\t\t<CellTag\n\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\tcolSpan={ colspan }\n\t\t\trowSpan={ rowspan }\n\t\t\tclassName={ clsx(\n\t\t\t\t{\n\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t},\n\t\t\t\t'wp-block-table__cell-content'\n\t\t\t) }\n\t\t>\n\t\t\t<RichText\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonFocus={ () => {\n\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\ttype: 'cell',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\tplaceholder={ placeholder[ name ] }\n\t\t\t/>\n\t\t</CellTag>\n\t);\n} );\n\nexport default TableEdit;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,+BAA+B;AAAA,EAC/B,gCAAgC;AAAA,EAChC;AAAA,OACM;AACP,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iCAAiC;AAAA,EACjC,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,eAAe;AACxB,SAAS,sCAAsC;AAiCvC,SAmWJ,UAnWI,KAmWJ,YAnWI;AA/BR,IAAM,qBAAqB;AAAA,EAC1B;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,mBAAoB;AAAA,IAC/B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,qBAAsB;AAAA,IACjC,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,oBAAqB;AAAA,IAChC,OAAO;AAAA,EACR;AACD;AAEA,IAAM,gBAAgB;AAAA,EACrB,MAAM,GAAI,kBAAmB;AAAA,EAC7B,MAAM,GAAI,gBAAiB;AAAA,EAC3B,MAAM,GAAI,kBAAmB;AAC9B;AAE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KAAI;AAAA,kBACJ,WAAU;AAAA;AAAA,cACX;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,aAAI,cAAe;AAAA;AAAA,cACtB;AAAA;AAAA;AAAA,QACD;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAa;AAAA,QACb;AAAA,QACA,OAAQ,GAAI,oBAAqB;AAAA,QACjC,mBACC,oBAAoB,qBAAqB;AAAA;AAAA,IAE3C;AAAA,KAEF;AAEF;AAEA,IAAM,OAAO,KAAM,SAAW;AAAA,EAC7B,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,YAAY,OAAO,QAAQ;AAAA,MACnC,SAAU;AAAA,MACV,SAAU;AAAA,MACV,WAAY;AAAA,QACX;AAAA,UACC,CAAE,kBAAmB,KAAM,EAAG,GAAG;AAAA,QAClC;AAAA,QACA;AAAA,MACD;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ;AAAA,UACR;AAAA,UACA,SAAU,MAAM;AACf,4BAAiB;AAAA,cAChB,aAAa;AAAA,cACb;AAAA,cACA;AAAA,cACA,MAAM;AAAA,YACP,CAAE;AAAA,UACH;AAAA,UACA,cAAa,cAAe,IAAK;AAAA,UACjC,aAAc,YAAa,IAAK;AAAA;AAAA,MACjC;AAAA;AAAA,EACD;AAEF,CAAE;AAEF,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ import type { MouseEvent, ReactElement } from 'react';
|
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
8
|
import type { NestedHeadingData } from './utils';
|
|
9
|
-
export default function TableOfContentsList({ nestedHeadingList, disableLinkActivation, onClick, ordered
|
|
9
|
+
export default function TableOfContentsList({ nestedHeadingList, disableLinkActivation, onClick, ordered }: {
|
|
10
10
|
nestedHeadingList: NestedHeadingData[];
|
|
11
11
|
disableLinkActivation?: boolean;
|
|
12
12
|
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/table-of-contents/list.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,EACP,OAAc,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/table-of-contents/list.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,EACP,OAAc,EACd,EAAE;IACF,iBAAiB,EAAE,iBAAiB,EAAE,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,CAAE,KAAK,EAAE,UAAU,CAAE,iBAAiB,CAAE,KAAM,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,GAAI,YAAY,CAmDhB"}
|