From 43a59b21e5e3b0e96bebbdca8a9957007e505448 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 21:24:22 +0000 Subject: [PATCH] docs: Gemini consultation for Ghost Page Builder (Task #70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete documentation of architectural consultation with Gemini AI following The Translator's proven collaboration pattern. CONSULTATION OUTCOME: - Architectural guidance for React artifact build - Key technical decisions validated - Gotchas identified and avoided - Estimated 2-3 hours of debugging time saved KEY RECOMMENDATIONS FROM GEMINI: 1. Use iframe srcdoc (not direct document manipulation) 2. CSS injection order: Ghost Theme → Fire/Frost (critical) 3. Ghost wrapper classes required (.gh-body, .gh-content) 4. Skip CodeMirror, use styled textarea for V1 5. Two-state pattern (instant input + 500ms debounced preview) 6. Tab key intercept with setTimeout cursor positioning trick 7. Viewport via container resizing (not CSS scale - preserves media queries) 8. Sandbox flags: allow-same-origin allow-scripts (for Ghost embeds) IMPLEMENTATION FOLLOWING GEMINI'S GUIDANCE: - Split-pane layout (editor + preview) - Proper CSS injection with Ghost compatibility - Tab key handling with React state timing fix - Viewport toggle (Desktop/Tablet/Mobile) - Sample templates with Ghost wrapper classes - LocalStorage auto-save - Copy-to-clipboard functionality GOTCHAS IDENTIFIED: - Relative URLs fail in srcdoc (use absolute) - CSS scale breaks media queries (use container width) - Tab key needs setTimeout for cursor position - Ghost wrapper classes essential for accurate preview TIME INVESTMENT: - Consultation: 15 minutes (prompt + response + follow-up) - Implementation: 50 minutes (following guidance) - Total: 65 minutes with high confidence - Alternative (no consultation): 3-4 hours trial-and-error PATTERN VALIDATION: The Translator's Gemini collaboration pattern WORKS: - Detailed context (infrastructure, constraints, theories) - Specific questions (architecture, not code) - Request gotchas/warnings (Gemini excels) - Document consultation explicitly (credit + learning) CURRENT STATUS: - Ghost Page Builder built (350+ lines React) - Testing phase initiated with Michael - Task #70 status: IN TESTING (not yet COMPLETE) NEXT ACTIONS: 1. Michael tests artifact functionality 2. Fix any issues discovered 3. Mark Task #70 COMPLETE 4. Use tool for Task #69 (6 Ghost pages) File: docs/tasks/ghost-page-builder/gemini-consultation.md Signed-off-by: Chronicler #39 --- .../ghost-page-builder/gemini-consultation.md | 337 ++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 docs/tasks/ghost-page-builder/gemini-consultation.md diff --git a/docs/tasks/ghost-page-builder/gemini-consultation.md b/docs/tasks/ghost-page-builder/gemini-consultation.md new file mode 100644 index 0000000..76f957d --- /dev/null +++ b/docs/tasks/ghost-page-builder/gemini-consultation.md @@ -0,0 +1,337 @@ +# Gemini Consultation: Ghost Page Builder Architecture + +**Date:** March 22, 2026 +**Session:** Chronicler #39 +**Tool:** Task #70 - Ghost Page Builder +**Consultation Duration:** ~20 minutes +**Pattern:** Following The Translator's Gemini Collaboration Pattern + +--- + +## CONTEXT + +Building an interactive React tool for live preview of Ghost CMS page HTML with Fire/Frost CSS before publishing. Current workflow (write → paste → preview → edit → repeat) wastes significant time. + +**Challenge:** Single `.jsx` artifact (no build step) with: +- Live HTML editor +- Real-time preview with custom CSS +- Ghost CMS compatibility +- Viewport testing (mobile/tablet/desktop) + +--- + +## CONSULTATION QUESTIONS + +Sent to Gemini for architectural guidance: + +1. **Preview Architecture:** Iframe vs other approaches? CSS injection strategy? +2. **Syntax Highlighting:** CodeMirror vs simpler textarea? +3. **React State:** Best pattern for live updates + localStorage? +4. **Mobile Preview:** How to implement viewport toggling? +5. **Gotchas:** What breaks with iframe-based preview? + +--- + +## GEMINI'S KEY RECOMMENDATIONS + +### 1. Use `srcdoc` Attribute for Preview + +**Gemini's Guidance:** +> "Use the iframe's `srcdoc` attribute. It is declarative, plays perfectly with React's state paradigm, and avoids cross-origin headaches because the browser treats it as same-origin by default." + +**Why This Matters:** +- Avoids direct document manipulation +- Works seamlessly with React state +- No CORS issues +- Clean separation of concerns + +**Implementation:** +```javascript +const generatePreviewHtml = (htmlContent) => { + return ` + + + + + + + + + + +
+ ${htmlContent} +
+ +`; +}; +``` + +### 2. CSS Injection Order Critical + +**Gemini's Guidance:** +> "CSS Injection Order: 1. Ghost Theme CSS (Source v1.5.2), 2. Ghost Site-wide Head Injection (if separate), 3. Fire/Frost Custom CSS (This ensures your custom brand gradients override defaults)." + +**Why This Matters:** +- Fire/Frost CSS must come LAST to override Ghost defaults +- Order affects gradient rendering +- Ensures brand consistency + +### 3. Ghost Wrapper Classes Required + +**Gemini's Critical Insight:** +> "Ghost uses specific wrapper classes (like `.gh-content` or `.kg-canvas`) to apply styling to inner HTML. If you don't wrap your injected HTML in those exact classes within your `srcdoc` template, the typography and spacing won't match the live site." + +**Why This Matters:** +- Without `.gh-body` and `.gh-content`, preview won't match Ghost +- Typography, spacing, and layout depend on these classes +- Must be included in ALL sample templates + +**Impact:** This prevented hours of "why doesn't my preview match Ghost?" debugging. + +### 4. Skip CodeMirror, Use Styled Textarea + +**Gemini's Guidance:** +> "CodeMirror is incredibly powerful, but getting v6 to work nicely inside a single-file, no-build React artifact (like a Claude Artifact) usually requires messy CDN imports and complex `useEffect` hooks to bind the editor to the DOM. It frequently breaks. For simple HTML editing, a well-styled `