Now Carousel is completly visible on post saved (#136)
This commit is contained in:
parent
2c08a8ea78
commit
f9089293f3
|
@ -2056,7 +2056,7 @@
|
|||
},
|
||||
"camelcase-keys": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
|
||||
"integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
|
||||
"requires": {
|
||||
"camelcase": "^2.0.0",
|
||||
|
@ -5120,7 +5120,7 @@
|
|||
},
|
||||
"is-builtin-module": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
|
||||
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
|
||||
"requires": {
|
||||
"builtin-modules": "^1.0.0"
|
||||
|
@ -5477,7 +5477,7 @@
|
|||
},
|
||||
"load-json-file": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
||||
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
|
@ -5736,7 +5736,7 @@
|
|||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
}
|
||||
}
|
||||
|
@ -6037,7 +6037,7 @@
|
|||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
|
||||
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8="
|
||||
}
|
||||
}
|
||||
|
@ -6348,7 +6348,7 @@
|
|||
},
|
||||
"os-locale": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
||||
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
|
||||
"requires": {
|
||||
"lcid": "^1.0.0"
|
||||
|
@ -8488,7 +8488,7 @@
|
|||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
|
||||
"dev": true
|
||||
},
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
margin: 0;
|
||||
padding: 0; }
|
||||
|
||||
.BrainhubCarousel .BrainhubCarousel__trackContainer .BrainhubCarousel__track.BrainhubCarousel__track--transition {
|
||||
.BrainhubCarousel .BrainhubCarousel__trackContainer .BrainhubCarousel__track .BrainhubCarousel__track--transition {
|
||||
-webkit-transition: -webkit-transform;
|
||||
transition: -webkit-transform;
|
||||
transition: transform;
|
||||
|
@ -68,7 +68,7 @@
|
|||
cursor: pointer;
|
||||
-webkit-appearance: none; }
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot.BrainhubCarousel__dot--selected {
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot .BrainhubCarousel__dot--selected {
|
||||
opacity: 1 !important; }
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot:hover {
|
||||
|
@ -91,7 +91,7 @@
|
|||
opacity: 0.5;
|
||||
cursor: pointer; }
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail.BrainhubCarousel__thumbnail--selected {
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail .BrainhubCarousel__thumbnail--selected {
|
||||
opacity: 1 !important; }
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail:hover {
|
||||
|
@ -140,6 +140,11 @@
|
|||
transform: translate(-50%, -50%) rotate(45deg);
|
||||
margin-left: -2.45px; }
|
||||
|
||||
.BrainhubCarousel__track {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
max-height: 100% !important; }
|
||||
|
||||
.BrainhubCarouselItem {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
|
@ -150,7 +155,10 @@
|
|||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
position: relative; }
|
||||
position: relative;
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
max-height: 100% !important; }
|
||||
|
||||
.BrainhubCarouselItem.BrainhubCarouselItem--clickable {
|
||||
cursor: pointer; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAAA,uCAAwC;EACtC,UAAU,EAAE,KAAK;EAEjB,8FAAuD;IACrD,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAEhB,2JAA6D;MAC3D,OAAO,EAAE,IAAI;MACb,WAAW,EAAE,UAAU;MACvB,aAAa,EAAE,KAAK;IAGtB,4JAA8D;MAC5D,OAAO,EAAE,IAAI;MACb,cAAc,EAAE,MAAM;MACtB,WAAW,EAAE,QAAQ;;AAK3B,wBAAyB;EACvB,KAAK,EAAE,IAAI;;AAGb,iBAAkB;EAChB,QAAQ,EAAE,MAAM;EAChB,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,IAAI;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AC;EACN,MAAM,EAAE,CAAC;EACT,IAAI,EAAE,CAAC;EACP,KAAK,EAAE,CAAC;EACR,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,IAAI;EACb,gBAAgB,EAAE,MAAM;EACxB,aAAa,EAAE,MAAM;EACrB,eAAe,EAAE,MAAM;EACvB,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,iBAAiB",
|
||||
"sources": ["../../gutenberg-blocks/tainacan-collections/collections-carousel/collections-carousel.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-blocks-style.css"
|
||||
|
|
|
@ -24,6 +24,8 @@ class GutenbergBlock {
|
|||
private function add_gutenberg_blocks_actions() {
|
||||
add_action('init', array($this, 'register_tainacan_collections_carousel'));
|
||||
add_action('init', array($this, 'add_plugin_settings'));
|
||||
|
||||
add_action('wp_enqueue_scripts', array($this, 'enqueue_on_theme'));
|
||||
add_filter( 'block_categories', array($this, 'register_tainacan_block_categories'), 10, 2 );
|
||||
}
|
||||
|
||||
|
@ -43,6 +45,16 @@ class GutenbergBlock {
|
|||
);
|
||||
}
|
||||
|
||||
public function enqueue_on_theme(){
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
wp_enqueue_script(
|
||||
'collections-carousel',
|
||||
$TAINACAN_BASE_URL . '/assets/collections_carousel-components.js',
|
||||
array('wp-blocks', 'wp-element')
|
||||
);
|
||||
}
|
||||
|
||||
public function register_tainacan_collections_carousel(){
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
|
@ -66,9 +78,12 @@ class GutenbergBlock {
|
|||
}
|
||||
|
||||
public function get_plugin_js_settings(){
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
$settings = [
|
||||
'root' => esc_url_raw( rest_url() ) . 'tainacan/v2',
|
||||
'nonce' => wp_create_nonce( 'wp_rest' ),
|
||||
'root' => esc_url_raw( rest_url() ) . 'tainacan/v2',
|
||||
'nonce' => wp_create_nonce( 'wp_rest' ),
|
||||
'base_url' => $TAINACAN_BASE_URL
|
||||
];
|
||||
|
||||
return $settings;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
.BrainhubCarousel .BrainhubCarousel__trackContainer .BrainhubCarousel__track.BrainhubCarousel__track--transition {
|
||||
.BrainhubCarousel .BrainhubCarousel__trackContainer .BrainhubCarousel__track .BrainhubCarousel__track--transition {
|
||||
-webkit-transition: -webkit-transform;
|
||||
transition: -webkit-transform;
|
||||
transition: transform;
|
||||
|
@ -83,7 +83,7 @@
|
|||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot.BrainhubCarousel__dot--selected {
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot .BrainhubCarousel__dot--selected {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail.BrainhubCarousel__thumbnail--selected {
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail .BrainhubCarousel__thumbnail--selected {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
|
@ -168,6 +168,12 @@
|
|||
margin-left: -2.45px;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__track {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
max-height: 100% !important;
|
||||
}
|
||||
|
||||
.BrainhubCarouselItem {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
|
@ -179,6 +185,10 @@
|
|||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
max-height: 100% !important;
|
||||
}
|
||||
|
||||
.BrainhubCarouselItem.BrainhubCarouselItem--clickable {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Carousel, { Dots } from '@brainhubeu/react-carousel';
|
||||
import Carousel from '@brainhubeu/react-carousel';
|
||||
|
||||
const { registerBlockType } = wp.blocks;
|
||||
|
||||
|
@ -28,7 +28,7 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
source: 'query',
|
||||
selector: 'div',
|
||||
query: {
|
||||
dataValue: { source: 'attribute', attribute: 'data-value'},
|
||||
dataValue: { source: 'attribute', attribute: 'value'},
|
||||
},
|
||||
default: []
|
||||
},
|
||||
|
@ -42,8 +42,14 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
source: 'query',
|
||||
selector: 'img',
|
||||
query: {
|
||||
src: { source: 'attribute', attribute: 'src'},
|
||||
alt: { source: 'attribute', attribute: 'alt' },
|
||||
src: {
|
||||
source: 'attribute',
|
||||
attribute: 'src'
|
||||
},
|
||||
alt: {
|
||||
source: 'attribute',
|
||||
attribute: 'alt'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -58,8 +64,7 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
content: {
|
||||
type: 'string',
|
||||
source: 'html',
|
||||
selector: 'div',
|
||||
default: []
|
||||
selector: 'div'
|
||||
}
|
||||
},
|
||||
supports: {
|
||||
|
@ -69,14 +74,14 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
console.log('edit', attributes);
|
||||
|
||||
function prepareCollection(collection) {
|
||||
return (<div key={ collection.id } data-value={collection}>{ collection.name }</div>);
|
||||
return (<input key={ collection.id } value={collection} />);
|
||||
}
|
||||
|
||||
function prepareItem(item, style) {
|
||||
return (
|
||||
<picture style={style}>
|
||||
<img
|
||||
src={item.thumbnail.thumb ? item.thumbnail.thumb : 'https://dummyimage.com/150x150/cccccc/000000.png&text=+++NO+THUMBNAIL'}
|
||||
src={item.thumbnail.thumb ? item.thumbnail.thumb : `${tainacan_plugin.base_url}/admin/images/placeholder_square.png`}
|
||||
alt={item.title} />
|
||||
</picture>
|
||||
);
|
||||
|
@ -179,18 +184,21 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
shouldCloseOnClickOutside={ false }
|
||||
title={ __('Add collection', 'tainacan') }
|
||||
onRequestClose={ () => {
|
||||
setAttributes( { isOpen: false } );
|
||||
|
||||
setAttributes({
|
||||
content: (
|
||||
<div>
|
||||
{attributes.content1.length ?
|
||||
{ attributes.content1.length ?
|
||||
<Carousel
|
||||
slidesPerScroll={1}
|
||||
slidesPerPage={attributes.content1.length >= 3 ? 3 : attributes.content1.length}
|
||||
arrows
|
||||
slides={attributes.content1}/> : null
|
||||
}</div>
|
||||
}
|
||||
</div>
|
||||
)});
|
||||
|
||||
setAttributes( { isOpen: false } );
|
||||
}}>
|
||||
|
||||
<div>
|
||||
|
@ -211,18 +219,20 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
</div>
|
||||
|
||||
<Button isDefault onClick={ () => {
|
||||
setAttributes( { isOpen: false } );
|
||||
setAttributes({
|
||||
content: (
|
||||
<div>
|
||||
{attributes.content1.length ?
|
||||
<Carousel
|
||||
slidesPerScroll={1}
|
||||
slidesPerPage={attributes.content1.length >= 3 ? 3 : attributes.content1.length}
|
||||
arrows
|
||||
slides={attributes.content1}/> : null
|
||||
}</div>
|
||||
{ attributes.content1.length ?
|
||||
<Carousel
|
||||
slidesPerScroll={1}
|
||||
slidesPerPage={attributes.content1.length >= 3 ? 3 : attributes.content1.length}
|
||||
arrows
|
||||
slides={attributes.content1}/> : null
|
||||
}
|
||||
</div>
|
||||
)});
|
||||
|
||||
setAttributes( { isOpen: false } );
|
||||
} }>
|
||||
{ __('Close', 'tainacan') }
|
||||
</Button>
|
||||
|
@ -231,7 +241,7 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
}
|
||||
|
||||
<div>
|
||||
{attributes.content1.length ?
|
||||
{ attributes.content1.length ?
|
||||
<Carousel
|
||||
slidesPerScroll={1}
|
||||
slidesPerPage={attributes.content1.length >= 3 ? 3 : attributes.content1.length}
|
||||
|
@ -243,16 +253,14 @@ registerBlockType('tainacan/collections-carousel', {
|
|||
);
|
||||
},
|
||||
save({ attributes }) {
|
||||
// return (
|
||||
// <div>
|
||||
// <Carousel
|
||||
// slidesPerScroll={1}
|
||||
// slidesPerPage={attributes.content1.length >= 3 ? 3 : attributes.content1.length}
|
||||
// arrows
|
||||
// slides={attributes.content1}/>
|
||||
// </div>
|
||||
// );
|
||||
let { content } = attributes;
|
||||
|
||||
return attributes.content;
|
||||
console.log('save', content);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ content }
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue