Documents
A rich-text editor with real-time collaboration, version history, wiki links, comments, backlinks, and multiple export formats.
Creating Documents
Navigate to Docs in the sidebar and click +. New documents are auto-saved with a 1-second debounce and a minimum 2-second interval between saves. Documents also save on unmount and beforeunload.
Editor
The editor is powered by TiptapEditor with the following capabilities:
- Rich text — headings, bold, italic, lists, tables, code blocks, images
- Slash commands — type
/for quick formatting - Wiki links — link between documents with
[[document name]] - Callout blocks — highlight notes, warnings, or tips
- Drag-and-drop images — upload inline
- Tags — add/remove tags via the tag bar (Enter to add, click X to remove). Persisted via
goSvc.updateDocTags()
Real-Time Collaboration
Documents support live co-editing via Yjs CRDT:
yjsCollabService.connect(docId, userEmail)establishes a WebSocket connection- Changes merge automatically without conflicts
- Presence avatars — colored circles in the toolbar show who's currently viewing the document, powered by
teamChatService.joinDoc(docId)+onDocPresence()
Title Editing
Click the title to enter inline edit mode. The title saves independently from the body content.
Version History
Click the History icon in the toolbar to open a 260px right sidebar listing all versions.
- Versions fetched via
goSvc.listDocVersions(docId) - Click any version to preview its content
- Restore button replaces the current document content with the selected version
- Version detail fetched via
goSvc.getDocVersion(docId, versionId)
Backlinks
Click the Links icon to open a 240px right sidebar showing all documents that reference this one. Backlinks are detected by scanning all documents for data-doc-id attributes that match the current document ID.
Comments
Click the Comments icon to open the DocCommentSidebar. Add inline comments via goSvc.addDocComment(docId, { id, content }).
Sharing
Click Share to open a dialog where you enter a recipient email. The document is shared via docsService.shareDocument(id, recipientEmail).
Folders
Organize documents into color-coded folders. Drag and drop to reorder or move documents between folders. Nested folders are supported with breadcrumb navigation.
Export
Click the Export menu for options:
| Format | Method |
|---|---|
| Markdown | client-side HTML→MD conversion via htmlToMarkdown() |
| PDF / Print | window.open with inline CSS stylesheet |
AI Assist
From the toolbar, click Ask AI to use the chat sidebar in document context. The AI can summarize, expand, rewrite, or generate content based on the current document.
Auto-Save
- 1000ms debounce after content changes
- Minimum 2000ms between saves (rate limited)
- Saves on component unmount and browser
beforeunload - Deduplicates new document creation via a creation-in-progress guard
- Status indicator in toolbar: "Saving..." or "Saved at HH:MM"
Error Handling
The editor surfaces specific error states:
| Error | Trigger |
|---|---|
| Rate limit | too many saves in quick succession |
| Content too large | document body exceeds size limit |
| Document limit | user has exceeded their document quota |