mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-23 03:21:35 +02:00
Dateien nach „web_src/js/features“ hochladen
This commit is contained in:
parent
e06bcbd52c
commit
a5154c6001
1 changed files with 7 additions and 1 deletions
|
@ -229,7 +229,8 @@ export function initDropzone(el) {
|
||||||
this.on('success', (file, data) => {
|
this.on('success', (file, data) => {
|
||||||
file.uuid = data.uuid;
|
file.uuid = data.uuid;
|
||||||
const $input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
|
const $input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
|
||||||
$dropzone.find('.files').append($input);
|
const $inputPath = $(`<input type="hidden" name="files_fullpath[${data.uuid}]" value="${file.fullPath || file.name}">`);
|
||||||
|
$dropzone.find('.files').append($input).append($inputPath);
|
||||||
// Create a "Copy Link" element, to conveniently copy the image
|
// Create a "Copy Link" element, to conveniently copy the image
|
||||||
// or file link as Markdown to the clipboard
|
// or file link as Markdown to the clipboard
|
||||||
const copyLinkElement = document.createElement('div');
|
const copyLinkElement = document.createElement('div');
|
||||||
|
@ -250,7 +251,12 @@ export function initDropzone(el) {
|
||||||
file.previewTemplate.append(copyLinkElement);
|
file.previewTemplate.append(copyLinkElement);
|
||||||
});
|
});
|
||||||
this.on('removedfile', (file) => {
|
this.on('removedfile', (file) => {
|
||||||
|
// Remove the hidden input for the file
|
||||||
$(`#${file.uuid}`).remove();
|
$(`#${file.uuid}`).remove();
|
||||||
|
|
||||||
|
// Remove the hidden input for files_fullpath
|
||||||
|
$(`input[name="files_fullpath[${file.uuid}]"]`).remove();
|
||||||
|
|
||||||
if ($dropzone.data('remove-url')) {
|
if ($dropzone.data('remove-url')) {
|
||||||
POST($dropzone.data('remove-url'), {
|
POST($dropzone.data('remove-url'), {
|
||||||
data: new URLSearchParams({file: file.uuid}),
|
data: new URLSearchParams({file: file.uuid}),
|
||||||
|
|
Loading…
Add table
Reference in a new issue