Skip to content

Commit

Permalink
prep build 12/27
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Dec 27, 2023
2 parents cef644a + ea2a22e commit 2cfd73a
Show file tree
Hide file tree
Showing 35 changed files with 835 additions and 538 deletions.
17 changes: 17 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
== Changelog ==

= 17.2.4 =

## Changelog

### Bug Fixes

- Site editor: fix image upload bug ([57040](https://github.com/WordPress/gutenberg/pull/57040))

## Contributors

The following contributors merged PRs in this release:

@glendaviesnz




= 17.3.0 =


Expand Down
Binary file added docs/assets/text-decoration-component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ import { Text, View } from 'react-native';
/**
* WordPress dependencies
*/
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
import {
usePreferredColorSchemeStyle,
useNetworkConnectivity,
} from '@wordpress/compose';
import { Icon } from '@wordpress/components';
import { offline as offlineIcon } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';
import { useIsConnected } from '@wordpress/react-native-bridge';

/**
* Internal dependencies
*/
import styles from './style.native.scss';

const OfflineStatus = () => {
const { isConnected } = useIsConnected();
const { isConnected } = useNetworkConnectivity();

const containerStyle = usePreferredColorSchemeStyle(
styles.offline,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# TextDecorationControl

<div class="callout callout-alert">
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
</div>
<br />

![TextDecorationControl Element in Inspector Control](https://raw.githubusercontent.com/WordPress/gutenberg/HEAD/docs/assets/text-decoration-component.png?raw=true)


## Usage

```jsx
import { __experimentalTextDecorationControl as TextDecorationControl } from '@wordpress/block-editor';
```

Then, you can use the component in your block editor UI:

```jsx
<TextDecorationControl
value={textDecorationValue}
onChange={(newValue) => setAttributes({ textDecoration: newValue })}
/>
```

### Props

### `value`

- **Type:** `String`
- **Default:** `none`
- **Options:** `none`, `underline`, `line-through`

The current value of the Text Decoration setting. You may only choose from the `Options` listed above.

### `onChange`

- **Type:** `Function`

A callback function invoked when the Text Decoration value is changed via an interaction with any of the buttons. Called with the Text Decoration value (`none`, `underline`, `line-through`) as the only argument.
41 changes: 27 additions & 14 deletions packages/block-library/src/audio/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,19 @@ function AudioEdit( {
} ) {
const { id, autoplay, loop, preload, src } = attributes;
const isTemporaryAudio = ! id && isBlobURL( src );
const mediaUpload = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
return getSettings().mediaUpload;
const { mediaUpload, multiAudioSelection } = useSelect( ( select ) => {
const { getSettings, getMultiSelectedBlockClientIds, getBlockName } =
select( blockEditorStore );
const multiSelectedClientIds = getMultiSelectedBlockClientIds();

return {
mediaUpload: getSettings().mediaUpload,
multiAudioSelection:
multiSelectedClientIds.length &&
multiSelectedClientIds.every(
( _clientId ) => getBlockName( _clientId ) === 'core/audio'
),
};
}, [] );

useEffect( () => {
Expand Down Expand Up @@ -146,17 +156,19 @@ function AudioEdit( {

return (
<>
<BlockControls group="other">
<MediaReplaceFlow
mediaId={ id }
mediaURL={ src }
allowedTypes={ ALLOWED_MEDIA_TYPES }
accept="audio/*"
onSelect={ onSelectAudio }
onSelectURL={ onSelectURL }
onError={ onUploadError }
/>
</BlockControls>
{ ! multiAudioSelection && (
<BlockControls group="other">
<MediaReplaceFlow
mediaId={ id }
mediaURL={ src }
allowedTypes={ ALLOWED_MEDIA_TYPES }
accept="audio/*"
onSelect={ onSelectAudio }
onSelectURL={ onSelectURL }
onError={ onUploadError }
/>
</BlockControls>
) }
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<ToggleControl
Expand Down Expand Up @@ -210,6 +222,7 @@ function AudioEdit( {
isSelected={ isSelected }
insertBlocksAfter={ insertBlocksAfter }
label={ __( 'Audio caption text' ) }
showToolbarButton={ ! multiAudioSelection }
/>
</figure>
</>
Expand Down
68 changes: 43 additions & 25 deletions packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,38 @@ function GalleryEdit( props ) {
getSettings,
preferredStyle,
innerBlockImages,
wasBlockJustInserted,
blockWasJustInserted,
multiGallerySelection,
} = useSelect(
( select ) => {
const settings = select( blockEditorStore ).getSettings();
const {
getBlockName,
getMultiSelectedBlockClientIds,
getSettings: _getSettings,
getBlock: _getBlock,
wasBlockJustInserted,
} = select( blockEditorStore );
const preferredStyleVariations =
settings.__experimentalPreferredStyleVariations;
_getSettings().__experimentalPreferredStyleVariations;
const multiSelectedClientIds = getMultiSelectedBlockClientIds();

return {
getBlock: select( blockEditorStore ).getBlock,
getSettings: select( blockEditorStore ).getSettings,
getBlock: _getBlock,
getSettings: _getSettings,
preferredStyle:
preferredStyleVariations?.value?.[ 'core/image' ],
innerBlockImages:
select( blockEditorStore ).getBlock( clientId )
?.innerBlocks ?? EMPTY_ARRAY,
wasBlockJustInserted: select(
blockEditorStore
).wasBlockJustInserted( clientId, 'inserter_menu' ),
_getBlock( clientId )?.innerBlocks ?? EMPTY_ARRAY,
blockWasJustInserted: wasBlockJustInserted(
clientId,
'inserter_menu'
),
multiGallerySelection:
multiSelectedClientIds.length &&
multiSelectedClientIds.every(
( _clientId ) =>
getBlockName( _clientId ) === 'core/gallery'
),
};
},
[ clientId ]
Expand Down Expand Up @@ -461,7 +476,7 @@ function GalleryEdit( props ) {
( hasImages && ! isSelected ) || imagesUploading,
value: hasImageIds ? images : {},
autoOpenMediaUpload:
! hasImages && isSelected && wasBlockJustInserted,
! hasImages && isSelected && blockWasJustInserted,
onFocus,
},
} );
Expand Down Expand Up @@ -583,20 +598,22 @@ function GalleryEdit( props ) {
</InspectorControls>
{ Platform.isWeb && (
<>
<BlockControls group="other">
<MediaReplaceFlow
allowedTypes={ ALLOWED_MEDIA_TYPES }
accept="image/*"
handleUpload={ false }
onSelect={ updateImages }
name={ __( 'Add' ) }
multiple={ true }
mediaIds={ images
.filter( ( image ) => image.id )
.map( ( image ) => image.id ) }
addToGallery={ hasImageIds }
/>
</BlockControls>
{ ! multiGallerySelection && (
<BlockControls group="other">
<MediaReplaceFlow
allowedTypes={ ALLOWED_MEDIA_TYPES }
accept="image/*"
handleUpload={ false }
onSelect={ updateImages }
name={ __( 'Add' ) }
multiple={ true }
mediaIds={ images
.filter( ( image ) => image.id )
.map( ( image ) => image.id ) }
addToGallery={ hasImageIds }
/>
</BlockControls>
) }
<GapStyles
blockGap={ attributes.style?.spacing?.blockGap }
clientId={ clientId }
Expand All @@ -614,6 +631,7 @@ function GalleryEdit( props ) {
}
blockProps={ innerBlocksProps }
insertBlocksAfter={ insertBlocksAfter }
multiGallerySelection={ multiGallerySelection }
/>
</>
);
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/gallery/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function Gallery( props ) {
blockProps,
__unstableLayoutClassNames: layoutClassNames,
isContentLocked,
multiGallerySelection,
} = props;

const { align, columns, imageCrop } = attributes;
Expand Down Expand Up @@ -54,7 +55,9 @@ export default function Gallery( props ) {
setAttributes={ setAttributes }
isSelected={ isSelected }
insertBlocksAfter={ insertBlocksAfter }
showToolbarButton={ ! isContentLocked }
showToolbarButton={
! multiGallerySelection && ! isContentLocked
}
className="blocks-gallery-caption"
label={ __( 'Gallery caption text' ) }
placeholder={ __( 'Add gallery caption' ) }
Expand Down
71 changes: 40 additions & 31 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,49 @@ export default function Image( {
const { allowResize = true } = context;
const { getBlock } = useSelect( blockEditorStore );

const { image, multiImageSelection } = useSelect(
const { image } = useSelect(
( select ) => {
const { getMedia } = select( coreStore );
const { getMultiSelectedBlockClientIds, getBlockName } =
select( blockEditorStore );
const multiSelectedClientIds = getMultiSelectedBlockClientIds();
return {
image:
id && isSelected
? getMedia( id, { context: 'view' } )
: null,
};
},
[ id, isSelected ]
);

const {
canInsertCover,
imageEditing,
imageSizes,
maxWidth,
mediaUpload,
multiImageSelection,
} = useSelect(
( select ) => {
const {
getBlockRootClientId,
getMultiSelectedBlockClientIds,
getBlockName,
getSettings,
canInsertBlockType,
} = select( blockEditorStore );

const rootClientId = getBlockRootClientId( clientId );
const settings = getSettings();
const multiSelectedClientIds = getMultiSelectedBlockClientIds();

return {
imageEditing: settings.imageEditing,
imageSizes: settings.imageSizes,
maxWidth: settings.maxWidth,
mediaUpload: settings.mediaUpload,
canInsertCover: canInsertBlockType(
'core/cover',
rootClientId
),
multiImageSelection:
multiSelectedClientIds.length &&
multiSelectedClientIds.every(
Expand All @@ -153,33 +185,8 @@ export default function Image( {
),
};
},
[ id, isSelected ]
[ clientId ]
);
const { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =
useSelect(
( select ) => {
const {
getBlockRootClientId,
getSettings,
canInsertBlockType,
} = select( blockEditorStore );

const rootClientId = getBlockRootClientId( clientId );
const settings = getSettings();

return {
imageEditing: settings.imageEditing,
imageSizes: settings.imageSizes,
maxWidth: settings.maxWidth,
mediaUpload: settings.mediaUpload,
canInsertCover: canInsertBlockType(
'core/cover',
rootClientId
),
};
},
[ clientId ]
);

const { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );
const { createErrorNotice, createSuccessNotice } =
Expand Down Expand Up @@ -755,7 +762,9 @@ export default function Image( {
isSelected={ isSelected }
insertBlocksAfter={ insertBlocksAfter }
label={ __( 'Image caption text' ) }
showToolbarButton={ hasNonContentControls }
showToolbarButton={
! multiImageSelection && hasNonContentControls
}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function render_block_core_social_link( $attributes, $content, $block ) {
* The `is_email` returns false for emails with schema.
*/
if ( is_email( $url ) ) {
$url = 'mailto:' . $url;
$url = 'mailto:' . antispambot( $url );
}

/**
Expand Down
Loading

0 comments on commit 2cfd73a

Please sign in to comment.