-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Allow embed sandbox to make content non-interactive for unknown embeds #10512
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,8 +154,17 @@ class Sandbox extends Component { | |
| margin-top: 0 !important; /* Has to have !important to override inline styles. */ | ||
| margin-bottom: 0 !important; | ||
| } | ||
| #wp-sandbox-overlay { | ||
| position: fixed; | ||
| width: 100%; | ||
| height: 100%; | ||
| top: 0; | ||
| left: 0; | ||
| right: 0; | ||
| bottom: 0; | ||
| } | ||
| `; | ||
|
|
||
| const overlayId = 'wp-sandbox-overlay'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I see a benefit to assigning this to a variable if it's not in-fact a single source of truth (i.e. duplicated in the style assignment).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Me neither, but the linter doesn't allow a string literal as |
||
| // put the html snippet into a html document, and then write it to the iframe's document | ||
| // we can use this in the future to inject custom styles or scripts. | ||
| // Scripts go into the body rather than the head, to support embedded content such as Instagram | ||
|
|
@@ -167,6 +176,7 @@ class Sandbox extends Component { | |
| <style dangerouslySetInnerHTML={ { __html: style } } /> | ||
| </head> | ||
| <body data-resizable-iframe-connected="data-resizable-iframe-connected" className={ this.props.type }> | ||
| { ! this.props.interactive && <div id={ overlayId } /> } | ||
| <div dangerouslySetInnerHTML={ { __html: this.props.html } } /> | ||
| <script type="text/javascript" dangerouslySetInnerHTML={ { __html: observeAndResizeJS } } /> | ||
| { ( this.props.scripts && this.props.scripts.map( | ||
|
|
@@ -189,6 +199,7 @@ class Sandbox extends Component { | |
| return { | ||
| html: '', | ||
| title: '', | ||
| interactive: true, | ||
| }; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, is there any reason we couldn't use
Disabledfor this?https://github.com/WordPress/gutenberg/tree/master/packages/components/src/disabled