Removes unavailable features from the gallery block by now. #674.

This commit is contained in:
mateuswetah 2022-03-08 11:10:43 -03:00
parent 6d47c6a664
commit b9074fef6a
6 changed files with 37 additions and 56 deletions

View File

@ -609,6 +609,19 @@ a.pswp__share--download:hover {
.pswp--minimal--dark .pswp__top-bar { .pswp--minimal--dark .pswp__top-bar {
background: none; } background: none; }
.item-gallery-edit-container .tainacan-media-component .swiper-slide,
.item-gallery-edit-container .tainacan-media-component .swiper-button-prev,
.item-gallery-edit-container .tainacan-media-component .swiper-button-next {
cursor: not-allowed !important; }
.item-gallery-edit-container .preview-warning {
width: 100%;
font-size: 0.875rem;
font-style: italic;
color: inherit;
text-align: center;
margin: 0 auto;
padding: 8px 2px 2px 2px; }
.tainacan-media-component { .tainacan-media-component {
--swiper-theme-color: var(--tainacan-secondary, #298596); --swiper-theme-color: var(--tainacan-secondary, #298596);
--swiper-navigation-size: 44px; --swiper-navigation-size: 44px;

File diff suppressed because one or more lines are too long

View File

@ -73,18 +73,6 @@
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"hideFileNameLightbox": {
"type": "boolean",
"default": false
},
"hideFileCaptionLightbox": {
"type": "boolean",
"default": false
},
"hideFileDescriptionLightbox": {
"type": "boolean",
"default": false
},
"openLightboxOnClick": { "openLightboxOnClick": {
"type": "boolean", "type": "boolean",
"default": true "default": true

View File

@ -22,9 +22,6 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
hideFileNameThumbnails, hideFileNameThumbnails,
hideFileCaptionThumbnails, hideFileCaptionThumbnails,
hideFileDescriptionThumbnails, hideFileDescriptionThumbnails,
hideFileNameLightbox,
hideFileCaptionLightbox,
hideFileDescriptionLightbox,
openLightboxOnClick, openLightboxOnClick,
arrowsSize, arrowsSize,
mainSliderHeight, mainSliderHeight,
@ -74,7 +71,7 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
} }
} }
/> />
<ToggleControl {/* <ToggleControl
label={__('Metadata', 'tainacan')} label={__('Metadata', 'tainacan')}
checked={ mediaSources['metadata'] === true } checked={ mediaSources['metadata'] === true }
onChange={ ( isChecked ) => { onChange={ ( isChecked ) => {
@ -83,7 +80,7 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
setAttributes({ mediaSources: updatedSources }); setAttributes({ mediaSources: updatedSources });
} }
} }
/> /> */}
</PanelBody> </PanelBody>
<PanelBody <PanelBody
title={__('Layout elements', 'tainacan')} title={__('Layout elements', 'tainacan')}
@ -237,40 +234,6 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
/> />
</PanelBody> </PanelBody>
: null } : null }
{ openLightboxOnClick ?
<PanelBody
title={__('Lightbox settings', 'tainacan')}
initialOpen={ false }
>
<ToggleControl
label={__('Hide file name', 'tainacan')}
checked={ hideFileNameLightbox }
onChange={ ( isChecked ) => {
hideFileNameLightbox = isChecked;
setAttributes({ hideFileNameLightbox: hideFileNameLightbox });
}
}
/>
<ToggleControl
label={__('Hide file caption', 'tainacan')}
checked={ hideFileCaptionLightbox }
onChange={ ( isChecked ) => {
hideFileCaptionLightbox = isChecked;
setAttributes({ hideFileCaptionLightbox: hideFileCaptionLightbox });
}
}
/>
<ToggleControl
label={__('Hide file description', 'tainacan')}
checked={ hideFileDescriptionLightbox }
onChange={ ( isChecked ) => {
hideFileDescriptionLightbox = isChecked;
setAttributes({ hideFileDescriptionLightbox: hideFileDescriptionLightbox });
}
}
/>
</PanelBody>
: null }
</InspectorControls> </InspectorControls>
{ isSelected ? { isSelected ?
@ -340,6 +303,7 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
{ itemId ? ( { itemId ? (
<div className={ 'item-gallery-edit-container' }> <div className={ 'item-gallery-edit-container' }>
<div class="preview-warning">{__('Warning: this is just a demonstration. To see the gallery in action, either preview or publish your post.', 'tainacan') }</div>
<ServerSideRender <ServerSideRender
block="tainacan/item-gallery" block="tainacan/item-gallery"
attributes={ attributes } attributes={ attributes }

View File

@ -22,9 +22,6 @@ function tainacan_blocks_render_items_gallery( $block_attributes, $content ) {
$hide_file_name_thumbnails = isset($block_attributes['hideFileNameThumbnails']) ? $block_attributes['hideFileNameThumbnails'] : true; $hide_file_name_thumbnails = isset($block_attributes['hideFileNameThumbnails']) ? $block_attributes['hideFileNameThumbnails'] : true;
$hide_file_caption_thumbnails = isset($block_attributes['hideFileCaptionThumbnails']) ? $block_attributes['hideFileCaptionThumbnails'] : true; $hide_file_caption_thumbnails = isset($block_attributes['hideFileCaptionThumbnails']) ? $block_attributes['hideFileCaptionThumbnails'] : true;
$hide_file_description_thumbnails = isset($block_attributes['hideFileDescriptionThumbnails']) ? $block_attributes['hideFileDescriptionThumbnails'] : true; $hide_file_description_thumbnails = isset($block_attributes['hideFileDescriptionThumbnails']) ? $block_attributes['hideFileDescriptionThumbnails'] : true;
$hide_file_name_lightbox = isset($block_attributes['hideFileNameLightbox']) ? $block_attributes['hideFileNameLightbox'] : false;
$hide_file_caption_lightbox = isset($block_attributes['hideFileCaptionLightbox']) ? $block_attributes['hideFileCaptionLightbox'] : false;
$hide_file_description_lightbox = isset($block_attributes['hideFileDescriptionLightbox']) ? $block_attributes['hideFileDescriptionLightbox'] : false;
$open_lightbox_on_click = isset($block_attributes['openLightboxOnClick']) ? $block_attributes['openLightboxOnClick'] : true; $open_lightbox_on_click = isset($block_attributes['openLightboxOnClick']) ? $block_attributes['openLightboxOnClick'] : true;
$media_items_main = array(); $media_items_main = array();
@ -152,13 +149,14 @@ function tainacan_blocks_render_items_gallery( $block_attributes, $content ) {
$block_custom_css .= (isset($block_attributes['mainSliderWidth']) && is_numeric($block_attributes['mainSliderWidth'])) ? ('--tainacan-media-main-carousel-width: ' . $block_attributes['mainSliderWidth'] . '%;') : ''; $block_custom_css .= (isset($block_attributes['mainSliderWidth']) && is_numeric($block_attributes['mainSliderWidth'])) ? ('--tainacan-media-main-carousel-width: ' . $block_attributes['mainSliderWidth'] . '%;') : '';
$block_custom_css .= (isset($block_attributes['thumbnailsCarouselWidth']) && is_numeric($block_attributes['thumbnailsCarouselWidth'])) ? ('--tainacan-media-thumbs-carousel-width: ' . $block_attributes['thumbnailsCarouselWidth'] . '%;') : ''; $block_custom_css .= (isset($block_attributes['thumbnailsCarouselWidth']) && is_numeric($block_attributes['thumbnailsCarouselWidth'])) ? ('--tainacan-media-thumbs-carousel-width: ' . $block_attributes['thumbnailsCarouselWidth'] . '%;') : '';
$block_custom_css .= (isset($block_attributes['thumbnailsCarouselItemSize']) && is_numeric($block_attributes['thumbnailsCarouselItemSize'])) ? ('--tainacan-media-thumbs-carousel-item-size: ' . $block_attributes['thumbnailsCarouselItemSize'] . 'px;') : ''; $block_custom_css .= (isset($block_attributes['thumbnailsCarouselItemSize']) && is_numeric($block_attributes['thumbnailsCarouselItemSize'])) ? ('--tainacan-media-thumbs-carousel-item-size: ' . $block_attributes['thumbnailsCarouselItemSize'] . 'px;') : '';
// var_dump($block_attributes['style']['elements']);
$wrapper_attributes = get_block_wrapper_attributes( $wrapper_attributes = get_block_wrapper_attributes(
array( array(
'style' => $block_custom_css, 'style' => $block_custom_css,
'class' => 'tainacan-media-component' 'class' => 'tainacan-media-component'
) )
); );
return tainacan_get_the_media_component( return tainacan_get_the_media_component(
'tainacan-item-gallery-block_id-' . $block_id, 'tainacan-item-gallery-block_id-' . $block_id,
(isset($layout_elements['thumbnails']) && ($layout_elements['thumbnails'] === true || $layout_elements['thumbnails'] == 'true')) ? $media_items_thumbnails : null, (isset($layout_elements['thumbnails']) && ($layout_elements['thumbnails'] === true || $layout_elements['thumbnails'] == 'true')) ? $media_items_thumbnails : null,

View File

@ -11,6 +11,24 @@ $pswp__include-minimal-style: true !default;
@import '../../../../../node_modules/photoswipe/src/css/main.scss'; @import '../../../../../node_modules/photoswipe/src/css/main.scss';
@import '../../../../../node_modules/photoswipe/src/css/default-skin/default-skin.scss'; @import '../../../../../node_modules/photoswipe/src/css/default-skin/default-skin.scss';
.item-gallery-edit-container {
.tainacan-media-component {
.swiper-slide,
.swiper-button-prev,
.swiper-button-next {
cursor: not-allowed !important;
}
}
.preview-warning {
width: 100%;
font-size: 0.875rem;
font-style: italic;
color: inherit;
text-align: center;
margin: 0 auto;
padding: 8px 2px 2px 2px;
}
}
.tainacan-media-component { .tainacan-media-component {
--swiper-theme-color: var(--tainacan-secondary, #298596); --swiper-theme-color: var(--tainacan-secondary, #298596);
--swiper-navigation-size: 44px; --swiper-navigation-size: 44px;