cms-block-editor 1.0.9 → 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 +42 -2
- package/dist/index.css +267 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +60 -3
- package/dist/index.mjs +1681 -801
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@ A powerful, feature-rich block editor for CMS applications built with Lexical an
|
|
|
11
11
|
✨ **Rich Text Editing** - Full formatting support (bold, italic, underline, headings, lists, etc.)
|
|
12
12
|
🎨 **Sections** - 10 pre-designed section templates (hero, features, pricing, testimonials, etc.)
|
|
13
13
|
📐 **Layouts** - Flexbox and CSS Grid support with visual controls
|
|
14
|
-
🖼️ **Images** - Upload, resize,
|
|
14
|
+
🖼️ **Images** - Upload, resize, drag-and-drop, and advanced editing with filters
|
|
15
|
+
🎨 **Image Filters** - 7 adjustable filters with 6 professional presets
|
|
16
|
+
🎬 **Videos** - Native HTML5 video upload with playback controls
|
|
15
17
|
🎥 **Embeds** - YouTube, Facebook, Instagram, Twitter, TikTok, Vimeo, Spotify, SoundCloud
|
|
16
18
|
🔗 **Links** - Custom link insertion with labels and options
|
|
17
19
|
📊 **Tables** - Visual table builder with configurable rows/columns and professional styling
|
|
@@ -72,6 +74,7 @@ Main editor component with full editing capabilities.
|
|
|
72
74
|
- `value?: string` - Initial editor state (JSON string)
|
|
73
75
|
- `onChange?: (state: any) => void` - Callback fired when content changes
|
|
74
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
|
|
75
78
|
- `useBase64Url?: boolean` - Use base64 encoding for images (default: `true`)
|
|
76
79
|
|
|
77
80
|
### CMSRenderer
|
|
@@ -94,7 +97,9 @@ Read-only renderer for displaying saved content.
|
|
|
94
97
|
- Code blocks
|
|
95
98
|
|
|
96
99
|
### Media
|
|
97
|
-
- **Images**: Upload from computer, resize with 8-point handles, drag-and-drop positioning, custom upload handler support
|
|
100
|
+
- **Images**: Upload from computer, resize with 8-point handles, drag-and-drop positioning, custom upload handler support, advanced editing with filters
|
|
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
|
|
98
103
|
- **YouTube**: Embed videos with custom sizing
|
|
99
104
|
- **Embeds**: Support for 8+ platforms with automatic URL detection
|
|
100
105
|
- **Tables**: Visual builder with configurable dimensions, header rows, and professional styling
|
|
@@ -132,6 +137,39 @@ Read-only renderer for displaying saved content.
|
|
|
132
137
|
|
|
133
138
|
## Advanced Usage
|
|
134
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
|
+
|
|
135
173
|
### Custom Image Upload
|
|
136
174
|
|
|
137
175
|
Upload images to your server instead of using base64 encoding:
|
|
@@ -291,6 +329,8 @@ Check out the [example app](./example-app) for a complete implementation with:
|
|
|
291
329
|
## Documentation
|
|
292
330
|
|
|
293
331
|
Comprehensive guides available:
|
|
332
|
+
- [Video Upload Guide](./docs/VIDEO-GUIDE.md) - Native HTML5 video upload and playback
|
|
333
|
+
- [Image Editing Guide](./docs/IMAGE-EDITING-GUIDE.md) - Advanced image filters and effects
|
|
294
334
|
- [Section Creator Guide](./SECTION-CREATOR-GUIDE.md)
|
|
295
335
|
- [Section Editing Guide](./SECTION-EDITING-GUIDE.md)
|
|
296
336
|
- [Background Image Guide](./BACKGROUND-IMAGE-GUIDE.md)
|
package/dist/index.css
CHANGED
|
@@ -2299,6 +2299,262 @@
|
|
|
2299
2299
|
height: 24px;
|
|
2300
2300
|
}
|
|
2301
2301
|
}
|
|
2302
|
+
.cms-image-editor-modal {
|
|
2303
|
+
position: fixed;
|
|
2304
|
+
top: 0;
|
|
2305
|
+
left: 0;
|
|
2306
|
+
right: 0;
|
|
2307
|
+
bottom: 0;
|
|
2308
|
+
z-index: 10000;
|
|
2309
|
+
display: flex;
|
|
2310
|
+
align-items: center;
|
|
2311
|
+
justify-content: center;
|
|
2312
|
+
}
|
|
2313
|
+
.cms-image-editor-overlay {
|
|
2314
|
+
position: absolute;
|
|
2315
|
+
top: 0;
|
|
2316
|
+
left: 0;
|
|
2317
|
+
right: 0;
|
|
2318
|
+
bottom: 0;
|
|
2319
|
+
background: rgba(0, 0, 0, 0.7);
|
|
2320
|
+
backdrop-filter: blur(4px);
|
|
2321
|
+
}
|
|
2322
|
+
.cms-image-editor-content {
|
|
2323
|
+
position: relative;
|
|
2324
|
+
background: white;
|
|
2325
|
+
border-radius: 12px;
|
|
2326
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
2327
|
+
max-width: 1200px;
|
|
2328
|
+
width: 90%;
|
|
2329
|
+
max-height: 90vh;
|
|
2330
|
+
display: flex;
|
|
2331
|
+
flex-direction: column;
|
|
2332
|
+
overflow: hidden;
|
|
2333
|
+
}
|
|
2334
|
+
.cms-image-editor-header {
|
|
2335
|
+
display: flex;
|
|
2336
|
+
justify-content: space-between;
|
|
2337
|
+
align-items: center;
|
|
2338
|
+
padding: 20px 24px;
|
|
2339
|
+
border-bottom: 1px solid #e5e7eb;
|
|
2340
|
+
}
|
|
2341
|
+
.cms-image-editor-header h2 {
|
|
2342
|
+
margin: 0;
|
|
2343
|
+
font-size: 20px;
|
|
2344
|
+
font-weight: 600;
|
|
2345
|
+
color: #1f2937;
|
|
2346
|
+
}
|
|
2347
|
+
.cms-close-btn {
|
|
2348
|
+
background: none;
|
|
2349
|
+
border: none;
|
|
2350
|
+
font-size: 32px;
|
|
2351
|
+
color: #6b7280;
|
|
2352
|
+
cursor: pointer;
|
|
2353
|
+
padding: 0;
|
|
2354
|
+
width: 32px;
|
|
2355
|
+
height: 32px;
|
|
2356
|
+
display: flex;
|
|
2357
|
+
align-items: center;
|
|
2358
|
+
justify-content: center;
|
|
2359
|
+
border-radius: 4px;
|
|
2360
|
+
transition: all 0.2s;
|
|
2361
|
+
}
|
|
2362
|
+
.cms-close-btn:hover {
|
|
2363
|
+
background: #f3f4f6;
|
|
2364
|
+
color: #1f2937;
|
|
2365
|
+
}
|
|
2366
|
+
.cms-image-editor-body {
|
|
2367
|
+
display: grid;
|
|
2368
|
+
grid-template-columns: 1fr 400px;
|
|
2369
|
+
gap: 24px;
|
|
2370
|
+
padding: 24px;
|
|
2371
|
+
overflow-y: auto;
|
|
2372
|
+
flex: 1;
|
|
2373
|
+
}
|
|
2374
|
+
.cms-image-editor-preview {
|
|
2375
|
+
display: flex;
|
|
2376
|
+
align-items: center;
|
|
2377
|
+
justify-content: center;
|
|
2378
|
+
background: #f9fafb;
|
|
2379
|
+
border-radius: 8px;
|
|
2380
|
+
padding: 24px;
|
|
2381
|
+
min-height: 400px;
|
|
2382
|
+
}
|
|
2383
|
+
.cms-image-editor-preview img {
|
|
2384
|
+
max-width: 100%;
|
|
2385
|
+
max-height: 500px;
|
|
2386
|
+
border-radius: 4px;
|
|
2387
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
2388
|
+
}
|
|
2389
|
+
.cms-image-editor-controls {
|
|
2390
|
+
display: flex;
|
|
2391
|
+
flex-direction: column;
|
|
2392
|
+
gap: 24px;
|
|
2393
|
+
overflow-y: auto;
|
|
2394
|
+
}
|
|
2395
|
+
.cms-editor-section {
|
|
2396
|
+
background: #f9fafb;
|
|
2397
|
+
padding: 16px;
|
|
2398
|
+
border-radius: 8px;
|
|
2399
|
+
}
|
|
2400
|
+
.cms-editor-section h3 {
|
|
2401
|
+
margin: 0 0 16px 0;
|
|
2402
|
+
font-size: 14px;
|
|
2403
|
+
font-weight: 600;
|
|
2404
|
+
color: #374151;
|
|
2405
|
+
text-transform: uppercase;
|
|
2406
|
+
letter-spacing: 0.5px;
|
|
2407
|
+
}
|
|
2408
|
+
.cms-preset-buttons {
|
|
2409
|
+
display: grid;
|
|
2410
|
+
grid-template-columns: repeat(3, 1fr);
|
|
2411
|
+
gap: 8px;
|
|
2412
|
+
}
|
|
2413
|
+
.cms-preset-buttons button {
|
|
2414
|
+
padding: 8px 12px;
|
|
2415
|
+
background: white;
|
|
2416
|
+
border: 1px solid #d1d5db;
|
|
2417
|
+
border-radius: 6px;
|
|
2418
|
+
font-size: 13px;
|
|
2419
|
+
font-weight: 500;
|
|
2420
|
+
color: #374151;
|
|
2421
|
+
cursor: pointer;
|
|
2422
|
+
transition: all 0.2s;
|
|
2423
|
+
}
|
|
2424
|
+
.cms-preset-buttons button:hover {
|
|
2425
|
+
background: #667eea;
|
|
2426
|
+
color: white;
|
|
2427
|
+
border-color: #667eea;
|
|
2428
|
+
}
|
|
2429
|
+
.cms-filter-control {
|
|
2430
|
+
margin-bottom: 16px;
|
|
2431
|
+
}
|
|
2432
|
+
.cms-filter-control:last-child {
|
|
2433
|
+
margin-bottom: 0;
|
|
2434
|
+
}
|
|
2435
|
+
.cms-filter-control label {
|
|
2436
|
+
display: block;
|
|
2437
|
+
font-size: 13px;
|
|
2438
|
+
font-weight: 500;
|
|
2439
|
+
color: #374151;
|
|
2440
|
+
margin-bottom: 8px;
|
|
2441
|
+
}
|
|
2442
|
+
.cms-filter-control input[type=range] {
|
|
2443
|
+
width: 100%;
|
|
2444
|
+
height: 6px;
|
|
2445
|
+
border-radius: 3px;
|
|
2446
|
+
background: #e5e7eb;
|
|
2447
|
+
outline: none;
|
|
2448
|
+
-webkit-appearance: none;
|
|
2449
|
+
}
|
|
2450
|
+
.cms-filter-control input[type=range]::-webkit-slider-thumb {
|
|
2451
|
+
-webkit-appearance: none;
|
|
2452
|
+
appearance: none;
|
|
2453
|
+
width: 18px;
|
|
2454
|
+
height: 18px;
|
|
2455
|
+
border-radius: 50%;
|
|
2456
|
+
background: #667eea;
|
|
2457
|
+
cursor: pointer;
|
|
2458
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
2459
|
+
}
|
|
2460
|
+
.cms-filter-control input[type=range]::-moz-range-thumb {
|
|
2461
|
+
width: 18px;
|
|
2462
|
+
height: 18px;
|
|
2463
|
+
border-radius: 50%;
|
|
2464
|
+
background: #667eea;
|
|
2465
|
+
cursor: pointer;
|
|
2466
|
+
border: none;
|
|
2467
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
2468
|
+
}
|
|
2469
|
+
.cms-crop-info {
|
|
2470
|
+
padding: 12px;
|
|
2471
|
+
background: white;
|
|
2472
|
+
border-radius: 6px;
|
|
2473
|
+
border: 1px solid #d1d5db;
|
|
2474
|
+
}
|
|
2475
|
+
.cms-crop-info p {
|
|
2476
|
+
margin: 0;
|
|
2477
|
+
font-size: 13px;
|
|
2478
|
+
color: #6b7280;
|
|
2479
|
+
}
|
|
2480
|
+
.cms-image-editor-footer {
|
|
2481
|
+
display: flex;
|
|
2482
|
+
justify-content: space-between;
|
|
2483
|
+
align-items: center;
|
|
2484
|
+
padding: 16px 24px;
|
|
2485
|
+
border-top: 1px solid #e5e7eb;
|
|
2486
|
+
background: #f9fafb;
|
|
2487
|
+
}
|
|
2488
|
+
.cms-image-editor-footer > div {
|
|
2489
|
+
display: flex;
|
|
2490
|
+
gap: 12px;
|
|
2491
|
+
}
|
|
2492
|
+
.cms-btn-primary,
|
|
2493
|
+
.cms-btn-secondary {
|
|
2494
|
+
padding: 10px 20px;
|
|
2495
|
+
border-radius: 6px;
|
|
2496
|
+
font-size: 14px;
|
|
2497
|
+
font-weight: 500;
|
|
2498
|
+
cursor: pointer;
|
|
2499
|
+
transition: all 0.2s;
|
|
2500
|
+
border: none;
|
|
2501
|
+
}
|
|
2502
|
+
.cms-btn-primary {
|
|
2503
|
+
background: #667eea;
|
|
2504
|
+
color: white;
|
|
2505
|
+
}
|
|
2506
|
+
.cms-btn-primary:hover {
|
|
2507
|
+
background: #5568d3;
|
|
2508
|
+
}
|
|
2509
|
+
.cms-btn-secondary {
|
|
2510
|
+
background: white;
|
|
2511
|
+
color: #374151;
|
|
2512
|
+
border: 1px solid #d1d5db;
|
|
2513
|
+
}
|
|
2514
|
+
.cms-btn-secondary:hover {
|
|
2515
|
+
background: #f3f4f6;
|
|
2516
|
+
}
|
|
2517
|
+
@media (max-width: 768px) {
|
|
2518
|
+
.cms-image-editor-body {
|
|
2519
|
+
grid-template-columns: 1fr;
|
|
2520
|
+
}
|
|
2521
|
+
.cms-preset-buttons {
|
|
2522
|
+
grid-template-columns: repeat(2, 1fr);
|
|
2523
|
+
}
|
|
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
|
+
}
|
|
2302
2558
|
|
|
2303
2559
|
/* src/styles/renderer.css */
|
|
2304
2560
|
.cms-renderer {
|
|
@@ -2947,4 +3203,15 @@
|
|
|
2947
3203
|
background: #3a3a3a;
|
|
2948
3204
|
}
|
|
2949
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
|
+
}
|
|
2950
3217
|
/*# sourceMappingURL=index.css.map */
|