Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] trunk from WordPress:trunk #159

Merged
merged 8 commits into from
Jan 13, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
background: none;
border: 0;
text-align: left;
transition: box-shadow 0.1s linear;

@media not (prefers-reduced-motion) {
transition: box-shadow 0.1s linear;
}

// The item contains absolutely positioned items.
// Set `position: relative` on the parent to prevent overflow issues
Expand Down
20 changes: 20 additions & 0 deletions packages/block-library/src/navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*/
import { __ } from '@wordpress/i18n';
import { navigation as icon } from '@wordpress/icons';
import { select } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -52,6 +55,23 @@ export const settings = {
},
edit,
save,
__experimentalLabel: ( { ref } ) => {
if ( ! ref ) {
return;
}

const navigation = select( coreStore ).getEditedEntityRecord(
'postType',
'wp_navigation',
ref
);

if ( ! navigation?.title ) {
return;
}

return decodeEntities( navigation.title );
},
deprecated,
};

Expand Down
68 changes: 53 additions & 15 deletions packages/block-library/src/post-author-name/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ import {
import { useSelect } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
import { store as coreStore } from '@wordpress/core-data';
import { PanelBody, ToggleControl } from '@wordpress/components';
import {
ToggleControl,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';

/**
* Internal dependencies
*/
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';

function PostAuthorNameEdit( {
context: { postType, postId },
Expand Down Expand Up @@ -61,6 +70,8 @@ function PostAuthorNameEdit( {
displayName
);

const dropdownMenuProps = useToolsPanelDropdownMenuProps();

return (
<>
<BlockControls group="block">
Expand All @@ -72,26 +83,53 @@ function PostAuthorNameEdit( {
/>
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<ToggleControl
__nextHasNoMarginBottom
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( {
isLink: false,
linkTarget: '_self',
} );
} }
dropdownMenuProps={ dropdownMenuProps }
>
<ToolsPanelItem
label={ __( 'Link to author archive' ) }
onChange={ () => setAttributes( { isLink: ! isLink } ) }
checked={ isLink }
/>
{ isLink && (
isShownByDefault
hasValue={ () => isLink }
onDeselect={ () => setAttributes( { isLink: false } ) }
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Open in new tab' ) }
onChange={ ( value ) =>
setAttributes( {
linkTarget: value ? '_blank' : '_self',
} )
label={ __( 'Link to author archive' ) }
onChange={ () =>
setAttributes( { isLink: ! isLink } )
}
checked={ linkTarget === '_blank' }
checked={ isLink }
/>
</ToolsPanelItem>
{ isLink && (
<ToolsPanelItem
label={ __( 'Open in new tab' ) }
isShownByDefault
hasValue={ () => linkTarget !== '_self' }
onDeselect={ () =>
setAttributes( { linkTarget: '_self' } )
}
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Open in new tab' ) }
onChange={ ( value ) =>
setAttributes( {
linkTarget: value ? '_blank' : '_self',
} )
}
checked={ linkTarget === '_blank' }
/>
</ToolsPanelItem>
) }
</PanelBody>
</ToolsPanel>
</InspectorControls>
<div { ...blockProps }>
{ supportsAuthor
Expand Down
31 changes: 0 additions & 31 deletions packages/block-library/src/query/editor.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
.block-library-query-toolbar__popover .components-popover__content {
min-width: 230px;

.block-library-query-toolbar__popover-number-control {
margin-bottom: $grid-unit-10;
}
}

.block-library-query__pattern-selection-content .block-editor-block-patterns-list {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: $grid-unit-10;

.block-editor-block-patterns-list__list-item {
margin-bottom: 0;
.block-editor-block-preview__container {
max-height: 250px;
}
}
}

.block-library-query-pattern__selection-modal {

.block-editor-block-patterns-list {
Expand All @@ -45,22 +24,12 @@
}
}

.block-library-query-toolspanel__design {
.block-library-query-pattern__selection-content {
margin-top: $grid-unit-10;
}
}

.wp-block-query__enhanced-pagination-modal {
@include break-small() {
max-width: $break-mobile;
}
}

.wp-block-query__enhanced-pagination-notice {
margin: 0;
}

.block-editor-block-settings-menu__popover {
&.is-expanded {
overflow-y: scroll;
Expand Down
5 changes: 5 additions & 0 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ export default function LogoEdit( {
};

const onFilesDrop = ( filesList ) => {
if ( filesList?.length > 1 ) {
onUploadError( __( 'Only one image can be used as a site logo.' ) );
return;
}

getSettings().mediaUpload( {
allowedTypes: ALLOWED_MEDIA_TYPES,
filesList,
Expand Down
57 changes: 38 additions & 19 deletions packages/block-library/src/table-of-contents/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import {
} from '@wordpress/block-editor';
import { createBlock } from '@wordpress/blocks';
import {
PanelBody,
Placeholder,
ToggleControl,
ToolbarButton,
ToolbarGroup,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { renderToString } from '@wordpress/element';
Expand All @@ -29,6 +30,7 @@ import { tableOfContents as icon } from '@wordpress/icons';
import TableOfContentsList from './list';
import { linearToNestedHeadingList } from './utils';
import { useObserveHeadings } from './hooks';
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';

/** @typedef {import('./utils').HeadingData} HeadingData */

Expand Down Expand Up @@ -79,7 +81,7 @@ export default function TableOfContentsEdit( {
);

const { replaceBlocks } = useDispatch( blockEditorStore );

const dropdownMenuProps = useToolsPanelDropdownMenuProps();
const headingTree = linearToNestedHeadingList( headings );

const toolbarControls = canInsertList && (
Expand Down Expand Up @@ -108,25 +110,42 @@ export default function TableOfContentsEdit( {

const inspectorControls = (
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<ToggleControl
__nextHasNoMarginBottom
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( {
onlyIncludeCurrentPage: false,
} );
} }
dropdownMenuProps={ dropdownMenuProps }
>
<ToolsPanelItem
hasValue={ () => !! onlyIncludeCurrentPage }
label={ __( 'Only include current page' ) }
checked={ onlyIncludeCurrentPage }
onChange={ ( value ) =>
setAttributes( { onlyIncludeCurrentPage: value } )
}
help={
onlyIncludeCurrentPage
? __(
'Only including headings from the current page (if the post is paginated).'
)
: __(
'Include headings from all pages (if the post is paginated).'
)
onDeselect={ () =>
setAttributes( { onlyIncludeCurrentPage: false } )
}
/>
</PanelBody>
isShownByDefault
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Only include current page' ) }
checked={ onlyIncludeCurrentPage }
onChange={ ( value ) =>
setAttributes( { onlyIncludeCurrentPage: value } )
}
help={
onlyIncludeCurrentPage
? __(
'Only including headings from the current page (if the post is paginated).'
)
: __(
'Include headings from all pages (if the post is paginated).'
)
}
/>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
);

Expand Down
7 changes: 5 additions & 2 deletions packages/dataviews/src/components/dataviews-footer/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
padding: $grid-unit-15 $grid-unit-60;
border-top: $border-width solid $gray-100;
flex-shrink: 0;
transition: padding ease-out 0.1s;
@include reduce-motion("transition");

@media not (prefers-reduced-motion) {
transition: padding ease-out 0.1s;
}

z-index: z-index(".dataviews-footer");
}

Expand Down
12 changes: 8 additions & 4 deletions packages/dataviews/src/components/dataviews/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
flex-shrink: 0;
position: sticky;
left: 0;
transition: padding ease-out 0.1s;
@include reduce-motion( "transition" );

@media not (prefers-reduced-motion) {
transition: padding ease-out 0.1s;
}
}

.dataviews-no-results,
Expand All @@ -29,8 +31,10 @@
display: flex;
align-items: center;
justify-content: center;
transition: padding ease-out 0.1s;
@include reduce-motion( "transition" );

@media not (prefers-reduced-motion) {
transition: padding ease-out 0.1s;
}
}

@container (max-width: 430px) {
Expand Down
5 changes: 3 additions & 2 deletions packages/dataviews/src/dataviews-layouts/grid/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
margin-bottom: auto;
grid-template-rows: max-content;
padding: 0 $grid-unit-60 $grid-unit-30;
transition: padding ease-out 0.1s;
container-type: inline-size;
@include reduce-motion("transition");

@media not (prefers-reduced-motion) {
transition: padding ease-out 0.1s;
}

.dataviews-view-grid__card {
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function useDeleteNavigationMenu() {
type: 'snackbar',
}
);
history.navivate( '/navigation' );
history.navigate( '/navigation' );
} catch ( error ) {
createErrorNotice(
sprintf(
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/specs/editor/blocks/navigation-list-view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,10 @@ test.describe( 'Navigation block - List view editing', () => {

await editor.openDocumentSettingsSidebar();

await page.getByLabel( 'Test Menu' ).click();
await page
.getByRole( 'tabpanel' )
.getByRole( 'button', { name: 'Test Menu' } )
.click();

await page.keyboard.press( 'ArrowUp' );

Expand Down
6 changes: 5 additions & 1 deletion test/e2e/specs/site-editor/navigation-editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ test.describe( 'Editing Navigation Menus', () => {
canvas: 'edit',
} );

await expect(
page.getByRole( 'button', { name: 'Document Overview' } )
).toBeVisible();

// Open List View.
await pageUtils.pressKeys( 'access+o' );

Expand All @@ -54,7 +58,7 @@ test.describe( 'Editing Navigation Menus', () => {
await expect( listView ).toBeVisible();

const navBlockNode = listView.getByRole( 'link', {
name: 'Navigation',
name: 'Primary Menu',
exact: true,
} );

Expand Down
Loading