@wordpress/block-library 9.33.1-next.b8c8708f3.0 → 9.33.1
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/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/build/breadcrumbs/block.json +8 -2
- package/build/breadcrumbs/edit.js +113 -12
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/buttons/transforms.js +7 -7
- package/build/buttons/transforms.js.map +2 -2
- package/build/code/transforms.js +19 -15
- package/build/code/transforms.js.map +2 -2
- package/build/heading/index.js +1 -3
- package/build/heading/index.js.map +3 -3
- package/build/heading/transforms.js +22 -20
- package/build/heading/transforms.js.map +2 -2
- package/build/index.js +5 -1
- package/build/index.js.map +2 -2
- package/build/math/block.json +21 -0
- package/build/math/edit.js +132 -0
- package/build/math/edit.js.map +7 -0
- package/build/math/index.js +63 -0
- package/build/math/index.js.map +7 -0
- package/build/math/init.js +35 -0
- package/build/math/init.js.map +7 -0
- package/build/math/save.js +40 -0
- package/build/math/save.js.map +7 -0
- package/build/navigation/edit/menu-inspector-controls.js +3 -3
- package/build/navigation/edit/menu-inspector-controls.js.map +2 -2
- package/build/navigation-link/edit.js +6 -3
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/link-ui/index.js +1 -1
- package/build/navigation-link/link-ui/index.js.map +2 -2
- package/build/navigation-link/shared/controls.js +4 -1
- package/build/navigation-link/shared/controls.js.map +3 -3
- package/build/navigation-link/shared/index.js +2 -0
- package/build/navigation-link/shared/index.js.map +2 -2
- package/build/navigation-link/shared/update-attributes.js +3 -1
- package/build/navigation-link/shared/update-attributes.js.map +2 -2
- package/build/navigation-link/shared/use-entity-binding.js +46 -13
- package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build/navigation-submenu/edit.js +6 -3
- package/build/navigation-submenu/edit.js.map +2 -2
- package/build/page-list/use-convert-to-navigation-links.js +6 -1
- package/build/page-list/use-convert-to-navigation-links.js.map +2 -2
- package/build/paragraph/index.js +1 -3
- package/build/paragraph/index.js.map +3 -3
- package/build/post-date/deprecated.js +98 -2
- package/build/post-date/deprecated.js.map +2 -2
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/variations.js +4 -4
- package/build/post-date/variations.js.map +2 -2
- package/build/term-template/edit.js +4 -1
- package/build/term-template/edit.js.map +2 -2
- package/build/utils/get-transformed-attributes.js +82 -0
- package/build/utils/get-transformed-attributes.js.map +7 -0
- package/build-module/breadcrumbs/block.json +8 -2
- package/build-module/breadcrumbs/edit.js +117 -14
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/buttons/transforms.js +7 -7
- package/build-module/buttons/transforms.js.map +2 -2
- package/build-module/code/transforms.js +19 -15
- package/build-module/code/transforms.js.map +2 -2
- package/build-module/heading/index.js +1 -3
- package/build-module/heading/index.js.map +2 -2
- package/build-module/heading/transforms.js +22 -20
- package/build-module/heading/transforms.js.map +2 -2
- package/build-module/index.js +5 -1
- package/build-module/index.js.map +2 -2
- package/build-module/math/block.json +21 -0
- package/build-module/math/edit.js +110 -0
- package/build-module/math/edit.js.map +7 -0
- package/build-module/math/index.js +26 -0
- package/build-module/math/index.js.map +7 -0
- package/build-module/math/init.js +8 -0
- package/build-module/math/init.js.map +7 -0
- package/build-module/math/save.js +20 -0
- package/build-module/math/save.js.map +7 -0
- package/build-module/navigation/edit/menu-inspector-controls.js +3 -3
- package/build-module/navigation/edit/menu-inspector-controls.js.map +2 -2
- package/build-module/navigation-link/edit.js +6 -3
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/link-ui/index.js +1 -1
- package/build-module/navigation-link/link-ui/index.js.map +2 -2
- package/build-module/navigation-link/shared/controls.js +4 -1
- package/build-module/navigation-link/shared/controls.js.map +2 -2
- package/build-module/navigation-link/shared/index.js +5 -1
- package/build-module/navigation-link/shared/index.js.map +2 -2
- package/build-module/navigation-link/shared/update-attributes.js +3 -1
- package/build-module/navigation-link/shared/update-attributes.js.map +2 -2
- package/build-module/navigation-link/shared/use-entity-binding.js +45 -13
- package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build-module/navigation-submenu/edit.js +6 -3
- package/build-module/navigation-submenu/edit.js.map +2 -2
- package/build-module/page-list/use-convert-to-navigation-links.js +6 -1
- package/build-module/page-list/use-convert-to-navigation-links.js.map +2 -2
- package/build-module/paragraph/index.js +1 -3
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/post-date/deprecated.js +98 -2
- package/build-module/post-date/deprecated.js.map +2 -2
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/variations.js +4 -4
- package/build-module/post-date/variations.js.map +2 -2
- package/build-module/term-template/edit.js +4 -1
- package/build-module/term-template/edit.js.map +2 -2
- package/build-module/utils/get-transformed-attributes.js +58 -0
- package/build-module/utils/get-transformed-attributes.js.map +7 -0
- package/package.json +61 -36
- package/src/breadcrumbs/block.json +8 -2
- package/src/breadcrumbs/edit.js +163 -18
- package/src/breadcrumbs/index.php +118 -16
- package/src/buttons/transforms.js +6 -6
- package/src/code/transforms.js +16 -14
- package/src/heading/index.js +0 -2
- package/src/heading/transforms.js +25 -24
- package/src/index.js +6 -1
- package/src/math/block.json +21 -0
- package/src/math/edit.js +123 -0
- package/src/math/index.js +31 -0
- package/src/math/init.js +4 -0
- package/src/math/save.js +20 -0
- package/src/navigation/edit/menu-inspector-controls.js +8 -7
- package/src/navigation-link/edit.js +6 -3
- package/src/navigation-link/index.php +4 -18
- package/src/navigation-link/link-ui/index.js +4 -2
- package/src/navigation-link/shared/controls.js +12 -3
- package/src/navigation-link/shared/index.js +4 -1
- package/src/navigation-link/shared/test/update-attributes.test.js +8 -0
- package/src/navigation-link/shared/test/use-entity-binding.js +132 -17
- package/src/navigation-link/shared/update-attributes.js +1 -0
- package/src/navigation-link/shared/use-entity-binding.js +74 -19
- package/src/navigation-submenu/edit.js +6 -3
- package/src/navigation-submenu/index.php +3 -17
- package/src/page-list/test/{convert-to-links-modal.js → convert-to-navigation-links.js} +67 -0
- package/src/page-list/use-convert-to-navigation-links.js +11 -1
- package/src/paragraph/index.js +0 -2
- package/src/post-date/deprecated.js +100 -2
- package/src/post-date/edit.js +1 -1
- package/src/post-date/index.php +3 -3
- package/src/post-date/variations.js +5 -4
- package/src/term-template/edit.js +4 -1
- package/src/term-template/index.php +4 -6
- package/src/utils/get-transformed-attributes.js +98 -0
- package/tsconfig.json +1 -0
- package/build/heading/variations.js +0 -48
- package/build/heading/variations.js.map +0 -7
- package/build/paragraph/variations.js +0 -48
- package/build/paragraph/variations.js.map +0 -7
- package/build/utils/get-transformed-metadata.js +0 -59
- package/build/utils/get-transformed-metadata.js.map +0 -7
- package/build-module/heading/variations.js +0 -28
- package/build-module/heading/variations.js.map +0 -7
- package/build-module/paragraph/variations.js +0 -28
- package/build-module/paragraph/variations.js.map +0 -7
- package/build-module/utils/get-transformed-metadata.js +0 -35
- package/build-module/utils/get-transformed-metadata.js.map +0 -7
- package/src/heading/variations.js +0 -29
- package/src/paragraph/variations.js +0 -29
- package/src/utils/get-transformed-metadata.js +0 -60
package/build/index.js.map
CHANGED
|
@@ -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 { 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 */\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 image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\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 pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\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 table from './table';\nimport * as tableOfContents from './table-of-contents';\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\tbreadcrumbs,\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\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\tlogInOut,\n\t\ttermCount,\n\t\ttermDescription,\n\t\ttermName,\n\t\ttermsQuery,\n\t\ttermTemplate,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\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\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\t\t\tconst bootstrappedApiVersion = bootstrappedBlockType.apiVersion;\n\n\t\t\tregisterBlockType( blockName, {\n\t\t\t\ttitle: blockName,\n\t\t\t\t...( bootstrappedApiVersion < 3 && { apiVersion: 3 } ),\n\t\t\t\tedit: function Edit( { attributes } ) {\n\t\t\t\t\tconst blockProps = useBlockProps();\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<div\n\t\t\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: content || '',\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\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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 { 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 */\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 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 pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\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 table from './table';\nimport * as tableOfContents from './table-of-contents';\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\tlogInOut,\n\t\ttermCount,\n\t\ttermDescription,\n\t\ttermName,\n\t\ttermsQuery,\n\t\ttermTemplate,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\n\t];\n\n\tif ( window?.__experimentalEnableBlockExperiments ) {\n\t\tblocks.push( breadcrumbs );\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\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\t\t\tconst bootstrappedApiVersion = bootstrappedBlockType.apiVersion;\n\n\t\t\tregisterBlockType( blockName, {\n\t\t\t\ttitle: blockName,\n\t\t\t\t...( bootstrappedApiVersion < 3 && { apiVersion: 3 } ),\n\t\t\t\tedit: function Edit( { attributes } ) {\n\t\t\t\t\tconst blockProps = useBlockProps();\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<div\n\t\t\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: content || '',\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\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0VO;AAvVP,oBAOO;AACP,kBAAuB;AACvB,0BAA8B;AAC9B,gCAAoC;AACpC,kBAA4B;AAc5B,gBAA2B;AAC3B,oBAA+B;AAC/B,uBAAkC;AAClC,qBAAgC;AAChC,eAA0B;AAC1B,aAAwB;AACxB,YAAuB;AACvB,kBAA6B;AAC7B,aAAwB;AACxB,cAAyB;AACzB,eAA0B;AAC1B,iBAA4B;AAC5B,cAAyB;AACzB,WAAsB;AACtB,aAAwB;AACxB,cAAyB;AACzB,eAA0B;AAC1B,0BAAqC;AACrC,wBAAmC;AACnC,qBAAgC;AAChC,kBAA6B;AAC7B,sBAAiC;AACjC,uBAAkC;AAClC,sBAAiC;AACjC,iCAA4C;AAC5C,yBAAoC;AACpC,6BAAwC;AACxC,gCAA2C;AAC3C,oBAA+B;AAC/B,YAAuB;AACvB,cAAyB;AACzB,YAAuB;AACvB,WAAsB;AACtB,WAAsB;AACtB,gBAA2B;AAC3B,uBAAkC;AAClC,iCAA4C;AAC5C,cAAyB;AACzB,YAAuB;AACvB,cAAyB;AACzB,eAA0B;AAC1B,WAAsB;AACtB,YAAuB;AACvB,qBAAgC;AAChC,kBAA6B;AAC7B,WAAsB;AACtB,WAAsB;AACtB,eAA0B;AAC1B,eAA0B;AAC1B,gBAA2B;AAC3B,cAAyB;AACzB,WAAsB;AACtB,iBAA4B;AAC5B,qBAAgC;AAChC,wBAAmC;AACnC,eAA0B;AAC1B,cAAyB;AACzB,eAA0B;AAC1B,mBAA8B;AAC9B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AAK,GAClD;AACD,qDAA+B,QAAQ,IAAK;AAAA,EAC7C;AACA,oDAAgC,QAAQ,IAAK;AAC7C,0CAAsB,MAAM,IAAK;AAClC;AAaO,MAAM,+CACZ,WAAW,sBACR,CAAE,EAAE,gBAAgB,IAAI,CAAC,MAAO;AAChC,QAAM,qBAAqB,CAAE,kBAAkB,QAAQ,IAAK;AAC5D,eAAa,EACX;AAAA,IAAQ,CAAE,EAAE,SAAS,UACrB,sCAAAD,SAA6B,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": ["isBlockMetadataExperimental", "blocksStore"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
+
"apiVersion": 3,
|
|
4
|
+
"name": "core/math",
|
|
5
|
+
"title": "Math",
|
|
6
|
+
"category": "text",
|
|
7
|
+
"description": "Display mathematical notation using LaTeX.",
|
|
8
|
+
"keywords": [ "equation", "formula", "latex", "mathematics" ],
|
|
9
|
+
"textdomain": "default",
|
|
10
|
+
"attributes": {
|
|
11
|
+
"latex": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"role": "content"
|
|
14
|
+
},
|
|
15
|
+
"mathML": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"source": "html",
|
|
18
|
+
"selector": "math"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var edit_exports = {};
|
|
30
|
+
__export(edit_exports, {
|
|
31
|
+
default: () => MathEdit
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(edit_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_i18n = require("@wordpress/i18n");
|
|
36
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
37
|
+
var import_components = require("@wordpress/components");
|
|
38
|
+
var import_element = require("@wordpress/element");
|
|
39
|
+
var import_data = require("@wordpress/data");
|
|
40
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
41
|
+
const { Badge } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
42
|
+
function MathEdit({ attributes, setAttributes, isSelected }) {
|
|
43
|
+
const { latex } = attributes;
|
|
44
|
+
const [blockRef, setBlockRef] = (0, import_element.useState)();
|
|
45
|
+
const [error, setError] = (0, import_element.useState)(null);
|
|
46
|
+
const [latexToMathML, setLatexToMathML] = (0, import_element.useState)();
|
|
47
|
+
const initialLatex = (0, import_element.useRef)(attributes.latex);
|
|
48
|
+
const { __unstableMarkNextChangeAsNotPersistent } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
49
|
+
(0, import_element.useEffect)(() => {
|
|
50
|
+
import("@wordpress/latex-to-mathml").then((module2) => {
|
|
51
|
+
setLatexToMathML(() => module2.default);
|
|
52
|
+
if (initialLatex.current) {
|
|
53
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
54
|
+
setAttributes({
|
|
55
|
+
mathML: module2.default(initialLatex.current, {
|
|
56
|
+
displayMode: true
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}, [
|
|
62
|
+
initialLatex,
|
|
63
|
+
setAttributes,
|
|
64
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
65
|
+
]);
|
|
66
|
+
const blockProps = (0, import_block_editor.useBlockProps)({
|
|
67
|
+
ref: setBlockRef,
|
|
68
|
+
position: "relative"
|
|
69
|
+
});
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...blockProps, children: [
|
|
71
|
+
attributes.mathML ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
"math",
|
|
73
|
+
{
|
|
74
|
+
display: "block",
|
|
75
|
+
dangerouslySetInnerHTML: { __html: attributes.mathML }
|
|
76
|
+
}
|
|
77
|
+
) : "\u200B",
|
|
78
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
+
import_components.Popover,
|
|
80
|
+
{
|
|
81
|
+
placement: "bottom-start",
|
|
82
|
+
offset: 8,
|
|
83
|
+
anchor: blockRef,
|
|
84
|
+
focusOnMount: "firstContentElement",
|
|
85
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "4px", minWidth: "300px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 1, children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
import_components.TextareaControl,
|
|
88
|
+
{
|
|
89
|
+
__nextHasNoMarginBottom: true,
|
|
90
|
+
__next40pxDefaultSize: true,
|
|
91
|
+
label: (0, import_i18n.__)("LaTeX math syntax"),
|
|
92
|
+
hideLabelFromVision: true,
|
|
93
|
+
value: latex,
|
|
94
|
+
onChange: (newLatex) => {
|
|
95
|
+
if (!latexToMathML) {
|
|
96
|
+
setAttributes({ latex: newLatex });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let mathML = "";
|
|
100
|
+
try {
|
|
101
|
+
mathML = latexToMathML(newLatex, {
|
|
102
|
+
displayMode: true
|
|
103
|
+
});
|
|
104
|
+
setError(null);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
setError(err.message);
|
|
107
|
+
}
|
|
108
|
+
setAttributes({
|
|
109
|
+
mathML,
|
|
110
|
+
latex: newLatex
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
placeholder: (0, import_i18n.__)("e.g., x^2, \\frac{a}{b}")
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
118
|
+
Badge,
|
|
119
|
+
{
|
|
120
|
+
intent: "error",
|
|
121
|
+
className: "wp-block-math__error",
|
|
122
|
+
children: error
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: ".wp-block-math__error .components-badge__content{white-space:normal}" })
|
|
126
|
+
] })
|
|
127
|
+
] }) })
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/math/edit.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tTextareaControl,\n\tPopover,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nexport default function MathEdit( { attributes, setAttributes, isSelected } ) {\n\tconst { latex } = attributes;\n\tconst [ blockRef, setBlockRef ] = useState();\n\tconst [ error, setError ] = useState( null );\n\tconst [ latexToMathML, setLatexToMathML ] = useState();\n\tconst initialLatex = useRef( attributes.latex );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\timport( '@wordpress/latex-to-mathml' ).then( ( module ) => {\n\t\t\tsetLatexToMathML( () => module.default );\n\t\t\tif ( initialLatex.current ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tmathML: module.default( initialLatex.current, {\n\t\t\t\t\t\tdisplayMode: true,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tinitialLatex,\n\t\tsetAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\tconst blockProps = useBlockProps( {\n\t\tref: setBlockRef,\n\t\tposition: 'relative',\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ attributes.mathML ? (\n\t\t\t\t<math\n\t\t\t\t\t// We can't spread block props on the math element because\n\t\t\t\t\t// it only supports a limited amount of global attributes.\n\t\t\t\t\t// For example, draggable will have no effect.\n\t\t\t\t\tdisplay=\"block\"\n\t\t\t\t\tdangerouslySetInnerHTML={ { __html: attributes.mathML } }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t'\\u200B'\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\toffset={ 8 }\n\t\t\t\t\tanchor={ blockRef }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t>\n\t\t\t\t\t<div style={ { padding: '4px', minWidth: '300px' } }>\n\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'LaTeX math syntax' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tvalue={ latex }\n\t\t\t\t\t\t\t\tonChange={ ( newLatex ) => {\n\t\t\t\t\t\t\t\t\tif ( ! latexToMathML ) {\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { latex: newLatex } );\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlet mathML = '';\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tmathML = latexToMathML( newLatex, {\n\t\t\t\t\t\t\t\t\t\t\tdisplayMode: true,\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\tsetError( null );\n\t\t\t\t\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\t\t\t\t\tsetError( err.message );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tmathML,\n\t\t\t\t\t\t\t\t\t\tlatex: newLatex,\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\tplaceholder={ __( 'e.g., x^2, \\\\frac{a}{b}' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ error && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\t\t\tintent=\"error\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-math__error\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ error }\n\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t\t<style children=\".wp-block-math__error .components-badge__content{white-space:normal}\" />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2DI;AAxDJ,kBAAmB;AACnB,0BAGO;AACP,wBAKO;AACP,qBAA4C;AAC5C,kBAA4B;AAK5B,yBAAuB;AAEvB,MAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAEjC,SAAR,SAA2B,EAAE,YAAY,eAAe,WAAW,GAAI;AAC7E,QAAM,EAAE,MAAM,IAAI;AAClB,QAAM,CAAE,UAAU,WAAY,QAAI,yBAAS;AAC3C,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAU,IAAK;AAC3C,QAAM,CAAE,eAAe,gBAAiB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AAA,kBACd,CAAE;AACF,2BAAU,IAAK;AAAA,gBAChB,SAAU,KAAM;AACf,2BAAU,IAAI,OAAQ;AAAA,gBACvB;AACA,8BAAe;AAAA,kBACd;AAAA,kBACA,OAAO;AAAA,gBACR,CAAE;AAAA,cACH;AAAA,cACA,iBAAc,gBAAI,yBAA0B;AAAA;AAAA,UAC7C;AAAA,UACE,SACD,4EACC;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,QAAO;AAAA,gBACP,WAAU;AAAA,gBAER;AAAA;AAAA,YACH;AAAA,YACA,4CAAC,WAAM,UAAS,wEAAuE;AAAA,aACxF;AAAA,WAEF,GACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
|
+
"names": ["componentsPrivateApis", "blockEditorStore", "module", "VStack"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name2 in all)
|
|
10
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var math_exports = {};
|
|
30
|
+
__export(math_exports, {
|
|
31
|
+
init: () => init,
|
|
32
|
+
metadata: () => import_block.default,
|
|
33
|
+
name: () => name,
|
|
34
|
+
settings: () => settings
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(math_exports);
|
|
37
|
+
var import_icons = require("@wordpress/icons");
|
|
38
|
+
var import_init_block = __toESM(require("../utils/init-block"));
|
|
39
|
+
var import_edit = __toESM(require("./edit"));
|
|
40
|
+
var import_block = __toESM(require("./block.json"));
|
|
41
|
+
var import_save = __toESM(require("./save"));
|
|
42
|
+
const { name } = import_block.default;
|
|
43
|
+
const settings = {
|
|
44
|
+
icon: import_icons.math,
|
|
45
|
+
example: {
|
|
46
|
+
attributes: {
|
|
47
|
+
latex: "x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}",
|
|
48
|
+
mathML: '<semantics><mrow><mi>x</mi><mo>=</mo><mfrac><mrow><mo lspace="0em" rspace="0em">\u2212</mo><mi>b</mi><mo>\xB1</mo><msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup><mo>\u2212</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex">x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}</annotation></semantics>'
|
|
49
|
+
},
|
|
50
|
+
viewportWidth: 300
|
|
51
|
+
},
|
|
52
|
+
edit: import_edit.default,
|
|
53
|
+
save: import_save.default
|
|
54
|
+
};
|
|
55
|
+
const init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
init,
|
|
59
|
+
metadata,
|
|
60
|
+
name,
|
|
61
|
+
settings
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/math/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { math as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tlatex: 'x = \\\\frac{-b \\\\pm \\\\sqrt{b^2-4ac}}{2a}',\n\t\t\tmathML: '<semantics><mrow><mi>x</mi><mo>=</mo><mfrac><mrow><mo lspace=\"0em\" rspace=\"0em\">\u2212</mo><mi>b</mi><mo>\u00B1</mo><msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup><mo>\u2212</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></mrow><annotation encoding=\"application/x-tex\">x = \\\\frac{-b \\\\pm \\\\sqrt{b^2-4ac}}{2a}</annotation></semantics>',\n\t\t},\n\t\tviewportWidth: 300,\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAA6B;AAK7B,wBAAsB;AACtB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AAEjB,MAAM,EAAE,KAAK,IAAI,aAAAA;AAIV,MAAM,WAAW;AAAA,EACvB,mBAAAC;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,OAAO;AAAA,MACP,QAAQ;AAAA,IACT;AAAA,IACA,eAAe;AAAA,EAChB;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEO,MAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAJ,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "icon", "edit", "save", "initBlock"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name2 in all)
|
|
8
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var init_exports = {};
|
|
20
|
+
__export(init_exports, {
|
|
21
|
+
init: () => import_index.init,
|
|
22
|
+
metadata: () => import_index.metadata,
|
|
23
|
+
name: () => import_index.name,
|
|
24
|
+
settings: () => import_index.settings
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(init_exports);
|
|
27
|
+
var import_index = require("./index");
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
init,
|
|
31
|
+
metadata,
|
|
32
|
+
name,
|
|
33
|
+
settings
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/math/init.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nexport { init, metadata, name, settings } from './index';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA+C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var save_exports = {};
|
|
20
|
+
__export(save_exports, {
|
|
21
|
+
default: () => save
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(save_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
26
|
+
function save({ attributes }) {
|
|
27
|
+
const { latex, mathML } = attributes;
|
|
28
|
+
if (!latex) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
+
"math",
|
|
33
|
+
{
|
|
34
|
+
...import_block_editor.useBlockProps.save(),
|
|
35
|
+
display: "block",
|
|
36
|
+
dangerouslySetInnerHTML: { __html: mathML }
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=save.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/math/save.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { latex, mathML } = attributes;\n\n\tif ( ! latex ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<math\n\t\t\t{ ...useBlockProps.save() }\n\t\t\tdisplay=\"block\"\n\t\t\tdangerouslySetInnerHTML={ { __html: mathML } }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaE;AAVF,0BAA8B;AAEf,SAAR,KAAuB,EAAE,WAAW,GAAI;AAC9C,QAAM,EAAE,OAAO,OAAO,IAAI;AAE1B,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG,kCAAc,KAAK;AAAA,MACxB,SAAQ;AAAA,MACR,yBAA0B,EAAE,QAAQ,OAAO;AAAA;AAAA,EAC5C;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -95,15 +95,15 @@ function AdditionalBlockContent({ block, insertedBlock, setInsertedBlock }) {
|
|
|
95
95
|
cleanupInsertedBlock();
|
|
96
96
|
},
|
|
97
97
|
onChange: (updatedValue) => {
|
|
98
|
-
const { isEntityLink } = (0, import_shared.updateAttributes)(
|
|
98
|
+
const { isEntityLink, attributes: updatedAttributes } = (0, import_shared.updateAttributes)(
|
|
99
99
|
updatedValue,
|
|
100
100
|
setInsertedBlockAttributes(insertedBlock?.clientId),
|
|
101
101
|
insertedBlock?.attributes
|
|
102
102
|
);
|
|
103
103
|
if (isEntityLink) {
|
|
104
|
-
createBinding();
|
|
104
|
+
createBinding(updatedAttributes);
|
|
105
105
|
} else {
|
|
106
|
-
clearBinding();
|
|
106
|
+
clearBinding(updatedAttributes);
|
|
107
107
|
}
|
|
108
108
|
setInsertedBlock(null);
|
|
109
109
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/edit/menu-inspector-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuSelector from './navigation-menu-selector';\nimport { unlock } from '../../lock-unlock';\nimport DeletedNavigationWarning from './deleted-navigation-warning';\nimport useNavigationMenu from '../use-navigation-menu';\nimport LeafMoreMenu from './leaf-more-menu';\nimport {\n\tLinkUI,\n\tupdateAttributes,\n\tuseEntityBinding,\n} from '../../navigation-link/shared';\n\nconst actionLabel =\n\t/* translators: %s: The name of a menu. */ __( \"Switch to '%s'\" );\nconst BLOCKS_WITH_LINK_UI_SUPPORT = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\nconst { PrivateListView } = unlock( blockEditorPrivateApis );\n\nfunction AdditionalBlockContent( { block, insertedBlock, setInsertedBlock } ) {\n\tconst { updateBlockAttributes, removeBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst supportsLinkControls = BLOCKS_WITH_LINK_UI_SUPPORT?.includes(\n\t\tinsertedBlock?.name\n\t);\n\tconst blockWasJustInserted = insertedBlock?.clientId === block.clientId;\n\tconst showLinkControls = supportsLinkControls && blockWasJustInserted;\n\n\t// Get binding utilities for the inserted block\n\tconst { createBinding, clearBinding } = useEntityBinding( {\n\t\tclientId: insertedBlock?.clientId,\n\t\tattributes: insertedBlock?.attributes || {},\n\t} );\n\n\tif ( ! showLinkControls ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Cleanup function for auto-inserted Navigation Link blocks.\n\t *\n\t * Removes the block if it has no URL and clears the inserted block state.\n\t * This ensures consistent cleanup behavior across different contexts.\n\t */\n\tconst cleanupInsertedBlock = () => {\n\t\t// Prevent automatic block selection when removing blocks in list view context\n\t\t// This avoids focus stealing that would close the list view and switch to canvas\n\t\tconst shouldAutoSelectBlock = false;\n\n\t\t// Follows the exact same pattern as Navigation Link block's onClose handler\n\t\t// If there is no URL then remove the auto-inserted block to avoid empty blocks\n\t\tif ( ! insertedBlock?.attributes?.url && insertedBlock?.clientId ) {\n\t\t\t// Remove the block entirely to avoid poor UX\n\t\t\t// This matches the Navigation Link block's behavior\n\t\t\tremoveBlock( insertedBlock.clientId, shouldAutoSelectBlock );\n\t\t}\n\t\tsetInsertedBlock( null );\n\t};\n\n\tconst setInsertedBlockAttributes =\n\t\t( _insertedBlockClientId ) => ( _updatedAttributes ) => {\n\t\t\tif ( ! _insertedBlockClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tupdateBlockAttributes( _insertedBlockClientId, _updatedAttributes );\n\t\t};\n\n\t// Wrapper function to clean up original block when a new block is selected\n\tconst handleSetInsertedBlock = ( newBlock ) => {\n\t\t// Prevent automatic block selection when removing blocks in list view context\n\t\t// This avoids focus stealing that would close the list view and switch to canvas\n\t\tconst shouldAutoSelectBlock = false;\n\n\t\t// If we have an existing inserted block and a new block is being set,\n\t\t// remove the original block to avoid duplicates\n\t\tif ( insertedBlock?.clientId && newBlock ) {\n\t\t\tremoveBlock( insertedBlock.clientId, shouldAutoSelectBlock );\n\t\t}\n\t\tsetInsertedBlock( newBlock );\n\t};\n\n\treturn (\n\t\t<LinkUI\n\t\t\tclientId={ insertedBlock?.clientId }\n\t\t\tlink={ insertedBlock?.attributes }\n\t\t\tonBlockInsert={ handleSetInsertedBlock }\n\t\t\tonClose={ () => {\n\t\t\t\t// Use cleanup function\n\t\t\t\tcleanupInsertedBlock();\n\t\t\t} }\n\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t// updateAttributes determines the final state and returns metadata\n\t\t\t\tconst { isEntityLink }
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuGE;AApGF,0BAIO;AACP,wBAKO;AACP,kBAAuC;AACvC,kBAA4B;AAK5B,sCAAmC;AACnC,yBAAuB;AACvB,wCAAqC;AACrC,iCAA8B;AAC9B,4BAAyB;AACzB,oBAIO;AAEP,MAAM;AAAA;AAAA,MACsC,gBAAI,gBAAiB;AAAA;AACjE,MAAM,8BAA8B;AAAA,EACnC;AAAA,EACA;AACD;AACA,MAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAE3D,SAAS,uBAAwB,EAAE,OAAO,eAAe,iBAAiB,GAAI;AAC7E,QAAM,EAAE,uBAAuB,YAAY,QAC1C,yBAAa,oBAAAC,KAAiB;AAE/B,QAAM,uBAAuB,6BAA6B;AAAA,IACzD,eAAe;AAAA,EAChB;AACA,QAAM,uBAAuB,eAAe,aAAa,MAAM;AAC/D,QAAM,mBAAmB,wBAAwB;AAGjD,QAAM,EAAE,eAAe,aAAa,QAAI,gCAAkB;AAAA,IACzD,UAAU,eAAe;AAAA,IACzB,YAAY,eAAe,cAAc,CAAC;AAAA,EAC3C,CAAE;AAEF,MAAK,CAAE,kBAAmB;AACzB,WAAO;AAAA,EACR;AAQA,QAAM,uBAAuB,MAAM;AAGlC,UAAM,wBAAwB;AAI9B,QAAK,CAAE,eAAe,YAAY,OAAO,eAAe,UAAW;AAGlE,kBAAa,cAAc,UAAU,qBAAsB;AAAA,IAC5D;AACA,qBAAkB,IAAK;AAAA,EACxB;AAEA,QAAM,6BACL,CAAE,2BAA4B,CAAE,uBAAwB;AACvD,QAAK,CAAE,wBAAyB;AAC/B;AAAA,IACD;AACA,0BAAuB,wBAAwB,kBAAmB;AAAA,EACnE;AAGD,QAAM,yBAAyB,CAAE,aAAc;AAG9C,UAAM,wBAAwB;AAI9B,QAAK,eAAe,YAAY,UAAW;AAC1C,kBAAa,cAAc,UAAU,qBAAsB;AAAA,IAC5D;AACA,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,eAAe;AAAA,MAC1B,MAAO,eAAe;AAAA,MACtB,eAAgB;AAAA,MAChB,SAAU,MAAM;AAEf,6BAAqB;AAAA,MACtB;AAAA,MACA,UAAW,CAAE,iBAAkB;AAE9B,cAAM,EAAE,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuSelector from './navigation-menu-selector';\nimport { unlock } from '../../lock-unlock';\nimport DeletedNavigationWarning from './deleted-navigation-warning';\nimport useNavigationMenu from '../use-navigation-menu';\nimport LeafMoreMenu from './leaf-more-menu';\nimport {\n\tLinkUI,\n\tupdateAttributes,\n\tuseEntityBinding,\n} from '../../navigation-link/shared';\n\nconst actionLabel =\n\t/* translators: %s: The name of a menu. */ __( \"Switch to '%s'\" );\nconst BLOCKS_WITH_LINK_UI_SUPPORT = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\nconst { PrivateListView } = unlock( blockEditorPrivateApis );\n\nfunction AdditionalBlockContent( { block, insertedBlock, setInsertedBlock } ) {\n\tconst { updateBlockAttributes, removeBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst supportsLinkControls = BLOCKS_WITH_LINK_UI_SUPPORT?.includes(\n\t\tinsertedBlock?.name\n\t);\n\tconst blockWasJustInserted = insertedBlock?.clientId === block.clientId;\n\tconst showLinkControls = supportsLinkControls && blockWasJustInserted;\n\n\t// Get binding utilities for the inserted block\n\tconst { createBinding, clearBinding } = useEntityBinding( {\n\t\tclientId: insertedBlock?.clientId,\n\t\tattributes: insertedBlock?.attributes || {},\n\t} );\n\n\tif ( ! showLinkControls ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Cleanup function for auto-inserted Navigation Link blocks.\n\t *\n\t * Removes the block if it has no URL and clears the inserted block state.\n\t * This ensures consistent cleanup behavior across different contexts.\n\t */\n\tconst cleanupInsertedBlock = () => {\n\t\t// Prevent automatic block selection when removing blocks in list view context\n\t\t// This avoids focus stealing that would close the list view and switch to canvas\n\t\tconst shouldAutoSelectBlock = false;\n\n\t\t// Follows the exact same pattern as Navigation Link block's onClose handler\n\t\t// If there is no URL then remove the auto-inserted block to avoid empty blocks\n\t\tif ( ! insertedBlock?.attributes?.url && insertedBlock?.clientId ) {\n\t\t\t// Remove the block entirely to avoid poor UX\n\t\t\t// This matches the Navigation Link block's behavior\n\t\t\tremoveBlock( insertedBlock.clientId, shouldAutoSelectBlock );\n\t\t}\n\t\tsetInsertedBlock( null );\n\t};\n\n\tconst setInsertedBlockAttributes =\n\t\t( _insertedBlockClientId ) => ( _updatedAttributes ) => {\n\t\t\tif ( ! _insertedBlockClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tupdateBlockAttributes( _insertedBlockClientId, _updatedAttributes );\n\t\t};\n\n\t// Wrapper function to clean up original block when a new block is selected\n\tconst handleSetInsertedBlock = ( newBlock ) => {\n\t\t// Prevent automatic block selection when removing blocks in list view context\n\t\t// This avoids focus stealing that would close the list view and switch to canvas\n\t\tconst shouldAutoSelectBlock = false;\n\n\t\t// If we have an existing inserted block and a new block is being set,\n\t\t// remove the original block to avoid duplicates\n\t\tif ( insertedBlock?.clientId && newBlock ) {\n\t\t\tremoveBlock( insertedBlock.clientId, shouldAutoSelectBlock );\n\t\t}\n\t\tsetInsertedBlock( newBlock );\n\t};\n\n\treturn (\n\t\t<LinkUI\n\t\t\tclientId={ insertedBlock?.clientId }\n\t\t\tlink={ insertedBlock?.attributes }\n\t\t\tonBlockInsert={ handleSetInsertedBlock }\n\t\t\tonClose={ () => {\n\t\t\t\t// Use cleanup function\n\t\t\t\tcleanupInsertedBlock();\n\t\t\t} }\n\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t// updateAttributes determines the final state and returns metadata\n\t\t\t\tconst { isEntityLink, attributes: updatedAttributes } =\n\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\tsetInsertedBlockAttributes( insertedBlock?.clientId ),\n\t\t\t\t\t\tinsertedBlock?.attributes\n\t\t\t\t\t);\n\n\t\t\t\t// Handle URL binding based on the final computed state\n\t\t\t\t// Only create bindings for entity links (posts, pages, taxonomies)\n\t\t\t\t// Never create bindings for custom links (manual URLs)\n\t\t\t\tif ( isEntityLink ) {\n\t\t\t\t\tcreateBinding( updatedAttributes );\n\t\t\t\t} else {\n\t\t\t\t\tclearBinding( updatedAttributes );\n\t\t\t\t}\n\n\t\t\t\tsetInsertedBlock( null );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nconst MainContent = ( {\n\tclientId,\n\tcurrentMenuId,\n\tisLoading,\n\tisNavigationMenuMissing,\n\tonCreateNew,\n} ) => {\n\tconst hasChildren = useSelect(\n\t\t( select ) => {\n\t\t\treturn !! select( blockEditorStore ).getBlockCount( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { navigationMenu } = useNavigationMenu( currentMenuId );\n\n\tif ( currentMenuId && isNavigationMenuMissing ) {\n\t\treturn (\n\t\t\t<DeletedNavigationWarning onCreateNew={ onCreateNew } isNotice />\n\t\t);\n\t}\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\tconst description = navigationMenu\n\t\t? sprintf(\n\t\t\t\t/* translators: %s: The name of a menu. */\n\t\t\t\t__( 'Structure for Navigation Menu: %s' ),\n\t\t\t\tnavigationMenu?.title || __( 'Untitled menu' )\n\t\t )\n\t\t: __(\n\t\t\t\t'You have not yet created any menus. Displaying a list of your Pages'\n\t\t );\n\n\treturn (\n\t\t<div className=\"wp-block-navigation__menu-inspector-controls\">\n\t\t\t{ ! hasChildren && (\n\t\t\t\t<p className=\"wp-block-navigation__menu-inspector-controls__empty-message\">\n\t\t\t\t\t{ __( 'This Navigation Menu is empty.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<PrivateListView\n\t\t\t\trootClientId={ clientId }\n\t\t\t\tisExpanded\n\t\t\t\tdescription={ description }\n\t\t\t\tshowAppender\n\t\t\t\tblockSettingsMenu={ LeafMoreMenu }\n\t\t\t\tadditionalBlockContent={ AdditionalBlockContent }\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nconst MenuInspectorControls = ( props ) => {\n\tconst {\n\t\tcreateNavigationMenuIsSuccess,\n\t\tcreateNavigationMenuIsError,\n\t\tcurrentMenuId = null,\n\t\tonCreateNew,\n\t\tonSelectClassicMenu,\n\t\tonSelectNavigationMenu,\n\t\tisManageMenusButtonDisabled,\n\t\tblockEditingMode,\n\t} = props;\n\n\treturn (\n\t\t<InspectorControls group=\"list\">\n\t\t\t<PanelBody title={ null }>\n\t\t\t\t<HStack className=\"wp-block-navigation-off-canvas-editor__header\">\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tclassName=\"wp-block-navigation-off-canvas-editor__title\"\n\t\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Menu' ) }\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t\t\t<NavigationMenuSelector\n\t\t\t\t\t\t\tcurrentMenuId={ currentMenuId }\n\t\t\t\t\t\t\tonSelectClassicMenu={ onSelectClassicMenu }\n\t\t\t\t\t\t\tonSelectNavigationMenu={ onSelectNavigationMenu }\n\t\t\t\t\t\t\tonCreateNew={ onCreateNew }\n\t\t\t\t\t\t\tcreateNavigationMenuIsSuccess={\n\t\t\t\t\t\t\t\tcreateNavigationMenuIsSuccess\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcreateNavigationMenuIsError={\n\t\t\t\t\t\t\t\tcreateNavigationMenuIsError\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactionLabel={ actionLabel }\n\t\t\t\t\t\t\tisManageMenusButtonDisabled={\n\t\t\t\t\t\t\t\tisManageMenusButtonDisabled\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</HStack>\n\t\t\t\t<MainContent { ...props } />\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default MenuInspectorControls;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuGE;AApGF,0BAIO;AACP,wBAKO;AACP,kBAAuC;AACvC,kBAA4B;AAK5B,sCAAmC;AACnC,yBAAuB;A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QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,SACC,4CAAC,yCAAkB,OAAM,QACxB,uDAAC,+BAAU,OAAQ,MAClB;AAAA,iDAAC,kBAAAC,sBAAA,EAAO,WAAU,iDACjB;AAAA;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA,WAAU;AAAA,UACV,OAAQ;AAAA,UAEN,8BAAI,MAAO;AAAA;AAAA,MACd;AAAA,MACE,qBAAqB,aACtB;AAAA,QAAC,gCAAAC;AAAA,QAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAGA;AAAA,UAGA;AAAA,UACA;AAAA;AAAA,MAGD;AAAA,OAEF;AAAA,IACA,4CAAC,eAAc,GAAG,OAAQ;AAAA,KAC3B,GACD;AAEF;AAEA,IAAO,kCAAQ;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "blockEditorStore", "useNavigationMenu", "DeletedNavigationWarning", "LeafMoreMenu", "HStack", "Heading", "NavigationMenuSelector"]
|
|
7
7
|
}
|
|
@@ -407,15 +407,18 @@ function NavigationLinkEdit({
|
|
|
407
407
|
anchor: popoverAnchor,
|
|
408
408
|
onRemove: removeLink,
|
|
409
409
|
onChange: (updatedValue) => {
|
|
410
|
-
const {
|
|
410
|
+
const {
|
|
411
|
+
isEntityLink,
|
|
412
|
+
attributes: updatedAttributes
|
|
413
|
+
} = (0, import_shared.updateAttributes)(
|
|
411
414
|
updatedValue,
|
|
412
415
|
setAttributes,
|
|
413
416
|
attributes
|
|
414
417
|
);
|
|
415
418
|
if (isEntityLink) {
|
|
416
|
-
createBinding();
|
|
419
|
+
createBinding(updatedAttributes);
|
|
417
420
|
} else {
|
|
418
|
-
clearBinding();
|
|
421
|
+
clearBinding(updatedAttributes);
|
|
419
422
|
}
|
|
420
423
|
}
|
|
421
424
|
}
|