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.
This commit is contained in:
Tom Butcher 2026-08-19 17:38:59 +01:00
parent 7b4bedeee4
commit a3eef435f4

View File

@ -179,9 +179,9 @@ async function transformCustomElements(content) {
attrs: { attrs: {
class: 'documentBarcode', class: 'documentBarcode',
'jsbarcode-displayValue': 'false', 'jsbarcode-displayValue': 'false',
'jsbarcode-value': node.content[0], 'jsbarcode-value': node.content.at(0) || '',
'jsbarcode-format': node.attrs.format, 'jsbarcode-format': node.attrs.format || 'code128',
'jsbarcode-width': node.attrs.barcodeWidth, 'jsbarcode-width': node.attrs.barcodeWidth || 2,
'jsbarcode-margin': 0 'jsbarcode-margin': 0
} }
} }