Feature Specification: Rich-Text Authoring
1. Overview & Vision
The Rich-Text Authoring feature is the core creative engine of the Document module. It provides a professional, "What-You-See-Is-What-You-Get" (WYSIWYG) editing experience that allows users to create high-quality internal documentation, policies, and reports directly within the VENI-AI platform.
2. Personas & Stakeholders
| Persona | Goal |
|---|---|
| Author | Create and format structured documents easily. |
| Reviewer | Read and comment on document content during the approval cycle. |
| Knowledge Admin | Maintain standard styles and formatting across the org. |
3. User Stories
- As an author, I want to use Markdown shortcuts (like
#for H1) so I can write without taking my hands off the keyboard. - As an author, I want to insert tables and code blocks to document technical requirements.
- As an author, I want my work to be auto-saved every few seconds so I don't lose progress.
4. Functional Requirements (FR)
- REQ-ED-001: TipTap-based rich-text editing (Bold, Italic, Lists, H1-H3).
- REQ-ED-002: Support for advanced nodes (Tables, Code Blocks, Task Lists).
- REQ-ED-003: Markdown shortcut support for common formatting.
- REQ-ED-004: Automated background saving (every 30 seconds).
5. Non-Functional Requirements (NFR)
- Performance: Editor initialization < 500ms.
- Reliability: Zero data loss via local storage buffering (planned).
6. Business Logic & Rules
- Schema Validation: Content must strictly follow the TipTap JSON schema.
- Locking: Documents are read-only when in the "In Review" or "Published" state.
- Autosave Logic: Only triggers if changes are detected since the last save.
7. User Interface (UI/UX)
- Floating Toolbar: Context-sensitive formatting options (appears on selection).
- Sticky Menu: Top-bar with permanent action icons (Bold, Link, etc.).
- Distraction-free Mode: Option to hide sidebars for focused writing.
8. Information Architecture
- Primary view for
docs.venizia.ai/edit/:id. - Side-panel for "Outline" (Auto-generated from H1-H3 tags).
9. Data Model & Persistence
- Table:
document_versions. - Field:
content(jsonb). - Format: TipTap/Prosemirror JSON structure.
10. API & Service Layer
PUT /documents/:id(Saves a new draft version).GET /templates/:id(Load initial content).
11. Integration Patterns
- TipTap Extensions: Custom extensions for platform links (e.g., linking to a Drive file).
12. Security & Permissions
- RBAC:
documents:writerequired to access the editor. - Content Security: Sanitization of all HTML/JSON before persistence.
13. Error Handling & Resilience
- Sync Conflict: Alert the user if a newer version exists on the server.
- Network Error: Notification when auto-save fails.
14. Performance & Scalability
- Efficient JSON serialization/deserialization.
- Support for documents up to 100,000 characters without lag.
15. Globalization & i18n
- Multi-language UI for the editor toolbar.
- Support for RTL (Right-to-Left) languages (planned for v2).
16. Accessibility (a11y)
- Standard keyboard shortcuts (Ctrl+B, Ctrl+I).
- Screen reader support for the document outline.
17. Observability & Analytics
- Tracking of "Time Spent Editing" per document.
- Analytics on "Most Used Formatting Tools".
18. Testing & Quality
- Integration tests for JSON schema validation.
- Cypress E2E tests for the auto-save sequence.
19. Constraints & Assumptions
- Assumes users have a modern browser with JavaScript enabled.
20. Future Enhancements
- Real-time collaborative editing (Yjs/Websocket integration).
- AI Writing Assistant (Integrate with AI module for rewording/summarizing).