Separate deprecated file for collection list and adds font size support. #461

This commit is contained in:
mateuswetah 2020-11-30 17:45:35 -03:00
parent 0301df4ac6
commit 8561bde7e9
4 changed files with 90 additions and 3 deletions

View File

@ -11,7 +11,7 @@ import tainacan from '../../js/axios.js';
import axios from 'axios';
import qs from 'qs';
import TainacanBlocksCompatToolbar from '../../js/tainacan-blocks-compat-toolbar.js';
import deprecatedBlocks from './deprecated.js'
import DeprecatedBlocks from './carousel-collections-deprecated.js'
registerBlockType('tainacan/carousel-collections-list', {
title: __('Tainacan Collections Carousel', 'tainacan'),
@ -621,5 +621,5 @@ registerBlockType('tainacan/carousel-collections-list', {
{ content }
</div>
},
deprecated: deprecatedBlocks
deprecated: DeprecatedBlocks
});

View File

@ -0,0 +1,84 @@
export default [
/* Deprecated on Tainacan 0.17.2, due to the introduction of support: fontSize */
{
attributes: {
selectedCollectionsObject: {
type: 'array',
source: 'query',
selector: 'a',
query: {
id: {
type: 'string',
source: 'attribute',
attribute: 'id'
},
url: {
type: 'string',
source: 'attribute',
attribute: 'href'
},
name: {
type: 'string',
source: 'text'
},
thumbnail: {
source: 'query',
selector: 'img',
query: {
src: {
source: 'attribute',
attribute: 'src'
},
alt: {
source: 'attribute',
attribute: 'alt'
},
}
},
},
default: []
},
content: {
type: 'array',
source: 'children',
selector: 'div'
},
query: {
type: Object,
default: {}
},
selectedCollectionsHTML: {
type: Array,
default: []
},
showImage: {
type: Boolean,
default: true
},
showName: {
type: Boolean,
default: true
},
layout: {
type: String,
default: 'grid'
},
isModalOpen: {
type: Boolean,
default: false
},
gridMargin: {
type: Number,
default: 0
}
},
supports: {
align: ['full', 'wide'],
html: false,
},
save({ attributes, className }){
const { content } = attributes;
return <div className={className}>{ content }</div>
}
}
];

View File

@ -8,6 +8,7 @@ const { InspectorControls, BlockControls } = ( tainacan_blocks.wp_version < '5.2
import TainacanBlocksCompatToolbar from '../../js/tainacan-blocks-compat-toolbar.js';
import CollectionsModal from './collections-modal.js';
import DeprecatedBlocks from './collections-list-deprecated.js';
registerBlockType('tainacan/collections-list', {
title: __('Tainacan Collections List', 'tainacan'),
@ -100,6 +101,7 @@ registerBlockType('tainacan/collections-list', {
supports: {
align: ['full', 'wide'],
html: false,
fontSize: true
},
edit({ attributes, setAttributes, className, isSelected }){
let {
@ -352,5 +354,6 @@ registerBlockType('tainacan/collections-list', {
save({ attributes, className }){
const { content } = attributes;
return <div className={className}>{ content }</div>
}
},
deprecated: DeprecatedBlocks
});