Merge branch 'trunk' into fix/marketing-campaign-link

This commit is contained in:
Gan Eng Chin 2023-11-03 20:15:39 +08:00
commit 56712b3568
No known key found for this signature in database
GPG Key ID: 94D5D972860ADB01
22 changed files with 95 additions and 68 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix selection in currency and number fields to only select if field still has focus.

View File

@ -8,7 +8,7 @@ import { useContext } from '@wordpress/element';
* Internal dependencies
*/
import { useProductHelper } from './use-product-helper';
import { formatCurrencyDisplayValue } from '../utils';
import { deferSelectInFocus, formatCurrencyDisplayValue } from '../utils';
export type CurrencyInputProps = {
prefix: string;
@ -51,18 +51,7 @@ export const useCurrencyInputProps = ( {
return sanitizePrice( String( val ) );
},
onFocus( event: React.FocusEvent< HTMLInputElement > ) {
// In some browsers like safari .select() function inside
// the onFocus event doesn't work as expected because it
// conflicts with onClick the first time user click the
// input. Using setTimeout defers the text selection and
// avoid the unexpected behaviour.
setTimeout(
function deferSelection( element: HTMLInputElement ) {
element.select();
},
0,
event.currentTarget
);
deferSelectInFocus( event.currentTarget );
if ( onFocus ) {
onFocus( event );
}

View File

@ -2,6 +2,7 @@
* Internal dependencies
*/
import { useProductHelper } from './use-product-helper';
import { deferSelectInFocus } from '../utils';
export type NumberInputProps = {
value: string;
@ -28,18 +29,7 @@ export const useNumberInputProps = ( {
const numberInputProps: NumberInputProps = {
value: formatNumber( value ),
onFocus( event: React.FocusEvent< HTMLInputElement > ) {
// In some browsers like safari .select() function inside
// the onFocus event doesn't work as expected because it
// conflicts with onClick the first time user click the
// input. Using setTimeout defers the text selection and
// avoid the unexpected behaviour.
setTimeout(
function deferSelection( element: HTMLInputElement ) {
element.select();
},
0,
event.currentTarget
);
deferSelectInFocus( event.currentTarget );
if ( onFocus ) {
onFocus( event );
}

View File

@ -0,0 +1,17 @@
export function deferSelectInFocus( element: HTMLInputElement ) {
// In some browsers like safari .select() function inside
// the onFocus event doesn't work as expected because it
// conflicts with onClick the first time user click the
// input. Using setTimeout defers the text selection and
// avoid the unexpected behaviour.
setTimeout(
function deferSelection( originalElement: HTMLInputElement ) {
if ( element.ownerDocument.activeElement === originalElement ) {
// We still have focus, so select the content.
originalElement.select();
}
},
0,
element
);
}

View File

@ -2,6 +2,7 @@
* Internal dependencies
*/
import { AUTO_DRAFT_NAME } from './constants';
import { deferSelectInFocus } from './defer-select-in-focus';
import { formatCurrencyDisplayValue } from './format-currency-display-value';
import { getCheckboxTracks } from './get-checkbox-tracks';
import { getCurrencySymbolProps } from './get-currency-symbol-props';
@ -30,6 +31,7 @@ export * from './sift';
export {
AUTO_DRAFT_NAME,
deferSelectInFocus,
formatCurrencyDisplayValue,
getCheckboxTracks,
getCurrencySymbolProps,

View File

@ -66,7 +66,7 @@ const MAX_PAGE_COUNT = 100;
export const BlockEditor = ( {} ) => {
const history = useHistory();
const settings = useSiteEditorSettings();
const [ blocks, onChange ] = useEditorBlocks();
const [ blocks, , onChange ] = useEditorBlocks();
const urlParams = useQuery();
const { currentState } = useContext( CustomizeStoreContext );

View File

@ -145,35 +145,15 @@ export const Layout = () => {
</NavigableRegion>
{ ! isMobileViewport && (
<div
className={ classnames(
'edit-site-layout__canvas-container'
) }
>
<div className="edit-site-layout__canvas-container">
{ canvasResizer }
{ !! canvasSize.width && (
<motion.div
whileHover={ {
scale: 1.005,
transition: {
duration: disableMotion
? 0
: 0.5,
ease: 'easeOut',
},
} }
initial={ false }
layout="position"
className={ classnames(
'edit-site-layout__canvas'
) }
transition={ {
type: 'tween',
duration: disableMotion
? 0
: ANIMATION_DURATION,
ease: 'easeOut',
} }
>
<ErrorBoundary>
<ResizableFrame

View File

@ -158,7 +158,7 @@ export const OnboardingTour = ( {
[ key: string ]: unknown;
} ) => {
if ( placement === 'left' ) {
return [ -15, 35 ];
return [ 0, 20 ];
}
return [ 52, 16 ];
},

View File

@ -189,12 +189,10 @@ function ResizableFrame( {
},
};
const currentResizeHandleVariant = ( () => {
if ( isResizing ) {
if ( isResizing || isHandleVisibleByDefault ) {
return 'active';
}
return shouldShowHandle || isHandleVisibleByDefault
? 'visible'
: 'hidden';
return shouldShowHandle ? 'visible' : 'hidden';
} )();
const resizeHandler = (
@ -246,6 +244,13 @@ function ResizableFrame( {
if ( definition === 'fullWidth' )
setFrameSize( { width: '100%', height: '100%' } );
} }
whileHover={ {
scale: 1.005,
transition: {
duration: 0.5,
ease: 'easeOut',
},
} }
transition={ frameTransition }
size={ frameSize }
enable={ {

View File

@ -1187,6 +1187,13 @@ export const COLOR_PALETTES = [
text: 'var(--wp--preset--color--background)',
},
},
':visited': {
color: {
text: color.styles.elements?.button
? color.styles.elements.button.color
: 'var(--wp--preset--color--background)',
},
},
color: {
background: 'var(--wp--preset--color--primary)',
text: 'var(--wp--preset--color--background)',

View File

@ -26,8 +26,17 @@ export const ColorPanel = () => {
const [ rawSettings ] = useGlobalSetting( '' );
const settings = useSettingsForBlockElement( rawSettings );
const onChange = ( ...props ) => {
setStyle( ...props );
const onChange = ( _style ) => {
setStyle( {
..._style,
blocks: {
..._style.blocks,
// Reset the "core/button" color that may have been set via predefined color palette to ensure it uses the custom button color.
'core/button': {
color: {},
},
},
} );
setUserConfig( ( currentConfig ) => ( {
...currentConfig,
settings: mergeBaseAndUserConfigs( currentConfig.settings, {

View File

@ -4,10 +4,14 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { createInterpolateElement } from '@wordpress/element';
import { createInterpolateElement, useContext } from '@wordpress/element';
import { Link } from '@woocommerce/components';
import { PanelBody } from '@wordpress/components';
import { recordEvent } from '@woocommerce/tracks';
// @ts-ignore No types for this exist yet.
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
// @ts-ignore No types for this exist yet.
import { unlock } from '@wordpress/edit-site/build-module/lock-unlock';
/**
* Internal dependencies
@ -16,7 +20,14 @@ import { SidebarNavigationScreen } from './sidebar-navigation-screen';
import { ADMIN_URL } from '~/utils/admin-settings';
import { ColorPalette, ColorPanel } from './global-styles';
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
const SidebarNavigationScreenColorPaletteContent = () => {
// @ts-ignore No types for this exist yet.
const { user } = useContext( GlobalStylesContext );
const hasCreatedOwnColors = !! (
user.settings.color && user.settings.color.palette.hasCreatedOwnColors
);
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
// loaded. This is necessary because the Iframe component waits until
// the block editor store's `__internalIsInitialized` is true before
@ -34,7 +45,7 @@ const SidebarNavigationScreenColorPaletteContent = () => {
<PanelBody
className="woocommerce-customize-store__color-panel-container"
title={ __( 'or create your own', 'woocommerce' ) }
initialOpen={ false }
initialOpen={ hasCreatedOwnColors }
>
<ColorPanel />
</PanelBody>

View File

@ -29,7 +29,7 @@ import { findPatternByBlock } from './utils';
import BlockPatternList from '../block-pattern-list';
const SUPPORTED_FOOTER_PATTERNS = [
'woocommerce-blocks/footer-simple-menu-and-cart',
'woocommerce-blocks/footer-simple-menu',
'woocommerce-blocks/footer-with-3-menus',
'woocommerce-blocks/footer-large',
];

View File

@ -415,6 +415,11 @@
color: $gray-900;
}
}
.color-block-support-panel {
border-top: 0;
padding: 0;
}
}
.woocommerce-customize-store_color-palette-container {

View File

@ -5,8 +5,8 @@ import { z } from 'zod';
const footerChoices = [
{
slug: 'woocommerce-blocks/footer-simple-menu-and-cart',
label: 'Footer with Simple Menu and Cart',
slug: 'woocommerce-blocks/footer-simple-menu',
label: 'Footer with Simple Menu',
},
{
slug: 'woocommerce-blocks/footer-with-3-menus',

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix save button is still disabled after updating logo settings

View File

@ -1,4 +0,0 @@
Significance: patch
Type: fix
Preload Jetpack-related data from the Jetpack Connection package

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Rename the reference to the 'Footer with Simple Menu and Cart' pattern

View File

@ -1,4 +0,0 @@
Significance: patch
Type: fix
Fix core profiler email opt in validation

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix cys ui issues

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix for PR tests and daily tests

View File

@ -224,7 +224,7 @@ module.exports = async ( config ) => {
}
}
!process.env.BASE_URL || process.env.BASE_URL === 'localhost' && await site.useCartCheckoutShortcodes( baseURL, userAgent, admin );
await site.useCartCheckoutShortcodes( baseURL, userAgent, admin );
await adminContext.close();
await customerContext.close();