Make some small improvements to actor sheets
This commit is contained in:
parent
df6e1672cf
commit
0fd9622e2d
8 changed files with 53 additions and 31 deletions
|
@ -8,6 +8,7 @@ import { DS4CreatureActorSheet } from "./actor/sheets/creature-sheet";
|
|||
import { createCheckRoll } from "./rolls/check-factory";
|
||||
import { registerSystemSettings } from "./settings";
|
||||
import { migration } from "./migrations";
|
||||
import handlebarsHelpers from "./handlebars-helpers";
|
||||
|
||||
Hooks.once("init", async () => {
|
||||
console.log(`DS4 | Initializing the DS4 Game System\n${DS4.ASCII}`);
|
||||
|
@ -39,7 +40,8 @@ Hooks.once("init", async () => {
|
|||
Items.unregisterSheet("core", ItemSheet);
|
||||
Items.registerSheet("ds4", DS4ItemSheet, { makeDefault: true });
|
||||
|
||||
registerHandlebarsPartials();
|
||||
await registerHandlebarsPartials();
|
||||
registerHandlebarsHelpers();
|
||||
});
|
||||
|
||||
async function registerHandlebarsPartials() {
|
||||
|
@ -65,6 +67,10 @@ async function registerHandlebarsPartials() {
|
|||
return loadTemplates(templatePaths);
|
||||
}
|
||||
|
||||
function registerHandlebarsHelpers() {
|
||||
Object.entries(handlebarsHelpers).forEach(([key, helper]) => Handlebars.registerHelper(key, helper));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function runs after game data has been requested and loaded from the servers, so entities exist
|
||||
*/
|
||||
|
|
6
src/module/handlebars-helpers.ts
Normal file
6
src/module/handlebars-helpers.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export default { htmlToPlainText };
|
||||
|
||||
function htmlToPlainText(input: string | null | undefined): string | null | undefined {
|
||||
if (!input) return;
|
||||
return $(input).text();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue