vue2-bbl-editor 1.3.0

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.
@@ -0,0 +1,1386 @@
1
+ # Vue2 Premium BBL Editor - Complete Package Documentation
2
+
3
+ This document provides comprehensive documentation for all components, features, and APIs included in the Vue2 Premium BBL Editor package.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Package Overview](#package-overview)
8
+ 2. [Installation & Setup](#installation--setup)
9
+ 3. [Main Components](#main-components)
10
+ 4. [Toolbar Components](#toolbar-components)
11
+ 5. [Menu Components](#menu-components)
12
+ 6. [Modal Components](#modal-components)
13
+ 7. [Upload System](#upload-system)
14
+ 8. [Development Tools](#development-tools)
15
+ 9. [Extensions](#extensions)
16
+ 10. [Composables](#composables)
17
+ 11. [TypeScript Support](#typescript-support)
18
+ 12. [Styling & Theming](#styling--theming)
19
+ 13. [Configuration Reference](#configuration-reference)
20
+ 14. [Event Reference](#event-reference)
21
+ 15. [Method Reference](#method-reference)
22
+ 16. [Best Practices](#best-practices)
23
+ 17. [Troubleshooting](#troubleshooting)
24
+
25
+ ## Package Overview
26
+
27
+ The Vue2 Premium BBL Editor is a comprehensive rich text editing solution for Vue 2.6+ applications. It provides:
28
+
29
+ - **Full-featured WYSIWYG editor** with extensive formatting options
30
+ - **Advanced media handling** with resizable images and videos
31
+ - **Comprehensive upload system** with multiple adapter support
32
+ - **Smart table editing** with interactive controls
33
+ - **Multiple themes** and extensive customization options
34
+ - **TypeScript support** with complete type definitions
35
+ - **Development tools** for debugging and diagnostics
36
+ - **External project integration** capabilities
37
+
38
+ ### Key Features
39
+
40
+ - ✅ Vue 2.6+ compatible with Composition API support
41
+ - ✅ Production-ready with comprehensive error handling
42
+ - ✅ Modular architecture with individual component exports
43
+ - ✅ Advanced upload management with retry logic and progress tracking
44
+ - ✅ Accessibility compliant (WCAG guidelines)
45
+ - ✅ Mobile responsive design
46
+ - ✅ Auto-save functionality
47
+ - ✅ Source code editing mode
48
+ - ✅ Extensive customization options
49
+
50
+ ## Installation & Setup
51
+
52
+ ### Basic Installation
53
+
54
+ ```bash
55
+ npm install vue2-bbl-editor
56
+ ```
57
+
58
+ ### Required Dependencies
59
+
60
+ ```bash
61
+ npm install @vue/composition-api @tiptap/core @tiptap/vue-2 @tiptap/starter-kit @tiptap/extension-text-style @tiptap/extension-color @tiptap/extension-highlight @tiptap/extension-underline @tiptap/extension-text-align @tiptap/extension-link @tiptap/extension-font-family @tiptap/extension-code @tiptap/extension-code-block @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-cell @tiptap/extension-table-header @tiptap/extension-task-list @tiptap/extension-task-item @tiptap/extension-placeholder
62
+ ```
63
+
64
+ ### Quick Setup
65
+
66
+ ```javascript
67
+ // main.js
68
+ import Vue from 'vue'
69
+ import PremiumBblEditor from 'vue2-bbl-editor'
70
+
71
+ // Register globally
72
+ Vue.use(PremiumBblEditor)
73
+
74
+ // Or register with options
75
+ Vue.use(PremiumBblEditor, {
76
+ registerAllComponents: true
77
+ })
78
+ ```
79
+
80
+ ## Main Components
81
+
82
+ ### PremiumBblEditor
83
+
84
+ The primary editor component using Composition API.
85
+
86
+ **Import:**
87
+ ```javascript
88
+ import { PremiumBblEditor } from 'vue2-bbl-editor'
89
+ ```
90
+
91
+ **Basic Usage:**
92
+ ```vue
93
+ <template>
94
+ <PremiumBblEditor
95
+ v-model="content"
96
+ placeholder="Start writing..."
97
+ @ready="handleReady"
98
+ />
99
+ </template>
100
+ ```
101
+
102
+ ### PremiumBblEditorOptionsAPI
103
+
104
+ The same editor component using pure Vue 2 Options API.
105
+
106
+ **Import:**
107
+ ```javascript
108
+ import { PremiumBblEditorOptionsAPI } from 'vue2-bbl-editor'
109
+ ```
110
+
111
+ **Basic Usage:**
112
+ ```vue
113
+ <template>
114
+ <PremiumBblEditorOptionsAPI
115
+ v-model="content"
116
+ placeholder="Start writing..."
117
+ @ready="handleReady"
118
+ />
119
+ </template>
120
+ ```
121
+
122
+ **Complete Options API Example:**
123
+ ```vue
124
+ <template>
125
+ <PremiumBblEditorOptionsAPI
126
+ v-model="content"
127
+ :placeholder="placeholder"
128
+ :theme="theme"
129
+ :toolbar-config="toolbarConfig"
130
+ :extension-config="extensionConfig"
131
+ :upload-handler="uploadHandler"
132
+ :auto-save="autoSave"
133
+ :auto-save-interval="autoSaveInterval"
134
+ :max-height="maxHeight"
135
+ :min-height="minHeight"
136
+ :font-families="fontFamilies"
137
+ :font-sizes="fontSizes"
138
+ :show-toolbar="showToolbar"
139
+ :show-bubble-menu="showBubbleMenu"
140
+ :editor-class="editorClass"
141
+ :toolbar-class="toolbarClass"
142
+ :content-class="contentClass"
143
+ @input="handleInput"
144
+ @ready="handleReady"
145
+ @focus="handleFocus"
146
+ @blur="handleBlur"
147
+ @auto-save="handleAutoSave"
148
+ @error="handleError"
149
+ />
150
+ </template>
151
+
152
+ <script>
153
+ import { PremiumBblEditorOptionsAPI } from 'vue2-bbl-editor'
154
+
155
+ export default {
156
+ components: {
157
+ PremiumBblEditorOptionsAPI
158
+ },
159
+
160
+ data() {
161
+ return {
162
+ content: '<p>Options API Editor</p>',
163
+ placeholder: 'Start writing with Options API...',
164
+ theme: 'default',
165
+ autoSave: true,
166
+ autoSaveInterval: 30000,
167
+ maxHeight: 500,
168
+ minHeight: 200,
169
+ showToolbar: true,
170
+ showBubbleMenu: true,
171
+
172
+ toolbarConfig: {
173
+ bold: true,
174
+ italic: true,
175
+ underline: true,
176
+ textColor: true,
177
+ highlight: true,
178
+ fontFamily: true,
179
+ fontSize: true,
180
+ headings: true,
181
+ lists: true,
182
+ link: true,
183
+ image: true,
184
+ video: true,
185
+ table: true
186
+ },
187
+
188
+ extensionConfig: {
189
+ image: {
190
+ allowResize: true,
191
+ allowAlignment: true,
192
+ maxWidth: '100%'
193
+ },
194
+ table: {
195
+ resizable: true,
196
+ cellSelection: true
197
+ }
198
+ },
199
+
200
+ fontFamilies: ['Inter', 'Arial', 'Georgia'],
201
+ fontSizes: ['14px', '16px', '18px', '20px'],
202
+
203
+ editorClass: 'my-editor',
204
+ toolbarClass: 'my-toolbar',
205
+ contentClass: 'my-content'
206
+ }
207
+ },
208
+
209
+ methods: {
210
+ handleInput(content) {
211
+ console.log('Content changed:', content)
212
+ },
213
+
214
+ handleReady(editor) {
215
+ console.log('Options API Editor ready:', editor)
216
+ this.editorInstance = editor
217
+ },
218
+
219
+ handleFocus() {
220
+ console.log('Editor focused')
221
+ },
222
+
223
+ handleBlur() {
224
+ console.log('Editor blurred')
225
+ },
226
+
227
+ handleAutoSave(content) {
228
+ console.log('Auto-saving...')
229
+ this.saveToServer(content)
230
+ },
231
+
232
+ handleError(error) {
233
+ console.error('Editor error:', error)
234
+ },
235
+
236
+ async uploadHandler(file) {
237
+ const formData = new FormData()
238
+ formData.append('file', file)
239
+
240
+ const response = await fetch('/api/upload', {
241
+ method: 'POST',
242
+ body: formData
243
+ })
244
+
245
+ const data = await response.json()
246
+ return { src: data.url, alt: file.name }
247
+ },
248
+
249
+ async saveToServer(content) {
250
+ try {
251
+ await fetch('/api/save', {
252
+ method: 'POST',
253
+ headers: { 'Content-Type': 'application/json' },
254
+ body: JSON.stringify({ content })
255
+ })
256
+ } catch (error) {
257
+ console.error('Save failed:', error)
258
+ }
259
+ }
260
+ }
261
+ }
262
+ </script>
263
+ ```
264
+
265
+ **Props:**
266
+ - `value` (String): Editor content (v-model)
267
+ - `placeholder` (String): Placeholder text
268
+ - `editable` (Boolean): Whether content can be edited
269
+ - `theme` (String): Theme name ('default', 'minimal', 'dark')
270
+ - `toolbarConfig` (Object): Toolbar button configuration
271
+ - `extensionConfig` (Object): Extension behavior configuration
272
+ - `uploadHandler` (Function): Custom upload handler
273
+ - `autoSave` (Boolean): Enable auto-save
274
+ - `autoSaveInterval` (Number): Auto-save interval in milliseconds
275
+ - `maxHeight` (String|Number): Maximum editor height
276
+ - `minHeight` (String|Number): Minimum editor height
277
+ - `showToolbar` (Boolean): Show/hide toolbar
278
+ - `showBubbleMenu` (Boolean): Show/hide bubble menu
279
+
280
+ **Local File Base64 Management:**
281
+ - `useBase64Upload` (Boolean): Force base64 conversion even when upload URLs are provided
282
+ - `base64Quality` (Number): Image compression quality (0.1 - 1.0)
283
+ - `base64MaxWidth` (Number): Maximum width for compressed images (px)
284
+ - `base64MaxHeight` (Number): Maximum height for compressed images (px)
285
+ - `enableImageCompression` (Boolean): Enable automatic image compression
286
+ - `preserveOriginalFileName` (Boolean): Preserve original file names in alt text
287
+ - `base64Prefix` (String): Custom prefix for base64 data URLs
288
+ - And many more...
289
+
290
+ **Events:**
291
+ - `@input`: Content changed (v-model)
292
+ - `@ready`: Editor ready for use
293
+ - `@focus`: Editor gained focus
294
+ - `@blur`: Editor lost focus
295
+ - `@auto-save`: Auto-save triggered
296
+ - `@image-compressed`: Image compression completed with statistics
297
+ - `@error`: Error occurred
298
+
299
+ **Methods:**
300
+ - `focus()`: Focus the editor
301
+ - `blur()`: Blur the editor
302
+ - `getContent(format)`: Get editor content
303
+ - `setContent(content)`: Set editor content
304
+ - `executeCommand(command, options)`: Execute editor command
305
+
306
+ ### PremiumBblEditorOptionsAPI
307
+
308
+ The same editor component using Vue 2 Options API.
309
+
310
+ **Import:**
311
+ ```javascript
312
+ import { PremiumBblEditorOptionsAPI } from 'vue2-bbl-editor'
313
+ ```
314
+
315
+ **Usage:**
316
+ ```vue
317
+ <template>
318
+ <PremiumBblEditorOptionsAPI
319
+ v-model="content"
320
+ :toolbar-config="toolbarConfig"
321
+ @ready="handleReady"
322
+ />
323
+ </template>
324
+ ```
325
+
326
+ Same props, events, and methods as PremiumBblEditor.
327
+
328
+ ## Toolbar Components
329
+
330
+ ### ToolbarMain
331
+
332
+ Complete toolbar with all formatting options.
333
+
334
+ **Import:**
335
+ ```javascript
336
+ import { ToolbarMain } from 'vue2-bbl-editor'
337
+ ```
338
+
339
+ **Usage:**
340
+ ```vue
341
+ <template>
342
+ <ToolbarMain
343
+ :editor="editor"
344
+ :config="toolbarConfig"
345
+ :font-families="fontFamilies"
346
+ :font-sizes="fontSizes"
347
+ @execute-command="executeCommand"
348
+ />
349
+ </template>
350
+ ```
351
+
352
+ **Props:**
353
+ - `editor` (Object): TipTap editor instance
354
+ - `config` (Object): Toolbar configuration
355
+ - `fontFamilies` (Array): Available font families
356
+ - `fontSizes` (Array): Available font sizes
357
+ - `lineHeights` (Array): Available line heights
358
+ - `allowedHeadings` (Array): Allowed heading levels
359
+ - `sourceCodeMode` (Boolean): Source code mode state
360
+
361
+ **Events:**
362
+ - `@execute-command`: Execute editor command
363
+ - `@insert-link`: Insert link request
364
+ - `@insert-image`: Insert image request
365
+ - `@insert-video`: Insert video request
366
+ - `@clear-formatting`: Clear formatting request
367
+ - `@toggle-source-code`: Toggle source code mode
368
+
369
+ ### ToolbarGroup
370
+
371
+ Container for grouping related toolbar buttons.
372
+
373
+ **Import:**
374
+ ```javascript
375
+ import { ToolbarGroup } from 'vue2-bbl-editor'
376
+ ```
377
+
378
+ **Usage:**
379
+ ```vue
380
+ <template>
381
+ <ToolbarGroup label="Text Formatting">
382
+ <ToolbarButton ... />
383
+ <ToolbarButton ... />
384
+ </ToolbarGroup>
385
+ </template>
386
+ ```
387
+
388
+ **Props:**
389
+ - `label` (String): Group label for accessibility
390
+
391
+ ### ToolbarButton
392
+
393
+ Individual toolbar button component.
394
+
395
+ **Import:**
396
+ ```javascript
397
+ import { ToolbarButton } from 'vue2-bbl-editor'
398
+ ```
399
+
400
+ **Usage:**
401
+ ```vue
402
+ <template>
403
+ <ToolbarButton
404
+ :editor="editor"
405
+ command="toggleBold"
406
+ icon="B"
407
+ tooltip="Bold"
408
+ :is-active="editor && editor.isActive('bold')"
409
+ @click="handleClick"
410
+ />
411
+ </template>
412
+ ```
413
+
414
+ **Props:**
415
+ - `editor` (Object): TipTap editor instance
416
+ - `command` (String): Command to execute
417
+ - `icon` (String): Button icon text/HTML
418
+ - `tooltip` (String): Tooltip text
419
+ - `isActive` (Boolean): Whether button is active
420
+ - `isDropdown` (Boolean): Whether button has dropdown
421
+ - `disabled` (Boolean): Whether button is disabled
422
+
423
+ **Events:**
424
+ - `@click`: Button clicked
425
+
426
+ **Slots:**
427
+ - `#icon`: Custom icon content
428
+ - `#dropdown`: Dropdown content
429
+
430
+ ## Menu Components
431
+
432
+ ### EditorBubbleMenu
433
+
434
+ Text selection bubble menu.
435
+
436
+ **Import:**
437
+ ```javascript
438
+ import { EditorBubbleMenu } from 'vue2-bbl-editor'
439
+ ```
440
+
441
+ **Usage:**
442
+ ```vue
443
+ <template>
444
+ <EditorBubbleMenu
445
+ :editor="editor"
446
+ :config="bubbleConfig"
447
+ @execute-command="executeCommand"
448
+ />
449
+ </template>
450
+ ```
451
+
452
+ **Props:**
453
+ - `editor` (Object): TipTap editor instance
454
+ - `config` (Object): Bubble menu configuration
455
+ - `showLinkOptions` (Boolean): Show link options
456
+ - `showTextFormatting` (Boolean): Show text formatting
457
+ - `showTextStyling` (Boolean): Show text styling
458
+
459
+ **Events:**
460
+ - `@execute-command`: Execute command
461
+ - `@open-link-modal`: Open link modal
462
+
463
+ ### TableBubbleMenu
464
+
465
+ Table-specific bubble menu.
466
+
467
+ **Import:**
468
+ ```javascript
469
+ import { TableBubbleMenu } from 'vue2-bbl-editor'
470
+ ```
471
+
472
+ **Usage:**
473
+ ```vue
474
+ <template>
475
+ <TableBubbleMenu
476
+ :editor="editor"
477
+ @add-row-before="addRowBefore"
478
+ @delete-table="deleteTable"
479
+ />
480
+ </template>
481
+ ```
482
+
483
+ **Props:**
484
+ - `editor` (Object): TipTap editor instance
485
+ - `showRowControls` (Boolean): Show row controls
486
+ - `showColumnControls` (Boolean): Show column controls
487
+ - `showCellControls` (Boolean): Show cell controls
488
+ - `showTableControls` (Boolean): Show table controls
489
+
490
+ **Events:**
491
+ - `@add-row-before`: Add row before current
492
+ - `@add-row-after`: Add row after current
493
+ - `@delete-row`: Delete current row
494
+ - `@add-column-before`: Add column before current
495
+ - `@add-column-after`: Add column after current
496
+ - `@delete-column`: Delete current column
497
+ - `@merge-cells`: Merge selected cells
498
+ - `@split-cell`: Split current cell
499
+ - `@delete-table`: Delete entire table
500
+
501
+ ### ImageBubbleMenu
502
+
503
+ Image-specific bubble menu.
504
+
505
+ **Import:**
506
+ ```javascript
507
+ import { ImageBubbleMenu } from 'vue2-bbl-editor'
508
+ ```
509
+
510
+ **Usage:**
511
+ ```vue
512
+ <template>
513
+ <ImageBubbleMenu
514
+ :editor="editor"
515
+ @align-left="alignImageLeft"
516
+ @delete-image="deleteImage"
517
+ />
518
+ </template>
519
+ ```
520
+
521
+ **Props:**
522
+ - `editor` (Object): TipTap editor instance
523
+ - `showAlignmentControls` (Boolean): Show alignment controls
524
+ - `showResizeControls` (Boolean): Show resize controls
525
+ - `showDeleteControl` (Boolean): Show delete control
526
+ - `showAltTextControl` (Boolean): Show alt text control
527
+
528
+ **Events:**
529
+ - `@align-left`: Align image left
530
+ - `@align-center`: Align image center
531
+ - `@align-right`: Align image right
532
+ - `@resize-image`: Resize image
533
+ - `@delete-image`: Delete image
534
+ - `@edit-alt-text`: Edit alt text
535
+
536
+ ### VideoBubbleMenu
537
+
538
+ Video-specific bubble menu.
539
+
540
+ **Import:**
541
+ ```javascript
542
+ import { VideoBubbleMenu } from 'vue2-bbl-editor'
543
+ ```
544
+
545
+ **Usage:**
546
+ ```vue
547
+ <template>
548
+ <VideoBubbleMenu
549
+ :editor="editor"
550
+ @toggle-autoplay="toggleAutoplay"
551
+ @delete-video="deleteVideo"
552
+ />
553
+ </template>
554
+ ```
555
+
556
+ **Props:**
557
+ - `editor` (Object): TipTap editor instance
558
+ - `showAlignmentControls` (Boolean): Show alignment controls
559
+ - `showResizeControls` (Boolean): Show resize controls
560
+ - `showPlaybackControls` (Boolean): Show playback controls
561
+ - `showDeleteControl` (Boolean): Show delete control
562
+
563
+ **Events:**
564
+ - `@align-left`: Align video left
565
+ - `@align-center`: Align video center
566
+ - `@align-right`: Align video right
567
+ - `@resize-video`: Resize video
568
+ - `@toggle-autoplay`: Toggle autoplay
569
+ - `@toggle-controls`: Toggle controls
570
+ - `@delete-video`: Delete video
571
+
572
+ ## Modal Components
573
+
574
+ ### ImageModal
575
+
576
+ Modal for uploading and configuring images.
577
+
578
+ **Import:**
579
+ ```javascript
580
+ import { ImageModal } from 'vue2-bbl-editor'
581
+ ```
582
+
583
+ **Usage:**
584
+ ```vue
585
+ <template>
586
+ <ImageModal
587
+ :visible="showModal"
588
+ :upload-handler="uploadHandler"
589
+ :max-file-size="maxFileSize"
590
+ :allowed-types="allowedTypes"
591
+ @close="showModal = false"
592
+ @insert="insertImage"
593
+ />
594
+ </template>
595
+ ```
596
+
597
+ **Props:**
598
+ - `visible` (Boolean): Modal visibility
599
+ - `uploadHandler` (Function): Upload handler function
600
+ - `maxFileSize` (Number): Maximum file size in bytes
601
+ - `allowedTypes` (Array): Allowed MIME types
602
+ - `showUrlInput` (Boolean): Show URL input field
603
+ - `showAltTextInput` (Boolean): Show alt text input
604
+ - `showAlignmentOptions` (Boolean): Show alignment options
605
+ - `showSizeOptions` (Boolean): Show size options
606
+
607
+ **Events:**
608
+ - `@close`: Close modal
609
+ - `@insert`: Insert image
610
+ - `@upload-progress`: Upload progress update
611
+ - `@upload-error`: Upload error
612
+
613
+ ### VideoModal
614
+
615
+ Modal for uploading and configuring videos.
616
+
617
+ **Import:**
618
+ ```javascript
619
+ import { VideoModal } from 'vue2-bbl-editor'
620
+ ```
621
+
622
+ **Usage:**
623
+ ```vue
624
+ <template>
625
+ <VideoModal
626
+ :visible="showModal"
627
+ :upload-handler="uploadHandler"
628
+ @close="showModal = false"
629
+ @insert="insertVideo"
630
+ />
631
+ </template>
632
+ ```
633
+
634
+ **Props:**
635
+ - `visible` (Boolean): Modal visibility
636
+ - `uploadHandler` (Function): Upload handler function
637
+ - `maxFileSize` (Number): Maximum file size in bytes
638
+ - `allowedTypes` (Array): Allowed MIME types
639
+ - `showUrlInput` (Boolean): Show URL input field
640
+ - `showEmbedInput` (Boolean): Show embed code input
641
+ - `showPlaybackOptions` (Boolean): Show playback options
642
+ - `showSizeOptions` (Boolean): Show size options
643
+
644
+ **Events:**
645
+ - `@close`: Close modal
646
+ - `@insert`: Insert video
647
+ - `@upload-progress`: Upload progress update
648
+ - `@upload-error`: Upload error
649
+
650
+ ### LinkModal
651
+
652
+ Modal for creating and editing links.
653
+
654
+ **Import:**
655
+ ```javascript
656
+ import { LinkModal } from 'vue2-bbl-editor'
657
+ ```
658
+
659
+ **Usage:**
660
+ ```vue
661
+ <template>
662
+ <LinkModal
663
+ :visible="showModal"
664
+ :initial-text="linkText"
665
+ :initial-url="linkUrl"
666
+ @close="showModal = false"
667
+ @insert="insertLink"
668
+ />
669
+ </template>
670
+ ```
671
+
672
+ **Props:**
673
+ - `visible` (Boolean): Modal visibility
674
+ - `initialText` (String): Initial link text
675
+ - `initialUrl` (String): Initial link URL
676
+ - `initialTarget` (String): Initial link target
677
+ - `showTextInput` (Boolean): Show text input field
678
+ - `showTargetOptions` (Boolean): Show target options
679
+ - `showTitleInput` (Boolean): Show title input field
680
+ - `validateUrl` (Boolean): Enable URL validation
681
+
682
+ **Events:**
683
+ - `@close`: Close modal
684
+ - `@insert`: Insert link
685
+ - `@update`: Update existing link
686
+ - `@remove`: Remove link
687
+
688
+ ## Upload System
689
+
690
+ The package includes a comprehensive upload management system with multiple adapters and advanced features.
691
+
692
+ ### UploadManager
693
+
694
+ Main upload management class.
695
+
696
+ **Import:**
697
+ ```javascript
698
+ import { UploadManager } from 'vue2-bbl-editor'
699
+ ```
700
+
701
+ #### Composition API Usage
702
+ ```javascript
703
+ const config = createUploadConfig('localStorage')
704
+ const uploadManager = new UploadManager(config)
705
+ ```
706
+
707
+ #### Options API Usage
708
+ ```javascript
709
+ // In data()
710
+ data() {
711
+ return {
712
+ uploadManager: null
713
+ }
714
+ },
715
+
716
+ // In created()
717
+ async created() {
718
+ const config = createUploadConfig('localStorage')
719
+ this.uploadManager = new UploadManager(config)
720
+ }
721
+ ```
722
+
723
+ **Methods:**
724
+ - `registerAdapter(adapter)`: Register upload adapter
725
+ - `setDefaultAdapter(name)`: Set default adapter
726
+ - `upload(file, options)`: Upload file
727
+ - `uploadWithAdapter(name, file, options)`: Upload with specific adapter
728
+ - `cancelUpload(uploadId)`: Cancel upload
729
+ - `getStats()`: Get upload statistics
730
+ - `destroy()`: Cleanup resources
731
+ - `on(event, callback)`: Add event listener
732
+ - `off(event, callback)`: Remove event listener
733
+
734
+ **Events:**
735
+ - `uploadStarted`: Upload started
736
+ - `progress`: Upload progress update
737
+ - `uploadCompleted`: Upload completed successfully
738
+ - `uploadFailed`: Upload failed
739
+ - `retryAttemptStarted`: Retry attempt started
740
+ - `defaultAdapterChanged`: Default adapter changed
741
+ - `validationFailed`: File validation failed
742
+
743
+ ### LocalStorageAdapter
744
+
745
+ Local storage upload adapter for development.
746
+
747
+ **Import:**
748
+ ```javascript
749
+ import { LocalStorageAdapter } from 'vue2-bbl-editor'
750
+ ```
751
+
752
+ #### Composition API Usage
753
+ ```javascript
754
+ const adapter = new LocalStorageAdapter({
755
+ generateObjectUrl: true,
756
+ persistToIndexedDB: false
757
+ })
758
+ uploadManager.registerAdapter(adapter)
759
+ ```
760
+
761
+ #### Options API Usage
762
+ ```javascript
763
+ // In methods
764
+ setupAdapters() {
765
+ const adapter = new LocalStorageAdapter({
766
+ generateObjectUrl: true,
767
+ persistToIndexedDB: false
768
+ })
769
+ this.uploadManager.registerAdapter(adapter)
770
+ }
771
+ ```
772
+
773
+ ### Upload Configuration
774
+
775
+ **Import:**
776
+ ```javascript
777
+ import { createUploadConfig } from 'vue2-bbl-editor'
778
+ ```
779
+
780
+ #### Composition API Usage
781
+ ```javascript
782
+ const config = createUploadConfig('localStorage', {
783
+ validation: {
784
+ maxSize: 10 * 1024 * 1024, // 10MB
785
+ allowedTypes: ['image/jpeg', 'image/png']
786
+ },
787
+ retry: {
788
+ maxAttempts: 3,
789
+ baseDelay: 1000
790
+ }
791
+ })
792
+ ```
793
+
794
+ #### Options API Usage
795
+ ```javascript
796
+ // In methods
797
+ createUploadConfiguration() {
798
+ return createUploadConfig('localStorage', {
799
+ validation: {
800
+ maxSize: this.maxFileSize,
801
+ allowedTypes: this.allowedFileTypes
802
+ },
803
+ retry: {
804
+ maxAttempts: this.maxRetryAttempts,
805
+ baseDelay: this.retryBaseDelay
806
+ }
807
+ })
808
+ }
809
+ ```
810
+
811
+ **Configuration Options:**
812
+ - `defaultAdapter` (String): Default adapter name
813
+ - `adapters` (Object): Adapter configurations
814
+ - `validation` (Object): File validation settings
815
+ - `retry` (Object): Retry configuration
816
+ - `progress` (Object): Progress tracking settings
817
+ - `debug` (Boolean): Enable debug logging
818
+
819
+ ### TipTap Integration
820
+
821
+ **Import:**
822
+ ```javascript
823
+ import { integrateTipTapUpload } from 'vue2-bbl-editor'
824
+ ```
825
+
826
+ #### Composition API Usage
827
+ ```javascript
828
+ integrateTipTapUpload(editor, uploadManager, {
829
+ onStart: () => console.log('Upload started'),
830
+ onEnd: () => console.log('Upload finished')
831
+ })
832
+ ```
833
+
834
+ #### Options API Usage
835
+ ```javascript
836
+ // In methods
837
+ onEditorReady(editor) {
838
+ integrateTipTapUpload(editor, this.uploadManager, {
839
+ onStart: () => {
840
+ this.uploadInProgress = true
841
+ console.log('Upload started')
842
+ },
843
+ onEnd: () => {
844
+ this.uploadInProgress = false
845
+ console.log('Upload finished')
846
+ }
847
+ })
848
+ }
849
+ ```
850
+
851
+ ## Development Tools
852
+
853
+ ### DiagnosticTool
854
+
855
+ Built-in diagnostic and troubleshooting tool.
856
+
857
+ **Import:**
858
+ ```javascript
859
+ import { DiagnosticTool } from 'vue2-bbl-editor'
860
+ ```
861
+
862
+ **Usage:**
863
+ ```vue
864
+ <template>
865
+ <DiagnosticTool
866
+ :editor="editor"
867
+ :show-dependency-check="true"
868
+ :show-browser-info="true"
869
+ @diagnostic-complete="handleDiagnostic"
870
+ />
871
+ </template>
872
+ ```
873
+
874
+ **Props:**
875
+ - `editor` (Object): Editor instance to diagnose
876
+ - `showDependencyCheck` (Boolean): Show dependency check
877
+ - `showBrowserInfo` (Boolean): Show browser information
878
+ - `showEditorState` (Boolean): Show editor state
879
+ - `showPerformanceMetrics` (Boolean): Show performance metrics
880
+
881
+ **Events:**
882
+ - `@diagnostic-complete`: Diagnostic completed
883
+
884
+ ### DebugHelper
885
+
886
+ Development debugging helper component.
887
+
888
+ **Import:**
889
+ ```javascript
890
+ import { DebugHelper } from 'vue2-bbl-editor'
891
+ ```
892
+
893
+ **Usage:**
894
+ ```vue
895
+ <template>
896
+ <DebugHelper
897
+ :editor="editor"
898
+ :show-editor-state="true"
899
+ :show-event-log="true"
900
+ @state-change="handleStateChange"
901
+ />
902
+ </template>
903
+ ```
904
+
905
+ **Props:**
906
+ - `editor` (Object): Editor instance to debug
907
+ - `showEditorState` (Boolean): Show editor state
908
+ - `showContentAnalysis` (Boolean): Show content analysis
909
+ - `showEventLog` (Boolean): Show event log
910
+ - `showPerformanceMonitor` (Boolean): Show performance monitor
911
+ - `autoRefresh` (Boolean): Auto-refresh data
912
+ - `refreshInterval` (Number): Refresh interval in milliseconds
913
+
914
+ **Events:**
915
+ - `@state-change`: Editor state changed
916
+ - `@performance-update`: Performance metrics updated
917
+
918
+ ## Extensions
919
+
920
+ The package includes custom TipTap extensions for enhanced functionality.
921
+
922
+ ### ResizableImage
923
+
924
+ Enhanced image extension with resize controls.
925
+
926
+ **Import:**
927
+ ```javascript
928
+ import { ResizableImage } from 'vue2-bbl-editor'
929
+ ```
930
+
931
+ **Configuration:**
932
+ ```javascript
933
+ ResizableImage.configure({
934
+ allowResize: true,
935
+ allowAlignment: true,
936
+ allowDelete: true,
937
+ maxWidth: '100%',
938
+ quality: 0.8
939
+ })
940
+ ```
941
+
942
+ ### ResizableVideo
943
+
944
+ Enhanced video extension with resize controls.
945
+
946
+ **Import:**
947
+ ```javascript
948
+ import { ResizableVideo } from 'vue2-bbl-editor'
949
+ ```
950
+
951
+ **Configuration:**
952
+ ```javascript
953
+ ResizableVideo.configure({
954
+ allowResize: true,
955
+ allowAlignment: true,
956
+ allowDelete: true,
957
+ maxWidth: '100%',
958
+ autoplay: false
959
+ })
960
+ ```
961
+
962
+ ### CustomTableCell
963
+
964
+ Enhanced table cell with interactive controls.
965
+
966
+ **Import:**
967
+ ```javascript
968
+ import { CustomTableCell } from 'vue2-bbl-editor'
969
+ ```
970
+
971
+ ### CustomTableHeader
972
+
973
+ Enhanced table header with interactive controls.
974
+
975
+ **Import:**
976
+ ```javascript
977
+ import { CustomTableHeader } from 'vue2-bbl-editor'
978
+ ```
979
+
980
+ ## Composables
981
+
982
+ ### useEditor
983
+
984
+ Core editor composable for custom implementations.
985
+
986
+ **Import:**
987
+ ```javascript
988
+ import { useEditor } from 'vue2-bbl-editor'
989
+ ```
990
+
991
+ **Usage:**
992
+ ```javascript
993
+ const {
994
+ editor,
995
+ isEditorReady,
996
+ currentContent,
997
+ editorError,
998
+ executeCommand,
999
+ isActive,
1000
+ getContent,
1001
+ setContent,
1002
+ focus,
1003
+ blur
1004
+ } = useEditor(props, emit)
1005
+ ```
1006
+
1007
+ **Parameters:**
1008
+ - `props` (Object): Component props
1009
+ - `emit` (Function): Component emit function
1010
+
1011
+ **Returns:**
1012
+ - `editor` (Ref): TipTap editor instance
1013
+ - `isEditorReady` (Ref): Editor ready state
1014
+ - `currentContent` (Computed): Current editor content
1015
+ - `editorError` (Ref): Editor error state
1016
+ - `missingDependencies` (Ref): Missing dependencies
1017
+ - `executeCommand` (Function): Execute editor command
1018
+ - `isActive` (Function): Check if feature is active
1019
+ - `getContent` (Function): Get editor content
1020
+ - `setContent` (Function): Set editor content
1021
+ - `focus` (Function): Focus editor
1022
+ - `blur` (Function): Blur editor
1023
+
1024
+ ## TypeScript Support
1025
+
1026
+ The package includes comprehensive TypeScript definitions.
1027
+
1028
+ ### Main Interfaces
1029
+
1030
+ ```typescript
1031
+ import {
1032
+ PremiumBblEditorProps,
1033
+ PremiumBblEditorEvents,
1034
+ PremiumBblEditorMethods,
1035
+ ToolbarConfig,
1036
+ ExtensionConfig,
1037
+ UploadHandler,
1038
+ UploadConfig,
1039
+ UploadResult
1040
+ } from 'vue2-bbl-editor'
1041
+ ```
1042
+
1043
+ ### Component Types
1044
+
1045
+ ```typescript
1046
+ import { PremiumBblEditor } from 'vue2-bbl-editor'
1047
+
1048
+ // Component instance type
1049
+ type EditorInstance = InstanceType<typeof PremiumBblEditor>
1050
+ ```
1051
+
1052
+ ### Upload System Types
1053
+
1054
+ ```typescript
1055
+ import { UploadManager, LocalStorageAdapter } from 'vue2-bbl-editor'
1056
+
1057
+ const uploadManager: UploadManager = new UploadManager(config)
1058
+ const adapter: LocalStorageAdapter = new LocalStorageAdapter()
1059
+ ```
1060
+
1061
+ ## Styling & Theming
1062
+
1063
+ ### Built-in Themes
1064
+
1065
+ The package includes three built-in themes:
1066
+
1067
+ 1. **Default Theme**: Clean, professional appearance
1068
+ 2. **Minimal Theme**: Simplified interface with reduced visual elements
1069
+ 3. **Dark Theme**: Dark color scheme for low-light environments
1070
+
1071
+ **Usage:**
1072
+ ```vue
1073
+ <template>
1074
+ <PremiumBblEditor
1075
+ v-model="content"
1076
+ theme="dark"
1077
+ />
1078
+ </template>
1079
+ ```
1080
+
1081
+ ### Custom Themes
1082
+
1083
+ Create custom themes using CSS custom properties:
1084
+
1085
+ ```css
1086
+ .premium-editor-container.theme-custom {
1087
+ --editor-bg: #f8fafc;
1088
+ --editor-text: #1a202c;
1089
+ --toolbar-bg: #ffffff;
1090
+ --toolbar-border: #e2e8f0;
1091
+ --button-hover: #f7fafc;
1092
+ --button-active: #3182ce;
1093
+ --bubble-menu-bg: #ffffff;
1094
+ --bubble-menu-border: #e2e8f0;
1095
+ --modal-bg: #ffffff;
1096
+ --modal-overlay: rgba(0, 0, 0, 0.5);
1097
+ }
1098
+ ```
1099
+
1100
+ ### Custom CSS Classes
1101
+
1102
+ Apply custom CSS classes to different parts of the editor:
1103
+
1104
+ ```vue
1105
+ <template>
1106
+ <PremiumBblEditor
1107
+ v-model="content"
1108
+ editor-class="my-editor"
1109
+ toolbar-class="my-toolbar"
1110
+ content-class="my-content"
1111
+ />
1112
+ </template>
1113
+
1114
+ <style>
1115
+ .my-editor {
1116
+ border-radius: 12px;
1117
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
1118
+ }
1119
+
1120
+ .my-toolbar {
1121
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
1122
+ }
1123
+
1124
+ .my-content {
1125
+ font-family: 'Georgia', serif;
1126
+ line-height: 1.8;
1127
+ }
1128
+ </style>
1129
+ ```
1130
+
1131
+ ## Configuration Reference
1132
+
1133
+ ### Toolbar Configuration
1134
+
1135
+ Complete toolbar configuration options:
1136
+
1137
+ ```javascript
1138
+ const toolbarConfig = {
1139
+ // Text formatting
1140
+ bold: true, // Bold text
1141
+ italic: true, // Italic text
1142
+ underline: true, // Underlined text
1143
+ strike: true, // Strikethrough text
1144
+ code: true, // Inline code
1145
+
1146
+ // Text styling
1147
+ textColor: true, // Text color picker
1148
+ highlight: true, // Text highlight
1149
+ fontFamily: true, // Font family dropdown
1150
+ fontSize: true, // Font size dropdown
1151
+
1152
+ // Alignment and spacing
1153
+ textAlign: true, // Text alignment options
1154
+ lineHeight: true, // Line height options
1155
+
1156
+ // Structure
1157
+ headings: true, // Heading levels
1158
+ lists: true, // Bullet and numbered lists
1159
+ blockquote: true, // Blockquotes
1160
+ codeBlock: true, // Code blocks
1161
+ horizontalRule: true, // Horizontal rules
1162
+
1163
+ // Media
1164
+ link: true, // Links
1165
+ image: true, // Images
1166
+ video: true, // Videos
1167
+ table: true, // Tables
1168
+
1169
+ // Utilities
1170
+ clearFormatting: true, // Clear formatting
1171
+ sourceCode: true, // Source code view
1172
+ undo: true, // Undo
1173
+ redo: true // Redo
1174
+ }
1175
+ ```
1176
+
1177
+ ### Extension Configuration
1178
+
1179
+ Complete extension configuration options:
1180
+
1181
+ ```javascript
1182
+ const extensionConfig = {
1183
+ image: {
1184
+ allowResize: true, // Allow image resizing
1185
+ allowAlignment: true, // Allow image alignment
1186
+ allowDelete: true, // Allow image deletion
1187
+ maxWidth: '100%', // Maximum image width
1188
+ quality: 0.8 // Image quality (0-1)
1189
+ },
1190
+
1191
+ video: {
1192
+ allowResize: true, // Allow video resizing
1193
+ allowAlignment: true, // Allow video alignment
1194
+ allowDelete: true, // Allow video deletion
1195
+ maxWidth: '100%', // Maximum video width
1196
+ autoplay: false // Auto-play videos
1197
+ },
1198
+
1199
+ table: {
1200
+ resizable: true, // Allow table resizing
1201
+ allowRowControls: true, // Show row controls
1202
+ allowColumnControls: true, // Show column controls
1203
+ cellSelection: true // Allow cell selection
1204
+ },
1205
+
1206
+ link: {
1207
+ openOnClick: false, // Open links on click
1208
+ autolink: true, // Auto-detect links
1209
+ linkOnPaste: true // Create links on paste
1210
+ },
1211
+
1212
+ textAlign: {
1213
+ types: ['heading', 'paragraph'] // Elements that support alignment
1214
+ }
1215
+ }
1216
+ ```
1217
+
1218
+ ## Event Reference
1219
+
1220
+ ### Editor Events
1221
+
1222
+ | Event | Payload | Description |
1223
+ |-------|---------|-------------|
1224
+ | `input` | `content: string` | Content changed (v-model) |
1225
+ | `update` | `content: string` | Content updated |
1226
+ | `ready` | `editor: Editor` | Editor ready for use |
1227
+ | `created` | `editor: Editor` | Editor instance created |
1228
+ | `focus` | - | Editor gained focus |
1229
+ | `blur` | - | Editor lost focus |
1230
+ | `destroyed` | - | Editor destroyed |
1231
+ | `auto-save` | `content: string` | Auto-save triggered |
1232
+ | `content-limit-exceeded` | `{current: number, max: number}` | Content limit exceeded |
1233
+ | `error` | `{type: string, message: string, ...}` | Error occurred |
1234
+
1235
+ ### Upload Events
1236
+
1237
+ | Event | Payload | Description |
1238
+ |-------|---------|-------------|
1239
+ | `uploadStarted` | `{uploadId: string, fileName: string, ...}` | Upload started |
1240
+ | `progress` | `{percentage: number, loaded: number, total: number, ...}` | Upload progress |
1241
+ | `uploadCompleted` | `{result: UploadResult, uploadId: string, ...}` | Upload completed |
1242
+ | `uploadFailed` | `{error: Error, uploadId: string, ...}` | Upload failed |
1243
+ | `retryAttemptStarted` | `{attempt: number, maxAttempts: number, ...}` | Retry attempt started |
1244
+ | `validationFailed` | `{error: Error, file: File}` | File validation failed |
1245
+
1246
+ ## Method Reference
1247
+
1248
+ ### Editor Methods
1249
+
1250
+ | Method | Parameters | Returns | Description |
1251
+ |--------|------------|---------|-------------|
1252
+ | `focus()` | - | `void` | Focus the editor |
1253
+ | `blur()` | - | `void` | Blur the editor |
1254
+ | `getContent(format?)` | `format?: 'html' \| 'json'` | `string \| object` | Get editor content |
1255
+ | `setContent(content, emitUpdate?)` | `content: string, emitUpdate?: boolean` | `void` | Set editor content |
1256
+ | `executeCommand(command, options?)` | `command: string, options?: any` | `void` | Execute editor command |
1257
+
1258
+ ### Upload Manager Methods
1259
+
1260
+ | Method | Parameters | Returns | Description |
1261
+ |--------|------------|---------|-------------|
1262
+ | `registerAdapter(adapter)` | `adapter: UploadAdapter` | `void` | Register upload adapter |
1263
+ | `setDefaultAdapter(name)` | `name: string` | `void` | Set default adapter |
1264
+ | `upload(file, options?)` | `file: File, options?: any` | `Promise<UploadResult>` | Upload file |
1265
+ | `uploadWithAdapter(name, file, options?)` | `name: string, file: File, options?: any` | `Promise<UploadResult>` | Upload with specific adapter |
1266
+ | `cancelUpload(uploadId)` | `uploadId: string` | `Promise<void>` | Cancel upload |
1267
+ | `getStats()` | - | `object` | Get upload statistics |
1268
+ | `destroy()` | - | `void` | Cleanup resources |
1269
+
1270
+ ## Best Practices
1271
+
1272
+ ### Performance Optimization
1273
+
1274
+ 1. **Lazy Load Components**: Import components only when needed
1275
+ 2. **Optimize Images**: Use appropriate image sizes and formats
1276
+ 3. **Debounce Auto-save**: Use reasonable auto-save intervals
1277
+ 4. **Limit Content Length**: Set appropriate content limits
1278
+ 5. **Use Production Builds**: Always use minified builds in production
1279
+
1280
+ ### Accessibility
1281
+
1282
+ 1. **Keyboard Navigation**: Ensure all features are keyboard accessible
1283
+ 2. **Screen Reader Support**: Use proper ARIA labels and descriptions
1284
+ 3. **Color Contrast**: Maintain sufficient color contrast ratios
1285
+ 4. **Focus Management**: Provide clear focus indicators
1286
+ 5. **Alternative Text**: Always provide alt text for images
1287
+
1288
+ ### Security
1289
+
1290
+ 1. **Sanitize Content**: Always sanitize HTML content on the server
1291
+ 2. **Validate Uploads**: Implement proper file validation
1292
+ 3. **HTTPS Only**: Use HTTPS for all upload endpoints
1293
+ 4. **Authentication**: Secure upload endpoints with proper authentication
1294
+ 5. **Content Security Policy**: Implement appropriate CSP headers
1295
+
1296
+ ### Error Handling
1297
+
1298
+ 1. **Graceful Degradation**: Handle missing dependencies gracefully
1299
+ 2. **User-Friendly Messages**: Show clear error messages to users
1300
+ 3. **Retry Logic**: Implement retry logic for failed operations
1301
+ 4. **Logging**: Log errors for debugging purposes
1302
+ 5. **Fallback Options**: Provide fallback options when features fail
1303
+
1304
+ ## Troubleshooting
1305
+
1306
+ ### Common Issues
1307
+
1308
+ #### Editor Not Loading
1309
+
1310
+ **Symptoms**: Editor shows loading state indefinitely or displays error message.
1311
+
1312
+ **Solutions**:
1313
+ 1. Check if all required dependencies are installed
1314
+ 2. Verify Vue Composition API is properly configured
1315
+ 3. Check browser console for error messages
1316
+ 4. Use DiagnosticTool component to identify issues
1317
+
1318
+ #### Upload Not Working
1319
+
1320
+ **Symptoms**: File uploads fail or don't start.
1321
+
1322
+ **Solutions**:
1323
+ 1. Verify upload handler is properly configured
1324
+ 2. Check file size and type restrictions
1325
+ 3. Ensure upload endpoint is accessible
1326
+ 4. Check network connectivity and CORS settings
1327
+
1328
+ #### Styling Issues
1329
+
1330
+ **Symptoms**: Editor appearance is broken or inconsistent.
1331
+
1332
+ **Solutions**:
1333
+ 1. Ensure CSS files are properly imported
1334
+ 2. Check for CSS conflicts with existing styles
1335
+ 3. Verify theme configuration is correct
1336
+ 4. Use browser developer tools to inspect styles
1337
+
1338
+ #### Performance Issues
1339
+
1340
+ **Symptoms**: Editor is slow or unresponsive.
1341
+
1342
+ **Solutions**:
1343
+ 1. Reduce auto-save frequency
1344
+ 2. Limit content length
1345
+ 3. Optimize images and media
1346
+ 4. Check for memory leaks
1347
+ 5. Use production builds
1348
+
1349
+ ### Debug Mode
1350
+
1351
+ Enable debug mode for detailed logging:
1352
+
1353
+ ```vue
1354
+ <template>
1355
+ <PremiumBblEditor
1356
+ v-model="content"
1357
+ :debug="true"
1358
+ />
1359
+ </template>
1360
+ ```
1361
+
1362
+ ### Diagnostic Tools
1363
+
1364
+ Use built-in diagnostic tools:
1365
+
1366
+ ```vue
1367
+ <template>
1368
+ <div>
1369
+ <PremiumBblEditor v-model="content" />
1370
+ <DiagnosticTool v-if="isDevelopment" />
1371
+ <DebugHelper v-if="isDevelopment" />
1372
+ </div>
1373
+ </template>
1374
+ ```
1375
+
1376
+ ### Getting Help
1377
+
1378
+ 1. **Check Documentation**: Review this documentation and examples
1379
+ 2. **Search Issues**: Search existing GitHub issues
1380
+ 3. **Create Issue**: Create a new issue with detailed information
1381
+ 4. **Community Support**: Ask questions in community forums
1382
+ 5. **Professional Support**: Contact for professional support options
1383
+
1384
+ ---
1385
+
1386
+ This documentation covers all aspects of the Vue2 Premium BBL Editor package. For additional examples and advanced usage patterns, see the [Component Usage Guide](COMPONENT_USAGE_GUIDE.md) and [External Integration Guide](EXTERNAL_INTEGRATION_GUIDE.md).