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

Try extra wrapping element around floated images #5460

Closed
wants to merge 1 commit into from
Closed
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
26 changes: 26 additions & 0 deletions blocks/library/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ export const settings = {
figureStyle = { maxWidth: '50%' };
}

// Output an extra element for floats
if ( align === 'left' || align === 'right' ) {
return (
<div className={ align ? `align${ align }` : null }>
<figure style={ figureStyle }>
{ href ? <a href={ href }>{ image }</a> : image }
{ caption && caption.length > 0 && <figcaption>{ caption }</figcaption> }
</figure>
</div>
);
}

// Just output figure when non floated
return (
<figure className={ align ? `align${ align }` : null } style={ figureStyle }>
{ href ? <a href={ href }>{ image }</a> : image }
Expand All @@ -202,6 +215,19 @@ export const settings = {
figureStyle = { maxWidth: '50%' };
}

// Output an extra element for floats
if ( align === 'left' || align === 'right' ) {
return (
<div className={ align ? `align${ align }` : null }>
<figure style={ figureStyle }>
{ href ? <a href={ href }>{ image }</a> : image }
{ caption && caption.length > 0 && <figcaption>{ caption }</figcaption> }
</figure>
</div>
);
}

// Just output figure when non floated
return (
<figure className={ align ? `align${ align }` : null } style={ figureStyle }>
{ href ? <a href={ href }>{ image }</a> : image }
Expand Down