-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zoom out mode: scale iframe instead of contents (#47004)
- Loading branch information
Showing
10 changed files
with
141 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { size, MiddlewareArguments } from '@floating-ui/react-dom'; | ||
|
||
export function overlayMiddlewares() { | ||
return [ | ||
{ | ||
name: 'overlay', | ||
fn( { rects }: MiddlewareArguments ) { | ||
return rects.reference; | ||
}, | ||
}, | ||
size( { | ||
apply( { rects, elements } ) { | ||
const { firstElementChild } = elements.floating ?? {}; | ||
|
||
// Only HTMLElement instances have the `style` property. | ||
if ( ! ( firstElementChild instanceof HTMLElement ) ) return; | ||
|
||
// Reduce the height of the popover to the available space. | ||
Object.assign( firstElementChild.style, { | ||
width: `${ rects.reference.width }px`, | ||
height: `${ rects.reference.height }px`, | ||
} ); | ||
}, | ||
} ), | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.