@wordpress/block-library 9.7.1-next.1f6eadc42.0 → 9.8.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/CHANGELOG.md +2 -0
- package/build/categories/edit.js +38 -17
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +10 -3
- package/build/categories/index.js.map +1 -1
- package/build/categories/variations.js +43 -0
- package/build/categories/variations.js.map +1 -0
- package/build/embed/edit.js +1 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-preview.js +80 -100
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -0
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/form/view.js +1 -0
- package/build/form/view.js.map +1 -1
- package/build/image/image.js +5 -2
- package/build/image/image.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/navigation-submenu/index.js +13 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/post-template/edit.js +6 -1
- package/build/post-template/edit.js.map +1 -1
- package/build/post-title/index.js +1 -4
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/format-controls.js +102 -0
- package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +45 -9
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +26 -10
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +3 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +12 -1
- package/build/query/utils.js.map +1 -1
- package/build/site-title/index.js +1 -4
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +13 -11
- package/build/social-link/edit.js.map +1 -1
- package/build-module/categories/edit.js +40 -19
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +10 -3
- package/build-module/categories/index.js.map +1 -1
- package/build-module/categories/variations.js +36 -0
- package/build-module/categories/variations.js.map +1 -0
- package/build-module/embed/edit.js +1 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +1 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +80 -100
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +1 -0
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/form/view.js +1 -0
- package/build-module/form/view.js.map +1 -1
- package/build-module/image/image.js +5 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/navigation-submenu/index.js +13 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/post-template/edit.js +6 -1
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-title/index.js +1 -4
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
- package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +45 -9
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +27 -11
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +3 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +12 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/site-title/index.js +1 -4
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +14 -12
- package/build-module/social-link/edit.js.map +1 -1
- package/build-style/editor-rtl.css +1 -1
- package/build-style/editor.css +1 -1
- package/build-style/gallery/editor-rtl.css +1 -1
- package/build-style/gallery/editor.css +1 -1
- package/build-style/post-title/style-rtl.css +4 -18
- package/build-style/post-title/style.css +4 -18
- package/build-style/site-title/style-rtl.css +4 -18
- package/build-style/site-title/style.css +4 -18
- package/build-style/style-rtl.css +8 -36
- package/build-style/style.css +8 -36
- package/package.json +35 -35
- package/src/categories/block.json +7 -2
- package/src/categories/edit.js +69 -30
- package/src/categories/index.js +2 -0
- package/src/categories/index.php +21 -9
- package/src/categories/variations.js +40 -0
- package/src/comments-pagination-next/index.php +1 -1
- package/src/comments-pagination-previous/index.php +2 -1
- package/src/embed/embed-preview.js +96 -112
- package/src/image/image.js +2 -1
- package/src/navigation-submenu/block.json +13 -0
- package/src/post-template/edit.js +6 -0
- package/src/post-template/index.php +5 -0
- package/src/post-title/block.json +1 -4
- package/src/post-title/style.scss +4 -21
- package/src/query/block.json +3 -1
- package/src/query/edit/inspector-controls/format-controls.js +90 -0
- package/src/query/edit/inspector-controls/index.js +68 -9
- package/src/query/edit/query-content.js +38 -5
- package/src/query/utils.js +16 -1
- package/src/site-title/block.json +1 -4
- package/src/site-title/style.scss +4 -21
- package/src/social-link/edit.js +11 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","PanelBody","Placeholder","Spinner","ToggleControl","VisuallyHidden","useInstanceId","InspectorControls","useBlockProps","RichText","decodeEntities","__","pin","useEntityRecords","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CategoriesEdit","attributes","displayAsDropdown","showHierarchy","showPostCounts","showOnlyTopLevel","showEmpty","label","showLabel","setAttributes","className","selectId","query","per_page","hide_empty","context","parent","records","categories","isResolving","getCategoriesList","parentId","length","filter","toggleAttribute","attributeName","newValue","renderCategoryName","name","trim","renderCategoryList","categoriesList","map","category","renderCategoryListItem","childCategories","id","link","count","children","href","target","rel","childCategory","renderCategoryDropdown","placeholder","withoutInteractiveFormatting","value","onChange","html","as","htmlFor","renderCategoryDropdownItem","level","Array","from","TagName","classes","blockProps","title","__nextHasNoMarginBottom","checked","icon"],"sources":["@wordpress/block-library/src/categories/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tSpinner,\n\tToggleControl,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { pin } from '@wordpress/icons';\nimport { useEntityRecords } from '@wordpress/core-data';\n\nexport default function CategoriesEdit( {\n\tattributes: {\n\t\tdisplayAsDropdown,\n\t\tshowHierarchy,\n\t\tshowPostCounts,\n\t\tshowOnlyTopLevel,\n\t\tshowEmpty,\n\t\tlabel,\n\t\tshowLabel,\n\t},\n\tsetAttributes,\n\tclassName,\n} ) {\n\tconst selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );\n\tconst query = { per_page: -1, hide_empty: ! showEmpty, context: 'view' };\n\tif ( showOnlyTopLevel ) {\n\t\tquery.parent = 0;\n\t}\n\n\tconst { records: categories, isResolving } = useEntityRecords(\n\t\t'taxonomy',\n\t\t'category',\n\t\tquery\n\t);\n\n\tconst getCategoriesList = ( parentId ) => {\n\t\tif ( ! categories?.length ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( parentId === null ) {\n\t\t\treturn categories;\n\t\t}\n\t\treturn categories.filter( ( { parent } ) => parent === parentId );\n\t};\n\n\tconst toggleAttribute = ( attributeName ) => ( newValue ) =>\n\t\tsetAttributes( { [ attributeName ]: newValue } );\n\n\tconst renderCategoryName = ( name ) =>\n\t\t! name ? __( '(Untitled)' ) : decodeEntities( name ).trim();\n\n\tconst renderCategoryList = () => {\n\t\tconst parentId = showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn categoriesList.map( ( category ) =>\n\t\t\trenderCategoryListItem( category )\n\t\t);\n\t};\n\n\tconst renderCategoryListItem = ( category ) => {\n\t\tconst childCategories = getCategoriesList( category.id );\n\t\tconst { id, link, count, name } = category;\n\t\treturn (\n\t\t\t<li key={ id } className={ `cat-item cat-item-${ id }` }>\n\t\t\t\t<a href={ link } target=\"_blank\" rel=\"noreferrer noopener\">\n\t\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t</a>\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t\t{ showHierarchy && !! childCategories.length && (\n\t\t\t\t\t<ul className=\"children\">\n\t\t\t\t\t\t{ childCategories.map( ( childCategory ) =>\n\t\t\t\t\t\t\trenderCategoryListItem( childCategory )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ul>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdown = () => {\n\t\tconst parentId = showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ showLabel ? (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName=\"wp-block-categories__label\"\n\t\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Categories' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<VisuallyHidden as=\"label\" htmlFor={ selectId }>\n\t\t\t\t\t\t{ label ? label : __( 'Categories' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t\t<select id={ selectId }>\n\t\t\t\t\t<option>{ __( 'Select Category' ) }</option>\n\t\t\t\t\t{ categoriesList.map( ( category ) =>\n\t\t\t\t\t\trenderCategoryDropdownItem( category, 0 )\n\t\t\t\t\t) }\n\t\t\t\t</select>\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdownItem = ( category, level ) => {\n\t\tconst { id, count, name } = category;\n\t\tconst childCategories = getCategoriesList( id );\n\t\treturn [\n\t\t\t<option key={ id } className={ `level-${ level }` }>\n\t\t\t\t{ Array.from( { length: level * 3 } ).map( () => '\\xa0' ) }\n\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t</option>,\n\t\t\tshowHierarchy &&\n\t\t\t\t!! childCategories.length &&\n\t\t\t\tchildCategories.map( ( childCategory ) =>\n\t\t\t\t\trenderCategoryDropdownItem( childCategory, level + 1 )\n\t\t\t\t),\n\t\t];\n\t};\n\n\tconst TagName =\n\t\t!! categories?.length && ! displayAsDropdown && ! isResolving\n\t\t\t? 'ul'\n\t\t\t: 'div';\n\n\tconst classes = clsx( className, {\n\t\t'wp-block-categories-list':\n\t\t\t!! categories?.length && ! displayAsDropdown && ! isResolving,\n\t\t'wp-block-categories-dropdown':\n\t\t\t!! categories?.length && displayAsDropdown && ! isResolving,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\n\treturn (\n\t\t<TagName { ...blockProps }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'displayAsDropdown' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"wp-block-categories__indentation\"\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showLabel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showPostCounts' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show only top level categories' ) }\n\t\t\t\t\t\tchecked={ showOnlyTopLevel }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showOnlyTopLevel' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show empty categories' ) }\n\t\t\t\t\t\tchecked={ showEmpty }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showEmpty' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! showOnlyTopLevel && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show hierarchy' ) }\n\t\t\t\t\t\t\tchecked={ showHierarchy }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showHierarchy' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ isResolving && (\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Categories' ) }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! isResolving && categories?.length === 0 && (\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Your site does not have any posts, so there is nothing to display here at the moment.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ ! isResolving &&\n\t\t\t\tcategories?.length > 0 &&\n\t\t\t\t( displayAsDropdown\n\t\t\t\t\t? renderCategoryDropdown()\n\t\t\t\t\t: renderCategoryList() ) }\n\t\t</TagName>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,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,UAAU,EAAEI,MAAM,KAAK,CAAC,iBAC1C3B,IAAA;MAAA4C,QAAA,EACGhD,EAAE,CACH,uFACD;IAAC,CACC,CACH,EACC,CAAE4B,WAAW,IACdD,UAAU,EAAEI,MAAM,GAAG,CAAC,KACpBpB,iBAAiB,GAChB0C,sBAAsB,CAAC,CAAC,GACxBd,kBAAkB,CAAC,CAAC,CAAE;EAAA,CAClB,CAAC;AAEZ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","PanelBody","Placeholder","SelectControl","Spinner","ToggleControl","VisuallyHidden","useInstanceId","InspectorControls","useBlockProps","RichText","decodeEntities","__","sprintf","pin","useEntityRecords","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CategoriesEdit","attributes","displayAsDropdown","showHierarchy","showPostCounts","showOnlyTopLevel","showEmpty","label","showLabel","taxonomy","taxonomySlug","setAttributes","className","selectId","records","allTaxonomies","isResolvingTaxonomies","taxonomies","filter","t","visibility","public","find","slug","isHierarchicalTaxonomy","hierarchical","query","per_page","hide_empty","context","parent","categories","isResolving","getCategoriesList","parentId","length","toggleAttribute","attributeName","newValue","renderCategoryName","name","trim","renderCategoryList","categoriesList","map","category","renderCategoryListItem","childCategories","id","link","count","children","href","target","rel","childCategory","renderCategoryDropdown","placeholder","withoutInteractiveFormatting","value","onChange","html","as","htmlFor","labels","singular_name","renderCategoryDropdownItem","level","Array","from","TagName","classes","blockProps","title","isArray","__nextHasNoMarginBottom","__next40pxDefaultSize","options","selectedTaxonomy","checked","icon","no_terms"],"sources":["@wordpress/block-library/src/categories/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tSelectControl,\n\tSpinner,\n\tToggleControl,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pin } from '@wordpress/icons';\nimport { useEntityRecords } from '@wordpress/core-data';\n\nexport default function CategoriesEdit( {\n\tattributes: {\n\t\tdisplayAsDropdown,\n\t\tshowHierarchy,\n\t\tshowPostCounts,\n\t\tshowOnlyTopLevel,\n\t\tshowEmpty,\n\t\tlabel,\n\t\tshowLabel,\n\t\ttaxonomy: taxonomySlug,\n\t},\n\tsetAttributes,\n\tclassName,\n} ) {\n\tconst selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );\n\n\tconst { records: allTaxonomies, isResolvingTaxonomies } = useEntityRecords(\n\t\t'root',\n\t\t'taxonomy'\n\t);\n\n\tconst taxonomies = allTaxonomies?.filter( ( t ) => t.visibility.public );\n\n\tconst taxonomy = taxonomies?.find( ( t ) => t.slug === taxonomySlug );\n\n\tconst isHierarchicalTaxonomy =\n\t\t! isResolvingTaxonomies && taxonomy?.hierarchical;\n\n\tconst query = { per_page: -1, hide_empty: ! showEmpty, context: 'view' };\n\tif ( isHierarchicalTaxonomy && showOnlyTopLevel ) {\n\t\tquery.parent = 0;\n\t}\n\n\tconst { records: categories, isResolving } = useEntityRecords(\n\t\t'taxonomy',\n\t\ttaxonomySlug,\n\t\tquery\n\t);\n\n\tconst getCategoriesList = ( parentId ) => {\n\t\tif ( ! categories?.length ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( parentId === null ) {\n\t\t\treturn categories;\n\t\t}\n\t\treturn categories.filter( ( { parent } ) => parent === parentId );\n\t};\n\n\tconst toggleAttribute = ( attributeName ) => ( newValue ) =>\n\t\tsetAttributes( { [ attributeName ]: newValue } );\n\n\tconst renderCategoryName = ( name ) =>\n\t\t! name ? __( '(Untitled)' ) : decodeEntities( name ).trim();\n\n\tconst renderCategoryList = () => {\n\t\tconst parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn categoriesList.map( ( category ) =>\n\t\t\trenderCategoryListItem( category )\n\t\t);\n\t};\n\n\tconst renderCategoryListItem = ( category ) => {\n\t\tconst childCategories = getCategoriesList( category.id );\n\t\tconst { id, link, count, name } = category;\n\t\treturn (\n\t\t\t<li key={ id } className={ `cat-item cat-item-${ id }` }>\n\t\t\t\t<a href={ link } target=\"_blank\" rel=\"noreferrer noopener\">\n\t\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t</a>\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t\t{ isHierarchicalTaxonomy &&\n\t\t\t\t\tshowHierarchy &&\n\t\t\t\t\t!! childCategories.length && (\n\t\t\t\t\t\t<ul className=\"children\">\n\t\t\t\t\t\t\t{ childCategories.map( ( childCategory ) =>\n\t\t\t\t\t\t\t\trenderCategoryListItem( childCategory )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdown = () => {\n\t\tconst parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ showLabel ? (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName=\"wp-block-categories__label\"\n\t\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\t\tplaceholder={ taxonomy.name }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<VisuallyHidden as=\"label\" htmlFor={ selectId }>\n\t\t\t\t\t\t{ label ? label : taxonomy.name }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t\t<select id={ selectId }>\n\t\t\t\t\t<option>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: taxonomy's singular name */\n\t\t\t\t\t\t\t__( 'Select %s' ),\n\t\t\t\t\t\t\ttaxonomy.labels.singular_name\n\t\t\t\t\t\t) }\n\t\t\t\t\t</option>\n\t\t\t\t\t{ categoriesList.map( ( category ) =>\n\t\t\t\t\t\trenderCategoryDropdownItem( category, 0 )\n\t\t\t\t\t) }\n\t\t\t\t</select>\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdownItem = ( category, level ) => {\n\t\tconst { id, count, name } = category;\n\t\tconst childCategories = getCategoriesList( id );\n\t\treturn [\n\t\t\t<option key={ id } className={ `level-${ level }` }>\n\t\t\t\t{ Array.from( { length: level * 3 } ).map( () => '\\xa0' ) }\n\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t</option>,\n\t\t\tisHierarchicalTaxonomy &&\n\t\t\t\tshowHierarchy &&\n\t\t\t\t!! childCategories.length &&\n\t\t\t\tchildCategories.map( ( childCategory ) =>\n\t\t\t\t\trenderCategoryDropdownItem( childCategory, level + 1 )\n\t\t\t\t),\n\t\t];\n\t};\n\n\tconst TagName =\n\t\t!! categories?.length && ! displayAsDropdown && ! isResolving\n\t\t\t? 'ul'\n\t\t\t: 'div';\n\n\tconst classes = clsx( className, {\n\t\t'wp-block-categories-list':\n\t\t\t!! categories?.length && ! displayAsDropdown && ! isResolving,\n\t\t'wp-block-categories-dropdown':\n\t\t\t!! categories?.length && displayAsDropdown && ! isResolving,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\n\treturn (\n\t\t<TagName { ...blockProps }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ Array.isArray( taxonomies ) && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\t\t\toptions={ taxonomies.map( ( t ) => ( {\n\t\t\t\t\t\t\t\tlabel: t.name,\n\t\t\t\t\t\t\t\tvalue: t.slug,\n\t\t\t\t\t\t\t} ) ) }\n\t\t\t\t\t\t\tvalue={ taxonomySlug }\n\t\t\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ttaxonomy: selectedTaxonomy,\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\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'displayAsDropdown' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"wp-block-categories__indentation\"\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showLabel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showPostCounts' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isHierarchicalTaxonomy && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show only top level terms' ) }\n\t\t\t\t\t\t\tchecked={ showOnlyTopLevel }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showOnlyTopLevel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show empty terms' ) }\n\t\t\t\t\t\tchecked={ showEmpty }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showEmpty' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isHierarchicalTaxonomy && ! showOnlyTopLevel && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show hierarchy' ) }\n\t\t\t\t\t\t\tchecked={ showHierarchy }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showHierarchy' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ isResolving && (\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Terms' ) }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! isResolving && categories?.length === 0 && (\n\t\t\t\t<p>{ taxonomy.labels.no_terms }</p>\n\t\t\t) }\n\t\t\t{ ! isResolving &&\n\t\t\t\tcategories?.length > 0 &&\n\t\t\t\t( displayAsDropdown\n\t\t\t\t\t? renderCategoryDropdown()\n\t\t\t\t\t: renderCategoryList() ) }\n\t\t</TagName>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,OAAO,EACPC,aAAa,EACbC,cAAc,QACR,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SACCC,iBAAiB,EACjBC,aAAa,EACbC,QAAQ,QACF,yBAAy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Version: 3,
|
|
13
13
|
name: "core/categories",
|
|
14
|
-
title: "
|
|
14
|
+
title: "Terms List",
|
|
15
15
|
category: "widgets",
|
|
16
|
-
description: "Display a list of all
|
|
16
|
+
description: "Display a list of all terms of a given taxonomy.",
|
|
17
|
+
keywords: ["categories"],
|
|
17
18
|
textdomain: "default",
|
|
18
19
|
attributes: {
|
|
20
|
+
taxonomy: {
|
|
21
|
+
type: "string",
|
|
22
|
+
"default": "category"
|
|
23
|
+
},
|
|
19
24
|
displayAsDropdown: {
|
|
20
25
|
type: "boolean",
|
|
21
26
|
"default": false
|
|
@@ -90,6 +95,7 @@ const metadata = {
|
|
|
90
95
|
style: "wp-block-categories"
|
|
91
96
|
};
|
|
92
97
|
import edit from './edit';
|
|
98
|
+
import variations from './variations';
|
|
93
99
|
const {
|
|
94
100
|
name
|
|
95
101
|
} = metadata;
|
|
@@ -97,7 +103,8 @@ export { metadata, name };
|
|
|
97
103
|
export const settings = {
|
|
98
104
|
icon,
|
|
99
105
|
example: {},
|
|
100
|
-
edit
|
|
106
|
+
edit,
|
|
107
|
+
variations
|
|
101
108
|
};
|
|
102
109
|
export const init = () => initBlock({
|
|
103
110
|
name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["category","icon","initBlock","metadata","$schema","apiVersion","name","title","description","textdomain","attributes","
|
|
1
|
+
{"version":3,"names":["category","icon","initBlock","metadata","$schema","apiVersion","name","title","description","keywords","textdomain","attributes","taxonomy","type","displayAsDropdown","showHierarchy","showPostCounts","showOnlyTopLevel","showEmpty","label","__experimentalRole","showLabel","usesContext","supports","align","html","spacing","margin","padding","__experimentalDefaultControls","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","interactivity","clientNavigation","__experimentalBorder","radius","color","width","style","editorStyle","edit","variations","settings","example","init"],"sources":["@wordpress/block-library/src/categories/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { category as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,IAAI,QAAQ,kBAAkB;;AAEnD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAP,QAAA;EAAAQ,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,QAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,iBAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,aAAA;MAAAF,IAAA;MAAA;IAAA;IAAAG,cAAA;MAAAH,IAAA;MAAA;IAAA;IAAAI,gBAAA;MAAAJ,IAAA;MAAA;IAAA;IAAAK,SAAA;MAAAL,IAAA;MAAA;IAAA;IAAAM,KAAA;MAAAN,IAAA;MAAAO,kBAAA;IAAA;IAAAC,SAAA;MAAAR,IAAA;MAAA;IAAA;EAAA;EAAAS,WAAA;EAAAC,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;MAAAC,6BAAA;QAAAF,MAAA;QAAAC,OAAA;MAAA;IAAA;IAAAE,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAT,6BAAA;QAAAE,QAAA;MAAA;IAAA;IAAAQ,aAAA;MAAAC,gBAAA;IAAA;IAAAC,oBAAA;MAAAC,MAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAhB,6BAAA;QAAAa,MAAA;QAAAC,KAAA;QAAAC,KAAA;QAAAC,KAAA;MAAA;IAAA;EAAA;EAAAC,WAAA;EAAAD,KAAA;AAAA;AAE5C,OAAOE,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAE1C;AAAK,CAAC,GAAGH,QAAQ;AAEzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAM2C,QAAQ,GAAG;EACvBhD,IAAI;EACJiD,OAAO,EAAE,CAAC,CAAC;EACXH,IAAI;EACJC;AACD,CAAC;AAED,OAAO,MAAMG,IAAI,GAAGA,CAAA,KAAMjD,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAE8C;AAAS,CAAE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { category as icon } from '@wordpress/icons';
|
|
6
|
+
const variations = [{
|
|
7
|
+
name: 'terms',
|
|
8
|
+
title: __('Terms List'),
|
|
9
|
+
icon,
|
|
10
|
+
attributes: {
|
|
11
|
+
// We need to set an attribute here that will be set when inserting the block.
|
|
12
|
+
// We cannot leave this empty, as that would be interpreted as the default value,
|
|
13
|
+
// which is `category` -- for which we're defining a distinct variation below,
|
|
14
|
+
// for backwards compatibility reasons.
|
|
15
|
+
// The logical fallback is thus the only other built-in and public taxonomy: Tags.
|
|
16
|
+
taxonomy: 'post_tag'
|
|
17
|
+
},
|
|
18
|
+
isActive: blockAttributes =>
|
|
19
|
+
// This variation is used for any taxonomy other than `category`.
|
|
20
|
+
blockAttributes.taxonomy !== 'category'
|
|
21
|
+
}, {
|
|
22
|
+
name: 'categories',
|
|
23
|
+
title: __('Categories List'),
|
|
24
|
+
description: __('Display a list of all categories.'),
|
|
25
|
+
icon,
|
|
26
|
+
attributes: {
|
|
27
|
+
taxonomy: 'category'
|
|
28
|
+
},
|
|
29
|
+
isActive: ['taxonomy'],
|
|
30
|
+
// The following is needed to prevent "Terms List" from showing up twice in the inserter
|
|
31
|
+
// (once for the block, once for the variation). Fortunately, it does not collide with
|
|
32
|
+
// `categories` being the default value of the `taxonomy` attribute.
|
|
33
|
+
isDefault: true
|
|
34
|
+
}];
|
|
35
|
+
export default variations;
|
|
36
|
+
//# sourceMappingURL=variations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","category","icon","variations","name","title","attributes","taxonomy","isActive","blockAttributes","description","isDefault"],"sources":["@wordpress/block-library/src/categories/variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { category as icon } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'terms',\n\t\ttitle: __( 'Terms List' ),\n\t\ticon,\n\t\tattributes: {\n\t\t\t// We need to set an attribute here that will be set when inserting the block.\n\t\t\t// We cannot leave this empty, as that would be interpreted as the default value,\n\t\t\t// which is `category` -- for which we're defining a distinct variation below,\n\t\t\t// for backwards compatibility reasons.\n\t\t\t// The logical fallback is thus the only other built-in and public taxonomy: Tags.\n\t\t\ttaxonomy: 'post_tag',\n\t\t},\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t// This variation is used for any taxonomy other than `category`.\n\t\t\tblockAttributes.taxonomy !== 'category',\n\t},\n\t{\n\t\tname: 'categories',\n\t\ttitle: __( 'Categories List' ),\n\t\tdescription: __( 'Display a list of all categories.' ),\n\t\ticon,\n\t\tattributes: {\n\t\t\ttaxonomy: 'category',\n\t\t},\n\t\tisActive: [ 'taxonomy' ],\n\t\t// The following is needed to prevent \"Terms List\" from showing up twice in the inserter\n\t\t// (once for the block, once for the variation). Fortunately, it does not collide with\n\t\t// `categories` being the default value of the `taxonomy` attribute.\n\t\tisDefault: true,\n\t},\n];\n\nexport default variations;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,IAAIC,IAAI,QAAQ,kBAAkB;AAEnD,MAAMC,UAAU,GAAG,CAClB;EACCC,IAAI,EAAE,OAAO;EACbC,KAAK,EAAEL,EAAE,CAAE,YAAa,CAAC;EACzBE,IAAI;EACJI,UAAU,EAAE;IACX;IACA;IACA;IACA;IACA;IACAC,QAAQ,EAAE;EACX,CAAC;EACDC,QAAQ,EAAIC,eAAe;EAC1B;EACAA,eAAe,CAACF,QAAQ,KAAK;AAC/B,CAAC,EACD;EACCH,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAEL,EAAE,CAAE,iBAAkB,CAAC;EAC9BU,WAAW,EAAEV,EAAE,CAAE,mCAAoC,CAAC;EACtDE,IAAI;EACJI,UAAU,EAAE;IACXC,QAAQ,EAAE;EACX,CAAC;EACDC,QAAQ,EAAE,CAAE,UAAU,CAAE;EACxB;EACA;EACA;EACAG,SAAS,EAAE;AACZ,CAAC,CACD;AAED,eAAeR,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createUpgradedEmbedBlock","getClassNames","removeAspectRatioClasses","fallback","getEmbedInfoByProvider","getMergedAttributesWithPreview","EmbedControls","embedContentIcon","EmbedLoading","EmbedPlaceholder","EmbedPreview","clsx","__","_x","sprintf","useState","useEffect","useDispatch","useSelect","useBlockProps","store","coreStore","View","getAuthority","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EmbedEdit","props","attributes","providerNameSlug","previewable","responsive","url","attributesUrl","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","defaultEmbedInfo","title","icon","setURL","isEditingURL","setIsEditingURL","invalidateResolution","preview","fetching","themeSupportsResponsive","cannotEmbed","hasResolved","select","getEmbedPreview","isPreviewEmbedFallback","isRequestingEmbedPreview","getThemeSupports","hasFinishedResolution","embedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","data","status","validPreview","getMergedAttributes","toggleResponsive","allowResponsive","className","newAllowResponsive","newURL","replace","URL","host","toString","mergedAttributes","upgradedBlock","blockProps","children","label","showEmbedPlaceholder","onSubmit","event","preventDefault","blockClass","value","onChange","tryAgain","caption","classFromPreview","showEditButton","blockSupportsResponsive","switchBackToURLInput","onCaptionChange"],"sources":["@wordpress/block-library/src/embed/edit.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: {\n\t\t\tproviderNameSlug,\n\t\t\tpreviewable,\n\t\t\tresponsive,\n\t\t\turl: attributesUrl,\n\t\t},\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst { icon, title } =\n\t\tgetEmbedInfoByProvider( providerNameSlug ) || defaultEmbedInfo;\n\n\tconst [ url, setURL ] = useState( attributesUrl );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tisRequestingEmbedPreview,\n\t\t\t\tgetThemeSupports,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! attributesUrl ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( attributesUrl );\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( attributesUrl );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `data.status` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.data?.status === 404;\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: isRequestingEmbedPreview( attributesUrl ),\n\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\thasResolved: hasFinishedResolution( 'getEmbedPreview', [\n\t\t\t\t\tattributesUrl,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ attributesUrl ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( preview?.html || ! cannotEmbed || ! hasResolved ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = attributesUrl.replace( /\\/$/, '' );\n\t\tsetURL( newURL );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [\n\t\tpreview?.html,\n\t\tattributesUrl,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t\tsetAttributes,\n\t] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// translators: %s: type of embed e.g: \"YouTube\", \"Twitter\", etc. \"Embed\" is used when no specific type exists\n\tconst label = sprintf( __( '%s URL' ), title );\n\n\t// No preview, or we can't embed the current URL, or we've clicked the edit button.\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed || isEditingURL;\n\n\tif ( showEmbedPlaceholder ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\tif ( event ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\t\t\tattributes.className\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\tsetAttributes( { url, className: blockClass } );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\tonChange={ ( value ) => setURL( value ) }\n\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [ url ] );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\tcaption,\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\treturn (\n\t\t<>\n\t\t\t<EmbedControls\n\t\t\t\tshowEditButton={ preview && ! cannotEmbed }\n\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t/>\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPreview\n\t\t\t\t\tpreview={ preview }\n\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\turl={ url }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tcaption={ caption }\n\t\t\t\t\tonCaptionChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,wBAAwB,EACxBC,aAAa,EACbC,wBAAwB,EACxBC,QAAQ,EACRC,sBAAsB,EACtBC,8B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QACvBtC,GAAG,EAAGA,GAAK;QACX6B,IAAI,EAAGA,IAAM;QACb6B,OAAO,EAAGA,OAAS;QACnBK,eAAe,EAAKR,KAAK,IACxBnD,aAAa,CAAE;UAAEsD,OAAO,EAAEH;QAAM,CAAE,CAClC;QACDrD,UAAU,EAAGA,UAAY;QACzBO,IAAI,EAAGA,IAAM;QACbwC,KAAK,EAAGA,KAAO;QACf5C,iBAAiB,EAAGA,iBAAmB;QACvCT,UAAU,EAAGA,UAAY;QACzBQ,aAAa,EAAGA;MAAe,CAC/B;IAAC,CACG,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAED,eAAeV,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createUpgradedEmbedBlock","getClassNames","removeAspectRatioClasses","fallback","getEmbedInfoByProvider","getMergedAttributesWithPreview","EmbedControls","embedContentIcon","EmbedLoading","EmbedPlaceholder","EmbedPreview","clsx","__","_x","sprintf","useState","useEffect","useDispatch","useSelect","useBlockProps","store","coreStore","View","getAuthority","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EmbedEdit","props","attributes","providerNameSlug","previewable","responsive","url","attributesUrl","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","defaultEmbedInfo","title","icon","setURL","isEditingURL","setIsEditingURL","invalidateResolution","preview","fetching","themeSupportsResponsive","cannotEmbed","hasResolved","select","getEmbedPreview","isPreviewEmbedFallback","isRequestingEmbedPreview","getThemeSupports","hasFinishedResolution","embedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","data","status","validPreview","getMergedAttributes","toggleResponsive","allowResponsive","className","newAllowResponsive","newURL","replace","URL","host","toString","mergedAttributes","upgradedBlock","blockProps","children","label","showEmbedPlaceholder","onSubmit","event","preventDefault","blockClass","value","onChange","tryAgain","caption","classFromPreview","showEditButton","blockSupportsResponsive","switchBackToURLInput","onCaptionChange"],"sources":["@wordpress/block-library/src/embed/edit.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: {\n\t\t\tproviderNameSlug,\n\t\t\tpreviewable,\n\t\t\tresponsive,\n\t\t\turl: attributesUrl,\n\t\t},\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst { icon, title } =\n\t\tgetEmbedInfoByProvider( providerNameSlug ) || defaultEmbedInfo;\n\n\tconst [ url, setURL ] = useState( attributesUrl );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tisRequestingEmbedPreview,\n\t\t\t\tgetThemeSupports,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! attributesUrl ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( attributesUrl );\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( attributesUrl );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `data.status` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.data?.status === 404;\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: isRequestingEmbedPreview( attributesUrl ),\n\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\thasResolved: hasFinishedResolution( 'getEmbedPreview', [\n\t\t\t\t\tattributesUrl,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ attributesUrl ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( preview?.html || ! cannotEmbed || ! hasResolved ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = attributesUrl.replace( /\\/$/, '' );\n\t\tsetURL( newURL );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [\n\t\tpreview?.html,\n\t\tattributesUrl,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t\tsetAttributes,\n\t] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// translators: %s: type of embed e.g: \"YouTube\", \"Twitter\", etc. \"Embed\" is used when no specific type exists\n\tconst label = sprintf( __( '%s URL' ), title );\n\n\t// No preview, or we can't embed the current URL, or we've clicked the edit button.\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed || isEditingURL;\n\n\tif ( showEmbedPlaceholder ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\tif ( event ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\t\t\tattributes.className\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\tsetAttributes( { url, className: blockClass } );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\tonChange={ ( value ) => setURL( value ) }\n\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [ url ] );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\tcaption,\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\treturn (\n\t\t<>\n\t\t\t<EmbedControls\n\t\t\t\tshowEditButton={ preview && ! cannotEmbed }\n\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t/>\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPreview\n\t\t\t\t\tpreview={ preview }\n\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\turl={ url }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tcaption={ caption }\n\t\t\t\t\tonCaptionChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,wBAAwB,EACxBC,aAAa,EACbC,wBAAwB,EACxBC,QAAQ,EACRC,sBAAsB,EACtBC,8BAA8B,QACxB,QAAQ;AACf,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,gBAAgB,MAAM,qBAAqB;AAClD,OAAOC,YAAY,MAAM,iBAAiB;;AAE1C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,MAAM;;AAEvB;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f5C,iBAAiB,EAAGA,iBAAmB;QACvCT,UAAU,EAAGA,UAAY;QACzBQ,aAAa,EAAGA;MAAe,CAC/B;IAAC,CACG,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAED,eAAeV,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createUpgradedEmbedBlock","getClassNames","removeAspectRatioClasses","fallback","getEmbedInfoByProvider","getMergedAttributesWithPreview","EmbedControls","embedContentIcon","EmbedLoading","EmbedPlaceholder","EmbedPreview","EmbedLinkSettings","clsx","_x","useCallback","useState","useEffect","useDispatch","useSelect","useBlockProps","store","blockEditorStore","coreStore","View","getAuthority","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PREVIEWABLE_PROVIDERS","NOT_PREVIEWABLE_WP_EMBED_PROVIDERS","WP_EMBED_TYPE","EmbedEdit","props","attributes","align","providerNameSlug","previewable","responsive","url","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","clientId","defaultEmbedInfo","title","icon","embedInfoByProvider","wasBlockJustInserted","select","isEditingURL","setIsEditingURL","showEmbedBottomSheet","setShowEmbedBottomSheet","invalidateResolution","preview","fetching","themeSupportsResponsive","cannotEmbed","getEmbedPreview","hasFinishedResolution","isPreviewEmbedFallback","getThemeSupports","embedPreview","hasResolvedEmbedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","code","validPreview","getMergedAttributes","toggleResponsive","allowResponsive","className","newAllowResponsive","newURL","replace","URL","host","toString","mergedAttributes","upgradedBlock","onEditURL","value","blockClass","blockProps","children","showEmbedPlaceholder","classFromPreview","isProviderPreviewable","includes","linkLabel","label","onPress","event","tryAgain","openEmbedLinkSettings","blockSupportsResponsive","isDefaultEmbedInfo","autoFocus","isVisible","onClose","onSubmit","withBottomSheet"],"sources":["@wordpress/block-library/src/embed/edit.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\nimport EmbedLinkSettings from './embed-link-settings';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useCallback, useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\n// The inline preview feature will be released progressible, for this reason\n// the embed will only be considered previewable for the following providers list.\nconst PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter', 'instagram', 'vimeo' ];\n// Some providers are rendering the inline preview as a WordPress embed and\n// are not supported yet, so we need to disallow them with a fixed providers list.\nconst NOT_PREVIEWABLE_WP_EMBED_PROVIDERS = [ 'pinterest' ];\n\nconst WP_EMBED_TYPE = 'wp-embed';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: { align, providerNameSlug, previewable, responsive, url },\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t\tclientId,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );\n\tconst { icon, title } = embedInfoByProvider || defaultEmbedInfo;\n\n\tconst { wasBlockJustInserted } = useSelect(\n\t\t( select ) => ( {\n\t\t\twasBlockJustInserted: select(\n\t\t\t\tblockEditorStore\n\t\t\t).wasBlockJustInserted( clientId, 'inserter_menu' ),\n\t\t} ),\n\t\t[ clientId ]\n\t);\n\tconst [ isEditingURL, setIsEditingURL ] = useState(\n\t\tisSelected && wasBlockJustInserted && ! url\n\t);\n\tconst [ showEmbedBottomSheet, setShowEmbedBottomSheet ] =\n\t\tuseState( isEditingURL );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst { preview, fetching, themeSupportsResponsive, cannotEmbed } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEmbedPreview,\n\t\t\t\t\thasFinishedResolution,\n\t\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\t\tgetThemeSupports,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tif ( ! url ) {\n\t\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t\t}\n\n\t\t\t\tconst embedPreview = getEmbedPreview( url );\n\t\t\t\tconst hasResolvedEmbedPreview = hasFinishedResolution(\n\t\t\t\t\t'getEmbedPreview',\n\t\t\t\t\t[ url ]\n\t\t\t\t);\n\t\t\t\tconst previewIsFallback = isPreviewEmbedFallback( url );\n\n\t\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\t\tconst badEmbedProvider =\n\t\t\t\t\tembedPreview?.html === false &&\n\t\t\t\t\tembedPreview?.type === undefined;\n\t\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t\t// a valid JSON response with no HTML and `code` set to 404, rather\n\t\t\t\t// than generating a fallback response as other embeds do.\n\t\t\t\tconst wordpressCantEmbed = embedPreview?.code === '404';\n\t\t\t\tconst validPreview =\n\t\t\t\t\t!! embedPreview &&\n\t\t\t\t\t! badEmbedProvider &&\n\t\t\t\t\t! wordpressCantEmbed;\n\n\t\t\t\treturn {\n\t\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\t\tfetching: ! hasResolvedEmbedPreview,\n\t\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ url ]\n\t\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! preview?.html || ! cannotEmbed || fetching ) {\n\t\t\treturn;\n\t\t}\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = url.replace( /\\/$/, '' );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [ preview?.html, url, cannotEmbed, fetching ] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tuseEffect(\n\t\t() => setShowEmbedBottomSheet( isEditingURL ),\n\t\t[ isEditingURL ]\n\t);\n\n\tconst onEditURL = useCallback(\n\t\t( value ) => {\n\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\tif ( attributes.url !== value ) {\n\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\tattributes.className\n\t\t\t\t);\n\t\t\t\tsetAttributes( { className: blockClass } );\n\t\t\t}\n\n\t\t\t// The order of the following calls is important, we need to update the URL attribute before changing `isEditingURL`,\n\t\t\t// otherwise the side-effect that potentially replaces the block when updating the local state won't use the new URL\n\t\t\t// for creating the new block.\n\t\t\tsetAttributes( { url: value } );\n\t\t\tsetIsEditingURL( false );\n\t\t},\n\t\t[ attributes, setAttributes ]\n\t);\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed;\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\tconst isProviderPreviewable =\n\t\tPREVIEWABLE_PROVIDERS.includes( providerNameSlug ) ||\n\t\t// For WordPress embeds, we enable the inline preview for all its providers\n\t\t// except the ones that are not supported yet.\n\t\t( WP_EMBED_TYPE === type &&\n\t\t\t! NOT_PREVIEWABLE_WP_EMBED_PROVIDERS.includes( providerNameSlug ) );\n\n\tconst linkLabel = WP_EMBED_TYPE === type ? 'WordPress' : title;\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmbedPlaceholder ? (\n\t\t\t\t<>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus( event );\n\t\t\t\t\t\t\t\tsetIsEditingURL( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\topenEmbedLinkSettings={ () =>\n\t\t\t\t\t\t\t\tsetShowEmbedBottomSheet( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<EmbedControls\n\t\t\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tlinkLabel={ linkLabel }\n\t\t\t\t\t\tonEditURL={ onEditURL }\n\t\t\t\t\t/>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPreview\n\t\t\t\t\t\t\talign={ align }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tisProviderPreviewable={ isProviderPreviewable }\n\t\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tisDefaultEmbedInfo={ ! embedInfoByProvider }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<EmbedLinkSettings\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus\n\t\t\t\tvalue={ url }\n\t\t\t\tlabel={ linkLabel }\n\t\t\t\tisVisible={ showEmbedBottomSheet }\n\t\t\t\tonClose={ () => setShowEmbedBottomSheet( false ) }\n\t\t\t\tonSubmit={ onEditURL }\n\t\t\t\twithBottomSheet\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,wBAAwB,EACxBC,aAAa,EACbC,wBAAwB,EACxBC,QAAQ,EACRC,sBAAsB,EACtBC,8BAA8B,QACxB,QAAQ;AACf,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,gBAAgB,QAAQ,SAA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ThB,KAAK,EAAGjD,GAAK;MACb0D,KAAK,EAAGD,SAAW;MACnBS,SAAS,EAAGnD,oBAAsB;MAClCoD,OAAO,EAAGA,CAAA,KAAMnD,uBAAuB,CAAE,KAAM,CAAG;MAClDoD,QAAQ,EAAGpB,SAAW;MACtBqB,eAAe;IAAA,CACf,CAAC;EAAA,CACD,CAAC;AAEL,CAAC;AAED,eAAe5E,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createUpgradedEmbedBlock","getClassNames","removeAspectRatioClasses","fallback","getEmbedInfoByProvider","getMergedAttributesWithPreview","EmbedControls","embedContentIcon","EmbedLoading","EmbedPlaceholder","EmbedPreview","EmbedLinkSettings","clsx","_x","useCallback","useState","useEffect","useDispatch","useSelect","useBlockProps","store","blockEditorStore","coreStore","View","getAuthority","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PREVIEWABLE_PROVIDERS","NOT_PREVIEWABLE_WP_EMBED_PROVIDERS","WP_EMBED_TYPE","EmbedEdit","props","attributes","align","providerNameSlug","previewable","responsive","url","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","clientId","defaultEmbedInfo","title","icon","embedInfoByProvider","wasBlockJustInserted","select","isEditingURL","setIsEditingURL","showEmbedBottomSheet","setShowEmbedBottomSheet","invalidateResolution","preview","fetching","themeSupportsResponsive","cannotEmbed","getEmbedPreview","hasFinishedResolution","isPreviewEmbedFallback","getThemeSupports","embedPreview","hasResolvedEmbedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","code","validPreview","getMergedAttributes","toggleResponsive","allowResponsive","className","newAllowResponsive","newURL","replace","URL","host","toString","mergedAttributes","upgradedBlock","onEditURL","value","blockClass","blockProps","children","showEmbedPlaceholder","classFromPreview","isProviderPreviewable","includes","linkLabel","label","onPress","event","tryAgain","openEmbedLinkSettings","blockSupportsResponsive","isDefaultEmbedInfo","autoFocus","isVisible","onClose","onSubmit","withBottomSheet"],"sources":["@wordpress/block-library/src/embed/edit.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\nimport EmbedLinkSettings from './embed-link-settings';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useCallback, useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\n// The inline preview feature will be released progressible, for this reason\n// the embed will only be considered previewable for the following providers list.\nconst PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter', 'instagram', 'vimeo' ];\n// Some providers are rendering the inline preview as a WordPress embed and\n// are not supported yet, so we need to disallow them with a fixed providers list.\nconst NOT_PREVIEWABLE_WP_EMBED_PROVIDERS = [ 'pinterest' ];\n\nconst WP_EMBED_TYPE = 'wp-embed';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: { align, providerNameSlug, previewable, responsive, url },\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t\tclientId,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );\n\tconst { icon, title } = embedInfoByProvider || defaultEmbedInfo;\n\n\tconst { wasBlockJustInserted } = useSelect(\n\t\t( select ) => ( {\n\t\t\twasBlockJustInserted: select(\n\t\t\t\tblockEditorStore\n\t\t\t).wasBlockJustInserted( clientId, 'inserter_menu' ),\n\t\t} ),\n\t\t[ clientId ]\n\t);\n\tconst [ isEditingURL, setIsEditingURL ] = useState(\n\t\tisSelected && wasBlockJustInserted && ! url\n\t);\n\tconst [ showEmbedBottomSheet, setShowEmbedBottomSheet ] =\n\t\tuseState( isEditingURL );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst { preview, fetching, themeSupportsResponsive, cannotEmbed } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEmbedPreview,\n\t\t\t\t\thasFinishedResolution,\n\t\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\t\tgetThemeSupports,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tif ( ! url ) {\n\t\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t\t}\n\n\t\t\t\tconst embedPreview = getEmbedPreview( url );\n\t\t\t\tconst hasResolvedEmbedPreview = hasFinishedResolution(\n\t\t\t\t\t'getEmbedPreview',\n\t\t\t\t\t[ url ]\n\t\t\t\t);\n\t\t\t\tconst previewIsFallback = isPreviewEmbedFallback( url );\n\n\t\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\t\tconst badEmbedProvider =\n\t\t\t\t\tembedPreview?.html === false &&\n\t\t\t\t\tembedPreview?.type === undefined;\n\t\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t\t// a valid JSON response with no HTML and `code` set to 404, rather\n\t\t\t\t// than generating a fallback response as other embeds do.\n\t\t\t\tconst wordpressCantEmbed = embedPreview?.code === '404';\n\t\t\t\tconst validPreview =\n\t\t\t\t\t!! embedPreview &&\n\t\t\t\t\t! badEmbedProvider &&\n\t\t\t\t\t! wordpressCantEmbed;\n\n\t\t\t\treturn {\n\t\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\t\tfetching: ! hasResolvedEmbedPreview,\n\t\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ url ]\n\t\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! preview?.html || ! cannotEmbed || fetching ) {\n\t\t\treturn;\n\t\t}\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = url.replace( /\\/$/, '' );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [ preview?.html, url, cannotEmbed, fetching ] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tuseEffect(\n\t\t() => setShowEmbedBottomSheet( isEditingURL ),\n\t\t[ isEditingURL ]\n\t);\n\n\tconst onEditURL = useCallback(\n\t\t( value ) => {\n\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\tif ( attributes.url !== value ) {\n\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\tattributes.className\n\t\t\t\t);\n\t\t\t\tsetAttributes( { className: blockClass } );\n\t\t\t}\n\n\t\t\t// The order of the following calls is important, we need to update the URL attribute before changing `isEditingURL`,\n\t\t\t// otherwise the side-effect that potentially replaces the block when updating the local state won't use the new URL\n\t\t\t// for creating the new block.\n\t\t\tsetAttributes( { url: value } );\n\t\t\tsetIsEditingURL( false );\n\t\t},\n\t\t[ attributes, setAttributes ]\n\t);\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed;\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\tconst isProviderPreviewable =\n\t\tPREVIEWABLE_PROVIDERS.includes( providerNameSlug ) ||\n\t\t// For WordPress embeds, we enable the inline preview for all its providers\n\t\t// except the ones that are not supported yet.\n\t\t( WP_EMBED_TYPE === type &&\n\t\t\t! NOT_PREVIEWABLE_WP_EMBED_PROVIDERS.includes( providerNameSlug ) );\n\n\tconst linkLabel = WP_EMBED_TYPE === type ? 'WordPress' : title;\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmbedPlaceholder ? (\n\t\t\t\t<>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus( event );\n\t\t\t\t\t\t\t\tsetIsEditingURL( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\topenEmbedLinkSettings={ () =>\n\t\t\t\t\t\t\t\tsetShowEmbedBottomSheet( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<EmbedControls\n\t\t\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tlinkLabel={ linkLabel }\n\t\t\t\t\t\tonEditURL={ onEditURL }\n\t\t\t\t\t/>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPreview\n\t\t\t\t\t\t\talign={ align }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tisProviderPreviewable={ isProviderPreviewable }\n\t\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tisDefaultEmbedInfo={ ! embedInfoByProvider }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<EmbedLinkSettings\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus\n\t\t\t\tvalue={ url }\n\t\t\t\tlabel={ linkLabel }\n\t\t\t\tisVisible={ showEmbedBottomSheet }\n\t\t\t\tonClose={ () => setShowEmbedBottomSheet( false ) }\n\t\t\t\tonSubmit={ onEditURL }\n\t\t\t\twithBottomSheet\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,wBAAwB,EACxBC,aAAa,EACbC,wBAAwB,EACxBC,QAAQ,EACRC,sBAAsB,EACtBC,8BAA8B,Q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AAC,CACG,CAAC;IAAA,CACN,CACF,eACDzB,IAAA,CAACf;IACA;IAAA;MACA+F,SAAS;MACThB,KAAK,EAAGjD,GAAK;MACb0D,KAAK,EAAGD,SAAW;MACnBS,SAAS,EAAGnD,oBAAsB;MAClCoD,OAAO,EAAGA,CAAA,KAAMnD,uBAAuB,CAAE,KAAM,CAAG;MAClDoD,QAAQ,EAAGpB,SAAW;MACtBqB,eAAe;IAAA,CACf,CAAC;EAAA,CACD,CAAC;AAEL,CAAC;AAED,eAAe5E,SAAS","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ import clsx from 'clsx';
|
|
|
14
14
|
import { __, sprintf } from '@wordpress/i18n';
|
|
15
15
|
import { Placeholder, SandBox } from '@wordpress/components';
|
|
16
16
|
import { BlockIcon } from '@wordpress/block-editor';
|
|
17
|
-
import {
|
|
17
|
+
import { useState } from '@wordpress/element';
|
|
18
18
|
import { getAuthority } from '@wordpress/url';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -24,114 +24,94 @@ import WpEmbedPreview from './wp-embed-preview';
|
|
|
24
24
|
import { Caption } from '../utils/caption';
|
|
25
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
export default function EmbedPreview({
|
|
28
|
+
preview,
|
|
29
|
+
previewable,
|
|
30
|
+
url,
|
|
31
|
+
type,
|
|
32
|
+
isSelected,
|
|
33
|
+
className,
|
|
34
|
+
icon,
|
|
35
|
+
label,
|
|
36
|
+
insertBlocksAfter,
|
|
37
|
+
attributes,
|
|
38
|
+
setAttributes
|
|
39
|
+
}) {
|
|
40
|
+
const [interactive, setInteractive] = useState(false);
|
|
41
|
+
if (!isSelected && interactive) {
|
|
42
|
+
// We only want to change this when the block is not selected, because changing it when
|
|
43
|
+
// the block becomes selected makes the overlap disappear too early. Hiding the overlay
|
|
44
|
+
// happens on mouseup when the overlay is clicked.
|
|
45
|
+
setInteractive(false);
|
|
34
46
|
}
|
|
35
|
-
|
|
36
|
-
if (!nextProps.isSelected && state.interactive) {
|
|
37
|
-
// We only want to change this when the block is not selected, because changing it when
|
|
38
|
-
// the block becomes selected makes the overlap disappear too early. Hiding the overlay
|
|
39
|
-
// happens on mouseup when the overlay is clicked.
|
|
40
|
-
return {
|
|
41
|
-
interactive: false
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
hideOverlay() {
|
|
47
|
+
const hideOverlay = () => {
|
|
47
48
|
// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop
|
|
48
49
|
// changing, because that happens on mouse down, and the overlay immediately disappears,
|
|
49
50
|
// and the mouse event can end up in the preview content. We can't use onClick on
|
|
50
51
|
// the overlay to hide it either, because then the editor misses the mouseup event, and
|
|
51
52
|
// thinks we're multi-selecting blocks.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
icon,
|
|
64
|
-
label,
|
|
65
|
-
insertBlocksAfter,
|
|
66
|
-
attributes,
|
|
67
|
-
setAttributes,
|
|
68
|
-
isSelected
|
|
69
|
-
} = this.props;
|
|
70
|
-
const {
|
|
71
|
-
scripts
|
|
72
|
-
} = preview;
|
|
73
|
-
const {
|
|
74
|
-
interactive
|
|
75
|
-
} = this.state;
|
|
76
|
-
const html = 'photo' === type ? getPhotoHtml(preview) : preview.html;
|
|
77
|
-
const embedSourceUrl = getAuthority(url);
|
|
78
|
-
const iframeTitle = sprintf(
|
|
79
|
-
// translators: %s: host providing embed content e.g: www.youtube.com
|
|
80
|
-
__('Embedded content from %s'), embedSourceUrl);
|
|
81
|
-
const sandboxClassnames = clsx(type, className, 'wp-block-embed__wrapper');
|
|
53
|
+
setInteractive(true);
|
|
54
|
+
};
|
|
55
|
+
const {
|
|
56
|
+
scripts
|
|
57
|
+
} = preview;
|
|
58
|
+
const html = 'photo' === type ? getPhotoHtml(preview) : preview.html;
|
|
59
|
+
const embedSourceUrl = getAuthority(url);
|
|
60
|
+
const iframeTitle = sprintf(
|
|
61
|
+
// translators: %s: host providing embed content e.g: www.youtube.com
|
|
62
|
+
__('Embedded content from %s'), embedSourceUrl);
|
|
63
|
+
const sandboxClassnames = clsx(type, className, 'wp-block-embed__wrapper');
|
|
82
64
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
65
|
+
// Disabled because the overlay div doesn't actually have a role or functionality
|
|
66
|
+
// as far as the user is concerned. We're just catching the first click so that
|
|
67
|
+
// the block can be selected without interacting with the embed preview that the overlay covers.
|
|
68
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
69
|
+
const embedWrapper = 'wp-embed' === type ? /*#__PURE__*/_jsx(WpEmbedPreview, {
|
|
70
|
+
html: html
|
|
71
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
|
72
|
+
className: "wp-block-embed__wrapper",
|
|
73
|
+
children: [/*#__PURE__*/_jsx(SandBox, {
|
|
74
|
+
html: html,
|
|
75
|
+
scripts: scripts,
|
|
76
|
+
title: iframeTitle,
|
|
77
|
+
type: sandboxClassnames,
|
|
78
|
+
onFocus: hideOverlay
|
|
79
|
+
}), !interactive && /*#__PURE__*/_jsx("div", {
|
|
80
|
+
className: "block-library-embed__interactive-overlay",
|
|
81
|
+
onMouseUp: hideOverlay
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
103
85
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
86
|
+
return /*#__PURE__*/_jsxs("figure", {
|
|
87
|
+
className: clsx(className, 'wp-block-embed', {
|
|
88
|
+
'is-type-video': 'video' === type
|
|
89
|
+
}),
|
|
90
|
+
children: [previewable ? embedWrapper : /*#__PURE__*/_jsxs(Placeholder, {
|
|
91
|
+
icon: /*#__PURE__*/_jsx(BlockIcon, {
|
|
92
|
+
icon: icon,
|
|
93
|
+
showColors: true
|
|
107
94
|
}),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
})
|
|
120
|
-
}), /*#__PURE__*/_jsx("p", {
|
|
121
|
-
className: "components-placeholder__error",
|
|
122
|
-
children: sprintf( /* translators: %s: host providing embed content e.g: www.youtube.com */
|
|
123
|
-
__("Embedded content from %s can't be previewed in the editor."), embedSourceUrl)
|
|
124
|
-
})]
|
|
125
|
-
}), /*#__PURE__*/_jsx(Caption, {
|
|
126
|
-
attributes: attributes,
|
|
127
|
-
setAttributes: setAttributes,
|
|
128
|
-
isSelected: isSelected,
|
|
129
|
-
insertBlocksAfter: insertBlocksAfter,
|
|
130
|
-
label: __('Embed caption text'),
|
|
131
|
-
showToolbarButton: isSelected
|
|
95
|
+
label: label,
|
|
96
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
97
|
+
className: "components-placeholder__error",
|
|
98
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
99
|
+
href: url,
|
|
100
|
+
children: url
|
|
101
|
+
})
|
|
102
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
103
|
+
className: "components-placeholder__error",
|
|
104
|
+
children: sprintf( /* translators: %s: host providing embed content e.g: www.youtube.com */
|
|
105
|
+
__("Embedded content from %s can't be previewed in the editor."), embedSourceUrl)
|
|
132
106
|
})]
|
|
133
|
-
})
|
|
134
|
-
|
|
107
|
+
}), /*#__PURE__*/_jsx(Caption, {
|
|
108
|
+
attributes: attributes,
|
|
109
|
+
setAttributes: setAttributes,
|
|
110
|
+
isSelected: isSelected,
|
|
111
|
+
insertBlocksAfter: insertBlocksAfter,
|
|
112
|
+
label: __('Embed caption text'),
|
|
113
|
+
showToolbarButton: isSelected
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
135
116
|
}
|
|
136
|
-
export default EmbedPreview;
|
|
137
117
|
//# sourceMappingURL=embed-preview.js.map
|