wip upload files and select

This commit is contained in:
2026-05-05 19:21:59 +03:00
parent bd01e5c32c
commit 16e50e2d49
13 changed files with 439 additions and 208 deletions
+27 -28
View File
@@ -1,30 +1,29 @@
export function imgurl(channel, record) {
if (record._file.mime === "image/svg+xml") {
return fileurl(channel, record);
export function imgurl(channel, file) {
if (file.mime === "image/svg+xml") {
return fileurl(channel, file);
}
return channel.filesUrl + `/thumbs/${file.path}`;
}
export function fileurl(channel, file) {
return channel.filesUrl + `/${file.path}`;
}
export function htmlurl(channel, file, preset) {
let html = "";
let url = fileurl(channel, file);
if (file.width > 0) {
let presetUrl = url;
if (preset) {
presetUrl = channel.filesUrl + `/templates/${preset}/${file.path}`;
}
return channel.disks[record._file.disk] + `/thumbs/${record._file.path}`;
}
export function fileurl(channel, record) {
return channel.disks[record._file.disk] + `/${record._file.path}`;
}
export function htmlurl(channel, record, preset) {
let html = "";
let url = fileurl(channel, record)
if (record._file.width > 0) {
let presetUrl = url;
if (preset) {
presetUrl = channel.disks[record._file.disk] + `/templates/${preset}/${record._file.path}`;
}
html = `<img src="${presetUrl}" alt="${record._file.path}" />`
} else if (record._file.mime === "image/svg+xml") {
html = `<img src="${url}" alt="${record._file.path}"/>`
} else {
html = `<a href="${url}">${record._file.originalName}</a>`
}
return html;
html = `<img src="${presetUrl}" alt="${file.path}" />`;
} else if (file.mime === "image/svg+xml") {
html = `<img src="${url}" alt="${file.path}"/>`;
} else {
html = `<a href="${url}">${file.originalName}</a>`;
}
return html;
}