Skip to content

Comments

Add toolbar, themes, toast notifications, image upload, and PWA support#103

Open
Nir-Bhay wants to merge 29 commits intotanabe:mainfrom
Nir-Bhay:main
Open

Add toolbar, themes, toast notifications, image upload, and PWA support#103
Nir-Bhay wants to merge 29 commits intotanabe:mainfrom
Nir-Bhay:main

Conversation

@Nir-Bhay
Copy link

Implements 5 high-priority UX enhancements: formatting toolbar, theme switching, toast notifications, image upload with drag-drop, and PWA offline support.

Changes

Formatting Toolbar

  • 16-button toolbar for instant markdown insertion: Bold, Italic, Strikethrough, Headers (H1-H3), Links, Images, Code blocks, Lists (bullet/numbered/task), Blockquotes, Tables, Emoji
  • Keyboard shortcuts: Ctrl+B (Bold), Ctrl+I (Italic), Ctrl+D (cycle themes)

Theme System

  • 3 Monaco themes: Light (vs), Dark (vs-dark), High Contrast (hc-black)
  • Dropdown selector with localStorage persistence
  • Body class sync for preview pane styling

Toast Notifications

  • Replaces window.confirm() and alerts with slide-in notifications
  • 4 types (success/error/warning/info) with auto-dismiss and manual close
  • Event-driven close handler (no inline onclick)

Image Upload

  • Toolbar button triggers file picker or handles drag-drop onto editor
  • Base64 encoding with configurable size limit (5MB default)
  • Visual drag-over feedback with validation

PWA Support

  • Service worker with offline caching
  • Manifest for installability on mobile/desktop
  • 30-minute update interval (configurable via APP_CONFIG.SERVICE_WORKER_UPDATE_INTERVAL_MS)

Additional Features

  • Copy HTML button exports rendered preview
  • Reading time estimate (200 WPM, configurable via APP_CONFIG.READING_SPEED_WPM)

Implementation

// Configuration object for easy tuning
const APP_CONFIG = {
    MAX_IMAGE_SIZE_MB: 5,
    READING_SPEED_WPM: 200,
    SERVICE_WORKER_UPDATE_INTERVAL_MS: 30 * 60 * 1000
};

// Toast system with proper event handling
let showToast = (message, type = 'info', duration = 3000) => {
    const toast = document.createElement('div');
    toast.className = `toast toast-${type}`;
    // ... innerHTML setup
    toast.querySelector('.toast-close').addEventListener('click', () => toast.remove());
    container.appendChild(toast);
    if (duration > 0) setTimeout(() => toast.remove(), duration);
};

Screenshots

Before:
Original

After:
Enhanced

Dark Theme:
Dark

Files Modified

  • index.html - Toolbar UI, theme selector, PWA meta tags
  • src/main.js - Feature implementations (~800 LOC added)
  • public/css/style.css - Toolbar, toast, drag-drop styles
  • public/manifest.json (new) - PWA manifest
  • public/sw.js (new) - Service worker with caching strategy
Original prompt

🎯 Markdown Live Preview - Code Review & Enhancement Suggestions
Hey! I've thoroughly analyzed your Markdown Live Preview project. Here's what I found and some exciting suggestions to make it even better! 🚀

📊 Current State - What You Have
Your project is a feature-rich markdown editor with:

✅ Existing Features
Live Preview with Monaco Editor (professional code editor)
Split View with resizable divider
Sync Scrolling between editor and preview
Dark Mode support
Export Options: Download as MD, Export to PDF
Import Files (.md, .markdown, .txt)
Auto-save to local storage
Word/Character Count
Help Modal with markdown syntax reference
Responsive Design for mobile devices
Keyboard Shortcuts (Ctrl+S, Ctrl+P, etc.)
🎨 Enhancement Suggestions to Make It More Alive & User-Friendly

  1. 🎭 Enhanced UI/UX Improvements
    Modern Visual Enhancements
    Smooth Animations: Add subtle fade-in/slide transitions when toggling panels
    Better Loading States: Add skeleton loaders or progress indicators
    Toast Notifications: Replace alerts with elegant toast messages for actions (saved, exported, copied)
    Floating Action Button (FAB): Quick access to common actions on mobile
    Glassmorphism Effects: Modern frosted-glass effect for modals and overlays
    Color Themes
    Add multiple theme options (GitHub Dark, Dracula, Monokai, Solarized)
    Custom theme builder where users can pick their own colors
    Syntax highlighting themes that match the editor theme
  2. 📝 Editor Enhancements
    Advanced Editing Features
    Toolbar with Quick Actions: Bold, Italic, Headers, Links, Images, Code blocks
    Markdown Templates: Pre-built templates (README, Blog Post, Documentation)
    Table Generator: Visual table builder/editor
    Emoji Picker: 😊 Quick emoji insertion
    Image Upload: Drag & drop images (convert to base64 or upload to imgur/cloudinary)
    Auto-formatting: Format on save option
    Line Numbers Toggle: Show/hide line numbers
    Smart Features
    Auto-complete: Suggest markdown syntax as you type
    Spell Check: Built-in spell checker
    Find & Replace: Search functionality within the editor
    Multiple Tabs: Work on multiple documents simultaneously
  3. 💾 File Management
    Recent Files List: Quick access to recently edited documents
    File History/Versions: Save multiple versions with timestamps
    Cloud Sync: Google Drive, Dropbox, or GitHub Gist integration
    Export to Multiple Formats: HTML, DOCX, TXT, RTF
    Print Preview: Better print formatting
  4. 🔥 Collaboration & Sharing
    Share Link: Generate shareable links (with expiration)
    QR Code Generator: Quick share via QR code
    Collaborative Editing: Real-time collaboration (using WebSockets)
    Comments/Annotations: Add comments to specific sections
  5. ⚡ Performance & Accessibility
    Progressive Web App (PWA): Install as desktop/mobile app
    Offline Mode: Full functionality without internet
    Accessibility: ARIA labels, keyboard navigation, screen reader support
    Performance: Lazy loading, code splitting for faster initial load
  6. 🎮 User Experience Features
    Customization
    Font Options: Multiple font choices (JetBrains Mono, Fira Code, etc.)
    Font Size Control: Increase/decrease text size
    Editor Width: Adjustable editor/preview split ratio presets
    Custom CSS: Let users add their own CSS for preview
    Productivity
    Focus Mode: Hide toolbar, distraction-free writing
    Zen Mode: Fullscreen with minimal UI
    Pomodoro Timer: Built-in writing timer
    Word Goals: Set daily word count goals with progress tracking
    Reading Time Estimate: Show estimated reading time
  7. 📊 Analytics & Insights
    Writing Statistics: Track words written per day/week/month
    Readability Score: Flesch-Kincaid reading level
    Markdown Lint: Show markdown syntax issues/suggestions
    Document Outline: Auto-generated table of contents navigation
  8. 🔧 Technical Improvements
    Code Quality
    TypeScript: Migrate to TypeScript for better type safety
    Testing: Add unit tests (Vitest) and E2E tests (Playwright)
    Error Boundaries: Better error handling and recovery
    Performance Monitoring: Add analytics to track usage
    Features
    Plugin System: Allow users to create/install plugins
    API: Expose an API for integrations
    Webhook Support: Trigger actions on save/export
    Markdown Extensions: Support for extended markdown (tables, task lists, footnotes, math equations with KaTeX)
  9. 🎯 Quick Wins (Easy to Implement)
    These can be done quickly for immediate impact:

Copy HTML Button: Copy rendered HTML to clipboard
Preview-Only Mode: Hide editor, show only preview
Vertical/Horizontal Layout Toggle: Switch split orientation
Sample Documents: Load example documents (resume, blog post, etc.)
Export Preview as Image: Screenshot the preview as PNG
Markdown Cheat Sheet: Expandable sidebar reference
URL Import: Load markdown from a URL
GitHub Flavored Markdown: Full GFM support (task lists, strikethrough)
Mermaid Diagrams: Support for flowcharts and diagrams
Code Syntax Highlighting Options: Different highlight.js themes
🎨 Modern UI Mockup Suggestions
Code
┌─────────────────────────────────────────────────────────┐
│ 🎨 Markdown Live Preview [Theme ▼] [⚙️]...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 15 commits November 23, 2025 18:27
Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
…pdate README

Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
…eedback

Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
Add PDF export, file import, dark mode, keyboard shortcuts, and mobile responsiveness
Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
…ent handling

Co-authored-by: Nir-Bhay <149897613+Nir-Bhay@users.noreply.github.com>
…-preview

Add toolbar, themes, toast notifications, image upload, and PWA support
Copilot AI review requested due to automatic review settings December 8, 2025 06:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

- Split monolithic 2,574-line main.js into 40+ focused modules
- Add core services: editor, markdown, storage
- Add UI components: toast, modal, theme, autosave
- Add feature modules: tabs, goals, stats, linter, toc, search, templates, snippets, toolbar, modes, focus, typewriter, fullscreen, image-upload, divider, mobile, import
- Add services: export (PDF, HTML, MD, DOCX), shortcuts, PWA
- Add utilities: eventBus, debounce, clipboard, file, scroll-sync, dom
- Add centralized config and feature flags
- Preserve original code in src/legacy/main.legacy.js
- Add FEATURE_COMPARISON.md documentation
- Added setupSettingsModal() function to handle settings modal open/close
- Settings modal now opens when clicking Settings button in header
- Settings modal includes appearance, editor, and sync/save options
- Added premium-ui.css with complete design system
- Updated index.html with new premium UI structure
- Fixed modal display handling for JS inline style approach
…nd Microsoft Clarity (uwrtfye6w8), create OG image
vercel bot and others added 3 commits January 26, 2026 05:26
## Vercel Web Analytics Documentation Added

Successfully created comprehensive documentation for integrating Vercel Web Analytics across multiple frameworks and platforms.

### Created Files:
- `docs/vercel-web-analytics.md` - Complete guide for Vercel Web Analytics setup

### Implementation Details:

The documentation includes:

1. **Prerequisites Section**
   - Links to Vercel signup and project creation
   - CLI installation instructions for all major package managers (pnpm, yarn, npm, bun)

2. **Setup Instructions**
   - Enabling Web Analytics in Vercel dashboard
   - Installing the `@vercel/analytics` package

3. **Framework-Specific Integration Guides**
   - Next.js (Pages Directory and App Router)
   - Remix
   - Nuxt
   - SvelteKit
   - Astro (including legacy configuration notes)
   - Create React App
   - Vue
   - Plain HTML
   - Other JavaScript frameworks (generic integration)

4. **Deployment & Verification**
   - Deployment instructions using Vercel CLI
   - Git repository integration recommendations
   - Verification steps for proper setup

5. **Dashboard & Next Steps**
   - Viewing analytics data
   - Filtering and custom events (for Pro/Enterprise)
   - Links to additional documentation

### Code Structure:
- Each framework section includes both TypeScript and JavaScript examples
- Code examples show exact file paths and line numbers
- All examples follow best practices for each framework
- Includes important notes about route support and limitations

### Testing:
- Verified markdown format is correct
- Build system tested with `npm run build` - completed successfully
- All changes limited to documentation only (no code changes)

### Notes:
This is a standalone documentation file that can be:
- Viewed directly in the repository
- Linked from README.md if needed
- Used as reference for developers integrating Vercel Analytics
- Easily maintained and updated as Vercel releases new features

The documentation is comprehensive and covers all major web frameworks, making it easy for developers to find integration instructions for their specific stack.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
…rati-fououo

Add Vercel Web Analytics integration guide
# Vercel Web Analytics Implementation

## Summary
Successfully implemented Vercel Web Analytics on the Markdown Live Preview project (markups) following the official documentation for HTML-based projects.

## Changes Made

### Modified Files:
- **index.html** - Added Vercel Web Analytics scripts

### Implementation Details:
Added the Vercel Web Analytics tracking scripts to the `<head>` section of `index.html`, positioned after the Microsoft Clarity analytics and before the Fonts section.

The implementation includes:
1. The initialization script that sets up the `window.va` function and the `window.vaq` array for queuing analytics calls
2. The deferred loading of the Vercel Insights script from `/_vercel/insights/script.js`

### Code Added:
```html
<!-- Vercel Web Analytics -->
<script>
    window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
```

## Implementation Approach
Since this is an HTML/JavaScript project using Vite (not a framework like Next.js, React, Vue, etc.), I used the HTML implementation method as specified in the Vercel Web Analytics documentation. This approach:
- Requires no `@vercel/analytics` package installation
- Works directly with plain HTML files
- Automatically tracks page views once deployed to Vercel
- The `/_vercel/insights/*` routes will be automatically added after deployment

## Testing
- ✅ Build completed successfully with `npm run build`
- ✅ No linting errors (project has no linter configured)
- ✅ Dependencies installed successfully
- ✅ Verified analytics scripts are properly formatted and positioned in HTML

## Next Steps for Project Owner
1. Enable Web Analytics in the Vercel dashboard:
   - Go to the Vercel dashboard
   - Select the project
   - Click the **Analytics** tab
   - Click **Enable** in the dialog
   
2. Deploy the app to Vercel using `vercel deploy`

3. After deployment, verify the integration by:
   - Opening the browser's Network tab
   - Visiting any page on the deployed site
   - Looking for a Fetch/XHR request to `/_vercel/insights/view`

4. View analytics data in the Vercel dashboard under the Analytics tab

## Notes
- The implementation follows Vercel's official documentation for HTML sites
- The scripts are positioned to load after critical analytics (Google Analytics, Microsoft Clarity) but before fonts and styles for optimal performance
- The `defer` attribute ensures the script doesn't block page rendering
- No changes were needed to package.json or any JavaScript source files

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Nir-Bhay and others added 3 commits January 26, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants