@xuda.io/xuda-widget-plugin-xuda-drive 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +2 -2
- package/package.json +1 -1
- package/runtime.mjs +26 -0
package/index.mjs
CHANGED
package/package.json
CHANGED
package/runtime.mjs
CHANGED
|
@@ -325,6 +325,32 @@ export async function upload(fields, e) {
|
|
|
325
325
|
formData.append("folder", fields.file_upload_folder);
|
|
326
326
|
formData.append("public", fields.public_file);
|
|
327
327
|
|
|
328
|
+
let tags = [];
|
|
329
|
+
|
|
330
|
+
if (fields.file_tags) {
|
|
331
|
+
function csvToArray(csvString) {
|
|
332
|
+
// Split the string into rows (by newline)
|
|
333
|
+
const rows = csvString.split("\n");
|
|
334
|
+
|
|
335
|
+
// Map through each row and split by commas to create arrays for each row
|
|
336
|
+
return rows.map((row) => row.split(","));
|
|
337
|
+
}
|
|
338
|
+
tags = csvToArray(fields.upload_tags);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (fields.auto_tag_generator) {
|
|
342
|
+
let identifier = fields.auto_tag_identifier || " ";
|
|
343
|
+
let file_tags = file.name.split(identifier);
|
|
344
|
+
if (fields.auto_tag_translations) {
|
|
345
|
+
for (let tag of file_tags) {
|
|
346
|
+
if (auto_tag_translations[tag]) {
|
|
347
|
+
tag = auto_tag_translations[tag];
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
formData.append("tags", [...tags, ...file_tags]);
|
|
353
|
+
|
|
328
354
|
const request = new XMLHttpRequest();
|
|
329
355
|
|
|
330
356
|
let _domain = e._session.domain;
|