fix(embed): set height of player iframe from config

This commit is contained in:
Yassine Doghri 2023-05-19 17:33:27 +00:00
parent 6c010fc5fd
commit 4665741425
2 changed files with 9 additions and 2 deletions

View File

@ -14,7 +14,7 @@ const ThemePicker = (): void => {
const url: string | undefined = button.dataset.url;
if (url) {
button.addEventListener("click", () => {
iframeTextArea.value = `<iframe width="100%" height="280" frameborder="0" scrolling="no" style="width: 100%; height: 280px; overflow: hidden;" src="${url}"></iframe>`;
iframeTextArea.value = `<iframe width="100%" height="112" frameborder="0" scrolling="no" style="width: 100%; height: 112px; overflow: hidden;" src="${url}"></iframe>`;
urlTextArea.value = url;
iframe.src = url;
});

View File

@ -1,3 +1,10 @@
<?php declare(strict_types=1);
$embedHeight = config('Embed')
->height;
?>
<?= $this->extend('_layout') ?>
<?= $this->section('title') ?>
@ -27,7 +34,7 @@
<iframe name="embed" id="embed" class="w-full max-w-xl mt-6 h-28" frameborder="0" scrolling="no" style="width: 100%; overflow: hidden;" src="<?= $episode->embed_url ?>"></iframe>
<div class="flex items-center mt-8 gap-x-2">
<Forms.Textarea readonly="true" class="w-full max-w-xl" name="iframe" rows="2" value="<?= esc("<iframe width=\"100%\" height=\"280\" frameborder=\"0\" scrolling=\"no\" style=\"width: 100%; height: 280px; overflow: hidden;\" src=\"{$episode->embed_url}\"></iframe>") ?>" />
<Forms.Textarea readonly="true" class="w-full max-w-xl" name="iframe" rows="2" value="<?= esc("<iframe width=\"100%\" height=\"{$embedHeight}\" frameborder=\"0\" scrolling=\"no\" style=\"width: 100%; height: {$embedHeight}px; overflow: hidden;\" src=\"{$episode->embed_url}\"></iframe>") ?>" />
<IconButton glyph="file-copy" data-type="clipboard-copy" data-clipboard-target="iframe"><?= lang('Episode.embed.clipboard_iframe') ?></IconButton>
</div>