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

ETP: Premium Content: Remove __experimentalAlignmentHookSettingsProvider dep #47467

Merged
merged 2 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
* WordPress dependencies
*/
// eslint-disable-next-line wpcalypso/import-docblock
import {
__experimentalAlignmentHookSettingsProvider as AlignmentHookSettingsProvider,
InnerBlocks,
__experimentalBlock as Block,
} from '@wordpress/block-editor';
import { InnerBlocks, __experimentalBlock as Block } from '@wordpress/block-editor';
import { compose } from '@wordpress/compose';
import { withDispatch, withSelect } from '@wordpress/data';
import { useEffect } from '@wordpress/element';
Expand All @@ -19,11 +15,6 @@ const ALLOWED_BLOCKS = [
'premium-content/login-button',
];

// Inside buttons block alignment options are not supported.
const alignmentHooksSetting = {
isEmbedButton: true,
};

function ButtonsEdit( { context, subscribeButton, setSubscribeButtonPlan } ) {
const planId = context ? context[ 'premium-content/planId' ] : null;
const isPreview = context ? context[ 'premium-content/isPreview' ] : false;
Expand Down Expand Up @@ -91,14 +82,13 @@ function ButtonsEdit( { context, subscribeButton, setSubscribeButtonPlan } ) {
return (
// eslint-disable-next-line wpcalypso/jsx-classname-namespace
<Block.div className="wp-block-buttons">
<AlignmentHookSettingsProvider value={ alignmentHooksSetting }>
<InnerBlocks
allowedBlocks={ ALLOWED_BLOCKS }
template={ isPreview ? previewTemplate : template }
__experimentalMoverDirection="horizontal"
templateInsertUpdatesSelection={ false }
/>
</AlignmentHookSettingsProvider>
<InnerBlocks
allowedBlocks={ ALLOWED_BLOCKS }
template={ isPreview ? previewTemplate : template }
templateInsertUpdatesSelection={ false }
__experimentalLayout={ { type: 'default', alignments: [] } }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this line actually does anything (see PR description, section 'Open questions'). We could consider removing it.

__experimentalMoverDirection="horizontal"
/>
</Block.div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,7 @@
.wp-block-premium-content-container .jetpack-block-nudge {
display: none;
}

.wp-block-premium-content-login-button {
display: inline-block;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import { mergeWith } from 'lodash';
*/
import apiFetch from '@wordpress/api-fetch';
import { getBlockType, registerBlockType, unregisterBlockType } from '@wordpress/blocks';
import {
__experimentalAlignmentHookSettingsProvider,
__experimentalBlock,
} from '@wordpress/block-editor';
import { __experimentalBlock } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand All @@ -22,9 +19,7 @@ import * as loggedOutView from './blocks/logged-out-view';
import * as buttons from './blocks/buttons';
import * as loginButton from './blocks/login-button';

const supportsDecoupledBlocks = !! (
__experimentalAlignmentHookSettingsProvider && __experimentalBlock
);
const supportsDecoupledBlocks = !! __experimentalBlock;

/**
* Function to register an individual block.
Expand Down
1 change: 0 additions & 1 deletion test/e2e/specs/wp-gutenberg-experimental-features-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const gutenbergUser =
const EXPERIMENTAL_FEATURES = {
'@wordpress/block-editor': [
// Used in the premium content block in the Editing Toolkit plugin
'__experimentalAlignmentHookSettingsProvider',
'__experimentalBlock',
],
};
Expand Down