add: ability to upload images while creating a reply or answer

This commit is contained in:
trisua 2025-05-11 15:34:09 -04:00
parent eb95be0f38
commit 68c3a5d84e
2 changed files with 38 additions and 7 deletions

View file

@ -43,9 +43,13 @@
></textarea>
</div>
<div id="files_list" class="flex gap-2 flex-wrap"></div>
<div class="flex gap-2">
{{ components::emoji_picker(element_id="content",
render_dialog=true) }}
render_dialog=true) }} {% if is_supporter %} {{
components::file_picker(files_list_id="files_list") }} {% endif
%}
<button class="primary">
{{ text "communities:action.create" }}
@ -294,6 +298,12 @@
// create body
const body = new FormData();
if (e.target.file_picker) {
for (const file of e.target.file_picker.files) {
body.append(file.name, file);
}
}
body.append(
"body",
JSON.stringify({