Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
disabled={ isEmpty( previewedTemplate ) || isLoading }
onClick={ this.handleConfirmation }
>
{ sprintf(
__( 'Use %s layout', 'full-site-editing' ),
this.getTitleByTemplateSlug( previewedTemplate )
) }
);
}
}
export const PageTemplatesPlugin = compose(
withSelect( select => {
const getMeta = () => select( 'core/editor' ).getEditedPostAttribute( 'meta' );
const { _starter_page_template } = getMeta();
return {
getMeta,
_starter_page_template,
postContentBlock: select( 'core/editor' )
.getBlocks()
.find( block => block.name === 'a8c/post-content' ),
};
} ),
withDispatch( ( dispatch, ownProps ) => {
// Disable tips right away as the collide with the modal window.
dispatch( 'core/nux' ).disableTips();
const editorDispatcher = dispatch( 'core/editor' );
return {
const SubscriptionsCheckbox = ( { isPostExcludedFromSubs, editPost } ) => (
{
editPost( { jetpack_dont_email_post_to_subs: value } );
} }
/>
);
// Fetch the post meta.
const applyWithSelect = withSelect( select => {
const { getEditedPostAttribute } = select( 'core/editor' );
const isPostExcludedFromSubs = getEditedPostAttribute( 'jetpack_dont_email_post_to_subs' );
return { isPostExcludedFromSubs };
} );
// Provide method to update post meta.
const applyWithDispatch = withDispatch( dispatch => {
const { editPost } = dispatch( 'core/editor' );
return { editPost };
} );
// Combine the higher-order components.
export default compose( [ applyWithSelect, applyWithDispatch ] )( SubscriptionsCheckbox );
}
},
} )( Sidebar );
function AnimatedSidebarFill( props ) {
return (
{ () => }
);
}
const WrappedSidebar = compose(
withSelect( ( select, { name } ) => ( {
isActive: select( 'core/edit-post' ).getActiveGeneralSidebarName() === name,
} ) ),
ifCondition( ( { isActive } ) => isActive ),
)( AnimatedSidebarFill );
WrappedSidebar.Slot = Slot;
export default WrappedSidebar;
return (
<div>
{ ( rootBlockIcon || rootBlockTitle ) && (
<div>
{ rootBlockTitle && <h2>{ rootBlockTitle }</h2> }
</div>
) }
</div>
);
}
export default compose(
ifCondition( ( { items } ) => items && items.length > 0 ),
withSelect( ( select, { rootClientId } ) => {
const {
getBlockType,
} = select( 'core/blocks' );
const {
getBlockName,
} = select( 'core/block-editor' );
const rootBlockName = getBlockName( rootClientId );
const rootBlockType = getBlockType( rootBlockName );
return {
rootBlockTitle: rootBlockType && rootBlockType.title,
rootBlockIcon: rootBlockType && rootBlockType.icon,
};
} ),
)( ChildBlocks );
* { __( 'My sidebar content' ) }
*
*
* );
* ```
*
* @return {WPComponent} Plugin sidebar component.
*/
export default compose(
withPluginContext( ( context, ownProps ) => {
return {
icon: ownProps.icon || context.icon,
sidebarName: `${ context.name }/${ ownProps.name }`,
};
} ),
withSelect( ( select, { sidebarName } ) => {
const {
getActiveGeneralSidebarName,
isPluginItemPinned,
} = select( 'core/edit-post' );
return {
isActive: getActiveGeneralSidebarName() === sidebarName,
isPinned: isPluginItemPinned( sidebarName ),
};
} ),
withDispatch( ( dispatch, { isActive, sidebarName } ) => {
const {
closeGeneralSidebar,
openGeneralSidebar,
togglePinnedPluginItem,
} = dispatch( 'core/edit-post' );
}
);
}
AMPToggle.propTypes = {
isEnabled: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
};
export const name = 'amp';
export const icon = 'hidden';
export const render = compose(
withSelect( () => {
return {
isEnabled: isAMPEnabled(),
};
} ),
withDispatch( ( dispatch ) => {
return {
onChange: ( isEnabled ) => {
dispatch( 'core/editor' ).editPost( { amp_enabled: isEnabled } );
},
};
} ),
withInstanceId,
)( AMPToggle );
>
{ this.getBlockControls() }
{ this.getInspectorControls() }
{ isEditing
? this.renderEditMode()
: this.renderViewMode() }
);
};
}
export default compose(
withSpokenMessages,
withSelect( ( select, { clientId } ) => {
const { getBlock } = select( 'core/block-editor' );
return {
block: getBlock( clientId ),
};
} ),
withDispatch( ( dispatch ) => {
const { replaceInnerBlocks } = dispatch( 'core/block-editor' );
return {
replaceInnerBlocks,
};
} )
)( Editor );
className={ getBlockClassName(
'wc-block-all-products',
attributes
) }
>
{ this.getBlockControls() }
{ this.getInspectorControls() }
{ isEditing ? this.renderEditMode() : this.renderViewMode() }
);
};
}
export default compose(
withSpokenMessages,
withSelect( ( select, { clientId } ) => {
const { getBlock } = select( 'core/block-editor' );
return {
block: getBlock( clientId ),
};
} ),
withDispatch( ( dispatch ) => {
const { replaceInnerBlocks } = dispatch( 'core/block-editor' );
return {
replaceInnerBlocks,
};
} )
)( Editor );
onKeyPress={ onKeyPress }
/>
) }
{ ! isEditingLink && (
) }
);
}
export default compose(
withInstanceId,
withSelect( ( select, ownProps ) => {
if ( ownProps.fetchSearchSuggestions && isFunction( ownProps.fetchSearchSuggestions ) ) {
return;
}
const { getSettings } = select( 'core/block-editor' );
return {
fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions,
};
} )
)( LinkControl );
) }
);
};
MetaFields.propTypes = {
autoAdvanceAfterOptions: PropTypes.array.isRequired,
updateMeta: PropTypes.func.isRequired,
meta: PropTypes.shape( {
amp_story_auto_advance_after: PropTypes.string,
amp_story_auto_advance_after_duration: PropTypes.number,
} ),
};
const EnhancedMetaFields = compose(
withSelect( ( select ) => {
const { getEditedPostAttribute } = select( 'core/editor' );
const { getSettings } = select( 'amp/story' );
const { storySettings } = getSettings();
const { autoAdvanceAfterOptions } = storySettings || {};
return {
meta: getEditedPostAttribute( 'meta' ),
autoAdvanceAfterOptions,
};
} ),
withDispatch( ( dispatch, { meta } ) => {
const { editPost } = dispatch( 'core/editor' );
return {
updateMeta( newMeta ) {
editPost( {
meta: {