Skip to content
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
18 changes: 18 additions & 0 deletions packages/block-library/src/image/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@ figure.wp-block-image:not(.wp-block) {
}
}

*:not([data-align]) {
> .wp-block-image {
display: grid;
grid-template-columns: [image] minmax(0, max-content) [placeholder] auto;
.components-placeholder {
grid-column: placeholder;
}
> div:not(.components-placeholder) {
grid-column: image;
}
> figcaption {
grid-column: image;
display: table-caption;
caption-side: bottom;
}
}
}

.wp-block[data-align="left"] > .wp-block-image {
margin-right: 1em;
margin-left: 0;
Expand Down
3 changes: 3 additions & 0 deletions packages/e2e-tests/specs/editor/blocks/cover.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ describe( 'Cover', () => {
await insertBlock( 'Image' );
// Upload image and transform to the Cover block
await upload( '.wp-block-image' );
// Click the block wrapper before trying to convert to make sure figcaption toolbar is not obscuring
// the block toolbar.
await page.click( '.wp-block-image' );
await transformBlockTo( 'Cover' );

// Get the block's background dim color and its opacity
Expand Down
5 changes: 3 additions & 2 deletions packages/e2e-tests/specs/editor/blocks/image.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ describe( 'Image', () => {
`<!-- wp:image {"id":\\d+,"sizeSlug":"full","linkDestination":"none"} -->\\s*<figure class="wp-block-image size-full"><img src="[^"]+\\/${ filename2 }\\.png" alt="" class="wp-image-\\d+"/></figure>\\s*<!-- \\/wp:image -->`
);
expect( await getEditedPostContent() ).toMatch( regex3 );

await page.click( '.wp-block-image' );
// For some reason just clicking the block wrapper causes figcaption to get focus
// in puppeteer but not in live browser, so clicking on the image wrapper div here instead.
await page.click( '.wp-block-image > div' );
await page.keyboard.press( 'Backspace' );

expect( await getEditedPostContent() ).toBe( '' );
Expand Down