feat: provide id on upload context

This commit is contained in:
mrilyew 2025-05-26 23:54:14 +03:00 committed by Alexander Minkin
parent da6e90b777
commit ca309aa14e
2 changed files with 2 additions and 1 deletions

View file

@ -2,7 +2,7 @@
{var $textAreaId = ($post ?? NULL) === NULL ? (++$GLOBALS["textAreaCtr"]) : $post->getId()} {var $textAreaId = ($post ?? NULL) === NULL ? (++$GLOBALS["textAreaCtr"]) : $post->getId()}
{var $textAreaId = ($custom_id ?? NULL) === NULL ? $textAreaId : $custom_id} {var $textAreaId = ($custom_id ?? NULL) === NULL ? $textAreaId : $custom_id}
<div id="write" class='model_content_textarea' style="padding: 5px 0;"> <div id="write" class='model_content_textarea' style="padding: 5px 0;" data-id="{$owner}">
<form action="{$route}" method="post" enctype="multipart/form-data" style="margin:0;"> <form action="{$route}" method="post" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input{$textAreaId}" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea> <textarea id="wall-post-input{$textAreaId}" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea>
<div> <div>

View file

@ -1191,6 +1191,7 @@ async function __uploadToTextarea(file, textareaNode) {
const form_data = new FormData const form_data = new FormData
form_data.append('photo_0', file) form_data.append('photo_0', file)
form_data.append('count', 1) form_data.append('count', 1)
form_data.append('upload_context', textareaNode.nodes[0].dataset.id)
form_data.append("hash", u("meta[name=csrf]").attr("value")) form_data.append("hash", u("meta[name=csrf]").attr("value"))
if(filetype == 'photo') { if(filetype == 'photo') {