@wordpress/media-fields 0.14.1 → 0.15.1-next.v.202607070741.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/attached_to/edit.cjs +0 -1
- package/build/attached_to/edit.cjs.map +2 -2
- package/build-module/attached_to/edit.mjs +0 -1
- package/build-module/attached_to/edit.mjs.map +2 -2
- package/build-style/style-rtl.css +6 -0
- package/build-style/style.css +6 -0
- package/build-types/attached_to/edit.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/attached_to/edit.tsx +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/attached_to/edit.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { Button, ComboboxControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { debounce } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\nimport { getRenderedContent } from '../utils/get-rendered-content';\n\nexport type SearchResult = {\n\t/**\n\t * Post or term id.\n\t */\n\tid: number;\n\t/**\n\t * Link url.\n\t */\n\turl: string;\n\t/**\n\t * Title of the link.\n\t */\n\ttitle: string;\n\t/**\n\t * The taxonomy or post type slug or type URL.\n\t */\n\ttype: string;\n\t/**\n\t * Link kind of post-type or taxonomy\n\t */\n\tkind?: string;\n};\n\nexport default function MediaAttachedToEdit( {\n\tdata,\n\tonChange,\n}: DataFormControlProps< MediaItem > ) {\n\tconst defaultPost =\n\t\t!! data.post && !! data?._embedded?.[ 'wp:attached-to' ]?.[ 0 ]\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: getRenderedContent(\n\t\t\t\t\t\t\tdata._embedded?.[ 'wp:attached-to' ]?.[ 0 ]?.title\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: data.post.toString(),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: [];\n\tconst [ options, setOptions ] =\n\t\tuseState< { label: string; value: string }[] >( defaultPost );\n\tconst [ searchResults, setSearchResults ] = useState< SearchResult[] >(\n\t\t[]\n\t);\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ value, setValue ] = useState< string | null >(\n\t\tdata?.post?.toString() ?? null\n\t);\n\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes(),\n\t\t[]\n\t);\n\tconst handleDetach = () => {\n\t\tonChange( {\n\t\t\tpost: 0,\n\t\t\t_embedded: { ...data?._embedded, 'wp:attached-to': undefined },\n\t\t} );\n\t\tsetValue( null );\n\t\tsetOptions( [] );\n\t};\n\n\tconst onValueChange = async ( filterValue: string ) => {\n\t\tsetIsLoading( true );\n\t\tconst results = await fetchLinkSuggestions(\n\t\t\tfilterValue,\n\t\t\t/*\n\t\t\t * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument.\n\t\t\t * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20.\n\t\t\t */\n\t\t\t{ type: 'post', isInitialSuggestions: true },\n\t\t\t{}\n\t\t);\n\t\tsetSearchResults( results );\n\t\tconst suggestions = results.map( ( result ) => {\n\t\t\treturn {\n\t\t\t\tlabel: result.title,\n\t\t\t\tvalue: result.id.toString(),\n\t\t\t};\n\t\t} );\n\t\tconst includeCurrent =\n\t\t\t! filterValue &&\n\t\t\tsuggestions.findIndex( ( s ) => s.value === value ) === -1;\n\t\tsetOptions( suggestions.concat( includeCurrent ? defaultPost : [] ) );\n\t\tsetIsLoading( false );\n\t};\n\n\t/**\n\t * Handle selection.\n\t *\n\t * @param {Object} selectedPostId The selected post id.\n\t */\n\tconst handleSelectOption = (\n\t\tselectedPostId: string | null | undefined\n\t) => {\n\t\tif ( ! selectedPostId ) {\n\t\t\thandleDetach();\n\t\t\treturn;\n\t\t}\n\t\tsetValue( selectedPostId );\n\t\tif ( selectedPostId ) {\n\t\t\tconst selectedPost = searchResults.find(\n\t\t\t\t( result ) => result.id === Number( selectedPostId )\n\t\t\t);\n\t\t\t// Although unlikely, it's technically possible for selectedPost to not be found.\n\t\t\t// E.g. if the user selects an option just as new search results are loaded.\n\t\t\t// TODO: Add error handling for when selectedPost is not found.\n\t\t\tif ( selectedPost && postTypes ) {\n\t\t\t\tconst postType = postTypes.find(\n\t\t\t\t\t( _postType: { slug: string } ) =>\n\t\t\t\t\t\t_postType.slug === selectedPost?.type\n\t\t\t\t);\n\n\t\t\t\tconst attachedTo = {\n\t\t\t\t\t...( postType && { type: postType.slug } ),\n\t\t\t\t\tid: Number( selectedPostId ),\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\traw: selectedPost.title,\n\t\t\t\t\t\trendered: selectedPost.title,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tonChange( {\n\t\t\t\t\tpost: Number( selectedPostId ),\n\t\t\t\t\t_embedded: {\n\t\t\t\t\t\t...data?._embedded,\n\t\t\t\t\t\t'wp:attached-to': [ attachedTo ],\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n\n\tconst help = createInterpolateElement(\n\t\t__(\n\t\t\t'Search for a post or page to attach this media to or <button>detach current</button>.'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={ handleDetach }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\tclassName=\"dataviews-media-field__att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AAA,MACd;AAAA,IAEF;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { Button, ComboboxControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { debounce } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\nimport { getRenderedContent } from '../utils/get-rendered-content';\n\nexport type SearchResult = {\n\t/**\n\t * Post or term id.\n\t */\n\tid: number;\n\t/**\n\t * Link url.\n\t */\n\turl: string;\n\t/**\n\t * Title of the link.\n\t */\n\ttitle: string;\n\t/**\n\t * The taxonomy or post type slug or type URL.\n\t */\n\ttype: string;\n\t/**\n\t * Link kind of post-type or taxonomy\n\t */\n\tkind?: string;\n};\n\nexport default function MediaAttachedToEdit( {\n\tdata,\n\tonChange,\n}: DataFormControlProps< MediaItem > ) {\n\tconst defaultPost =\n\t\t!! data.post && !! data?._embedded?.[ 'wp:attached-to' ]?.[ 0 ]\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: getRenderedContent(\n\t\t\t\t\t\t\tdata._embedded?.[ 'wp:attached-to' ]?.[ 0 ]?.title\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: data.post.toString(),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: [];\n\tconst [ options, setOptions ] =\n\t\tuseState< { label: string; value: string }[] >( defaultPost );\n\tconst [ searchResults, setSearchResults ] = useState< SearchResult[] >(\n\t\t[]\n\t);\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ value, setValue ] = useState< string | null >(\n\t\tdata?.post?.toString() ?? null\n\t);\n\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes(),\n\t\t[]\n\t);\n\tconst handleDetach = () => {\n\t\tonChange( {\n\t\t\tpost: 0,\n\t\t\t_embedded: { ...data?._embedded, 'wp:attached-to': undefined },\n\t\t} );\n\t\tsetValue( null );\n\t\tsetOptions( [] );\n\t};\n\n\tconst onValueChange = async ( filterValue: string ) => {\n\t\tsetIsLoading( true );\n\t\tconst results = await fetchLinkSuggestions(\n\t\t\tfilterValue,\n\t\t\t/*\n\t\t\t * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument.\n\t\t\t * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20.\n\t\t\t */\n\t\t\t{ type: 'post', isInitialSuggestions: true },\n\t\t\t{}\n\t\t);\n\t\tsetSearchResults( results );\n\t\tconst suggestions = results.map( ( result ) => {\n\t\t\treturn {\n\t\t\t\tlabel: result.title,\n\t\t\t\tvalue: result.id.toString(),\n\t\t\t};\n\t\t} );\n\t\tconst includeCurrent =\n\t\t\t! filterValue &&\n\t\t\tsuggestions.findIndex( ( s ) => s.value === value ) === -1;\n\t\tsetOptions( suggestions.concat( includeCurrent ? defaultPost : [] ) );\n\t\tsetIsLoading( false );\n\t};\n\n\t/**\n\t * Handle selection.\n\t *\n\t * @param {Object} selectedPostId The selected post id.\n\t */\n\tconst handleSelectOption = (\n\t\tselectedPostId: string | null | undefined\n\t) => {\n\t\tif ( ! selectedPostId ) {\n\t\t\thandleDetach();\n\t\t\treturn;\n\t\t}\n\t\tsetValue( selectedPostId );\n\t\tif ( selectedPostId ) {\n\t\t\tconst selectedPost = searchResults.find(\n\t\t\t\t( result ) => result.id === Number( selectedPostId )\n\t\t\t);\n\t\t\t// Although unlikely, it's technically possible for selectedPost to not be found.\n\t\t\t// E.g. if the user selects an option just as new search results are loaded.\n\t\t\t// TODO: Add error handling for when selectedPost is not found.\n\t\t\tif ( selectedPost && postTypes ) {\n\t\t\t\tconst postType = postTypes.find(\n\t\t\t\t\t( _postType: { slug: string } ) =>\n\t\t\t\t\t\t_postType.slug === selectedPost?.type\n\t\t\t\t);\n\n\t\t\t\tconst attachedTo = {\n\t\t\t\t\t...( postType && { type: postType.slug } ),\n\t\t\t\t\tid: Number( selectedPostId ),\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\traw: selectedPost.title,\n\t\t\t\t\t\trendered: selectedPost.title,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tonChange( {\n\t\t\t\t\tpost: Number( selectedPostId ),\n\t\t\t\t\t_embedded: {\n\t\t\t\t\t\t...data?._embedded,\n\t\t\t\t\t\t'wp:attached-to': [ attachedTo ],\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n\n\tconst help = createInterpolateElement(\n\t\t__(\n\t\t\t'Search for a post or page to attach this media to or <button>detach current</button>.'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={ handleDetach }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\tclassName=\"dataviews-media-field__attached-to\"\n\t\t\tisLoading={ isLoading }\n\t\t\tlabel={ __( 'Attached to' ) }\n\t\t\thelp={ help }\n\t\t\tvalue={ value }\n\t\t\toptions={ options }\n\t\t\tonFilterValueChange={ debounce(\n\t\t\t\t( filterValue: unknown ) =>\n\t\t\t\t\tonValueChange( filterValue as string ),\n\t\t\t\t300\n\t\t\t) }\n\t\t\tonChange={ handleSelectOption }\n\t\t\thideLabelFromVision\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAGO;AACP,wBAAwC;AACxC,kBAAmB;AACnB,q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A,MACA;AAAA,MACA;AAAA,MACA,yBAAsB;AAAA,QACrB,CAAE,gBACD,cAAe,WAAsB;AAAA,QACtC;AAAA,MACD;AAAA,MACA,UAAW;AAAA,MACX,qBAAmB;AAAA;AAAA,EACpB;AAEF;",
|
|
6
6
|
"names": ["coreStore", "fetchLinkSuggestions"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/attached_to/edit.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { Button, ComboboxControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { debounce } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\nimport { getRenderedContent } from '../utils/get-rendered-content';\n\nexport type SearchResult = {\n\t/**\n\t * Post or term id.\n\t */\n\tid: number;\n\t/**\n\t * Link url.\n\t */\n\turl: string;\n\t/**\n\t * Title of the link.\n\t */\n\ttitle: string;\n\t/**\n\t * The taxonomy or post type slug or type URL.\n\t */\n\ttype: string;\n\t/**\n\t * Link kind of post-type or taxonomy\n\t */\n\tkind?: string;\n};\n\nexport default function MediaAttachedToEdit( {\n\tdata,\n\tonChange,\n}: DataFormControlProps< MediaItem > ) {\n\tconst defaultPost =\n\t\t!! data.post && !! data?._embedded?.[ 'wp:attached-to' ]?.[ 0 ]\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: getRenderedContent(\n\t\t\t\t\t\t\tdata._embedded?.[ 'wp:attached-to' ]?.[ 0 ]?.title\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: data.post.toString(),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: [];\n\tconst [ options, setOptions ] =\n\t\tuseState< { label: string; value: string }[] >( defaultPost );\n\tconst [ searchResults, setSearchResults ] = useState< SearchResult[] >(\n\t\t[]\n\t);\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ value, setValue ] = useState< string | null >(\n\t\tdata?.post?.toString() ?? null\n\t);\n\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes(),\n\t\t[]\n\t);\n\tconst handleDetach = () => {\n\t\tonChange( {\n\t\t\tpost: 0,\n\t\t\t_embedded: { ...data?._embedded, 'wp:attached-to': undefined },\n\t\t} );\n\t\tsetValue( null );\n\t\tsetOptions( [] );\n\t};\n\n\tconst onValueChange = async ( filterValue: string ) => {\n\t\tsetIsLoading( true );\n\t\tconst results = await fetchLinkSuggestions(\n\t\t\tfilterValue,\n\t\t\t/*\n\t\t\t * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument.\n\t\t\t * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20.\n\t\t\t */\n\t\t\t{ type: 'post', isInitialSuggestions: true },\n\t\t\t{}\n\t\t);\n\t\tsetSearchResults( results );\n\t\tconst suggestions = results.map( ( result ) => {\n\t\t\treturn {\n\t\t\t\tlabel: result.title,\n\t\t\t\tvalue: result.id.toString(),\n\t\t\t};\n\t\t} );\n\t\tconst includeCurrent =\n\t\t\t! filterValue &&\n\t\t\tsuggestions.findIndex( ( s ) => s.value === value ) === -1;\n\t\tsetOptions( suggestions.concat( includeCurrent ? defaultPost : [] ) );\n\t\tsetIsLoading( false );\n\t};\n\n\t/**\n\t * Handle selection.\n\t *\n\t * @param {Object} selectedPostId The selected post id.\n\t */\n\tconst handleSelectOption = (\n\t\tselectedPostId: string | null | undefined\n\t) => {\n\t\tif ( ! selectedPostId ) {\n\t\t\thandleDetach();\n\t\t\treturn;\n\t\t}\n\t\tsetValue( selectedPostId );\n\t\tif ( selectedPostId ) {\n\t\t\tconst selectedPost = searchResults.find(\n\t\t\t\t( result ) => result.id === Number( selectedPostId )\n\t\t\t);\n\t\t\t// Although unlikely, it's technically possible for selectedPost to not be found.\n\t\t\t// E.g. if the user selects an option just as new search results are loaded.\n\t\t\t// TODO: Add error handling for when selectedPost is not found.\n\t\t\tif ( selectedPost && postTypes ) {\n\t\t\t\tconst postType = postTypes.find(\n\t\t\t\t\t( _postType: { slug: string } ) =>\n\t\t\t\t\t\t_postType.slug === selectedPost?.type\n\t\t\t\t);\n\n\t\t\t\tconst attachedTo = {\n\t\t\t\t\t...( postType && { type: postType.slug } ),\n\t\t\t\t\tid: Number( selectedPostId ),\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\traw: selectedPost.title,\n\t\t\t\t\t\trendered: selectedPost.title,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tonChange( {\n\t\t\t\t\tpost: Number( selectedPostId ),\n\t\t\t\t\t_embedded: {\n\t\t\t\t\t\t...data?._embedded,\n\t\t\t\t\t\t'wp:attached-to': [ attachedTo ],\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n\n\tconst help = createInterpolateElement(\n\t\t__(\n\t\t\t'Search for a post or page to attach this media to or <button>detach current</button>.'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={ handleDetach }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\tclassName=\"dataviews-media-field__attached-to\"\n\t\t\
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,sCAAsC;AAAA,EACtC,SAAS;AAAA,OACH;AACP,SAAS,QAAQ,uBAAuB;AACxC,SAAS,UAAU;AACnB,SAAS,UAAU,gCAAgC;AACnD,SAAS,gBAAgB;A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inkSuggestions,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { Button, ComboboxControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { debounce } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\nimport { getRenderedContent } from '../utils/get-rendered-content';\n\nexport type SearchResult = {\n\t/**\n\t * Post or term id.\n\t */\n\tid: number;\n\t/**\n\t * Link url.\n\t */\n\turl: string;\n\t/**\n\t * Title of the link.\n\t */\n\ttitle: string;\n\t/**\n\t * The taxonomy or post type slug or type URL.\n\t */\n\ttype: string;\n\t/**\n\t * Link kind of post-type or taxonomy\n\t */\n\tkind?: string;\n};\n\nexport default function MediaAttachedToEdit( {\n\tdata,\n\tonChange,\n}: DataFormControlProps< MediaItem > ) {\n\tconst defaultPost =\n\t\t!! data.post && !! data?._embedded?.[ 'wp:attached-to' ]?.[ 0 ]\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: getRenderedContent(\n\t\t\t\t\t\t\tdata._embedded?.[ 'wp:attached-to' ]?.[ 0 ]?.title\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: data.post.toString(),\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: [];\n\tconst [ options, setOptions ] =\n\t\tuseState< { label: string; value: string }[] >( defaultPost );\n\tconst [ searchResults, setSearchResults ] = useState< SearchResult[] >(\n\t\t[]\n\t);\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ value, setValue ] = useState< string | null >(\n\t\tdata?.post?.toString() ?? null\n\t);\n\n\tconst postTypes = useSelect(\n\t\t( select ) => select( coreStore ).getPostTypes(),\n\t\t[]\n\t);\n\tconst handleDetach = () => {\n\t\tonChange( {\n\t\t\tpost: 0,\n\t\t\t_embedded: { ...data?._embedded, 'wp:attached-to': undefined },\n\t\t} );\n\t\tsetValue( null );\n\t\tsetOptions( [] );\n\t};\n\n\tconst onValueChange = async ( filterValue: string ) => {\n\t\tsetIsLoading( true );\n\t\tconst results = await fetchLinkSuggestions(\n\t\t\tfilterValue,\n\t\t\t/*\n\t\t\t * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument.\n\t\t\t * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20.\n\t\t\t */\n\t\t\t{ type: 'post', isInitialSuggestions: true },\n\t\t\t{}\n\t\t);\n\t\tsetSearchResults( results );\n\t\tconst suggestions = results.map( ( result ) => {\n\t\t\treturn {\n\t\t\t\tlabel: result.title,\n\t\t\t\tvalue: result.id.toString(),\n\t\t\t};\n\t\t} );\n\t\tconst includeCurrent =\n\t\t\t! filterValue &&\n\t\t\tsuggestions.findIndex( ( s ) => s.value === value ) === -1;\n\t\tsetOptions( suggestions.concat( includeCurrent ? defaultPost : [] ) );\n\t\tsetIsLoading( false );\n\t};\n\n\t/**\n\t * Handle selection.\n\t *\n\t * @param {Object} selectedPostId The selected post id.\n\t */\n\tconst handleSelectOption = (\n\t\tselectedPostId: string | null | undefined\n\t) => {\n\t\tif ( ! selectedPostId ) {\n\t\t\thandleDetach();\n\t\t\treturn;\n\t\t}\n\t\tsetValue( selectedPostId );\n\t\tif ( selectedPostId ) {\n\t\t\tconst selectedPost = searchResults.find(\n\t\t\t\t( result ) => result.id === Number( selectedPostId )\n\t\t\t);\n\t\t\t// Although unlikely, it's technically possible for selectedPost to not be found.\n\t\t\t// E.g. if the user selects an option just as new search results are loaded.\n\t\t\t// TODO: Add error handling for when selectedPost is not found.\n\t\t\tif ( selectedPost && postTypes ) {\n\t\t\t\tconst postType = postTypes.find(\n\t\t\t\t\t( _postType: { slug: string } ) =>\n\t\t\t\t\t\t_postType.slug === selectedPost?.type\n\t\t\t\t);\n\n\t\t\t\tconst attachedTo = {\n\t\t\t\t\t...( postType && { type: postType.slug } ),\n\t\t\t\t\tid: Number( selectedPostId ),\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\traw: selectedPost.title,\n\t\t\t\t\t\trendered: selectedPost.title,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tonChange( {\n\t\t\t\t\tpost: Number( selectedPostId ),\n\t\t\t\t\t_embedded: {\n\t\t\t\t\t\t...data?._embedded,\n\t\t\t\t\t\t'wp:attached-to': [ attachedTo ],\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n\n\tconst help = createInterpolateElement(\n\t\t__(\n\t\t\t'Search for a post or page to attach this media to or <button>detach current</button>.'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={ handleDetach }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\tclassName=\"dataviews-media-field__attached-to\"\n\t\t\tisLoading={ isLoading }\n\t\t\tlabel={ __( 'Attached to' ) }\n\t\t\thelp={ help }\n\t\t\tvalue={ value }\n\t\t\toptions={ options }\n\t\t\tonFilterValueChange={ debounce(\n\t\t\t\t( filterValue: unknown ) =>\n\t\t\t\t\tonValueChange( filterValue as string ),\n\t\t\t\t300\n\t\t\t) }\n\t\t\tonChange={ handleSelectOption }\n\t\t\thideLabelFromVision\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,sCAAsC;AAAA,EACtC,SAAS;AAAA,OACH;AACP,SAAS,QAAQ,uBAAuB;AACxC,SAAS,UAAU;AACnB,SAAS,UAAU,gCAAgC;AACnD,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAO1B,SAAS,0BAA0B;AA4I/B;AAnHW,SAAR,oBAAsC;AAAA,EAC5C;AAAA,EACA;AACD,GAAuC;AACtC,QAAM,cACL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F;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -67,6 +67,12 @@
|
|
|
67
67
|
/**
|
|
68
68
|
* Focus styles.
|
|
69
69
|
*/
|
|
70
|
+
/**
|
|
71
|
+
* Standard focus rings for the WordPress Design System.
|
|
72
|
+
*
|
|
73
|
+
* Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
|
|
74
|
+
* e.g. `&:focus { @include outset-ring__focus(); }`.
|
|
75
|
+
*/
|
|
70
76
|
/**
|
|
71
77
|
* Applies editor left position to the selector passed as argument
|
|
72
78
|
*/
|
package/build-style/style.css
CHANGED
|
@@ -67,6 +67,12 @@
|
|
|
67
67
|
/**
|
|
68
68
|
* Focus styles.
|
|
69
69
|
*/
|
|
70
|
+
/**
|
|
71
|
+
* Standard focus rings for the WordPress Design System.
|
|
72
|
+
*
|
|
73
|
+
* Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
|
|
74
|
+
* e.g. `&:focus { @include outset-ring__focus(); }`.
|
|
75
|
+
*/
|
|
70
76
|
/**
|
|
71
77
|
* Applies editor left position to the selector passed as argument
|
|
72
78
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/attached_to/edit.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,MAAM,YAAY,GAAG;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,IAAI,EACJ,QAAQ,EACR,EAAE,oBAAoB,CAAE,SAAS,CAAE,+
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/attached_to/edit.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,MAAM,YAAY,GAAG;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,IAAI,EACJ,QAAQ,EACR,EAAE,oBAAoB,CAAE,SAAS,CAAE,+BA4InC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/media-fields",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1-next.v.202607070741.0+a51d59513",
|
|
4
4
|
"description": "Reusable field definitions for displaying and editing media attachment properties in WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
"src/**/*.scss"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@wordpress/base-styles": "^10.1.0",
|
|
52
|
-
"@wordpress/components": "^
|
|
53
|
-
"@wordpress/compose": "^8.
|
|
54
|
-
"@wordpress/core-data": "^7.
|
|
55
|
-
"@wordpress/data": "^10.
|
|
56
|
-
"@wordpress/dataviews": "^17.0
|
|
57
|
-
"@wordpress/date": "^5.
|
|
58
|
-
"@wordpress/element": "^8.1.0",
|
|
59
|
-
"@wordpress/i18n": "^6.
|
|
60
|
-
"@wordpress/icons": "^15.
|
|
61
|
-
"@wordpress/primitives": "^4.
|
|
62
|
-
"@wordpress/ui": "^0.
|
|
63
|
-
"@wordpress/url": "^4.
|
|
51
|
+
"@wordpress/base-styles": "^10.3.1-next.v.202607070741.0+a51d59513",
|
|
52
|
+
"@wordpress/components": "^37.0.1-next.v.202607070741.0+a51d59513",
|
|
53
|
+
"@wordpress/compose": "^8.3.1-next.v.202607070741.0+a51d59513",
|
|
54
|
+
"@wordpress/core-data": "^7.50.1-next.v.202607070741.0+a51d59513",
|
|
55
|
+
"@wordpress/data": "^10.50.1-next.v.202607070741.0+a51d59513",
|
|
56
|
+
"@wordpress/dataviews": "^17.1.2-next.v.202607070741.0+a51d59513",
|
|
57
|
+
"@wordpress/date": "^5.50.1-next.v.202607070741.0+a51d59513",
|
|
58
|
+
"@wordpress/element": "^8.2.1-next.v.202607070741.0+a51d59513",
|
|
59
|
+
"@wordpress/i18n": "^6.23.1-next.v.202607070741.0+a51d59513",
|
|
60
|
+
"@wordpress/icons": "^15.1.1-next.v.202607070741.0+a51d59513",
|
|
61
|
+
"@wordpress/primitives": "^4.50.1-next.v.202607070741.0+a51d59513",
|
|
62
|
+
"@wordpress/ui": "^0.18.1-next.v.202607070741.0+a51d59513",
|
|
63
|
+
"@wordpress/url": "^4.50.1-next.v.202607070741.0+a51d59513",
|
|
64
64
|
"clsx": "^2.1.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "f637726e370c8b23695ed9af82adbe171ad235d8"
|
|
85
85
|
}
|
package/src/attached_to/edit.tsx
CHANGED