From 967e3d11648560fbaf96c459209eff86adb7de8d Mon Sep 17 00:00:00 2001 From: David Bruant Date: Sun, 27 Apr 2025 02:06:10 +0200 Subject: [PATCH] New Compartment usage --- scripts/odf/fillOdtTemplate.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/odf/fillOdtTemplate.js b/scripts/odf/fillOdtTemplate.js index 7e83f10..c3f47bd 100644 --- a/scripts/odf/fillOdtTemplate.js +++ b/scripts/odf/fillOdtTemplate.js @@ -180,9 +180,10 @@ function fillEachBlock(startNode, iterableExpression, itemExpression, endNode, c // @ts-ignore const itemFragment = repeatedFragment.cloneNode(true) - let insideCompartment = new Compartment( - Object.assign({}, compartment.globalThis, {[itemExpression]: item}) - ) + let insideCompartment = new Compartment({ + globals: Object.assign({}, compartment.globalThis, {[itemExpression]: item}), + __options__: true + }) // recursive call to fillTemplatedOdtElement on itemFragment fillTemplatedOdtElement( @@ -446,7 +447,10 @@ export default async function fillOdtTemplate(odtTemplate, data) { const contentXml = await entry.getData(new TextWriter()); const contentDocument = parseXML(contentXml); - const compartment = new Compartment(data) + const compartment = new Compartment({ + globals: data, + __options__: true + }) fillTemplatedOdtElement(contentDocument, compartment)