Skip to content

Commit

Permalink
Add the embed figcaption inside the figure tag (#64970)
Browse files Browse the repository at this point in the history
Co-authored-by: hbhalodia <hbhalodia@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
  • Loading branch information
3 people committed Sep 10, 2024
1 parent 537fb18 commit aca9273
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
7 changes: 0 additions & 7 deletions packages/block-library/src/embed/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { embedContentIcon } from './icons';
import EmbedLoading from './embed-loading';
import EmbedPlaceholder from './embed-placeholder';
import EmbedPreview from './embed-preview';
import { Caption } from '../utils/caption';

/**
* External dependencies
Expand Down Expand Up @@ -277,14 +276,8 @@ const EmbedEdit = ( props ) => {
icon={ icon }
label={ label }
insertBlocksAfter={ insertBlocksAfter }
/>
<Caption
attributes={ attributes }
setAttributes={ setAttributes }
isSelected={ isSelected }
insertBlocksAfter={ insertBlocksAfter }
label={ __( 'Embed caption text' ) }
showToolbarButton={ isSelected }
/>
</View>
</>
Expand Down
24 changes: 22 additions & 2 deletions packages/block-library/src/embed/embed-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { getAuthority } from '@wordpress/url';
* Internal dependencies
*/
import WpEmbedPreview from './wp-embed-preview';
import { Caption } from '../utils/caption';

class EmbedPreview extends Component {
constructor() {
Expand Down Expand Up @@ -52,8 +53,19 @@ class EmbedPreview extends Component {
}

render() {
const { preview, previewable, url, type, className, icon, label } =
this.props;
const {
preview,
previewable,
url,
type,
className,
icon,
label,
insertBlocksAfter,
attributes,
setAttributes,
isSelected,
} = this.props;
const { scripts } = preview;
const { interactive } = this.state;

Expand Down Expand Up @@ -123,6 +135,14 @@ class EmbedPreview extends Component {
</p>
</Placeholder>
) }
<Caption
attributes={ attributes }
setAttributes={ setAttributes }
isSelected={ isSelected }
insertBlocksAfter={ insertBlocksAfter }
label={ __( 'Embed caption text' ) }
showToolbarButton={ isSelected }
/>
</figure>
);
}
Expand Down

0 comments on commit aca9273

Please sign in to comment.