Going back to the input from the preview no longer empties the textfield, allowing for easier edits before importing
This commit is contained in:
parent
b6a1af9926
commit
3e9bc42ca4
4 changed files with 19 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this.step = "input";
|
||||
this.parsedData = null;
|
||||
this.parsedDataType = null;
|
||||
this.inputText = "";
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
|
|
@ -45,7 +46,8 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
types: {
|
||||
adversary: "Adversary",
|
||||
environment: "Environment"
|
||||
}
|
||||
},
|
||||
inputText: this.inputText
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +77,9 @@ export class DHImporterApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
const text = form.querySelector("textarea[name='text']").value;
|
||||
const type = form.querySelector("select[name='type']").value;
|
||||
|
||||
// Store input text
|
||||
this.inputText = text;
|
||||
|
||||
if (!text) {
|
||||
ui.notifications.warn("Please enter text to import.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -314,10 +314,18 @@ export class DHImporter {
|
|||
};
|
||||
|
||||
if (isAction) {
|
||||
// Determine if this is an attack or a generic ability
|
||||
const isAttack = buffer.description.match(/make.*?attack/i) ||
|
||||
buffer.description.match(/(?:deal|inflict|take)\s+(\d+(?:d\d+)?(?:[\s]*[\+\-][\s]*\d+)?)\s+(direct\s+)?(\w+)\s+damage/i);
|
||||
|
||||
const actionType = isAttack ? "attack" : "ability";
|
||||
const rollType = isAttack ? "attack" : "ability";
|
||||
|
||||
const actionId = foundry.utils.randomID();
|
||||
|
||||
const action = {
|
||||
_id: actionId,
|
||||
type: "attack",
|
||||
type: actionType,
|
||||
name: buffer.name,
|
||||
actionType: "action",
|
||||
img: "icons/svg/item-bag.svg",
|
||||
|
|
@ -327,7 +335,7 @@ export class DHImporter {
|
|||
damage: { parts: [], includeBase: false, direct: false },
|
||||
range: "",
|
||||
roll: {
|
||||
type: "attack", // Default to attack
|
||||
type: rollType,
|
||||
diceRolling: { multiplier: "flat", dice: "d6" }
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue