diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/attachment_pill.php | 22 | ||||
| -rw-r--r-- | templates/note.php | 6 |
2 files changed, 25 insertions, 3 deletions
diff --git a/templates/attachment_pill.php b/templates/attachment_pill.php index 76fc590..6fff74d 100644 --- a/templates/attachment_pill.php +++ b/templates/attachment_pill.php @@ -16,7 +16,29 @@ $type ??= 'add'; <span class="pillIcon material-symbols attach-file"></span> <span class="pillText"><?= $name ?></span> <input type="hidden" name="attachments[]" value="<?= $oid ?>"> + <input type="hidden" name="altTexts[]" value="<?= $name ?>"> <span class="pillIcon material-symbols close-small"></span> </button> +<?php elseif ($type == 'image'): ?> + + <div class="inlinePill imageAttachmentPill"> + <div class="row pillInfo"> + <span class="pillIcon material-symbols attach-file"></span> + <span class="pillText"><?= $name ?></span> + </div> + <img src="<?= $href ?>"> + <input type="hidden" name="attachments[]" value="<?= $oid ?>"> + <div class="row"> + <label for="altText-<?= $oid ?>"><?= __('writeNote.attachments.altText.label') ?></label> + <textarea id="altText-<?= $oid ?>" name="altTexts[]"></textarea> + </div> + <div class="row"> + <button type="button" class="secondary" _="on click remove closest .inlinePill"> + <span class="material-symbols close-small"></span> + <?= __('writeNote.attachments.remove.action') ?> + </button> + </div> + </div> + <?php endif; ?>
\ No newline at end of file diff --git a/templates/note.php b/templates/note.php index f9eef45..b43e63e 100644 --- a/templates/note.php +++ b/templates/note.php @@ -79,12 +79,12 @@ if ($user != null) { <?php foreach ($note->attachments as $attachment): ?> <div> <?php if (str_starts_with($attachment->type, 'image/')): ?> - <img src="<?= $attachment->href ?>" alt="<?= $attachment->description ?? '' ?>" - title="<?= $attachment->description ?? '' ?>"> + <img src="<?= $attachment->href ?>" alt="<?= htmlspecialchars($attachment->description ?? '') ?>" + title="<?= htmlspecialchars($attachment->description ?? '') ?>"> <?php else: ?> <a class="file" href="<?= $attachment->href ?>" target="_blank"> <span class="material-symbols attach-file"></span> - <span><?= $attachment->description ?? basename($attachment->href) ?></span> + <span><?= htmlspecialchars($attachment->description ?? basename($attachment->href)) ?></span> </a> <?php endif; ?> </div> |
