-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cbaaee
commit 7a416db
Showing
4 changed files
with
60 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.v2-iframe iframe { | ||
width: 100%; | ||
} | ||
|
||
.v2-iframe.v2-iframe--full-viewport { | ||
width: 100vw; | ||
height: 100vh; | ||
display: flex; | ||
} | ||
|
||
.v2-iframe--full-viewport iframe { | ||
width: 100%; | ||
height: 100%; | ||
} |
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,17 @@ | ||
import { variantsClassesToBEM } from '../../scripts/common.js'; | ||
|
||
export default async function decorate(block) { | ||
const iframe = document.createElement('iframe'); | ||
const link = block.querySelector('a')?.getAttribute('href') || block.textContent.trim(); | ||
const fixedHeightClass = [...block.classList].find((el) => /[0-9]+px/.test(el)); | ||
|
||
variantsClassesToBEM(block.classList, ['full-viewport'], 'v2-iframe'); | ||
|
||
if (fixedHeightClass) { | ||
iframe.height = fixedHeightClass; | ||
} | ||
|
||
iframe.src = link; | ||
iframe.setAttribute('frameborder', 0); | ||
block.replaceChildren(iframe); | ||
} |
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