From a3eef435f4ef76377ac0628ba0d751d810206410 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Wed, 19 Aug 2026 17:38:59 +0100 Subject: [PATCH] Improve barcode attribute handling and enhance error logging in TemplateManager - Updated barcode attributes to provide default values when content or attributes are missing, ensuring more robust barcode generation. - Added error logging in the preview method to capture and log errors more effectively, improving debugging capabilities. --- src/templates/templatemanager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/templates/templatemanager.js b/src/templates/templatemanager.js index 922a2d7..2a0a6d7 100644 --- a/src/templates/templatemanager.js +++ b/src/templates/templatemanager.js @@ -179,9 +179,9 @@ async function transformCustomElements(content) { attrs: { class: 'documentBarcode', 'jsbarcode-displayValue': 'false', - 'jsbarcode-value': node.content[0], - 'jsbarcode-format': node.attrs.format, - 'jsbarcode-width': node.attrs.barcodeWidth, + 'jsbarcode-value': node.content.at(0) || '', + 'jsbarcode-format': node.attrs.format || 'code128', + 'jsbarcode-width': node.attrs.barcodeWidth || 2, 'jsbarcode-margin': 0 } }