Zeige das Widget Anfrage in der Vorschau des Seiteneditors und gib der Fassungsliste deutsche Texte
CI Feature / test (push) Successful in 5m32s
CI Feature / test (push) Successful in 5m32s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2eca612108
commit
374fd95576
7 files changed
+56
-4
No files matched your search
@@ -740,3 +740,23 @@ @media (prefers-reduced-motion: reduce) {
|
||||
transition: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Vorschau im Seiteneditor: der geöffnete Dialog als gerahmtes Beispiel statt als Dialog über der Seite. */
|
||||
.iw-sample-note {
|
||||
margin: var(--space-3) 0 var(--space-2);
|
||||
font-size: 0.9em;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.iw-dialog--sample {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: auto;
|
||||
max-height: none;
|
||||
border: 2px dashed var(--color-border-strong);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.iw-dialog--sample .iw-body {
|
||||
overflow: visible;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Einstieg für Vorschauen, die nur Stile laden (Iframes im Seiteneditor): bringt das Anfrageformular und das Widget
|
||||
* „Anfrage“ zum Laufen. Die öffentliche Seite und die Seitenvorschau laden dasselbe über app.js.
|
||||
*/
|
||||
import './inquiry-form.js';
|
||||
import './inquiry-widget.js';
|
||||
@@ -50,6 +50,10 @@ class InquiryWidget {
|
||||
this.active = null;
|
||||
this.sent = false;
|
||||
this.modal = this.config.open === 'modal';
|
||||
// In den Vorschau-Iframes des Seiteneditors (srcdoc, kleine feste Fläche) ist ein echter Dialog nicht darstellbar:
|
||||
// Dort steht der geöffnete Dialog als gerahmtes Beispiel unter dem Button. Auf der Seite und in der Seitenvorschau
|
||||
// öffnet der Button den echten Dialog.
|
||||
this.sample = this.modal && this.config.preview && Boolean(window.frameElement?.hasAttribute?.('srcdoc'));
|
||||
}
|
||||
|
||||
start() {
|
||||
@@ -64,6 +68,10 @@ class InquiryWidget {
|
||||
this.choose(preselected.key, false);
|
||||
}
|
||||
|
||||
if (this.sample) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.modal) {
|
||||
// Ein Button der Seite mit ?grund=… will den Dialog sofort sehen; ohne Vorwahl öffnet der Besucher selbst.
|
||||
if (preselected) {
|
||||
@@ -93,6 +101,18 @@ class InquiryWidget {
|
||||
}
|
||||
|
||||
this.root.classList.add('is-modal');
|
||||
|
||||
if (this.sample) {
|
||||
this.opener = h('button', { type: 'button', class: 'button iw-opener', text: this.config.openLabel });
|
||||
this.root.append(
|
||||
this.opener,
|
||||
h('p', { class: 'iw-sample-note', text: 'Vorschau: So sieht der geöffnete Dialog aus.' }),
|
||||
h('div', { class: 'iw-dialog iw-dialog--sample', role: 'group', 'aria-label': this.config.openLabel }, h('div', { class: 'iw-dialog-head' }, h('span', { class: 'iw-close', 'aria-hidden': 'true' }, '×')), this.body),
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.opener = h('button', {
|
||||
type: 'button',
|
||||
class: 'button iw-opener',
|
||||
|
||||
@@ -39,3 +39,7 @@
|
||||
</p>
|
||||
@endif
|
||||
@endif
|
||||
@if ($context->preview)
|
||||
{{-- Vorschau-Iframes im Seiteneditor laden nur Stile: Das Skript lässt das Formular dort wie auf der Seite erscheinen. --}}
|
||||
@vite('resources/js/inquiry-embed.js')
|
||||
@endif
|
||||
Reference in new issue
Block a user