@editora/plugins 1.0.0 → 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 +147 -110
- package/dist/documentManager-BGlu3WRB.js +317 -0
- package/dist/documentManager-CYC9totK.mjs +37581 -0
- package/dist/index-BbORIHoM.mjs +11763 -0
- package/dist/index-C-OCBS_6.js +3753 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-5sLJVO9i.js → index.es-B-to-4j4.js} +5 -5
- package/dist/{index.es-L0NTmDPl.mjs → index.es-BbXJ7tyO.mjs} +1 -1
- package/dist/index.esm.js +49 -70
- package/dist/plugins.css +1 -1
- package/package.json +18 -6
- package/dist/documentManager-By_jb4HX.js +0 -2
- package/dist/documentManager-DgU7aG0G.mjs +0 -77
- package/dist/index-560-K8WX.mjs +0 -61454
- package/dist/index-CGbrgpa_.js +0 -1969
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
BoldPlugin,
|
|
83
|
+
ItalicPlugin,
|
|
84
|
+
UnderlinePlugin,
|
|
85
|
+
StrikethroughPlugin
|
|
77
86
|
} from '@editora/plugins';
|
|
78
87
|
|
|
79
88
|
const plugins = [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
BoldPlugin,
|
|
102
|
+
ItalicPlugin,
|
|
103
|
+
UnderlinePlugin,
|
|
104
|
+
FontFamilyPlugin,
|
|
105
|
+
FontSizePlugin,
|
|
106
|
+
TextColorPlugin,
|
|
107
|
+
BackgroundColorPlugin,
|
|
108
|
+
|
|
100
109
|
// Block elements
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
HeadingPlugin,
|
|
111
|
+
BlockquotePlugin,
|
|
112
|
+
CodeSamplePlugin,
|
|
113
|
+
|
|
106
114
|
// Lists
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
ListPlugin,
|
|
116
|
+
ChecklistPlugin,
|
|
117
|
+
IndentPlugin,
|
|
118
|
+
TextAlignmentPlugin,
|
|
119
|
+
|
|
112
120
|
// Media
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
LinkPlugin,
|
|
122
|
+
TablePlugin,
|
|
123
|
+
MediaManagerPlugin,
|
|
124
|
+
|
|
117
125
|
// Advanced
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
MathPlugin,
|
|
127
|
+
CommentsPlugin,
|
|
128
|
+
HistoryPlugin,
|
|
129
|
+
FullscreenPlugin,
|
|
130
|
+
DocumentManagerPlugin
|
|
123
131
|
} from '@editora/plugins';
|
|
124
132
|
|
|
125
133
|
const plugins = [
|
|
126
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
466
|
+
FullscreenPlugin(options?: {
|
|
429
467
|
keyboard?: string; // Default: 'F11'
|
|
430
468
|
onEnter?: () => void;
|
|
431
469
|
onExit?: () => void;
|
|
@@ -438,30 +476,29 @@ createFullscreenPlugin(options?: {
|
|
|
438
476
|
|
|
439
477
|
```typescript
|
|
440
478
|
import {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
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
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
createImagePlugin({
|
|
491
|
+
BoldPlugin(),
|
|
492
|
+
ItalicPlugin(),
|
|
493
|
+
HeadingPlugin({ levels: [1, 2, 3] }),
|
|
494
|
+
LinkPlugin({ targetBlank: true }),
|
|
495
|
+
ImagePlugin({
|
|
459
496
|
upload: uploadImage,
|
|
460
497
|
maxSize: 2 * 1024 * 1024
|
|
461
498
|
}),
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
499
|
+
ListPlugin(),
|
|
500
|
+
BlockquotePlugin(),
|
|
501
|
+
HistoryPlugin()
|
|
465
502
|
];
|
|
466
503
|
```
|
|
467
504
|
|
|
@@ -469,23 +506,23 @@ const blogPlugins = [
|
|
|
469
506
|
|
|
470
507
|
```typescript
|
|
471
508
|
import {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
509
|
+
BoldPlugin,
|
|
510
|
+
ItalicPlugin,
|
|
511
|
+
CodePlugin,
|
|
512
|
+
CodeSamplePlugin,
|
|
513
|
+
HeadingPlugin,
|
|
514
|
+
TablePlugin,
|
|
515
|
+
LinkPlugin,
|
|
516
|
+
AnchorPlugin,
|
|
517
|
+
MathPlugin,
|
|
518
|
+
HistoryPlugin
|
|
482
519
|
} from '@editora/plugins';
|
|
483
520
|
|
|
484
521
|
const docsPlugins = [
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
522
|
+
BoldPlugin(),
|
|
523
|
+
ItalicPlugin(),
|
|
524
|
+
CodePlugin(),
|
|
525
|
+
CodeSamplePlugin({
|
|
489
526
|
languages: [
|
|
490
527
|
{ name: 'JavaScript', value: 'javascript' },
|
|
491
528
|
{ name: 'TypeScript', value: 'typescript' },
|
|
@@ -493,12 +530,12 @@ const docsPlugins = [
|
|
|
493
530
|
],
|
|
494
531
|
lineNumbers: true
|
|
495
532
|
}),
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
533
|
+
HeadingPlugin(),
|
|
534
|
+
TablePlugin({ headerRow: true }),
|
|
535
|
+
LinkPlugin(),
|
|
536
|
+
AnchorPlugin(),
|
|
537
|
+
MathPlugin({ engine: 'katex' }),
|
|
538
|
+
HistoryPlugin()
|
|
502
539
|
];
|
|
503
540
|
```
|
|
504
541
|
|
|
@@ -506,17 +543,17 @@ const docsPlugins = [
|
|
|
506
543
|
|
|
507
544
|
```typescript
|
|
508
545
|
import {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
546
|
+
BoldPlugin,
|
|
547
|
+
ItalicPlugin,
|
|
548
|
+
CommentsPlugin,
|
|
549
|
+
HistoryPlugin,
|
|
550
|
+
MergeTagPlugin
|
|
514
551
|
} from '@editora/plugins';
|
|
515
552
|
|
|
516
553
|
const collaborativePlugins = [
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
554
|
+
BoldPlugin(),
|
|
555
|
+
ItalicPlugin(),
|
|
556
|
+
CommentsPlugin({
|
|
520
557
|
onCommentAdd: async (comment) => {
|
|
521
558
|
await saveComment(comment);
|
|
522
559
|
},
|
|
@@ -524,14 +561,14 @@ const collaborativePlugins = [
|
|
|
524
561
|
await resolveComment(commentId);
|
|
525
562
|
}
|
|
526
563
|
}),
|
|
527
|
-
|
|
564
|
+
MergeTagPlugin({
|
|
528
565
|
tags: [
|
|
529
566
|
{ label: 'First Name', value: '{{firstName}}' },
|
|
530
567
|
{ label: 'Last Name', value: '{{lastName}}' },
|
|
531
568
|
{ label: 'Email', value: '{{email}}' }
|
|
532
569
|
]
|
|
533
570
|
}),
|
|
534
|
-
|
|
571
|
+
HistoryPlugin()
|
|
535
572
|
];
|
|
536
573
|
```
|
|
537
574
|
|