# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.8] - 2025-01-19

### ✨ New Features

#### Blockquote Inline Styles
- **Added CustomBlockquote extension**: Blockquote elements now include inline styles in HTML output
- **Inline styling**: Blockquotes automatically include `margin: 1.5em 0; padding: 1em 1.5em; border-left: 4px solid #3b82f6; background: #f8fafc; font-style: italic; color: #64748b;`
- **Consistent with other elements**: Similar to `<pre>` and `<code>` tags, blockquotes now preserve styling in exported HTML
- **Removed conflicting CSS**: Cleaned up CSS styles that were overriding inline styles
- **Enhanced HTML output**: Blockquotes maintain visual consistency when used outside the editor

### 🔧 Technical Improvements
- **Extended official extension**: Built on top of `@tiptap/extension-blockquote` for better compatibility
- **Preserved functionality**: All existing blockquote features (toolbar button, keyboard shortcuts) remain unchanged
- **CSS cleanup**: Removed redundant blockquote styles from multiple component files

## [1.2.7] - 2025-01-19

### 🧹 Code Cleanup & Standardization

#### Upload System Standardization
- **Created uploadMixin**: Standardized upload functionality across Image and Video modals
- **Unified upload logic**: Both ImageModal and VideoModal now use the same upload system
- **Removed duplicate code**: Eliminated redundant upload handling methods
- **Enhanced error handling**: Consistent error messages and user feedback across all modals

#### Documentation Cleanup
- **Removed outdated files**: Cleaned up redundant documentation files
- **Consolidated guides**: Merged overlapping documentation into main guides
- **Removed unused code**: Eliminated console.log statements and unused methods

#### Technical Improvements
- **Standardized props**: Consistent prop handling across upload components
- **Better validation**: Enhanced file validation with configurable limits
- **Improved maintainability**: Shared upload logic reduces code duplication
- **Bug-free implementation**: Thoroughly tested upload system for both image and video files

#### VideoModal Enhancements
- **Added upload progress**: Video uploads now show progress indicators
- **Error handling**: Consistent error handling with retry functionality
- **Upload manager support**: VideoModal now supports both uploadHandler and uploadManager
- **File validation**: Proper video file type and size validation

## [1.2.6] - 2025-01-19

### 🐛 Bug Fixes

#### ImageModal Upload URL Fix
- **Fixed uploaded URL not being used**: ImageModal now correctly uses the uploaded URL from uploadHandler instead of falling back to blob URL
- **Improved upload logic**: Fixed condition that was checking for uploadManager when using uploadHandler
- **Enhanced URL insertion**: Upload results now properly insert the API-returned URL instead of local blob URL
- **Better upload detection**: Simplified logic to check for uploadedUrl regardless of upload method

#### Technical Improvements
- Fixed insertImage method to prioritize uploadedUrl over local blob URL
- Improved upload success detection for both uploadManager and uploadHandler workflows
- Enhanced debugging with clearer console logs for upload URL usage

## [1.2.5] - 2025-01-19

### 🐛 Bug Fixes

#### ImageModal Upload Handler Integration
- **Fixed handleApiUpload not being called**: ImageModal now properly calls upload handlers when uploadManager is not available
- **Added handleLegacyUpload method**: New method to support existing uploadHandler prop alongside uploadManager
- **Enhanced upload flow**: Files now automatically trigger upload using either uploadManager or uploadHandler
- **Improved backward compatibility**: Existing components using uploadHandler prop now work correctly

#### Component Enhancements
- **Added uploadManager prop support**: Both PremiumBblEditor and PremiumBblEditorOptionsAPI now accept uploadManager prop
- **Enhanced ImageModal integration**: Modal now receives and uses both uploadHandler and uploadManager props
- **Improved retry functionality**: Retry button now works with both upload methods
- **Better error handling**: Enhanced error messages and fallback mechanisms

#### Technical Improvements
- Fixed auto-upload trigger in ImageModal when files are selected
- Added proper prop passing from editor components to ImageModal
- Enhanced upload method detection and execution
- Improved upload progress tracking for both upload types

## [1.2.3] - 2025-01-19

### 🐛 Bug Fixes

#### ImageModal Component Fixes
- **Fixed async/await syntax error**: Resolved syntax error in `handleFile` method that was using `await` without `async` declaration
- **Fixed missing method**: Added `insertLocalImage` method that was referenced in template but not implemented
- **Improved upload flow**: Fixed logic flow issues where preview URL creation was skipped during API uploads
- **Enhanced error handling**: Better async consistency across all file handling methods
- **Auto-upload functionality**: Files now automatically upload when upload manager is available

#### Technical Improvements
- Made `handleFileSelect`, `handleDrop`, and `retryUpload` methods properly async
- Simplified file handling logic for better predictability
- Removed redundant variable assignments
- Improved user experience with proper error handling and retry mechanisms

## [1.2.2] - 2025-01-19

### 🐛 Bug Fixes

#### Upload Handler Validation Fix
- **Fixed "No URL returned from upload handler" error**: Upload handlers returning `{ src: "url", alt: "name" }` format now work correctly
- **Enhanced URL validation**: Added support for `result.src` in addition to `result.url` and `result.publicUrl`
- **Improved error handling**: Better validation logic for different upload response formats

#### Technical Improvements
- Fixed ImageModal upload validation to properly handle `src` property in upload results
- Enhanced upload result parsing to support multiple URL property formats
- Improved compatibility with different API response structures

---

## [1.2.1] - 2025-01-19

### 🚀 Major Features Added - Upload Management System

#### Upload Management System
- **Base64 Upload Management**: Complete local file management with configurable compression
- **Hybrid Upload Mode**: Base64 preview with background API upload and URL replacement
- **Image Compression**: Intelligent compression with configurable quality and dimensions
- **Upload Events**: Comprehensive event system for upload progress and compression statistics

#### New Props
- `useBase64Upload` - Enable/disable base64 upload mode
- `base64Quality` - Compression quality (0.1 - 1.0)
- `base64MaxWidth` - Maximum image width for compression
- `base64MaxHeight` - Maximum image height for compression
- `enableImageCompression` - Toggle image compression
- `preserveOriginalFileName` - Keep original file names
- `base64Prefix` - Custom base64 data prefix

#### New Events
- `@image-compressed` - Fired when image compression completes with detailed statistics
- `@upload-progress` - Upload progress tracking
- `@upload-complete` - Upload completion notification
- `@upload-error` - Upload error handling

#### Options API Support Enhanced
- **PremiumBblEditorOptionsAPI**: Complete Options API component with all upload features
- **Full Feature Parity**: All Composition API features available in Options API
- **Upload Management**: Complete base64 and API upload support in Options API

### 🧪 Testing Infrastructure

#### Comprehensive Testing Suite
- **Local-to-API Upload Test**: Complete workflow testing component
- **Performance Testing Tool**: Advanced performance analysis and optimization
- **Test API Server**: Node.js/Express server with configurable failure simulation
- **Upload Statistics**: Real-time metrics and performance tracking

#### Testing Components
- `local-to-api-upload-test.vue` - Complete upload workflow testing
- `upload-performance-test.vue` - Performance testing and optimization
- `base64-upload-example.vue` - Base64 management demonstration
- `test-api-server.js` - Configurable test server with web interface

### 📚 Documentation Enhancements

#### New Documentation Files
- `COMPONENT_USAGE_GUIDE.md` - Comprehensive component API reference
- `PACKAGE_DOCUMENTATION.md` - Complete package documentation
- `EXTERNAL_INTEGRATION_GUIDE.md` - Integration examples and patterns
- `UPLOAD_TESTING_COMPLETE.md` - Testing system documentation
- `examples/README.md` - Comprehensive examples documentation

#### Updated Documentation
- Enhanced main `README.md` with upload management features
- Complete TypeScript definitions in `types/index.d.ts`
- Detailed integration examples and usage patterns

### 🔧 Technical Improvements

#### TypeScript Support
- Complete type definitions for all new props and events
- Interface definitions for upload handlers and compression data
- Enhanced IDE support with comprehensive type checking

#### Performance Optimizations
- Intelligent image compression algorithms
- Memory-efficient base64 handling
- Optimized upload queue management
- Configurable compression settings for different use cases

#### Error Handling
- Comprehensive error handling for upload failures
- Graceful fallback from API to base64 mode
- Detailed error reporting and debugging tools

### 🎯 Use Cases Supported

#### Upload Modes
1. **Base64 Only**: Local storage with immediate preview
2. **API Only**: Direct server upload
3. **Hybrid**: Base64 preview + background API upload (recommended)

#### Integration Patterns
- Blog editors with image management
- CMS systems with media upload
- Comment systems with file attachments
- Documentation tools with media support

### 🛠️ Developer Experience

#### Easy Setup
- Drop-in components with minimal configuration
- Comprehensive examples for all use cases
- Test server for local development and testing
- Performance optimization tools and recommendations

#### Debugging Tools
- Debug mode with detailed logging
- Upload statistics and performance metrics
- Visual performance charts and analysis
- Automated optimization recommendations

### 📦 Package Updates

#### Build System
- Updated build configuration for new components
- Enhanced file inclusion for examples and types
- Improved package structure and organization

#### Dependencies
- All dependencies updated to latest stable versions
- Enhanced peer dependency management
- Improved compatibility with Vue 2.6+

---

## [1.2.0] - 2025-01-19

### 🚀 Major Features Added

#### Upload Management System
- **Base64 Upload Management**: Complete local file management with configurable compression
- **Hybrid Upload Mode**: Base64 preview with background API upload and URL replacement
- **Image Compression**: Intelligent compression with configurable quality and dimensions
- **Upload Events**: Comprehensive event system for upload progress and compression statistics

#### New Props
- `useBase64Upload` - Enable/disable base64 upload mode
- `base64Quality` - Compression quality (0.1 - 1.0)
- `base64MaxWidth` - Maximum image width for compression
- `base64MaxHeight` - Maximum image height for compression
- `enableImageCompression` - Toggle image compression
- `preserveOriginalFileName` - Keep original file names
- `base64Prefix` - Custom base64 data prefix

#### New Events
- `@image-compressed` - Fired when image compression completes with detailed statistics
- `@upload-progress` - Upload progress tracking
- `@upload-complete` - Upload completion notification
- `@upload-error` - Upload error handling

#### Options API Support Enhanced
- **PremiumBblEditorOptionsAPI**: Complete Options API component with all upload features
- **Full Feature Parity**: All Composition API features available in Options API
- **Upload Management**: Complete base64 and API upload support in Options API

### 🧪 Testing Infrastructure

#### Comprehensive Testing Suite
- **Local-to-API Upload Test**: Complete workflow testing component
- **Performance Testing Tool**: Advanced performance analysis and optimization
- **Test API Server**: Node.js/Express server with configurable failure simulation
- **Upload Statistics**: Real-time metrics and performance tracking

#### Testing Components
- `local-to-api-upload-test.vue` - Complete upload workflow testing
- `upload-performance-test.vue` - Performance testing and optimization
- `base64-upload-example.vue` - Base64 management demonstration
- `test-api-server.js` - Configurable test server with web interface

### 📚 Documentation Enhancements

#### New Documentation Files
- `COMPONENT_USAGE_GUIDE.md` - Comprehensive component API reference
- `PACKAGE_DOCUMENTATION.md` - Complete package documentation
- `EXTERNAL_INTEGRATION_GUIDE.md` - Integration examples and patterns
- `UPLOAD_TESTING_COMPLETE.md` - Testing system documentation
- `examples/README.md` - Comprehensive examples documentation

#### Updated Documentation
- Enhanced main `README.md` with upload management features
- Complete TypeScript definitions in `types/index.d.ts`
- Detailed integration examples and usage patterns

### 🔧 Technical Improvements

#### TypeScript Support
- Complete type definitions for all new props and events
- Interface definitions for upload handlers and compression data
- Enhanced IDE support with comprehensive type checking

#### Performance Optimizations
- Intelligent image compression algorithms
- Memory-efficient base64 handling
- Optimized upload queue management
- Configurable compression settings for different use cases

#### Error Handling
- Comprehensive error handling for upload failures
- Graceful fallback from API to base64 mode
- Detailed error reporting and debugging tools

### 🎯 Use Cases Supported

#### Upload Modes
1. **Base64 Only**: Local storage with immediate preview
2. **API Only**: Direct server upload
3. **Hybrid**: Base64 preview + background API upload (recommended)

#### Integration Patterns
- Blog editors with image management
- CMS systems with media upload
- Comment systems with file attachments
- Documentation tools with media support

### 🛠️ Developer Experience

#### Easy Setup
- Drop-in components with minimal configuration
- Comprehensive examples for all use cases
- Test server for local development and testing
- Performance optimization tools and recommendations

#### Debugging Tools
- Debug mode with detailed logging
- Upload statistics and performance metrics
- Visual performance charts and analysis
- Automated optimization recommendations

### 📦 Package Updates

#### Build System
- Updated build configuration for new components
- Enhanced file inclusion for examples and types
- Improved package structure and organization

#### Dependencies
- All dependencies updated to latest stable versions
- Enhanced peer dependency management
- Improved compatibility with Vue 2.6+

---

## [1.1.2] - 2026-01-18

### Fixed
- **JavaScript Compatibility**: Fixed "Unexpected token '!'" errors in consuming projects
- **Transpilation**: Enhanced babel configuration for better browser support
- **Build System**: Improved webpack transpilation rules for @tiptap and prosemirror packages
- **Browser Support**: Better support for IE11 and older browsers

### Added
- **COMPATIBILITY_GUIDE.md**: Comprehensive guide for resolving JavaScript syntax errors
- **Enhanced Babel Config**: Better transpilation with optional chaining and nullish coalescing support
- **Webpack Rules**: Improved transpilation rules for dependencies

### Improved
- **Bundle Compatibility**: Better compatibility across different build systems
- **Error Prevention**: Proactive transpilation to prevent syntax errors in consuming projects

## [1.1.1] - 2026-01-18

### Fixed
- **TypeScript Definitions**: Updated TypeScript declarations to include both API components
- **Import Errors**: Fixed TypeScript import errors for `PremiumBblEditorOptionsAPI`
- **Type Safety**: Added proper type definitions for `DiagnosticTool`, `DebugHelper`, and `useEditor` composable

### Added
- Complete TypeScript support for dual API architecture
- Proper type exports for all components and composables

## [1.1.0] - 2026-01-18

### Added
- **🎯 Dual API Support**: Now supports both Options API and Composition API
- **New Component**: `PremiumBblEditorOptionsAPI` for traditional Vue 2 projects (no Composition API required)
- **API Flexibility**: Choose between `PremiumBblEditor` (Composition API) or `PremiumBblEditorOptionsAPI` (Options API)
- **Comprehensive Documentation**: New `API_SUPPORT_GUIDE.md` with detailed usage examples
- **Usage Examples**: Added example files for both API styles

### Improved
- **Compatibility**: Maximum compatibility with all Vue 2.6+ projects
- **Dependency Management**: Options API version eliminates Composition API dependency issues
- **Developer Experience**: Clear choice between API styles based on project needs

### Technical
- Both components have identical features and configuration options
- Seamless migration path between API styles
- Updated exports to include both components

## [1.0.5] - 2026-01-18

### Added
- **🔍 Diagnostic Tool**: New `DiagnosticTool` component that checks for missing dependencies
- **Enhanced Error Handling**: Editor now shows specific error messages when dependencies are missing
- **Better Loading States**: Clear distinction between loading and error states
- **Dependency Validation**: Automatic checking of required dependencies during editor initialization

### Improved
- **Error Messages**: More helpful error messages with specific missing dependencies listed
- **Setup Documentation**: Updated QUICK_SETUP.md with diagnostic tool usage
- **User Experience**: Users now get actionable feedback instead of indefinite loading

### Fixed
- **"Loading Premium Editor..." Issue**: Now shows specific error when dependencies are missing
- **Silent Failures**: Editor initialization errors are now properly caught and displayed

### Technical Changes
- Enhanced `useEditor` composable with dependency checking
- Added `editorError` and `missingDependencies` reactive properties
- Improved error handling in editor initialization
- Added comprehensive dependency validation

## [1.0.4] - 2024-01-18

### Fixed
- **Critical**: Resolved Vue version mismatch between vue@2.6.14 and vue-template-compiler@2.7.16
- **Syntax**: Fixed optional chaining operators (`?.`) causing compilation errors in older Babel setups
- **Composition API**: Fixed imports to use `@vue/composition-api` instead of `vue` for Vue 2.6 compatibility
- **Development**: Added proper Vue Composition API setup in main.js for local development

### Improved
- Better compatibility with Vue 2.6 projects
- Resolved all compilation errors in development and production builds
- Enhanced local development experience with proper error handling
- All linting issues resolved

### Technical
- Updated vue-template-compiler to match Vue version (2.6.14)
- Replaced optional chaining with compatible syntax across all components
- Fixed Composition API imports in useEditor composable
- Added comprehensive local development fixes documentation

## [1.0.3] - 2024-01-18

### Fixed
- **Critical**: Added missing ProseMirror peer dependencies to resolve `Can't resolve '@tiptap/pm/dropcursor'` errors
- Updated installation commands to include all required ProseMirror packages
- Enhanced troubleshooting guide with ProseMirror-specific error solutions

### Added
- Complete ProseMirror dependencies list in package.json peer dependencies
- Step-by-step installation guide as alternative to one-command install
- Specific error resolution for ProseMirror module resolution issues

### Improved
- More comprehensive dependency installation instructions
- Better error handling documentation for missing dependencies

## [1.0.2] - 2024-01-18

### Added
- **Documentation**: Comprehensive troubleshooting guide for "Loading Premium Editor..." issue
- **Setup Guide**: Quick setup instructions with one-command installation
- **Peer Dependencies**: Complete list of required Tiptap dependencies in package.json

### Improved
- Better error handling documentation
- Step-by-step setup instructions for Vue 2.6 projects
- Nuxt.js specific setup instructions

### Fixed
- Documentation for Vue Composition API requirement in Vue 2.6
- Clear instructions for resolving loading state issues

## [1.0.1] - 2024-01-18

### Fixed
- **Critical**: Resolved Vue case sensitivity issue in CommonJS build that caused `CaseSensitivePathsPlugin` errors when importing in other projects
- Fixed externals configuration to properly handle Vue module resolution across different build formats
- Updated repository URLs to correct GitHub path (Mahadi74/vue2-premium-bbl-editor)

### Improved
- **Bundle Size**: Reduced minified bundle size from 440KB to 213KB (51KB gzipped)
- Better externals configuration for Tiptap dependencies
- Added proper Vue runtime alias for consistent module resolution

### Technical
- Fixed webpack externals to use proper format for different module systems (CommonJS, UMD, AMD)
- Added comprehensive externals list for all Tiptap extensions
- Improved build configuration for library distribution

## [1.0.0] - 2024-01-18

### Added
- Initial release of Vue 2 Premium BBL Editor
- Full Vue 2.6+ compatibility
- Production-ready rich text editor with Tiptap
- Comprehensive configuration system with 50+ props
- Multiple themes (default, minimal, dark)
- Advanced media handling (resizable images and videos)
- Interactive table system with cell controls
- Auto-save functionality
- Source code view toggle
- Upload handling with custom upload functions
- TypeScript definitions
- Comprehensive event system
- Bubble menus for contextual editing
- Toolbar customization
- Extension configuration system
- Content validation and limits
- Custom CSS class support
- Font family and size configuration
- Line height controls
- Text alignment options
- Color and highlight support
- Link management with modal
- Task lists with checkboxes
- Code blocks with syntax highlighting
- Blockquotes and horizontal rules
- Undo/redo functionality
- Placeholder support
- Spellcheck configuration
- Focus and blur handling
- Content format options (HTML/JSON)
- Responsive design
- Accessibility features
- Demo components and examples
- Comprehensive documentation

### Technical Features
- Vue plugin architecture
- Individual component exports
- Composable useEditor function
- Custom Tiptap extensions
- CSS-in-JS styling
- Build optimization for libraries
- External dependency management
- Tree-shaking support
- ES modules and CommonJS builds
- UMD build for CDN usage

### Documentation
- Complete README with usage examples
- TypeScript definitions
- API documentation
- Configuration guide
- Event handling examples
- Custom styling guide
- Upload handling examples
- Theme customization
- Extension configuration
- Troubleshooting guide

### Development
- Vue CLI build system
- Jest testing setup
- ESLint configuration
- Babel transpilation
- Development server
- Hot module replacement
- Production build optimization
- Library build configuration