1.5 KiB
1.5 KiB
Speaking Lab Subtitle Delete Cues Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Add admin-side deletion of whole subtitle cue blocks.
Architecture: Backend accepts optional updated subtitle text fields on PATCH. Admin JS parses subtitle text into cue blocks, renders delete buttons during edit mode, rebuilds VTT text from remaining cue blocks, and sends updated content with the existing material edit request.
Tech Stack: FastAPI form fields, SQLite subtitle content, vanilla JavaScript admin page.
Task 1: Backend Content Update
- Modify
backend/main.py. - Add optional
subtitle_en_contentandsubtitle_zh_contentform fields to PATCH. - Convert provided content fields into subtitle update payloads when no replacement file exists for that language.
Task 2: Admin Markup
- Modify
admin.html. - Add a container below the subtitle upload inputs for subtitle cue deletion sections.
Task 3: Admin Subtitle State
- Modify
admin.js. - Add cue parsing and VTT rebuilding helpers.
- Track editable subtitle cues for the current editing material.
- Render per-language cue lists with
删除buttons. - Append updated subtitle content to FormData on edit save.
Task 4: Styles
- Modify
styles.css. - Add compact admin subtitle cue list styles.
Task 5: Verify
Run automated checks and manually verify admin delete/save/study-page reload.