docx-viewer
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://dwsmarketing--60c0c67e5d2711f0969b0224a6c84d84.web.val.run
A web-based DOCX file viewer and editor with rich text formatting capabilities.
-
File Operations:
- Open existing DOCX files
- Create new documents
- Save documents
-
Rich Text Editing:
- Bold, italic, underline formatting
- Font size and family selection
- Text alignment (left, center, right, justify)
- Lists (ordered and unordered)
- Headers (H1-H6)
- Text and background colors
-
Export Options:
- Export as DOCX
- Export as Markdown
- Export as plain text
├── backend/
│ └── index.ts # Main API server
├── frontend/
│ ├── index.html # Main HTML template
│ ├── index.tsx # React app entry point
│ ├── components/
│ │ ├── App.tsx # Main app component
│ │ ├── Editor.tsx # Rich text editor
│ │ ├── Toolbar.tsx # Formatting toolbar
│ │ └── FileManager.tsx # File operations
│ └── style.css # Styles
├── shared/
│ └── types.ts # Shared TypeScript types
└── README.md
- Visit the application URL
- Click "New Document" to create a new document or "Manage Files" to open existing documents
- Use the rich text toolbar to format your content:
- Text formatting (bold, italic, underline, strikethrough)
- Font family and size selection
- Text and background colors
- Text alignment (left, center, right, justify)
- Lists (bulleted and numbered)
- Headers (H1-H6)
- Indentation and horizontal rules
- Undo/redo functionality
- Documents auto-save as you type
- Export your document in DOCX, Markdown, or plain text format
- Upload existing DOCX files (parsing implementation in progress)
- Frontend: React with TypeScript
- Backend: Hono API framework
- DOCX Processing: docx library for reading/writing
- Rich Text Editor: Custom implementation with contentEditable and document.execCommand
- Storage: Val Town Blob storage
- Styling: TailwindCSS
GET /api/documents
- List all documentsGET /api/documents/:id
- Get specific documentPOST /api/documents
- Save/create documentDELETE /api/documents/:id
- Delete documentPOST /api/export
- Export document in various formatsPOST /api/upload
- Upload DOCX file (basic implementation)
- DOCX file parsing is basic (creates placeholder document)
- No collaborative editing features
- No document versioning
- Limited advanced formatting options (tables, images, etc.)
- Full DOCX parsing with mammoth.js or similar
- Advanced formatting (tables, images, charts)
- Document templates
- Collaborative editing
- Version history
- Print functionality
- Spell check