forked from retoor/devplacepy
Pressing Ctrl+V with a screenshot on the clipboard now attaches it immediately instead of requiring a trip through the file picker. The clipboard reader lives in dp-upload behind a new opt-in `paste` boolean attribute: with it set, the component binds one paste listener on its closest form and routes the clipboard image files through the same handleFiles path as the picker and the drop target, so validation, limits, the terms gate and the hidden attachment_uids field are shared. A paste carrying plain text is never swallowed. It is opt-in rather than a form-wide default because a form may hold several upload buttons - projects.html has cover and logo beside the attachment one - and a default would attach one pasted screenshot to all of them. Set on _attachment_form.html, so every form including it inherits the behaviour (post composer, post edit, gists, projects, issues, screenshots), plus _comment_form.html, messages.html and the embed-mode skeleton AppChat builds. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
23 lines
1.3 KiB
HTML
23 lines
1.3 KiB
HTML
{% if user %}
|
|
<form class="comment-form" method="POST" action="/comments/create">
|
|
<input type="hidden" name="target_uid" value="{{ _comment_target_uid }}">
|
|
<input type="hidden" name="target_type" value="{{ _comment_target_type }}">
|
|
{% set _user = user %}{% set _size = 32 %}{% set _size_class = "sm" %}{% include "_avatar_link.html" %}
|
|
<textarea name="content" placeholder="Your opinion goes here..." required aria-required="true" aria-label="Comment" maxlength="125000" class="emoji-picker-target" data-mention></textarea>
|
|
<div class="comment-form-actions">
|
|
<dp-upload multiple paste
|
|
max-size="{{ max_upload_size_mb() }}"
|
|
max-files="{{ max_attachments_per_resource() }}"
|
|
allowed-types="{{ allowed_file_types() }}"></dp-upload>
|
|
<button type="submit" class="comment-form-submit"><span class="icon">📤</span><span class="label"> Post</span></button>
|
|
</div>
|
|
</form>
|
|
{% else %}
|
|
<form class="comment-form comment-form-guest">
|
|
<textarea name="content" placeholder="Your opinion goes here..." disabled aria-disabled="true" aria-label="Comment"></textarea>
|
|
<div class="comment-form-actions">
|
|
<button type="button" class="comment-form-submit" disabled aria-disabled="true"><span class="icon">📤</span><span class="label"> Post</span></button>
|
|
</div>
|
|
</form>
|
|
{% endif %}
|