diff --git a/demo/advanced.html b/demo/advanced.html
index 38eea8f..df8455c 100644
--- a/demo/advanced.html
+++ b/demo/advanced.html
@@ -153,19 +153,43 @@
// Get some bookkeeping out of the way..
// First we create an interface to describe our settings form.
interface ConfigModalForm extends HTMLCollection {
- modalCancel : HTMLButtonElement
- modalDarkness : HTMLSelectElement
+ modalCancel : HTMLButtonElement
+ modalSubmit : HTMLButtonElement
+ modalPrinterIndex : HTMLInputElement
+
+ // Media
+ modalLabelWidth : HTMLInputElement
modalLabelHeight : HTMLInputElement
modalLabelOffsetLeft: HTMLInputElement
modalLabelOffsetTop : HTMLInputElement
- modalLabelWidth : HTMLInputElement
modalMediaType : HTMLSelectElement
+ modalWithAutosense : HTMLInputElement
+
+ // Printer
+ modalDarkness : HTMLSelectElement
modalSpeed : HTMLSelectElement
modalBackfeedPercent: HTMLSelectElement
- modalSubmit : HTMLButtonElement
- modalWithAutosense : HTMLInputElement
+
+ // These are ZPL-specific settings. Different languages can have additional
+ // commands or configs specific to their printers.
+ // Sensors
+ modalZplRibbonTHold: HTMLInputElement
+ modalZplRibbonLed : HTMLInputElement
+ modalZplWebTHold : HTMLInputElement
+ modalZplWebMedia : HTMLInputElement
+ modalZplWebLed : HTMLInputElement
+ modalZplMarkTHold : HTMLInputElement
+ modalZplMarkMedia : HTMLInputElement
+ modalZplMarkLed : HTMLInputElement
+
+ modalZplWithSensorGraph: HTMLInputElement
+
+ // Power up/head close actions
+ modalZplPowerUpAction : HTMLSelectElement
+ modalZplHeadCloseAction: HTMLSelectElement
}
+
// A function to find and hide any alerts for a given alert ID.
function hideAlerts(alertId: string) {
const existingAlerts = document.getElementById('printerAlertSpace')?.querySelectorAll(`.${alertId}`) ?? [];
@@ -303,14 +327,27 @@
${titleHtml}
/** Display the configuration for a printer. */
public showConfigModal(printer: WebLabel.LabelPrinterUsb, printerIdx: number) {
- if (printer == undefined) {
+ if (printer === undefined || printerIdx < 0) {
return;
}
const config = printer.printerOptions;
+ // If the printer uses ZPL it will have a special config, show those!
+ const isZpl = config instanceof WebLabel.ZPL.ZplPrinterConfig;
+
+ const formElement = this.configModal.querySelector('form')!;
+ const form = formElement.elements as ConfigModalForm;
+
+ // Only show ZPL settings if the printer language is ZPL.
+ for (const e of formElement.getElementsByTagName('modal-setting-zpl')) {
+ if (isZpl) {
+ e.classList.remove('d-hide');
+ } else {
+ e.classList.add('d-hide');
+ }
+ }
// Translate the available speeds to options to be selected
- const speedSelect = this.configModal.querySelector('#modalSpeed')! as HTMLSelectElement;
- speedSelect.innerHTML = '';
+ form.modalSpeed.innerHTML = '';
const speedTable = printer.printerOptions.speedTable.table;
for (const [key] of speedTable) {
// Skip utility values, so long as there's more than the defaults.
@@ -325,32 +362,47 @@