Skip to content

Commit

Permalink
Revert pullquote
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Feb 20, 2024
1 parent 5dfe5c6 commit b4c8097
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions packages/block-library/src/pullquote/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import {
RichText,
useBlockProps,
} from '@wordpress/block-editor';
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
import { Platform } from '@wordpress/element';
import { verse } from '@wordpress/icons';

/**
* Internal dependencies
*/
import { Figure } from './figure';
import { BlockQuote } from './blockquote';
import { Caption } from '../utils/caption';

const isWebPlatform = Platform.OS === 'web';

Expand All @@ -31,12 +30,13 @@ function PullQuoteEdit( {
isSelected,
insertBlocksAfter,
} ) {
const { textAlign, value } = attributes;
const { textAlign, citation, value } = attributes;
const blockProps = useBlockProps( {
className: classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ),
} );
const shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected;

return (
<>
Expand Down Expand Up @@ -66,26 +66,32 @@ function PullQuoteEdit( {
}
textAlign="center"
/>
<Caption
attributeKey="citation"
tagName={ isWebPlatform ? 'cite' : undefined }
style={ { display: 'block' } }
isSelected={ isSelected }
attributes={ attributes }
setAttributes={ setAttributes }
icon={ verse }
label={ __( 'Pullquote citation text' ) }
placeholder={
// translators: placeholder text used for the citation
__( 'Add citation' )
}
addLabel={ __( 'Add citation' ) }
removeLabel={ __( 'Remove citation' ) }
className="wp-block-pullquote__citation"
__unstableMobileNoFocusOnMount
textAlign="center"
insertBlocksAfter={ insertBlocksAfter }
/>
{ shouldShowCitation && (
<RichText
identifier="citation"
tagName={ isWebPlatform ? 'cite' : undefined }
style={ { display: 'block' } }
value={ citation }
aria-label={ __( 'Pullquote citation text' ) }
placeholder={
// translators: placeholder text used for the citation
__( 'Add citation' )
}
onChange={ ( nextCitation ) =>
setAttributes( {
citation: nextCitation,
} )
}
className="wp-block-pullquote__citation"
__unstableMobileNoFocusOnMount
textAlign="center"
__unstableOnSplitAtEnd={ () =>
insertBlocksAfter(
createBlock( getDefaultBlockName() )
)
}
/>
) }
</BlockQuote>
</Figure>
</>
Expand Down

0 comments on commit b4c8097

Please sign in to comment.