Skip to content

Commit

Permalink
Merge branch 'trunk' into social/unified-connections-management
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Jan 20, 2025
2 parents 1fabbd2 + 1e920f4 commit ec6091b
Show file tree
Hide file tree
Showing 25 changed files with 129 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Issue Triage: remove keyword no longer in use.


Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ function formatSlackMessage( payload, channel, message ) {
case 'Automattic/jetpack':
dris = '@jetpack-da';
break;
case 'Automattic/zero-bs-crm':
case 'Automattic/sensei':
dris = '@heysatellite';
break;
case 'Automattic/WP-Job-Manager':
case 'Automattic/Crowdsignal':
dris = '@meteorite-team';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ function formatSlackMessage( payload, channel, message ) {
case 'Automattic/jetpack':
dris = '@jetpack-da';
break;
case 'Automattic/zero-bs-crm':
case 'Automattic/sensei':
dris = '@heysatellite';
break;
case 'Automattic/WP-Job-Manager':
case 'Automattic/Crowdsignal':
dris = '@meteorite-team';
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions projects/js-packages/shared-extension-utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { default as getSiteFragment } from './src/get-site-fragment';
export * from './src/site-type-utils';
export { default as getJetpackExtensionAvailability } from './src/get-jetpack-extension-availability';
export { default as registerJetpackPlugin } from './src/register-jetpack-plugin';
export { default as withHasWarningIsInteractiveClassNames } from './src/with-has-warning-is-interactive-class-names';
export {
getUpgradeUrl,
isUpgradable,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createHigherOrderComponent } from '@wordpress/compose';

import './style.scss';

// Injecting the `has-warning` class into the block wrapper component gives us
// the right kind of borders around the block, both visually and conceptually.
// However, it also adds styling to prevent user interaction with that block.
// We thus add a new `is-interactive` class to be able to override that behavior.
export default name =>
createHigherOrderComponent(
BlockListBlock => props => (
<BlockListBlock
{ ...props }
className={ props.name === name ? 'has-warning is-interactive' : props.className }
/>
),
'withHasWarningIsInteractiveClassNames'
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.block-editor-block-list__layout
// Override core styles inherited from `.has-warning`:
// we do want blocks with upgrade nudge warning to be interactive
.block-editor-block-list__block.has-warning.is-interactive {
> * {
pointer-events: auto;
user-select: auto;
}

&:after {
content: none;
}
}
4 changes: 0 additions & 4 deletions projects/packages/forms/changelog/fix-upsell-nudge-safari

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {
getJetpackExtensionAvailability,
withHasWarningIsInteractiveClassNames,
requiresPaidPlan,
} from '@automattic/jetpack-shared-extension-utils';
import { registerBlockType } from '@wordpress/blocks';
import { addFilter } from '@wordpress/hooks';

/**
* Registers a gutenberg block if the availability requirements are met.
Expand Down Expand Up @@ -32,6 +34,14 @@ export default function registerJetpackBlock( name, settings, childBlocks = [],

const result = registerBlockType( jpPrefix + name, settings );

if ( requiredPlan ) {
addFilter(
'editor.BlockListBlock',
`${ jpPrefix + name }-with-has-warning-is-interactive-class-names`,
withHasWarningIsInteractiveClassNames( jpPrefix + name )
);
}

// Register child blocks. Using `registerBlockType()` directly avoids availability checks -- if
// their parent is available, we register them all, without checking for their individual availability.
childBlocks.forEach( childBlock =>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Performance fix


This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Admin Bar: Point the Edit Site menu item to /site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function () {
);

add_action(
is_admin() ? 'enqueue_block_assets' : 'enqueue_block_editor_assets',
'enqueue_block_editor_assets',
function () {
$handle = \jetpack_mu_wpcom_enqueue_assets( 'newspack-blocks-blog-posts-editor', array( 'js', 'css' ) );
enqueue_newspack_blocks_data( $handle );
Expand All @@ -112,7 +112,7 @@ function () {
);

add_action(
is_admin() ? 'enqueue_block_assets' : 'enqueue_block_editor_assets',
'enqueue_block_editor_assets',
function () {
$handle = \jetpack_mu_wpcom_enqueue_assets( 'newspack-blocks-carousel-editor', array( 'js', 'css' ) );
enqueue_newspack_blocks_data( $handle );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,20 @@ function wpcom_custom_wpcom_admin_bar_class( $wp_admin_bar_class ) {
return '\Automattic\Jetpack\Jetpack_Mu_Wpcom\WPCOM_Admin_Bar';
}
add_filter( 'wp_admin_bar_class', 'wpcom_custom_wpcom_admin_bar_class' );

/**
* Changes the edit site menu to point to the top-level site editor.
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar core object.
*/
function wpcom_edit_site_menu_override( $wp_admin_bar ) {
if ( $wp_admin_bar->get_node( 'site-editor' ) ) {
$args = array(
'id' => 'site-editor',
'href' => admin_url( 'site-editor.php' ),
);

$wp_admin_bar->add_node( $args );
}
}
add_action( 'admin_bar_menu', 'wpcom_edit_site_menu_override', 41 );
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,4 @@ function load_assets( $attr, $content ) {
function enqueue_block_editor_assets() {
\jetpack_mu_wpcom_enqueue_assets( 'wpcom-blocks-event-countdown-editor', array( 'js', 'css' ) );
}
if ( is_admin() ) {
add_action( 'enqueue_block_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
} else {
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
}
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,4 @@ function load_assets( $attr, $content ) {
function enqueue_block_editor_assets() {
\jetpack_mu_wpcom_enqueue_assets( 'wpcom-blocks-timeline-editor', array( 'js', 'css' ) );
}
if ( is_admin() ) {
add_action( 'enqueue_block_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
} else {
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
}
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global wpcomGlobalStyles */
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { ExternalLink, Notice } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import {
Expand Down Expand Up @@ -238,19 +239,31 @@ function GlobalStylesEditNotice() {
upgradePlan,
] );

const isDistractionFree = useSelect(
select => select( blockEditorStore ).getSettings().isDistractionFree,
[]
);

useEffect( () => {
if ( ! isSiteEditor && ! isPostEditor ) {
return;
}

if ( globalStylesInUse ) {
if ( globalStylesInUse && ! isDistractionFree ) {
showNotice();
} else {
removeNotice( NOTICE_ID );
}

return () => removeNotice( NOTICE_ID );
}, [ globalStylesInUse, isSiteEditor, isPostEditor, removeNotice, showNotice ] );
}, [
globalStylesInUse,
isDistractionFree,
isSiteEditor,
isPostEditor,
removeNotice,
showNotice,
] );

return null;
}
Expand Down
4 changes: 0 additions & 4 deletions projects/plugins/jetpack/changelog/fix-upsell-nudge-safari

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isAtomicSite,
isSimpleSite,
getJetpackExtensionAvailability,
withHasWarningIsInteractiveClassNames,
} from '@automattic/jetpack-shared-extension-utils';
import { createBlobURL } from '@wordpress/blob';
import { useBlockEditContext, store as blockEditorStore } from '@wordpress/block-editor';
Expand Down Expand Up @@ -185,6 +186,11 @@ const addVideoPressSupport = ( settings, name ) => {
// Check if VideoPress is unavailable and filter the mediaplaceholder to limit options
if ( isNotAvailable ) {
addFilter( 'editor.MediaPlaceholder', 'jetpack/videopress', videoPressNoPlanMediaPlaceholder );
addFilter(
'editor.BlockListBlock',
`jetpack/videopress-with-has-warning-is-interactive-class-names`,
withHasWarningIsInteractiveClassNames( `core/video` )
);
} else if ( available ) {
if ( resumableUploadEnabled ) {
addFilter( 'editor.MediaPlaceholder', 'jetpack/videopress', videoPressMediaPlaceholder );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useBlockProps } from '@wordpress/block-editor';
import { createHigherOrderComponent } from '@wordpress/compose';
import { useSelect } from '@wordpress/data';
import { useState, useEffect, useMemo, useContext } from '@wordpress/element';
import clsx from 'clsx';
import { PaidBlockContext, PaidBlockProvider } from './components';
import UpgradePlanBanner from './upgrade-plan-banner';
import { trackUpgradeBannerImpression, trackUpgradeClickEvent } from './utils';
Expand Down Expand Up @@ -81,14 +80,14 @@ const withUpgradeBanner = createHigherOrderComponent(

const blockProps = useBlockProps();
// Fix for width of cover block because otherwise the div defaults to content-size as max width
const cssFixForCoverBlock = { maxwidth: 'unset' };
const cssFixForCoverBlock = { 'max-width': 'unset' };

return (
<PaidBlockProvider
onBannerVisibilityChange={ setIsVisible }
hasParentBanner={ isBannerVisible }
>
<div { ...blockProps } style={ { ...cssFixForCoverBlock, ...blockProps.style } }>
<div ref={ blockProps.ref } style={ cssFixForCoverBlock }>
<UpgradePlanBanner
className={ `is-${ name.replace( /\//, '-' ) }-paid-block` }
title={ null }
Expand All @@ -99,7 +98,7 @@ const withUpgradeBanner = createHigherOrderComponent(
context={ bannerContext }
onRedirect={ () => trackUpgradeClickEvent( trackEventData ) }
/>
<BlockEdit { ...props } className={ clsx( blockProps.className, 'has-warning' ) } />
<BlockEdit { ...props } />
</div>
</PaidBlockProvider>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {
getJetpackExtensionAvailability,
withHasWarningIsInteractiveClassNames,
requiresPaidPlan,
getBlockIconProp,
} from '@automattic/jetpack-shared-extension-utils';
import { registerBlockType } from '@wordpress/blocks';
import { addFilter } from '@wordpress/hooks';

const JETPACK_PREFIX = 'jetpack/';

Expand Down Expand Up @@ -50,6 +52,14 @@ export default function registerJetpackBlock(
settings
);

if ( requiredPlan ) {
addFilter(
'editor.BlockListBlock',
`${ prefixedName }-with-has-warning-is-interactive-class-names`,
withHasWarningIsInteractiveClassNames( prefixedName )
);
}

// Register child blocks. Using `registerBlockType()` directly avoids availability checks -- if
// their parent is available, we register them all, without checking for their individual availability.
childBlocks.forEach( childBlock =>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Performance fix


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Admin Bar: Point the Edit Site menu item to /site-editor.php
5 changes: 5 additions & 0 deletions projects/plugins/wpcomsh/changelog/fix-block-asset-enqueueing
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Performance fix


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Admin Bar: Point the Edit Site menu item to /site-editor.php

0 comments on commit ec6091b

Please sign in to comment.