Add options to import documents into specific folders or compendium packs and sort them by tier.

This commit is contained in:
CPTN Cosmo 2026-01-24 15:23:33 +01:00
parent 3e9bc42ca4
commit f5153485af
No known key found for this signature in database
4 changed files with 133 additions and 10 deletions

View file

@ -47,7 +47,9 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
adversary: "Adversary",
environment: "Environment"
},
inputText: this.inputText
inputText: this.inputText,
folders: game.folders.filter(f => f.type === "Actor").sort((a, b) => a.name.localeCompare(b.name)),
packs: game.packs.filter(p => p.documentName === "Actor" && !p.locked)
};
}
@ -152,7 +154,10 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
}
}
await DHImporter.createDocuments(this.parsedData, this.parsedDataType);
const importTarget = formData.importTarget || "";
const sortTier = formData.sortTier || false;
await DHImporter.createDocuments(this.parsedData, this.parsedDataType, { target: importTarget, sortTier });
ui.notifications.info(`Successfully imported ${this.parsedData.length} documents.`);
this.close();
} catch (e) {