cms-block-editor 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,6 +13,7 @@ A powerful, feature-rich block editor for CMS applications built with Lexical an
13
13
  📐 **Layouts** - Flexbox and CSS Grid support with visual controls
14
14
  🖼️ **Images** - Upload, resize, drag-and-drop, and advanced editing with filters
15
15
  🎨 **Image Filters** - 7 adjustable filters with 6 professional presets
16
+ 🎬 **Videos** - Native HTML5 video upload with playback controls
16
17
  🎥 **Embeds** - YouTube, Facebook, Instagram, Twitter, TikTok, Vimeo, Spotify, SoundCloud
17
18
  🔗 **Links** - Custom link insertion with labels and options
18
19
  📊 **Tables** - Visual table builder with configurable rows/columns and professional styling
@@ -73,6 +74,7 @@ Main editor component with full editing capabilities.
73
74
  - `value?: string` - Initial editor state (JSON string)
74
75
  - `onChange?: (state: any) => void` - Callback fired when content changes
75
76
  - `onImageAdded?: (file: File) => Promise<string>` - Custom image upload handler that returns the image URL
77
+ - `onVideoAdded?: (file: File) => Promise<string>` - Custom video upload handler that returns the video URL
76
78
  - `useBase64Url?: boolean` - Use base64 encoding for images (default: `true`)
77
79
 
78
80
  ### CMSRenderer
@@ -97,6 +99,7 @@ Read-only renderer for displaying saved content.
97
99
  ### Media
98
100
  - **Images**: Upload from computer, resize with 8-point handles, drag-and-drop positioning, custom upload handler support, advanced editing with filters
99
101
  - **Image Filters**: Brightness, contrast, saturation, blur, grayscale, sepia, hue rotation with 6 presets
102
+ - **Videos**: Native HTML5 video upload, drag-and-drop, playback controls (autoplay, loop, mute), resize support
100
103
  - **YouTube**: Embed videos with custom sizing
101
104
  - **Embeds**: Support for 8+ platforms with automatic URL detection
102
105
  - **Tables**: Visual builder with configurable dimensions, header rows, and professional styling
@@ -134,6 +137,39 @@ Read-only renderer for displaying saved content.
134
137
 
135
138
  ## Advanced Usage
136
139
 
140
+ ### Custom Video Upload
141
+
142
+ Upload videos to your server:
143
+
144
+ ```typescript
145
+ import { CMSBlockEditor } from 'cms-block-editor';
146
+
147
+ function Editor() {
148
+ const [content, setContent] = useState('');
149
+
150
+ const handleVideoUpload = async (file: File): Promise<string> => {
151
+ const formData = new FormData();
152
+ formData.append('video', file);
153
+
154
+ const response = await fetch('/api/upload-video', {
155
+ method: 'POST',
156
+ body: formData,
157
+ });
158
+
159
+ const data = await response.json();
160
+ return data.url;
161
+ };
162
+
163
+ return (
164
+ <CMSBlockEditor
165
+ value={content}
166
+ onChange={(state) => setContent(JSON.stringify(state))}
167
+ onVideoAdded={handleVideoUpload}
168
+ />
169
+ );
170
+ }
171
+ ```
172
+
137
173
  ### Custom Image Upload
138
174
 
139
175
  Upload images to your server instead of using base64 encoding:
@@ -293,6 +329,7 @@ Check out the [example app](./example-app) for a complete implementation with:
293
329
  ## Documentation
294
330
 
295
331
  Comprehensive guides available:
332
+ - [Video Upload Guide](./docs/VIDEO-GUIDE.md) - Native HTML5 video upload and playback
296
333
  - [Image Editing Guide](./docs/IMAGE-EDITING-GUIDE.md) - Advanced image filters and effects
297
334
  - [Section Creator Guide](./SECTION-CREATOR-GUIDE.md)
298
335
  - [Section Editing Guide](./SECTION-EDITING-GUIDE.md)
package/dist/index.css CHANGED
@@ -2522,6 +2522,39 @@
2522
2522
  grid-template-columns: repeat(2, 1fr);
2523
2523
  }
2524
2524
  }
2525
+ .video-node-wrapper {
2526
+ position: relative;
2527
+ display: inline-block;
2528
+ max-width: 100%;
2529
+ }
2530
+ .video-node-wrapper.selected {
2531
+ outline: 2px solid #667eea;
2532
+ outline-offset: 2px;
2533
+ }
2534
+ .video-node-wrapper video {
2535
+ display: block;
2536
+ width: 100%;
2537
+ height: auto;
2538
+ border-radius: 4px;
2539
+ background: #000;
2540
+ }
2541
+ .video-resize-handle {
2542
+ position: absolute;
2543
+ background: #667eea;
2544
+ border: 2px solid white;
2545
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
2546
+ z-index: 10;
2547
+ transition: all 0.2s;
2548
+ }
2549
+ .video-resize-handle:hover {
2550
+ background: #5568d3;
2551
+ transform: scale(1.2);
2552
+ }
2553
+ @media (max-width: 768px) {
2554
+ .video-node-wrapper {
2555
+ width: 100% !important;
2556
+ }
2557
+ }
2525
2558
 
2526
2559
  /* src/styles/renderer.css */
2527
2560
  .cms-renderer {
@@ -3170,4 +3203,15 @@
3170
3203
  background: #3a3a3a;
3171
3204
  }
3172
3205
  }
3206
+ .cms-renderer video {
3207
+ max-width: 100%;
3208
+ height: auto;
3209
+ border-radius: 4px;
3210
+ margin: 16px 0;
3211
+ }
3212
+ .cms-renderer .video-node-wrapper {
3213
+ display: block;
3214
+ max-width: 100%;
3215
+ margin: 16px 0;
3216
+ }
3173
3217
  /*# sourceMappingURL=index.css.map */