Skip to content

Commit

Permalink
Gallery: Remove obsolete deprecation entry (#26736)
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored Nov 6, 2020
1 parent 1d9c07a commit dff001c
Showing 1 changed file with 0 additions and 158 deletions.
158 changes: 0 additions & 158 deletions packages/block-library/src/gallery/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,166 +13,8 @@ import { RichText } from '@wordpress/block-editor';
* Internal dependencies
*/
import { defaultColumnsNumber } from './shared';
import {
LINK_DESTINATION_ATTACHMENT,
LINK_DESTINATION_MEDIA,
} from './constants';

const deprecated = [
{
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: '.blocks-gallery-item',
query: {
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src',
},
fullUrl: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-full-url',
},
link: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-link',
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: '',
},
id: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-id',
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-item__caption',
},
},
},
ids: {
type: 'array',
items: {
type: 'number',
},
default: [],
},
columns: {
type: 'number',
minimum: 1,
maximum: 8,
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-caption',
},
imageCrop: {
type: 'boolean',
default: true,
},
linkTo: {
type: 'string',
},
sizeSlug: {
type: 'string',
default: 'large',
},
},
save( { attributes } ) {
const {
images,
columns = defaultColumnsNumber( attributes ),
imageCrop,
caption,
linkTo,
} = attributes;

return (
<figure
className={ `columns-${ columns } ${
imageCrop ? 'is-cropped' : ''
}` }
>
<ul className="blocks-gallery-grid">
{ images.map( ( image ) => {
let href;

switch ( linkTo ) {
case LINK_DESTINATION_MEDIA:
href = image.fullUrl || image.url;
break;
case LINK_DESTINATION_ATTACHMENT:
href = image.link;
break;
}

const img = (
<img
src={ image.url }
alt={ image.alt }
data-id={ image.id }
data-full-url={ image.fullUrl }
data-link={ image.link }
className={
image.id
? `wp-image-${ image.id }`
: null
}
/>
);

return (
<li
key={ image.id || image.url }
className="blocks-gallery-item"
>
<figure>
{ href ? (
<a href={ href }>{ img }</a>
) : (
img
) }
{ ! RichText.isEmpty(
image.caption
) && (
<RichText.Content
tagName="figcaption"
className="blocks-gallery-item__caption"
value={ image.caption }
/>
) }
</figure>
</li>
);
} ) }
</ul>
{ ! RichText.isEmpty( caption ) && (
<RichText.Content
tagName="figcaption"
className="blocks-gallery-caption"
value={ caption }
/>
) }
</figure>
);
},
},
{
attributes: {
images: {
Expand Down

0 comments on commit dff001c

Please sign in to comment.