Skip to content

Commit

Permalink
prep build 09/10
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Sep 10, 2024
2 parents bad817e + 07c7821 commit 87b5949
Show file tree
Hide file tree
Showing 59 changed files with 919 additions and 429 deletions.
4 changes: 2 additions & 2 deletions lib/compat/wordpress-6.7/block-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* Register a template.
*
* @param string $template_name Template name in the form of `plugin_uri//template_name`.
* @param array|string $args Object type or array of object types with which the taxonomy should be associated.
* @param array|string $args {
* @type string $title Optional. Title of the template as it will be shown in the Site Editor
* and other UI elements.
Expand All @@ -33,7 +32,8 @@ function wp_register_block_template( $template_name, $args = array() ) {
* Unregister a template.
*
* @param string $template_name Template name in the form of `plugin_uri//template_name`.
* @return true|WP_Error True on success, WP_Error on failure or if the template doesn't exist.
* @return WP_Block_Template|WP_Error The unregistered template object on success, WP_Error object on failure or if
* the template doesn't exist.
*/
function wp_unregister_block_template( $template_name ) {
return WP_Block_Templates_Registry::get_instance()->unregister( $template_name );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class WP_Block_Templates_Registry {
*
* @param string $template_name Template name including namespace.
* @param array $args Optional. Array of template arguments.
* @return WP_Block_Template|WP_Error The registered template on success, or false on failure.
* @return WP_Block_Template|WP_Error The registered template on success, or WP_Error on failure.
*/
public function register( $template_name, $args = array() ) {

Expand Down Expand Up @@ -100,7 +100,7 @@ public function register( $template_name, $args = array() ) {
*
* @since 6.7.0
*
* @return WP_Block_Template[]|false Associative array of `$template_name => $template` pairs.
* @return WP_Block_Template[] Associative array of `$template_name => $template` pairs.
*/
public function get_all_registered() {
return $this->registered_templates;
Expand All @@ -112,7 +112,7 @@ public function get_all_registered() {
* @since 6.7.0
*
* @param string $template_name Template name including namespace.
* @return WP_Block_Template|null|false The registered template, or null if it is not registered.
* @return WP_Block_Template|null The registered template, or null if it is not registered.
*/
public function get_registered( $template_name ) {
if ( ! $this->is_registered( $template_name ) ) {
Expand Down Expand Up @@ -216,7 +216,7 @@ public function is_registered( $template_name ) {
* @since 6.7.0
*
* @param string $template_name Template name including namespace.
* @return WP_Block_Template|false The unregistered template on success, or false on failure.
* @return WP_Block_Template|WP_Error The unregistered template on success, or WP_Error on failure.
*/
public function unregister( $template_name ) {
if ( ! $this->is_registered( $template_name ) ) {
Expand Down
13 changes: 1 addition & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
"@wordpress/viewport": "file:packages/viewport",
"@wordpress/warning": "file:packages/warning",
"@wordpress/widgets": "file:packages/widgets",
"@wordpress/wordcount": "file:packages/wordcount",
"es-module-shims": "^1.8.2"
"@wordpress/wordcount": "file:packages/wordcount"
},
"devDependencies": {
"@actions/core": "1.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@
// Raise the specificity.
&.components-accessible-toolbar {
border: none;
box-shadow: 0 $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
border-radius: 0;
}

&.is-unstyled {
box-shadow: 0 $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
}

.block-editor-block-toolbar {
overflow: auto;
overflow-y: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,39 +170,33 @@ export function PatternCategoryPreviews( {
</Text>
) }
</VStack>
<VStack spacing={ 4 }>
{ currentCategoryPatterns.length > 0 && (
<>
{ isZoomOutMode && (
<Text
size="12"
as="p"
className="block-editor-inserter__help-text"
>
{ __(
'Drag and drop patterns into the canvas.'
) }
</Text>
) }
<BlockPatternsList
ref={ scrollContainerRef }
shownPatterns={
pagingProps.categoryPatternsAsyncList
}
blockPatterns={ pagingProps.categoryPatterns }
onClickPattern={ onClickPattern }
onHover={ onHover }
label={ category.label }
orientation="vertical"
category={ category.name }
isDraggable
showTitlesAsTooltip={ showTitlesAsTooltip }
patternFilter={ patternSourceFilter }
pagingProps={ pagingProps }
/>
</>
) }
</VStack>
{ currentCategoryPatterns.length > 0 && (
<>
{ isZoomOutMode && (
<Text
size="12"
as="p"
className="block-editor-inserter__help-text"
>
{ __( 'Drag and drop patterns into the canvas.' ) }
</Text>
) }
<BlockPatternsList
ref={ scrollContainerRef }
shownPatterns={ pagingProps.categoryPatternsAsyncList }
blockPatterns={ pagingProps.categoryPatterns }
onClickPattern={ onClickPattern }
onHover={ onHover }
label={ category.label }
orientation="vertical"
category={ category.name }
isDraggable
showTitlesAsTooltip={ showTitlesAsTooltip }
patternFilter={ patternSourceFilter }
pagingProps={ pagingProps }
/>
</>
) }
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import clsx from 'clsx';
import { useState, useEffect } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { Button, SearchControl } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
Expand Down Expand Up @@ -82,8 +82,6 @@ export default function QuickInserter( {
}
}, [ setInserterIsOpened ] );

const { showInsertionPoint } = useDispatch( blockEditorStore );

// When clicking Browse All select the appropriate block so as
// the insertion point can work as expected.
const onBrowseAll = () => {
Expand All @@ -93,7 +91,6 @@ export default function QuickInserter( {
filterValue,
onSelect,
} );
showInsertionPoint( rootClientId, insertionIndex );
};

let maxBlockPatterns = 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -711,5 +711,5 @@ $block-inserter-tabs-height: 44px;
}

.block-editor-tabbed-sidebar__tabpanel .block-editor-inserter__help-text {
padding: 0 $grid-unit-30;
padding: 0 $grid-unit-30 $grid-unit-20;
}
22 changes: 6 additions & 16 deletions packages/block-editor/src/hooks/layout.scss
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
.block-editor-hooks__layout-controls-units {
display: flex;
flex-direction: column;
gap: $grid-unit-20;
}

.block-editor-block-inspector .block-editor-hooks__layout-controls-unit-input {
margin-bottom: 0;
}

.block-editor-hooks__layout-controls-reset {
display: flex;
justify-content: flex-end;
margin-bottom: $grid-unit-30;
.block-editor-hooks__layout-constrained {
.components-base-control {
margin-bottom: 0; // Cancel out margins added by block inspector
}
}

.block-editor-hooks__layout-controls-helptext {
.block-editor-hooks__layout-constrained-helptext {
color: $gray-700;
font-size: $helptext-font-size;
margin-bottom: $grid-unit-20;
margin-bottom: 0; // Cancel out margins added by common.css
}

.block-editor-hooks__flex-layout-justification-controls,
Expand Down
16 changes: 9 additions & 7 deletions packages/block-editor/src/layouts/constrained.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
__experimentalToggleGroupControl as ToggleGroupControl,
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
__experimentalVStack as VStack,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import {
Expand Down Expand Up @@ -70,12 +71,14 @@ export default {
availableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],
} );
return (
<>
<VStack
spacing={ 4 }
className="block-editor-hooks__layout-constrained"
>
{ allowCustomContentAndWideSize && (
<div className="block-editor-hooks__layout-controls-units">
<>
<UnitControl
__next40pxDefaultSize
className="block-editor-hooks__layout-controls-unit-input"
label={ __( 'Content width' ) }
labelPosition="top"
value={ contentSize || wideSize || '' }
Expand All @@ -98,7 +101,6 @@ export default {
/>
<UnitControl
__next40pxDefaultSize
className="block-editor-hooks__layout-controls-unit-input"
label={ __( 'Wide width' ) }
labelPosition="top"
value={ wideSize || contentSize || '' }
Expand All @@ -119,12 +121,12 @@ export default {
</InputControlPrefixWrapper>
}
/>
<p className="block-editor-hooks__layout-controls-helptext">
<p className="block-editor-hooks__layout-constrained-helptext">
{ __(
'Customize the width for all elements that are assigned to the center or wide columns.'
) }
</p>
</div>
</>
) }
{ allowJustification && (
<ToggleGroupControl
Expand All @@ -148,7 +150,7 @@ export default {
) }
</ToggleGroupControl>
) }
</>
</VStack>
);
},
toolBarControls: function DefaultLayoutToolbarControls( {
Expand Down
8 changes: 5 additions & 3 deletions packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,11 @@ const EMPTY_ARRAY = [];
export const getReusableBlocks = createRegistrySelector(
( select ) => ( state ) => {
const reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];
return reusableBlocksSelect
? reusableBlocksSelect( select )
: state.settings.__experimentalReusableBlocks ?? EMPTY_ARRAY;
return (
( reusableBlocksSelect
? reusableBlocksSelect( select )
: state.settings.__experimentalReusableBlocks ) ?? EMPTY_ARRAY
);
}
);

Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,6 @@ export function insertionPoint( state = null, action ) {
}

case 'HIDE_INSERTION_POINT':
case 'CLEAR_SELECTED_BLOCK':
case 'SELECT_BLOCK':
return null;
}

Expand Down
7 changes: 0 additions & 7 deletions packages/block-library/src/embed/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { embedContentIcon } from './icons';
import EmbedLoading from './embed-loading';
import EmbedPlaceholder from './embed-placeholder';
import EmbedPreview from './embed-preview';
import { Caption } from '../utils/caption';

/**
* External dependencies
Expand Down Expand Up @@ -277,14 +276,8 @@ const EmbedEdit = ( props ) => {
icon={ icon }
label={ label }
insertBlocksAfter={ insertBlocksAfter }
/>
<Caption
attributes={ attributes }
setAttributes={ setAttributes }
isSelected={ isSelected }
insertBlocksAfter={ insertBlocksAfter }
label={ __( 'Embed caption text' ) }
showToolbarButton={ isSelected }
/>
</View>
</>
Expand Down
24 changes: 22 additions & 2 deletions packages/block-library/src/embed/embed-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { getAuthority } from '@wordpress/url';
* Internal dependencies
*/
import WpEmbedPreview from './wp-embed-preview';
import { Caption } from '../utils/caption';

class EmbedPreview extends Component {
constructor() {
Expand Down Expand Up @@ -52,8 +53,19 @@ class EmbedPreview extends Component {
}

render() {
const { preview, previewable, url, type, className, icon, label } =
this.props;
const {
preview,
previewable,
url,
type,
className,
icon,
label,
insertBlocksAfter,
attributes,
setAttributes,
isSelected,
} = this.props;
const { scripts } = preview;
const { interactive } = this.state;

Expand Down Expand Up @@ -123,6 +135,14 @@ class EmbedPreview extends Component {
</p>
</Placeholder>
) }
<Caption
attributes={ attributes }
setAttributes={ setAttributes }
isSelected={ isSelected }
insertBlocksAfter={ insertBlocksAfter }
label={ __( 'Embed caption text' ) }
showToolbarButton={ isSelected }
/>
</figure>
);
}
Expand Down
Loading

0 comments on commit 87b5949

Please sign in to comment.