@estation/create-cms-site 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -585,10 +585,10 @@ When the website is inside an iframe, clicking any \`[data-cms-field]\` element
|
|
|
585
585
|
\`\`\`
|
|
586
586
|
|
|
587
587
|
Field type rules for live preview:
|
|
588
|
-
- \`text\` → use on any element (\`<h1>\`, \`<p>\`, \`<span>\`), updated via \`textContent\`
|
|
589
|
-
- \`richtext\` → use \`dangerouslySetInnerHTML\`, updated via \`innerHTML\`
|
|
590
|
-
- \`image\` → must be on an \`<img>\` element, updated via \`.src\`
|
|
591
|
-
- \`list\` →
|
|
588
|
+
- \`text\` → use on any element (\`<h1>\`, \`<p>\`, \`<span>\`), updated via \`textContent\` — real-time
|
|
589
|
+
- \`richtext\` → use \`dangerouslySetInnerHTML\`, updated via \`innerHTML\` — real-time
|
|
590
|
+
- \`image\` → must be on an \`<img>\` element, updated via \`.src\` — real-time
|
|
591
|
+
- \`list\` → **NO real-time preview**. List fields are too complex for postMessage updates. Changes appear after save + iframe reload. Do NOT try to send list field updates via postMessage — it will dump raw JSON into the page.
|
|
592
592
|
|
|
593
593
|
### Troubleshooting live preview
|
|
594
594
|
|
package/package.json
CHANGED
|
@@ -14,7 +14,6 @@ export function FAQSection({ block, locale }: SectionProps) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// Fallback: treat each content key as a question/answer pair
|
|
18
17
|
if (faqs.length === 0) {
|
|
19
18
|
for (const [key, field] of Object.entries(c)) {
|
|
20
19
|
if (key === "title" || key === "description") continue;
|
|
@@ -32,13 +31,13 @@ export function FAQSection({ block, locale }: SectionProps) {
|
|
|
32
31
|
{title}
|
|
33
32
|
</h2>
|
|
34
33
|
)}
|
|
35
|
-
<div
|
|
34
|
+
<div className="space-y-6">
|
|
36
35
|
{faqs.map((faq, i) => (
|
|
37
36
|
<details key={i} className="border border-gray-200 rounded-lg">
|
|
38
|
-
<summary className="px-6 py-4 cursor-pointer font-medium hover:bg-gray-50">
|
|
37
|
+
<summary data-cms-field={`items.${i}.question`} className="px-6 py-4 cursor-pointer font-medium hover:bg-gray-50">
|
|
39
38
|
{faq.question}
|
|
40
39
|
</summary>
|
|
41
|
-
<div className="px-6 pb-4 text-gray-600">{faq.answer}</div>
|
|
40
|
+
<div data-cms-field={`items.${i}.answer`} className="px-6 pb-4 text-gray-600">{faq.answer}</div>
|
|
42
41
|
</details>
|
|
43
42
|
))}
|
|
44
43
|
</div>
|
|
@@ -28,11 +28,11 @@ export function FeaturesSection({ block, locale }: SectionProps) {
|
|
|
28
28
|
{description}
|
|
29
29
|
</p>
|
|
30
30
|
)}
|
|
31
|
-
<div
|
|
31
|
+
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
|
|
32
32
|
{features.map((feat, i) => (
|
|
33
33
|
<div key={i} className="p-6 rounded-lg border border-gray-200">
|
|
34
|
-
<h3 className="text-xl font-semibold mb-2">{feat.title}</h3>
|
|
35
|
-
<p className="text-gray-600">{feat.description}</p>
|
|
34
|
+
<h3 data-cms-field={`items.${i}.title`} className="text-xl font-semibold mb-2">{feat.title}</h3>
|
|
35
|
+
<p data-cms-field={`items.${i}.description`} className="text-gray-600">{feat.description}</p>
|
|
36
36
|
</div>
|
|
37
37
|
))}
|
|
38
38
|
</div>
|
|
@@ -15,7 +15,6 @@ export function TestimonialsSection({ block, locale }: SectionProps) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// Fallback: extract numbered testimonials from flat fields
|
|
19
18
|
if (testimonials.length === 0) {
|
|
20
19
|
let i = 1;
|
|
21
20
|
while (str(c[`testimonial-${i}-title`]) || str(c[`testimonial-${i}-description`])) {
|
|
@@ -35,13 +34,13 @@ export function TestimonialsSection({ block, locale }: SectionProps) {
|
|
|
35
34
|
{title}
|
|
36
35
|
</h2>
|
|
37
36
|
)}
|
|
38
|
-
<div
|
|
37
|
+
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
|
|
39
38
|
{testimonials.map((t, i) => (
|
|
40
39
|
<blockquote key={i} className="p-6 bg-white rounded-lg border border-gray-200">
|
|
41
|
-
<p className="text-gray-600 italic mb-4">“{t.quote}”</p>
|
|
42
|
-
<footer
|
|
43
|
-
{t.name}
|
|
44
|
-
{t.role && <span className="text-gray-500 text-sm block">{t.role}</span>}
|
|
40
|
+
<p data-cms-field={`items.${i}.quote`} className="text-gray-600 italic mb-4">“{t.quote}”</p>
|
|
41
|
+
<footer>
|
|
42
|
+
<span data-cms-field={`items.${i}.name`} className="font-medium">{t.name}</span>
|
|
43
|
+
{t.role && <span data-cms-field={`items.${i}.role`} className="text-gray-500 text-sm block">{t.role}</span>}
|
|
45
44
|
</footer>
|
|
46
45
|
</blockquote>
|
|
47
46
|
))}
|