Skip to content

Commit 2512260

Browse files
authored
Merge pull request #383 from cloudinary/feature/pgw-look-feel
Updates
2 parents a1a21db + 64bb62b commit 2512260

File tree

12 files changed

+110
-80
lines changed

12 files changed

+110
-80
lines changed

js/cloudinary.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/gallery-block.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'b2f7ff6487417f414e26d41973005453');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '1eb11fc0b636111ccc4876191f5e87c7');

js/gallery-block.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/gallery.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'cd0e9af78dcc0b1cee52b98e8dbe93ac');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '29099104bb87442e73de687aa973be61');

js/gallery.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/gallery-block/attributes.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@
7575
"type": "array",
7676
"default": []
7777
},
78-
"transformation": {
79-
"type": "object",
80-
"default": {}
78+
"transformation_crop": {
79+
"type": "string",
80+
"default": "pad"
81+
},
82+
"transformation_background": {
83+
"type": "string"
8184
}
8285
}

js/src/gallery-block/controls.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Dot from 'dot-object';
22
import { __ } from '@wordpress/i18n';
33
import cloneDeep from 'lodash/cloneDeep';
4+
import Tippy from '@tippyjs/react';
45

56
import '@wordpress/components/build-style/style.css';
67

@@ -155,21 +156,25 @@ const Controls = ( { attributes, setAttributes, colors } ) => {
155156
setAttributes( { aspectRatio: value } )
156157
}
157158
/>
158-
<p
159-
title={ __(
160-
'How to resize or crop images to fit the gallery. Pad adds padding around the image using the specified padding style. Fill crops the image from the center so it fills as much of the available space as possible.',
161-
'cloudinary'
162-
) }
163-
>
164-
{ __( 'Resize or Crop Mode', 'cloudinary' ) }
165-
<span
166-
className="dashicons dashicons-info cld-tooltip"
167-
data-tooltip="tooltip_auto_sync"
168-
>
169-
<span id="tooltip_auto_sync" className="hidden"></span>
170-
</span>
171-
</p>
172159
<p>
160+
<Tippy
161+
content={
162+
<span>
163+
{ __(
164+
'How to resize or crop images to fit the gallery. Pad adds padding around the image using the specified padding style. Fill crops the image from the center so it fills as much of the available space as possible.',
165+
'cloudinary'
166+
) }
167+
</span>
168+
}
169+
theme={ 'cloudinary' }
170+
arrow={ false }
171+
placement={ 'bottom-start' }
172+
>
173+
<div className="cld-ui-title">
174+
{ __( 'Resize/Crop Mode', 'cloudinary' ) }
175+
<span className="dashicons dashicons-info cld-tooltip"></span>
176+
</div>
177+
</Tippy>
173178
<ButtonGroup>
174179
{ RESIZE_CROP.map( ( type ) => (
175180
<Button

js/src/gallery-block/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export const RESIZE_CROP = [
197197
value: 'pad',
198198
},
199199
{
200-
label: __( 'Crop', 'cloudinary' ),
200+
label: __( 'Fill', 'cloudinary' ),
201201
value: 'fill',
202202
},
203203
];

js/src/gallery-block/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ export const setupAttributesForRendering = ( attributes ) => {
7171
delete config.displayProps.columns;
7272
}
7373

74+
if ( 'pad' !== config?.transformation_crop ) {
75+
delete config.transformation_background;
76+
}
77+
78+
if ( 'pad' !== config?.transformation?.crop ) {
79+
delete config.transformation.background;
80+
}
81+
7482
if ( config.customSettings ) {
7583
try {
7684
const customSettings = JSON.parse( config.customSettings );

package-lock.json

Lines changed: 69 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)