mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 02:23:30 +00:00
Fix image blocks zoomable behaviour (#2756)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix Image blocks zoomable behaviour
|
||||
@@ -378,6 +378,21 @@ const testCases: TestsCase[] = [
|
||||
fullPage: true,
|
||||
screenshot: { threshold: 0.8 },
|
||||
},
|
||||
{
|
||||
name: 'Images (with zoom)',
|
||||
url: 'blocks/block-images',
|
||||
run: async (page) => {
|
||||
await waitForCookiesDialog(page);
|
||||
const zoomImage = page.getByTestId('zoom-image');
|
||||
if (!zoomImage) {
|
||||
throw new Error('Image block not found');
|
||||
}
|
||||
await zoomImage.first().click();
|
||||
await page.waitForSelector('[data-testid="zoom-image-modal"]');
|
||||
},
|
||||
fullPage: true,
|
||||
screenshot: { threshold: 0.8 },
|
||||
},
|
||||
{
|
||||
name: 'Inline Images',
|
||||
url: 'blocks/inline-images',
|
||||
|
||||
@@ -39,6 +39,7 @@ export function Caption(
|
||||
'after:block',
|
||||
'after:absolute',
|
||||
'after:-inset-[0]',
|
||||
'after:pointer-events-none',
|
||||
fit ? 'w-fit' : null,
|
||||
withBorder
|
||||
? 'rounded straight-corners:rounded-none after:border-dark/2 after:border after:rounded straight-corners:after:rounded-none dark:after:border-light/1 dark:after:mix-blend-plus-lighter after:pointer-events-none'
|
||||
|
||||
@@ -142,6 +142,7 @@ export function ZoomImage(
|
||||
) : (
|
||||
// When zooming, remove the image from the DOM to let the browser animates it with View Transition.
|
||||
<img
|
||||
data-testid="zoom-image"
|
||||
ref={imgRef}
|
||||
{...props}
|
||||
alt={alt ?? ''}
|
||||
@@ -206,6 +207,7 @@ function ZoomImageModal(props: {
|
||||
|
||||
return (
|
||||
<div
|
||||
data-testid="zoom-image-modal"
|
||||
className={classNames(
|
||||
styles.zoomModal,
|
||||
tcls(
|
||||
|
||||
Reference in New Issue
Block a user