-
Notifications
You must be signed in to change notification settings - Fork 9.3k
/
iframeswitcher.phtml
40 lines (38 loc) · 1.2 KB
/
iframeswitcher.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var \Magento\Backend\Block\Page $block */
?>
<div id="preview" class="cms-revision-preview">
<iframe name="preview_iframe"
id="preview_iframe"
frameborder="0"
title="<?= $block->escapeHtmlAttr(__('Preview')) ?>"
width="100%"
sandbox="allow-same-origin allow-pointer-lock"
></iframe>
<form id="preview_form"
action="<?= $block->escapeUrl($block->getUrl('*/*/popup')) ?>"
method="post"
target="preview_iframe"
>
<input type="hidden" name="form_key" value="<?= /* @noEscape */ $block->getFormKey() ?>" />
<?php foreach ($block->getPreviewFormViewModel()->getFormFields() as $name => $value) : ?>
<input type="hidden" name="<?= $block->escapeHtmlAttr($name) ?>" value="<?= $block->escapeHtmlAttr($value) ?>"/>
<?php endforeach; ?>
</form>
</div>
<script>
require([
'jquery'
], function($) {
$(document).ready(function() {
$('#preview_form').submit();
});
$('#preview_iframe').load(function() {
$(this).height($(this).contents().height());
});
});
</script>