feat: init export html button

This commit is contained in:
Matthieu CAILLEAUX
2022-04-23 21:05:13 +02:00
parent a246f899f4
commit 986d50a5eb
5 changed files with 25 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
{
"WFRP4SHEETPRINT.export.pdf": "Export to PDF"
"WFRP4SHEETPRINT.export.pdf": "Export to PDF",
"WFRP4SHEETPRINT.export.html": "Export to Html"
}

View File

@@ -1,3 +1,4 @@
{
"WFRP4SHEETPRINT.export.pdf": "Exporter en PDF"
"WFRP4SHEETPRINT.export.pdf": "Exporter en PDF",
"WFRP4SHEETPRINT.export.html": "Exporter en Html"
}

View File

@@ -1,3 +1,6 @@
#!/bin/bash
set -e
cp -r ./dist/* $LOCAL_FOUNDRY

View File

@@ -1,3 +1,6 @@
#!/bin/bash
set -e
rm -fr dist
npm run build
cp -r $MODULE_DIRS dist/

View File

@@ -30,6 +30,17 @@ Hooks.on('getActorDirectoryEntryContext', async (_, options) => {
);
await generatePdf(actor);
},
},
{
name: i18nLocalize('WFRP4SHEETPRINT.export.html'),
condition: isGM(),
icon: '<i class="fas fa-file-code"></i>',
callback: async (target) => {
const actor: Actor & any = (<any>game).actors.get(
target.attr('data-document-id')
);
await generateHtml(actor);
},
});
});
@@ -60,6 +71,10 @@ function addActorSheetActionButton(
title.after(button);
}
async function generateHtml(actor: Actor & any) {
console.dir(actor);
}
async function generatePdf(actor: Actor & any) {
const actorData = actor.data;
// @ts-ignore