@editora/plugins 1.0.1 → 1.0.2

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
@@ -1,5 +1,14 @@
1
1
  # @editora/plugins
2
2
 
3
+ <div align="center">
4
+ <img src="../../images/editora_logo_blocks.svg" alt="Editora Logo" width="200" height="auto">
5
+ </div>
6
+
7
+ <div align="center">
8
+ <img src="../../images/features-overview-7.png" alt="Editora Plugins - Plugin Architecture" width="600" style="border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);">
9
+ <p><em>Comprehensive plugin collection with 40+ plugins for rich text editing</em></p>
10
+ </div>
11
+
3
12
  Comprehensive plugin collection for Editora Rich Text Editor with 40+ plugins for text formatting, media management, accessibility, and more.
4
13
 
5
14
  ## 📦 Installation
@@ -70,17 +79,17 @@ This package provides a complete set of plugins for building feature-rich text e
70
79
 
71
80
  ```typescript
72
81
  import {
73
- createBoldPlugin,
74
- createItalicPlugin,
75
- createUnderlinePlugin,
76
- createStrikethroughPlugin
82
+ BoldPlugin,
83
+ ItalicPlugin,
84
+ UnderlinePlugin,
85
+ StrikethroughPlugin
77
86
  } from '@editora/plugins';
78
87
 
79
88
  const plugins = [
80
- createBoldPlugin(),
81
- createItalicPlugin(),
82
- createUnderlinePlugin(),
83
- createStrikethroughPlugin()
89
+ BoldPlugin(),
90
+ ItalicPlugin(),
91
+ UnderlinePlugin(),
92
+ StrikethroughPlugin()
84
93
  ];
85
94
  ```
86
95
 
@@ -89,41 +98,70 @@ const plugins = [
89
98
  ```typescript
90
99
  import {
91
100
  // Text formatting
92
- createBoldPlugin,
93
- createItalicPlugin,
94
- createUnderlinePlugin,
95
- createFontFamilyPlugin,
96
- createFontSizePlugin,
97
- createTextColorPlugin,
98
- createBackgroundColorPlugin,
99
-
101
+ BoldPlugin,
102
+ ItalicPlugin,
103
+ UnderlinePlugin,
104
+ FontFamilyPlugin,
105
+ FontSizePlugin,
106
+ TextColorPlugin,
107
+ BackgroundColorPlugin,
108
+
100
109
  // Block elements
101
- createHeadingPlugin,
102
- createParagraphPlugin,
103
- createBlockquotePlugin,
104
- createCodeSamplePlugin,
105
-
110
+ HeadingPlugin,
111
+ BlockquotePlugin,
112
+ CodeSamplePlugin,
113
+
106
114
  // Lists
107
- createListPlugin,
108
- createChecklistPlugin,
109
- createIndentPlugin,
110
- createTextAlignmentPlugin,
111
-
115
+ ListPlugin,
116
+ ChecklistPlugin,
117
+ IndentPlugin,
118
+ TextAlignmentPlugin,
119
+
112
120
  // Media
113
- createImagePlugin,
114
- createLinkPlugin,
115
- createTablePlugin,
116
-
121
+ LinkPlugin,
122
+ TablePlugin,
123
+ MediaManagerPlugin,
124
+
117
125
  // Advanced
118
- createMathPlugin,
119
- createCommentsPlugin,
120
- createHistoryPlugin,
121
- createFullscreenPlugin,
122
- createDocumentManagerPlugin
126
+ MathPlugin,
127
+ CommentsPlugin,
128
+ HistoryPlugin,
129
+ FullscreenPlugin,
130
+ DocumentManagerPlugin
123
131
  } from '@editora/plugins';
124
132
 
125
133
  const plugins = [
126
- // ... initialize all plugins
134
+ // Text formatting
135
+ BoldPlugin(),
136
+ ItalicPlugin(),
137
+ UnderlinePlugin(),
138
+ FontFamilyPlugin(),
139
+ FontSizePlugin(),
140
+ TextColorPlugin(),
141
+ BackgroundColorPlugin(),
142
+
143
+ // Block elements
144
+ HeadingPlugin(),
145
+ BlockquotePlugin(),
146
+ CodeSamplePlugin(),
147
+
148
+ // Lists
149
+ ListPlugin(),
150
+ ChecklistPlugin(),
151
+ IndentPlugin(),
152
+ TextAlignmentPlugin(),
153
+
154
+ // Media
155
+ LinkPlugin(),
156
+ TablePlugin(),
157
+ MediaManagerPlugin(),
158
+
159
+ // Advanced
160
+ MathPlugin(),
161
+ CommentsPlugin(),
162
+ HistoryPlugin(),
163
+ FullscreenPlugin(),
164
+ DocumentManagerPlugin()
127
165
  ];
128
166
  ```
129
167
 
@@ -133,7 +171,7 @@ const plugins = [
133
171
 
134
172
  #### Bold Plugin
135
173
  ```typescript
136
- createBoldPlugin(options?: {
174
+ BoldPlugin(options?: {
137
175
  keyboard?: string; // Default: 'Mod-b'
138
176
  icon?: ReactNode;
139
177
  className?: string;
@@ -142,7 +180,7 @@ createBoldPlugin(options?: {
142
180
 
143
181
  #### Font Family Plugin
144
182
  ```typescript
145
- createFontFamilyPlugin(options?: {
183
+ FontFamilyPlugin(options?: {
146
184
  fonts?: Array<{
147
185
  name: string;
148
186
  value: string;
@@ -152,7 +190,7 @@ createFontFamilyPlugin(options?: {
152
190
  })
153
191
 
154
192
  // Example
155
- const fontFamilyPlugin = createFontFamilyPlugin({
193
+ const fontFamilyPlugin = FontFamilyPlugin({
156
194
  fonts: [
157
195
  { name: 'Arial', value: 'Arial, sans-serif' },
158
196
  { name: 'Times New Roman', value: 'Times New Roman, serif' },
@@ -163,7 +201,7 @@ const fontFamilyPlugin = createFontFamilyPlugin({
163
201
 
164
202
  #### Font Size Plugin
165
203
  ```typescript
166
- createFontSizePlugin(options?: {
204
+ FontSizePlugin(options?: {
167
205
  sizes?: string[]; // Default: ['8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt']
168
206
  defaultSize?: string;
169
207
  })
@@ -171,7 +209,7 @@ createFontSizePlugin(options?: {
171
209
 
172
210
  #### Text Color Plugin
173
211
  ```typescript
174
- createTextColorPlugin(options?: {
212
+ TextColorPlugin(options?: {
175
213
  colors?: string[];
176
214
  customColors?: boolean;
177
215
  recentColors?: boolean;
@@ -182,14 +220,14 @@ createTextColorPlugin(options?: {
182
220
 
183
221
  #### Heading Plugin
184
222
  ```typescript
185
- createHeadingPlugin(options?: {
223
+ HeadingPlugin(options?: {
186
224
  levels?: number[]; // Default: [1, 2, 3, 4, 5, 6]
187
225
  defaultLevel?: number;
188
226
  keyboard?: Record<number, string>;
189
227
  })
190
228
 
191
229
  // Example
192
- const headingPlugin = createHeadingPlugin({
230
+ const headingPlugin = HeadingPlugin({
193
231
  levels: [1, 2, 3],
194
232
  keyboard: {
195
233
  1: 'Mod-Alt-1',
@@ -201,7 +239,7 @@ const headingPlugin = createHeadingPlugin({
201
239
 
202
240
  #### Code Sample Plugin
203
241
  ```typescript
204
- createCodeSamplePlugin(options?: {
242
+ CodeSamplePlugin(options?: {
205
243
  languages?: Array<{
206
244
  name: string;
207
245
  value: string;
@@ -212,7 +250,7 @@ createCodeSamplePlugin(options?: {
212
250
  })
213
251
 
214
252
  // Example
215
- const codeSamplePlugin = createCodeSamplePlugin({
253
+ const codeSamplePlugin = CodeSamplePlugin({
216
254
  languages: [
217
255
  { name: 'JavaScript', value: 'javascript' },
218
256
  { name: 'TypeScript', value: 'typescript' },
@@ -229,7 +267,7 @@ const codeSamplePlugin = createCodeSamplePlugin({
229
267
 
230
268
  #### List Plugin
231
269
  ```typescript
232
- createListPlugin(options?: {
270
+ ListPlugin(options?: {
233
271
  bulletList?: boolean;
234
272
  orderedList?: boolean;
235
273
  keyboard?: {
@@ -241,7 +279,7 @@ createListPlugin(options?: {
241
279
 
242
280
  #### Checklist Plugin
243
281
  ```typescript
244
- createChecklistPlugin(options?: {
282
+ ChecklistPlugin(options?: {
245
283
  nested?: boolean;
246
284
  keyboard?: string;
247
285
  })
@@ -251,7 +289,7 @@ createChecklistPlugin(options?: {
251
289
 
252
290
  #### Image Plugin
253
291
  ```typescript
254
- createImagePlugin(options: {
292
+ ImagePlugin(options: {
255
293
  upload: (file: File) => Promise<string>;
256
294
  validate?: (file: File) => boolean;
257
295
  maxSize?: number; // bytes
@@ -263,7 +301,7 @@ createImagePlugin(options: {
263
301
  })
264
302
 
265
303
  // Example
266
- const imagePlugin = createImagePlugin({
304
+ const imagePlugin = ImagePlugin({
267
305
  upload: async (file) => {
268
306
  const formData = new FormData();
269
307
  formData.append('image', file);
@@ -284,7 +322,7 @@ const imagePlugin = createImagePlugin({
284
322
 
285
323
  #### Link Plugin
286
324
  ```typescript
287
- createLinkPlugin(options?: {
325
+ LinkPlugin(options?: {
288
326
  openOnClick?: boolean;
289
327
  validate?: (url: string) => boolean;
290
328
  onLinkClick?: (url: string) => void;
@@ -293,7 +331,7 @@ createLinkPlugin(options?: {
293
331
  })
294
332
 
295
333
  // Example
296
- const linkPlugin = createLinkPlugin({
334
+ const linkPlugin = LinkPlugin({
297
335
  openOnClick: false,
298
336
  validate: (url) => {
299
337
  return url.startsWith('http://') || url.startsWith('https://');
@@ -309,7 +347,7 @@ const linkPlugin = createLinkPlugin({
309
347
 
310
348
  #### Table Plugin
311
349
  ```typescript
312
- createTablePlugin(options?: {
350
+ TablePlugin(options?: {
313
351
  allowResize?: boolean;
314
352
  defaultRows?: number;
315
353
  defaultCols?: number;
@@ -320,7 +358,7 @@ createTablePlugin(options?: {
320
358
  })
321
359
 
322
360
  // Example
323
- const tablePlugin = createTablePlugin({
361
+ const tablePlugin = TablePlugin({
324
362
  allowResize: true,
325
363
  defaultRows: 3,
326
364
  defaultCols: 3,
@@ -333,7 +371,7 @@ const tablePlugin = createTablePlugin({
333
371
 
334
372
  #### Math Plugin
335
373
  ```typescript
336
- createMathPlugin(options?: {
374
+ MathPlugin(options?: {
337
375
  engine?: 'katex' | 'mathjax';
338
376
  inline?: boolean;
339
377
  display?: boolean;
@@ -341,7 +379,7 @@ createMathPlugin(options?: {
341
379
  })
342
380
 
343
381
  // Example
344
- const mathPlugin = createMathPlugin({
382
+ const mathPlugin = MathPlugin({
345
383
  engine: 'katex',
346
384
  inline: true,
347
385
  display: true,
@@ -354,7 +392,7 @@ const mathPlugin = createMathPlugin({
354
392
 
355
393
  #### Comments Plugin
356
394
  ```typescript
357
- createCommentsPlugin(options?: {
395
+ CommentsPlugin(options?: {
358
396
  onCommentAdd?: (comment: Comment) => void;
359
397
  onCommentEdit?: (comment: Comment) => void;
360
398
  onCommentDelete?: (commentId: string) => void;
@@ -365,7 +403,7 @@ createCommentsPlugin(options?: {
365
403
 
366
404
  #### Document Manager Plugin
367
405
  ```typescript
368
- createDocumentManagerPlugin(options?: {
406
+ DocumentManagerPlugin(options?: {
369
407
  export?: {
370
408
  word?: boolean;
371
409
  pdf?: boolean;
@@ -381,7 +419,7 @@ createDocumentManagerPlugin(options?: {
381
419
  })
382
420
 
383
421
  // Example
384
- const documentManagerPlugin = createDocumentManagerPlugin({
422
+ const documentManagerPlugin = DocumentManagerPlugin({
385
423
  export: {
386
424
  word: true,
387
425
  pdf: true,
@@ -393,7 +431,7 @@ const documentManagerPlugin = createDocumentManagerPlugin({
393
431
 
394
432
  #### Spell Check Plugin
395
433
  ```typescript
396
- createSpellCheckPlugin(options?: {
434
+ SpellCheckPlugin(options?: {
397
435
  language?: string; // Default: 'en-US'
398
436
  customDictionary?: string[];
399
437
  ignoreUppercase?: boolean;
@@ -403,7 +441,7 @@ createSpellCheckPlugin(options?: {
403
441
 
404
442
  #### Accessibility Checker Plugin
405
443
  ```typescript
406
- createA11yCheckerPlugin(options?: {
444
+ A11yCheckerPlugin(options?: {
407
445
  rules?: string[];
408
446
  autoCheck?: boolean;
409
447
  severity?: 'error' | 'warning' | 'info';
@@ -414,7 +452,7 @@ createA11yCheckerPlugin(options?: {
414
452
 
415
453
  #### History Plugin
416
454
  ```typescript
417
- createHistoryPlugin(options?: {
455
+ HistoryPlugin(options?: {
418
456
  depth?: number; // Default: 100
419
457
  keyboard?: {
420
458
  undo?: string; // Default: 'Mod-z'
@@ -425,7 +463,7 @@ createHistoryPlugin(options?: {
425
463
 
426
464
  #### Fullscreen Plugin
427
465
  ```typescript
428
- createFullscreenPlugin(options?: {
466
+ FullscreenPlugin(options?: {
429
467
  keyboard?: string; // Default: 'F11'
430
468
  onEnter?: () => void;
431
469
  onExit?: () => void;
@@ -438,29 +476,29 @@ createFullscreenPlugin(options?: {
438
476
 
439
477
  ```typescript
440
478
  import {
441
- createBoldPlugin,
442
- createItalicPlugin,
443
- createHeadingPlugin,
444
- createParagraphPlugin,
445
- createLinkPlugin,
446
- createImagePlugin,
447
- createListPlugin,
448
- createBlockquotePlugin,
449
- createHistoryPlugin
479
+ BoldPlugin,
480
+ ItalicPlugin,
481
+ HeadingPlugin,
482
+ ParagraphPlugin,
483
+ LinkPlugin,
484
+ ImagePlugin,
485
+ ListPlugin,
486
+ BlockquotePlugin,
487
+ HistoryPlugin
450
488
  } from '@editora/plugins';
451
489
 
452
490
  const blogPlugins = [
453
- createBoldPlugin(),
454
- createItalicPlugin(),
455
- createHeadingPlugin({ levels: [1, 2, 3] }),
456
- createLinkPlugin({ targetBlank: true }),
457
- createImagePlugin({
491
+ BoldPlugin(),
492
+ ItalicPlugin(),
493
+ HeadingPlugin({ levels: [1, 2, 3] }),
494
+ LinkPlugin({ targetBlank: true }),
495
+ ImagePlugin({
458
496
  upload: uploadImage,
459
497
  maxSize: 2 * 1024 * 1024
460
498
  }),
461
- createListPlugin(),
462
- createBlockquotePlugin(),
463
- createHistoryPlugin()
499
+ ListPlugin(),
500
+ BlockquotePlugin(),
501
+ HistoryPlugin()
464
502
  ];
465
503
  ```
466
504
 
@@ -468,23 +506,23 @@ const blogPlugins = [
468
506
 
469
507
  ```typescript
470
508
  import {
471
- createBoldPlugin,
472
- createItalicPlugin,
473
- createCodePlugin,
474
- createCodeSamplePlugin,
475
- createHeadingPlugin,
476
- createTablePlugin,
477
- createLinkPlugin,
478
- createAnchorPlugin,
479
- createMathPlugin,
480
- createHistoryPlugin
509
+ BoldPlugin,
510
+ ItalicPlugin,
511
+ CodePlugin,
512
+ CodeSamplePlugin,
513
+ HeadingPlugin,
514
+ TablePlugin,
515
+ LinkPlugin,
516
+ AnchorPlugin,
517
+ MathPlugin,
518
+ HistoryPlugin
481
519
  } from '@editora/plugins';
482
520
 
483
521
  const docsPlugins = [
484
- createBoldPlugin(),
485
- createItalicPlugin(),
486
- createCodePlugin(),
487
- createCodeSamplePlugin({
522
+ BoldPlugin(),
523
+ ItalicPlugin(),
524
+ CodePlugin(),
525
+ CodeSamplePlugin({
488
526
  languages: [
489
527
  { name: 'JavaScript', value: 'javascript' },
490
528
  { name: 'TypeScript', value: 'typescript' },
@@ -492,12 +530,12 @@ const docsPlugins = [
492
530
  ],
493
531
  lineNumbers: true
494
532
  }),
495
- createHeadingPlugin(),
496
- createTablePlugin({ headerRow: true }),
497
- createLinkPlugin(),
498
- createAnchorPlugin(),
499
- createMathPlugin({ engine: 'katex' }),
500
- createHistoryPlugin()
533
+ HeadingPlugin(),
534
+ TablePlugin({ headerRow: true }),
535
+ LinkPlugin(),
536
+ AnchorPlugin(),
537
+ MathPlugin({ engine: 'katex' }),
538
+ HistoryPlugin()
501
539
  ];
502
540
  ```
503
541
 
@@ -505,17 +543,17 @@ const docsPlugins = [
505
543
 
506
544
  ```typescript
507
545
  import {
508
- createBoldPlugin,
509
- createItalicPlugin,
510
- createCommentsPlugin,
511
- createHistoryPlugin,
512
- createMergeTagPlugin
546
+ BoldPlugin,
547
+ ItalicPlugin,
548
+ CommentsPlugin,
549
+ HistoryPlugin,
550
+ MergeTagPlugin
513
551
  } from '@editora/plugins';
514
552
 
515
553
  const collaborativePlugins = [
516
- createBoldPlugin(),
517
- createItalicPlugin(),
518
- createCommentsPlugin({
554
+ BoldPlugin(),
555
+ ItalicPlugin(),
556
+ CommentsPlugin({
519
557
  onCommentAdd: async (comment) => {
520
558
  await saveComment(comment);
521
559
  },
@@ -523,14 +561,14 @@ const collaborativePlugins = [
523
561
  await resolveComment(commentId);
524
562
  }
525
563
  }),
526
- createMergeTagPlugin({
564
+ MergeTagPlugin({
527
565
  tags: [
528
566
  { label: 'First Name', value: '{{firstName}}' },
529
567
  { label: 'Last Name', value: '{{lastName}}' },
530
568
  { label: 'Email', value: '{{email}}' }
531
569
  ]
532
570
  }),
533
- createHistoryPlugin()
571
+ HistoryPlugin()
534
572
  ];
535
573
  ```
536
574