Skip to content

Commit 9ede2b5

Browse files
committed
docs: update docs for image and s3
1 parent a3f505f commit 9ede2b5

3 files changed

Lines changed: 54 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Mostage JS is a presentation framework based on Markdown and HTML. Available as
6262
- [AWS API Gateway](https://aws.amazon.com/api-gateway/) - REST API for backend services
6363
- [AWS Lambda](https://aws.amazon.com/lambda/) - Serverless functions
6464
- [AWS DynamoDB](https://aws.amazon.com/dynamodb/) - Database for presentations and users
65+
- [AWS S3](https://aws.amazon.com/s3/) - Object storage for image uploads
6566
- [AWS Amplify](https://aws.amazon.com/amplify/) - Frontend hosting and deployment
6667
- [AWS SES](https://aws.amazon.com/ses/) - Email delivery (optional)
6768
- [AWS Resource Groups](https://aws.amazon.com/resource-groups/) - Resource organization and management

docs/structure.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ frontend/src/
2121
├── features/ # Feature-based modules
2222
│ ├── app-info/ # About modal
2323
│ ├── auth/ # Authentication (Cognito)
24-
│ ├── editor/ # Content editor + AI
24+
│ ├── editor/ # Content editor + AI + Image upload
25+
│ │ ├── components/ # Editor components (toolbar, modals)
26+
│ │ ├── services/ # Image upload service
27+
│ │ └── hooks/ # Editor hooks (undo/redo)
2528
│ ├── export/ # File export
2629
│ ├── import/ # File import
2730
│ └── presentation/ # Settings + preview
@@ -36,7 +39,8 @@ frontend/src/
3639

3740
## Features
3841

39-
- **Editor**: Markdown editor with AI generation, undo/redo
42+
- **Editor**: Markdown editor with AI generation, undo/redo, image upload
43+
- **Image Upload**: Drag-and-drop image upload to S3, URL input, Unsplash integration
4044
- **Presentation**: Live preview with Mostage, customizable themes
4145
- **Authentication**: AWS Cognito integration (sign up, sign in, password reset)
4246
- **Export/Import**: Multiple formats (HTML, PDF, PPTX, JPG, Mostage)

docs/toolbar.md

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ The toolbar is built using React functional components and hooks. It's organized
2828
### Main Components
2929

3030
- **`MarkdownToolbar.tsx`**: Main toolbar component
31+
- **`ImagePicker.tsx`**: Reusable image picker component (upload, URL, Unsplash)
3132
- **`ToolbarButton.tsx`**: Reusable button component
3233
- **`ToolbarDivider.tsx`**: Visual separator component
33-
- **`PopupForm.tsx`**: Generic popup form component
34+
- **`PopupForm.tsx`**: Generic popup form component with file upload support
3435

3536
### File Structure
3637

3738
```text
3839
src/features/editor/components/
3940
├── MarkdownToolbar.tsx # Main toolbar component
41+
├── ImagePicker.tsx # Reusable image picker component
4042
└── toolbar/
4143
├── ToolbarButton.tsx # Reusable button component
4244
├── ToolbarDivider.tsx # Visual divider
@@ -193,19 +195,38 @@ Opens when clicking the Image button:
193195
**Fields:**
194196

195197
- Alt Text: Alternative text for the image
196-
- Image URL: The image source URL
198+
- Upload Image: File upload with drag-and-drop support
199+
- Enter Image URL: Manual URL input
200+
- Search Images from Unsplash: Opens Unsplash image search modal
201+
202+
**Image Upload Features:**
203+
204+
- **Drag & Drop**: Drag images directly into the upload area
205+
- **File Selection**: Click to browse and select image files
206+
- **Paste Support**: Paste images from clipboard (handled in ContentEditor)
207+
- **File Validation**:
208+
- Supported formats: JPG, PNG, GIF, WebP
209+
- Maximum file size: 2MB
210+
- **Upload Progress**: Real-time progress bar during upload
211+
- **Image Preview**: Preview before upload
212+
- **Error Handling**: Clear error messages for validation failures
197213

198214
**Behavior:**
199215

200216
- Pre-fills "Alt Text" if text is selected
217+
- Three options available: Upload, URL, or Unsplash search
218+
- Options are separated with dividers ("or")
219+
- When file is selected, URL field is hidden
220+
- When URL is entered, upload field is hidden
201221
- Closes on outside click
202222
- Clears values when canceled
203223
- Inserts: `![Alt Text](Image URL)`
204224

205225
**Validation:**
206226

207-
- URL field required
208-
- Submit button disabled if URL is empty
227+
- Either file upload or URL required
228+
- Alt text required when uploading file
229+
- Submit button disabled if no image source is provided
209230

210231
### Table Popup
211232

@@ -554,14 +575,34 @@ The toolbar is integrated into `ContentEditor.tsx`:
554575
5. **Responsive**: Works seamlessly on mobile and desktop
555576
6. **Language Independence**: Keyboard shortcuts work regardless of keyboard layout
556577

578+
## Image Upload Service
579+
580+
The image upload feature uses a dedicated service that handles:
581+
582+
- **File Validation**: Type and size validation (max 2MB)
583+
- **Base64 Encoding**: Converts image to base64 for API transmission
584+
- **Progress Tracking**: Real-time upload progress updates
585+
- **Error Handling**: Comprehensive error messages
586+
- **S3 Integration**: Uploads to AWS S3 via Lambda function
587+
- **Authentication**: Requires user authentication (AWS Cognito)
588+
589+
**Service Location**: `src/features/editor/services/imageUploadService.ts`
590+
591+
**Backend Integration**:
592+
593+
- Lambda function: `backend/src/lambda/images/upload.ts`
594+
- API endpoint: `POST /images/upload`
595+
- Storage: AWS S3 bucket with public read access
596+
- CORS: Configured for cross-origin requests
597+
557598
## Future Enhancements
558599

559600
Potential improvements for future versions:
560601

561602
- Custom table styling options
562-
- Image upload and preview
563603
- Link validation
564604
- Formatting presets/templates
565605
- Undo/redo for individual formatting actions
566-
- Drag-and-drop image insertion
567606
- Emoji picker integration
607+
- Image editing (crop, resize)
608+
- Multiple image upload

0 commit comments

Comments
 (0)