Skip to content

Commit

Permalink
prep build 01/08
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Jan 8, 2024
2 parents 9c17bc6 + debddee commit 8103924
Show file tree
Hide file tree
Showing 17 changed files with 237 additions and 115 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.3.2 =

## 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.4.1 =

## Changelog
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ Save the file and confirm that the block appears correctly in the Editor and on

### Cleaning up

When you use the `create-block` package to scaffold a block, it might include files that you don't need. In the case of this tutorial, the block doesn't use stylesheets or font end JavaScipt. Clean up the plugin's `src/` folder with the following actions.
When you use the `create-block` package to scaffold a block, it might include files that you don't need. In the case of this tutorial, the block doesn't use stylesheets or front end JavaScript. Clean up the plugin's `src/` folder with the following actions.

1. In the `edit.js` file, remove the lines that import `editor.scss`
2. In the `index.js` file, remove the lines that import `style.scss`
Expand Down
4 changes: 2 additions & 2 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
* for features like the enhanced pagination of the Query block.
*/
$container_class = gutenberg_incremental_id_per_prefix(
'wp-container-' . sanitize_title( $block['blockName'] ) . '-layout-'
'wp-container-' . sanitize_title( $block['blockName'] ) . '-is-layout-'
);

// Set the correct layout type for blocks using legacy content width.
Expand Down Expand Up @@ -893,7 +893,7 @@ function gutenberg_restore_group_inner_container( $block_content, $block ) {
if ( $classes ) {
$classes = explode( ' ', $classes );
foreach ( $classes as $class_name ) {
if ( str_contains( $class_name, 'layout' ) ) {
if ( str_contains( $class_name, 'is-layout-' ) ) {
array_push( $layout_classes, $class_name );
$processor->remove_class( $class_name );
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ function BlockWithLayoutStyles( { block: BlockListBlock, props } ) {
const layoutClasses = useLayoutClasses( attributes, name );

const { kebabCase } = unlock( componentsPrivateApis );
const selectorPrefix = `wp-container-${ kebabCase( name ) }-layout-`;
const selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;
// Higher specificity to override defaults from theme.json.
const selector = `.${ selectorPrefix }${ id }.${ selectorPrefix }${ id }`;
const [ blockGapSupport ] = useSettings( 'spacing.blockGap' );
Expand Down
10 changes: 8 additions & 2 deletions packages/dataviews/src/item-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const {
DropdownMenuGroupV2: DropdownMenuGroup,
DropdownMenuItemV2: DropdownMenuItem,
DropdownMenuItemLabelV2: DropdownMenuItemLabel,
kebabCase,
} = unlock( componentsPrivateApis );

function ButtonTrigger( { action, onClick } ) {
Expand Down Expand Up @@ -58,12 +59,17 @@ function ActionWithModal( { action, item, ActionTrigger } ) {
<ActionTrigger { ...actionTriggerProps } />
{ isModalOpen && (
<Modal
title={ ! hideModalHeader && action.label }
title={
( ! hideModalHeader && action.modalHeader ) ||
action.label
}
__experimentalHideHeader={ !! hideModalHeader }
onRequestClose={ () => {
setIsModalOpen( false );
} }
overlayClassName="dataviews-action-modal"
overlayClassName={ `dataviews-action-modal dataviews-action-modal__${ kebabCase(
action.id
) }` }
>
<RenderModal
item={ item }
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/disable-pre-publish-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { toggleMoreMenu } from './toggle-more-menu';
export async function disablePrePublishChecks() {
await togglePreferencesOption(
'General',
'Enable pre-publish flow',
'Enable pre-publish checks',
false
);
await toggleMoreMenu( 'close' );
Expand Down
6 changes: 5 additions & 1 deletion packages/e2e-test-utils/src/enable-pre-publish-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { toggleMoreMenu } from './toggle-more-menu';
* Enables Pre-publish checks.
*/
export async function enablePrePublishChecks() {
await togglePreferencesOption( 'General', 'Enable pre-publish flow', true );
await togglePreferencesOption(
'General',
'Enable pre-publish checks',
true
);
await toggleMoreMenu( 'close' );
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default function EditPostPreferencesModal() {
help={ __(
'Review settings, such as visibility and tags.'
) }
label={ __( 'Enable pre-publish flow' ) }
label={ __( 'Enable pre-publish checks' ) }
/>
</PreferencesModalSection>
) }
Expand Down
8 changes: 4 additions & 4 deletions packages/edit-post/src/hooks/commands/use-common-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@ export default function useCommonCommands() {
useCommand( {
name: 'core/toggle-publish-sidebar',
label: isPublishSidebarEnabled
? __( 'Disable pre-publish checklist' )
: __( 'Enable pre-publish checklist' ),
? __( 'Disable pre-publish checks' )
: __( 'Enable pre-publish checks' ),
icon: formatListBullets,
callback: ( { close } ) => {
close();
toggle( 'core/edit-post', 'isPublishSidebarEnabled' );
createInfoNotice(
isPublishSidebarEnabled
? __( 'Pre-publish checklist off.' )
: __( 'Pre-publish checklist on.' ),
? __( 'Pre-publish checks disabled.' )
: __( 'Pre-publish checks enabled.' ),
{
id: 'core/edit-post/publish-sidebar/notice',
type: 'snackbar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { paramCase as kebabCase } from 'change-case';
/**
* WordPress dependencies
*/
import { getQueryArgs } from '@wordpress/url';
import { downloadBlob } from '@wordpress/blob';
import { __, sprintf } from '@wordpress/i18n';
import {
Expand All @@ -21,12 +22,23 @@ import { useState } from '@wordpress/element';
import { store as noticesStore } from '@wordpress/notices';
import { decodeEntities } from '@wordpress/html-entities';
import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
import { privateApis as routerPrivateApis } from '@wordpress/router';
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';

/**
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
import { store as editSiteStore } from '../../store';
import { PATTERN_TYPES, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
import {
PATTERN_TYPES,
TEMPLATE_PART_POST_TYPE,
PATTERN_DEFAULT_CATEGORY,
} from '../../utils/constants';

const { useHistory } = unlock( routerPrivateApis );
const { CreatePatternModalContents, useDuplicatePatternProps } =
unlock( patternsPrivateApis );

export const exportJSONaction = {
id: 'export-pattern',
Expand Down Expand Up @@ -235,3 +247,37 @@ export const resetAction = {
);
},
};

export const duplicatePatternAction = {
id: 'duplicate-pattern',
label: __( 'Duplicate' ),
isEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,
modalHeader: __( 'Duplicate pattern' ),
RenderModal: ( { item, closeModal } ) => {
const { categoryId = PATTERN_DEFAULT_CATEGORY } = getQueryArgs(
window.location.href
);
const isThemePattern = item.type === PATTERN_TYPES.theme;
const history = useHistory();
function onPatternSuccess( { pattern } ) {
history.push( {
categoryType: PATTERN_TYPES.theme,
categoryId,
postType: PATTERN_TYPES.user,
postId: pattern.id,
} );
closeModal();
}
const duplicatedProps = useDuplicatePatternProps( {
pattern: isThemePattern ? item : item.patternPost,
onSuccess: onPatternSuccess,
} );
return (
<CreatePatternModalContents
onClose={ closeModal }
confirmLabel={ __( 'Duplicate' ) }
{ ...duplicatedProps }
/>
);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
renameAction,
resetAction,
deleteAction,
duplicatePatternAction,
} from './dataviews-pattern-actions';
import usePatternSettings from './use-pattern-settings';
import { unlock } from '../../lock-unlock';
Expand Down Expand Up @@ -314,7 +315,13 @@ export default function DataviewsPatterns() {
}, [ patterns, view, fields ] );

const actions = useMemo(
() => [ renameAction, exportJSONaction, resetAction, deleteAction ],
() => [
renameAction,
duplicatePatternAction,
exportJSONaction,
resetAction,
deleteAction,
],
[]
);
const onChangeView = useCallback(
Expand Down
28 changes: 28 additions & 0 deletions packages/edit-site/src/components/page-patterns/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,31 @@
z-index: 2;
}
}

// TODO: this is duplicated from `patterns-menu-items__convert-modal` styles,
// except for the `z-index`. Need to check if this is still needed.
.dataviews-action-modal__duplicate-pattern {
// Fix the modal width to prevent added categories from stretching the modal.
[role="dialog"] > [role="document"] {
width: 350px;
}

.patterns-menu-items__convert-modal-categories {
position: relative;
}

.components-form-token-field__suggestions-list:not(:empty) {
position: absolute;
border: $border-width solid var(--wp-admin-theme-color);
border-bottom-left-radius: $radius-block-ui;
border-bottom-right-radius: $radius-block-ui;
box-shadow: 0 0 0.5px 0.5px var(--wp-admin-theme-color);
box-sizing: border-box;
z-index: 1;
background-color: $white;
width: calc(100% + 2px); // Account for the border width of the token field.
left: -1px;
min-width: initial;
max-height: $grid-unit-60 * 2; // Adjust to not cover the save button, showing three items.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function MyEditorPreferencesModal() {
'Review settings, such as visibility and tags.'
) }
label={ __(
'Enable pre-publish flow'
'Enable pre-publish checks'
) }
/>
</PreferencesModalSection>
Expand Down
Loading

0 comments on commit 8103924

Please sign in to comment.