@@ -3,6 +3,7 @@ import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
33import { decodeEntities } from '@wordpress/html-entities' ;
44import { __ } from '@wordpress/i18n' ;
55import { useSelect } from '@wordpress/data' ;
6+ import { sortableHandle } from 'react-sortable-hoc' ;
67/** @jsxImportSource @emotion /react */
78import { jsx } from '@emotion/react' ; // eslint-disable-line no-unused-vars
89
@@ -12,6 +13,9 @@ import { jsx } from '@emotion/react'; // eslint-disable-line no-unused-vars
1213 * @param {Object } props react props
1314 * @return {* } React JSX
1415 */
16+
17+ const DragHandle = sortableHandle ( ( ) => < svg style = { { marginRight : '5px' , cursor : 'grab' } } width = "18" height = "18" xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 18 18" role = "img" aria-hidden = "true" focusable = "false" > < path d = "M5 4h2V2H5v2zm6-2v2h2V2h-2zm-6 8h2V8H5v2zm6 0h2V8h-2v2zm-6 6h2v-2H5v2zm6 0h2v-2h-2v2z" > </ path > </ svg > ) ;
18+
1519const PickedItem = ( { item, isOrderable, handleItemDelete, sortIndex, mode, totalItems } ) => {
1620 const type = mode === 'post' ? 'postType' : 'taxonomy' ;
1721
@@ -34,18 +38,19 @@ const PickedItem = ({ item, isOrderable, handleItemDelete, sortIndex, mode, tota
3438
3539 return preparedItem ? (
3640 < div
37- css = { {
38- cursor : isOrderable && totalItems > 1 ? 'move' : 'default' ,
41+ style = { {
3942 border : '2px dashed #ddd' ,
40- ':hover' : ! isOrderable
41- ? {
42- backgroundColor : 'transparent' ,
43- }
44- : '' ,
43+ paddingTop : '10px' ,
44+ paddingBottom : '10px' ,
45+ paddingLeft : isOrderable ? '3px' : '8px'
4546 } }
4647 className = "block-editor-link-control__search-item is-entity"
4748 >
49+ { isOrderable ?
50+ < DragHandle />
51+ : '' }
4852 < span className = "block-editor-link-control__search-item-header" >
53+
4954 < span className = "block-editor-link-control__search-item-title" >
5055 { decodeEntities ( preparedItem . title ) }
5156 </ span >
0 commit comments