Skip to content

Create beautiful slides on the web using a coding agent's frontend skills

Reintegrate inline editing feature from PR #23

Zara Zhangbe267ee7c8b1
diff --git a/SKILL.md b/SKILL.md
index bd3f063..8c7103c 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -83,6 +83,13 @@ Approximately how many slides? Options: Short 5-10 / Medium 10-20 / Long 20+
**Question 3 — Content** (header: "Content"):
Do you have content ready? Options: All content ready / Rough notes / Topic only
+**Question 4 — Inline Editing** (header: "Editing"):
+Do you need to edit text directly in the browser after generation? Options:
+- "Yes (Recommended)" — Can edit text in-browser, auto-save to localStorage, export file
+- "No" — Presentation only, keeps file smaller
+
+**Remember the user's editing choice — it determines whether edit-related code is included in Phase 3.**
+
If user has content, ask them to share it.
---
@@ -169,6 +176,7 @@ When converting PowerPoint files:
- File location, style name, slide count
- Navigation: Arrow keys, Space, scroll/swipe, click nav dots
- How to customize: `:root` CSS variables for colors, font link for typography, `.reveal` class for animations
+ - If inline editing was enabled: Hover top-left corner or press E to enter edit mode, click any text to edit, Ctrl+S to save
---
diff --git a/html-template.md b/html-template.md
index 82c5024..10e5f14 100644
--- a/html-template.md
+++ b/html-template.md
@@ -165,6 +165,93 @@ Every presentation must include:
- Magnetic buttons
- Counter animations
+4. **Inline Editing** (only if user opted in during Phase 1 — skip entirely if they said No):
+ - Edit toggle button (hidden by default, revealed via hover hotzone or `E` key)
+ - Auto-save to localStorage
+ - Export/save file functionality
+ - See "Inline Editing Implementation" section below
+
+## Inline Editing Implementation (Opt-In Only)
+
+**If the user chose "No" for inline editing in Phase 1, do NOT generate any edit-related HTML, CSS, or JS.**
+
+**Do NOT use CSS `~` sibling selector for hover-based show/hide.** The CSS-only approach (`edit-hotzone:hover ~ .edit-toggle`) fails because `pointer-events: none` on the toggle button breaks the hover chain: user hovers hotzone -> button becomes visible -> mouse moves toward button -> leaves hotzone -> button disappears before click.
+
+**Required approach: JS-based hover with 400ms delay timeout.**
+
+HTML:
+```html
+<div class="edit-hotzone"></div>
+<button class="edit-toggle" id="editToggle" title="Edit mode (E)">✏️</button>
+```
+
+CSS (visibility controlled by JS classes only):
+```css
+/* Do NOT use CSS ~ sibling selector for this!
+ pointer-events: none breaks the hover chain.
+ Must use JS with delay timeout. */
+.edit-hotzone {
+ position: fixed; top: 0; left: 0;
+ width: 80px; height: 80px;
+ z-index: 10000;
+ cursor: pointer;
+}
+.edit-toggle {
+ opacity: 0;
+ pointer-events: none;
+ transition: opacity 0.3s ease;
+ z-index: 10001;
+}
+.edit-toggle.show,
+.edit-toggle.active {
+ opacity: 1;
+ pointer-events: auto;
+}
+```
+
+JS (three interaction methods):
+```javascript
+// 1. Click handler on the toggle button
+document.getElementById('editToggle').addEventListener('click', () => {
+ editor.toggleEditMode();
+});
+
+// 2. Hotzone hover with 400ms grace period
+const hotzone = document.querySelector('.edit-hotzone');
+const editToggle = document.getElementById('editToggle');
+let hideTimeout = null;
+
+hotzone.addEventListener('mouseenter', () => {
+ clearTimeout(hideTimeout);
+ editToggle.classList.add('show');
+});
+hotzone.addEventListener('mouseleave', () => {
+ hideTimeout = setTimeout(() => {
+ if (!editor.isActive) editToggle.classList.remove('show');
+ }, 400);
+});
+editToggle.addEventListener('mouseenter', () => {
+ clearTimeout(hideTimeout);
+});
+editToggle.addEventListener('mouseleave', () => {
+ hideTimeout = setTimeout(() => {
+ if (!editor.isActive) editToggle.classList.remove('show');
+ }, 400);
+});
+
+// 3. Hotzone direct click
+hotzone.addEventListener('click', () => {
+ editor.toggleEditMode();
+});
+
+// 4. Keyboard shortcut (E key, skip when editing text)
+document.addEventListener('keydown', (e) => {
+ if ((e.key === 'e' || e.key === 'E') && !e.target.getAttribute('contenteditable')) {
+ editor.toggleEditMode();
+ }
+});
+```
+
## Code Quality
**Comments:** Every section needs clear comments explaining what it does and how to modify it.