diff --git a/resources/views/qr-codes/partials/qr-customizer-script.blade.php b/resources/views/qr-codes/partials/qr-customizer-script.blade.php
index d471090..81e23fb 100644
--- a/resources/views/qr-codes/partials/qr-customizer-script.blade.php
+++ b/resources/views/qr-codes/partials/qr-customizer-script.blade.php
@@ -11,6 +11,7 @@
removeLogo: false,
previewLoading: false,
previewTimer: null,
+ _qrLibTimer: null,
showPreviewModal: false,
openSection: config.openSection || 'body',
balance: config.balance ?? null,
@@ -59,8 +60,6 @@
this.$watch(field, () => this._reprocessLogo());
});
- this.schedulePreview();
-
if (config.existingLogoUrl) {
this._loadExistingLogo(config.existingLogoUrl);
}
@@ -68,6 +67,12 @@
this.$watch('showPreviewModal', (val) => {
if (val) this.schedulePreview();
});
+
+ if (this.wizard) {
+ this.$watch('step', () => this.$nextTick(() => this.schedulePreview()));
+ }
+
+ this.$nextTick(() => this.schedulePreview());
},
toggleSection(id) {
this.openSection = this.openSection === id ? null : id;
@@ -441,8 +446,13 @@
} catch (_) { /* silent */ }
},
refreshPreview() {
- if (typeof window.QRCodeStyling === 'undefined') return;
+ if (typeof window.QRCodeStyling === 'undefined') {
+ clearTimeout(this._qrLibTimer);
+ this._qrLibTimer = setTimeout(() => this.refreshPreview(), 100);
+ return;
+ }
+ clearTimeout(this._qrLibTimer);
this.previewLoading = true;
try {
@@ -659,11 +669,7 @@
}));
};
- if (window.Alpine) {
- registerQrCustomizer();
- } else {
- document.addEventListener('alpine:init', registerQrCustomizer);
- }
+ document.addEventListener('alpine:init', registerQrCustomizer);
})();
@endonce
diff --git a/resources/views/qr-codes/show.blade.php b/resources/views/qr-codes/show.blade.php
index 1b27a1f..b13bae2 100644
--- a/resources/views/qr-codes/show.blade.php
+++ b/resources/views/qr-codes/show.blade.php
@@ -19,6 +19,8 @@
style: @js(\App\Support\Qr\QrStyleDefaults::merge($qrStyle)),
})">
+ @include('qr-codes.partials.qr-customizer-script')
+
@foreach(['success', 'error'] as $flash)
@if(session($flash))