Commit 588590bd authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(xml-editor): escape xml editor's content + restyle form sections to prevent overflowing

parent 99bb40b8
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -16,13 +16,13 @@ class Section extends Component

    public function render(): string
    {
        $subtitle = $this->subtitle === null ? '' : '<p class="text-sm clear-left text-skin-muted ' . $this->subtitleClass . '">' . $this->subtitle . '</p>';
        $subtitle = $this->subtitle === null ? '' : '<p class="text-sm text-skin-muted ' . $this->subtitleClass . '">' . $this->subtitle . '</p>';

        return <<<HTML
            <fieldset class="w-full p-8 bg-elevated border-3 border-subtle rounded-xl {$this->class}">
            <fieldset class="w-full p-8 bg-elevated border-3 flex flex-col items-start border-subtle rounded-xl {$this->class}">
                <Heading tagName="legend" class="float-left">{$this->title}</Heading>
                {$subtitle}
                <div class="flex flex-col gap-4 py-4 clear-left">{$this->slot}</div>
                <div class="flex flex-col w-0 min-w-full gap-4 py-4">{$this->slot}</div>
            </fieldset>
        HTML;
    }
+8 −2
Original line number Diff line number Diff line
@@ -14,11 +14,17 @@ class XMLEditor extends FormComponent
        'class' => 'textarea',
    ];

    protected string $content = '';

    public function setContent(string $value): void
    {
        $this->content = htmlspecialchars_decode($value);
    }

    public function render(): string
    {
        $content = $this->slot;
        $this->attributes['slot'] = 'textarea';
        $textarea = form_textarea($this->attributes, $content);
        $textarea = form_textarea($this->attributes, $this->content);

        return <<<HTML
            <xml-editor>{$textarea}</time-ago>
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
    <dt class="text-sm font-medium leading-5 text-skin-muted">
    <?= lang('User.form.permissions') ?>
    </dt>
    <dd class="max-w-xl mt-1 text-sm leading-5">
    <dd class="w-full max-w-xl mt-1 text-sm leading-5">
    <?= implode(', ', $user->permissions) ?>
    </dd>
</div>
+3 −3
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@

<?= $this->section('content') ?>

<form action="<?= route_to('episode-create', $podcast->id) ?>" method="POST" enctype="multipart/form-data" class="flex flex-col max-w-xl mt-6 gap-y-8">
<form action="<?= route_to('episode-create', $podcast->id) ?>" method="POST" enctype="multipart/form-data" class="flex flex-col w-full max-w-xl mt-6 gap-y-8">
<?= csrf_field() ?>


@@ -53,14 +53,14 @@

<div class="flex flex-col gap-x-2 gap-y-4 md:flex-row">
    <Forms.Field
        class="flex-1 w-0"
        class="flex-1 w-full"
        name="season_number"
        label="<?= lang('Episode.form.season_number') ?>"
        type="number"
        value="<?= $currentSeasonNumber ?>"
    />
    <Forms.Field
        class="flex-1 w-0"
        class="flex-1 w-full"
        name="episode_number"
        label="<?= lang('Episode.form.episode_number') ?>"
        type="number"
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@

<?= $this->section('content') ?>

<form action="<?= route_to('episode-delete', $podcast->id, $episode->id) ?>" method="POST" class="flex flex-col max-w-xl mx-auto">
<form action="<?= route_to('episode-delete', $podcast->id, $episode->id) ?>" method="POST" class="flex flex-col w-full max-w-xl mx-auto">
<?= csrf_field() ?>

<Alert variant="danger" glyph="alert" class="font-semibold"><?= lang('Episode.delete_form.disclaimer') ?></Alert>
Loading