Skip to content

Commit 32cf731

Browse files
authored
Merge pull request #384 from cloudinary/fix/pgw-crop
Keep custom settings on the block
2 parents 9de7b2e + e159070 commit 32cf731

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

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', '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');
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' => '95635dcdce3468c638dab46e572af7a3');

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/src/gallery-block/edit.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ const Edit = ( { setAttributes, attributes, className, isSelected } ) => {
4141
const [ loading, setLoading ] = useState( false );
4242

4343
const preparedAttributes = useMemo( () => {
44+
// Do not override block settings with defaults on existing ones.
45+
if ( 0 !== attributes.selectedImages.length ) {
46+
return attributes;
47+
}
48+
4449
const defaultAttrs = {};
4550

4651
// eslint-disable-next-line no-unused-vars

0 commit comments

Comments
 (0)