From cf9cb4d968679050c3964837d01ffe59e1930551 Mon Sep 17 00:00:00 2001 From: Dean Vigoren Date: Wed, 12 Jul 2023 10:14:06 -0600 Subject: [PATCH] FIX: Updated the preCreateJournalEntry hook so that if the passed in data already contains a sheetClass to not update to the ferncombe sheetClass. If no sheetClass is set on the data then the ferncombe sheetClass will be set. --- js/ferncombe.mjs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/js/ferncombe.mjs b/js/ferncombe.mjs index 0a9b7a2..f56cc90 100644 --- a/js/ferncombe.mjs +++ b/js/ferncombe.mjs @@ -50,7 +50,7 @@ Hooks.on("renderJournalPageSheet", (app, html, options) => { // Apply handwritten styles if ( doc.getFlag("ferncombe", "handwritten") ) html.addClass("handwritten"); - + }); @@ -59,13 +59,15 @@ Hooks.on("renderJournalPageSheet", (app, html, options) => { /* -------------------------------------------- */ Hooks.on("preCreateJournalEntry", (doc, data, options, userId) => { - doc.data.update({ - flags: { - core: { - sheetClass: "ferncombe.FerncombeJournalSheet" + if(!(data.flags && data.flags.core && data.flags.core.sheetClass)){ + doc.data.update({ + flags: { + core: { + sheetClass: "ferncombe.FerncombeJournalSheet" + } } - } - }) + }); + } }); Hooks.on("preCreateJournalEntryPage", (doc, data, options, userId) => {