ckeditor5-livewire 1.7.0 → 1.9.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.
- package/bundler/vite-ckeditor5-externalize.ts +15 -4
- package/dist/bundler/vite-ckeditor5-externalize.cjs +2 -2
- package/dist/bundler/vite-ckeditor5-externalize.cjs.map +1 -1
- package/dist/bundler/vite-ckeditor5-externalize.d.ts.map +1 -1
- package/dist/bundler/vite-ckeditor5-externalize.mjs +37 -37
- package/dist/bundler/vite-ckeditor5-externalize.mjs.map +1 -1
- package/dist/hooks/context/context.d.ts.map +1 -1
- package/dist/hooks/editable.d.ts +18 -6
- package/dist/hooks/editable.d.ts.map +1 -1
- package/dist/hooks/editor/editor.d.ts +14 -0
- package/dist/hooks/editor/editor.d.ts.map +1 -1
- package/dist/hooks/editor/plugins/livewire-sync.d.ts.map +1 -1
- package/dist/hooks/editor/plugins/sync-editor-with-input.d.ts.map +1 -1
- package/dist/hooks/editor/utils/index.d.ts +0 -1
- package/dist/hooks/editor/utils/index.d.ts.map +1 -1
- package/dist/hooks/editor/utils/load-editor-translations.d.ts.map +1 -1
- package/dist/hooks/hook.d.ts.map +1 -1
- package/dist/hooks/utils/index.d.ts +3 -0
- package/dist/hooks/utils/index.d.ts.map +1 -0
- package/dist/hooks/utils/is-wire-model-connected.d.ts +8 -0
- package/dist/hooks/utils/is-wire-model-connected.d.ts.map +1 -0
- package/dist/hooks/utils/root-attributes-updater.d.ts +16 -0
- package/dist/hooks/utils/root-attributes-updater.d.ts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +921 -1328
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
- package/src/hooks/context/context.ts +1 -0
- package/src/hooks/editable.test.ts +103 -0
- package/src/hooks/editable.ts +75 -32
- package/src/hooks/editor/editor.test.ts +77 -9
- package/src/hooks/editor/editor.ts +33 -1
- package/src/hooks/editor/plugins/livewire-sync.ts +30 -4
- package/src/hooks/editor/plugins/sync-editor-with-input.ts +1 -0
- package/src/hooks/editor/utils/index.ts +0 -1
- package/src/hooks/editor/utils/load-editor-plugins.ts +2 -2
- package/src/hooks/editor/utils/load-editor-translations.ts +16 -12
- package/src/hooks/hook.ts +1 -0
- package/src/hooks/ui-part.ts +1 -1
- package/src/hooks/utils/index.ts +2 -0
- package/src/hooks/{editor/utils → utils}/is-wire-model-connected.test.ts +2 -1
- package/src/hooks/{editor/utils → utils}/is-wire-model-connected.ts +6 -0
- package/src/hooks/utils/root-attributes-updater.ts +46 -0
- package/dist/hooks/editor/utils/is-wire-model-connected.d.ts +0 -2
- package/dist/hooks/editor/utils/is-wire-model-connected.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,1333 +1,926 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
translations: y
|
|
868
|
-
}
|
|
869
|
-
}), h.on("itemError", (...I) => {
|
|
870
|
-
console.error("Context item error:", ...I);
|
|
871
|
-
}), h;
|
|
872
|
-
})();
|
|
873
|
-
const T = await this.contextPromise;
|
|
874
|
-
this.isBeingDestroyed() || g.the.register(t, T);
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Destroys the context component. Unmounts root from the editor.
|
|
878
|
-
*/
|
|
879
|
-
async destroyed() {
|
|
880
|
-
const { contextId: t } = this.canonical;
|
|
881
|
-
this.element.style.display = "none";
|
|
882
|
-
try {
|
|
883
|
-
await (await this.contextPromise)?.destroy();
|
|
884
|
-
} finally {
|
|
885
|
-
this.contextPromise = null, g.the.hasItem(t) && g.the.unregister(t);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
class d extends V {
|
|
890
|
-
static the = new d();
|
|
891
|
-
}
|
|
892
|
-
class ct extends D {
|
|
893
|
-
/**
|
|
894
|
-
* The promise that resolves when the editable is mounted.
|
|
895
|
-
*/
|
|
896
|
-
editorPromise = null;
|
|
897
|
-
/**
|
|
898
|
-
* Pending content to apply when the editor loses focus.
|
|
899
|
-
*/
|
|
900
|
-
pendingContent = null;
|
|
901
|
-
/**
|
|
902
|
-
* Mounts the editable component.
|
|
903
|
-
*/
|
|
904
|
-
mounted() {
|
|
905
|
-
const { editorId: t, rootName: e, content: r } = this.canonical;
|
|
906
|
-
this.editorPromise = d.the.execute(t, (n) => {
|
|
907
|
-
if (this.isBeingDestroyed())
|
|
908
|
-
return null;
|
|
909
|
-
const { ui: a, editing: o, model: s } = n;
|
|
910
|
-
if (s.document.getRoot(e)) {
|
|
911
|
-
if (r !== null) {
|
|
912
|
-
const c = n.getData({ rootName: e });
|
|
913
|
-
c && c !== r && n.setData({
|
|
914
|
-
[e]: r
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
} else {
|
|
918
|
-
n.addRoot(e, {
|
|
919
|
-
isUndoable: !1,
|
|
920
|
-
...r !== null && {
|
|
921
|
-
data: r
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
const c = this.element.querySelector("[data-cke-editable-content]"), u = a.view.createEditable(e, c);
|
|
925
|
-
a.addEditable(u), o.view.forceRender();
|
|
926
|
-
}
|
|
927
|
-
return this.syncTypingContentPush(n), this.setupPendingReceivedContentHandlers(n), n;
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
/**
|
|
931
|
-
* Setups the content sync from the editor to Livewire on user input with debounce.
|
|
932
|
-
*/
|
|
933
|
-
syncTypingContentPush(t) {
|
|
934
|
-
const { rootName: e, saveDebounceMs: r } = this.canonical, n = this.element.querySelector("input"), a = () => {
|
|
935
|
-
const s = t.getData({ rootName: e });
|
|
936
|
-
n && (n.value = s), this.$wire.set("content", s);
|
|
937
|
-
}, o = S(r, a);
|
|
938
|
-
t.model.document.on("change:data", o), a(), this.onBeforeDestroy(() => {
|
|
939
|
-
t.model.document.off("change:data", o);
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Sets up handlers that manage pending incoming content (clears pending
|
|
944
|
-
* content on user edits and applies pending content on blur).
|
|
945
|
-
*/
|
|
946
|
-
setupPendingReceivedContentHandlers(t) {
|
|
947
|
-
const { ui: e, model: r } = t, { focusTracker: n } = e, { rootName: a } = this.canonical, o = () => {
|
|
948
|
-
this.pendingContent = null;
|
|
949
|
-
}, s = () => {
|
|
950
|
-
!n.isFocused && this.pendingContent !== null && (t.setData({
|
|
951
|
-
[a]: this.pendingContent
|
|
952
|
-
}), this.pendingContent = null);
|
|
953
|
-
};
|
|
954
|
-
r.document.on("change:data", o), n.on("change:isFocused", s), this.onBeforeDestroy(() => {
|
|
955
|
-
r.document.off("change:data", o), n.off("change:isFocused", s);
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Applies canonical content to the editor while respecting focus/pending state.
|
|
960
|
-
*/
|
|
961
|
-
applyCanonicalContentToEditor(t) {
|
|
962
|
-
if (!B(this.element))
|
|
963
|
-
return;
|
|
964
|
-
const { content: e, rootName: r } = this.canonical, { ui: n } = t;
|
|
965
|
-
if (t.getData({ rootName: r }) !== (e ?? "")) {
|
|
966
|
-
if (n.focusTracker.isFocused) {
|
|
967
|
-
this.pendingContent = e ?? "";
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
t.setData({ [r]: e ?? "" });
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Called when the component is updated by Livewire.
|
|
975
|
-
*/
|
|
976
|
-
async afterCommitSynced() {
|
|
977
|
-
const t = await this.editorPromise;
|
|
978
|
-
this.applyCanonicalContentToEditor(t);
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Destroys the editable component. Unmounts root from the editor.
|
|
982
|
-
*/
|
|
983
|
-
async destroyed() {
|
|
984
|
-
const { rootName: t } = this.canonical;
|
|
985
|
-
this.element.style.display = "none";
|
|
986
|
-
const e = await this.editorPromise;
|
|
987
|
-
if (this.editorPromise = null, e && e.state !== "destroyed") {
|
|
988
|
-
const r = e.model.document.getRoot(t);
|
|
989
|
-
r && "detachEditable" in e && (e.detachEditable(r), e.detachRoot(t, !1));
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
async function ut({
|
|
994
|
-
saveDebounceMs: i,
|
|
995
|
-
component: t
|
|
996
|
-
}) {
|
|
997
|
-
const { Plugin: e } = await import("ckeditor5");
|
|
998
|
-
return class extends e {
|
|
999
|
-
/**
|
|
1000
|
-
* The name of the plugin.
|
|
1001
|
-
*/
|
|
1002
|
-
static get pluginName() {
|
|
1003
|
-
return "LivewireSync";
|
|
1004
|
-
}
|
|
1005
|
-
/**
|
|
1006
|
-
* Initializes the plugin.
|
|
1007
|
-
*/
|
|
1008
|
-
init() {
|
|
1009
|
-
this.setupTypingContentPush(), this.setupFocusableEventPush(), this.setupAfterCommitHandler(), this.setupSetEditorContentHandler(), this.setupReadyDispatch();
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Setups handler that updates the editor content after Livewire changes attributes
|
|
1013
|
-
* on the component and commits the changes, but only if the editor is not focused to prevent
|
|
1014
|
-
* disrupting the user while editing.
|
|
1015
|
-
*/
|
|
1016
|
-
setupAfterCommitHandler() {
|
|
1017
|
-
const { editor: n } = this, { model: a, ui: { focusTracker: o } } = n;
|
|
1018
|
-
let s = null;
|
|
1019
|
-
n.on("afterCommitSynced", () => {
|
|
1020
|
-
if (!B(t.element))
|
|
1021
|
-
return;
|
|
1022
|
-
const { content: c } = t.canonical, u = this.getEditorRootsValues();
|
|
1023
|
-
if (o.isFocused) {
|
|
1024
|
-
C(c, u) || (s = c);
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
C(c, u) || n.setData(c);
|
|
1028
|
-
}), a.document.on("change:data", () => {
|
|
1029
|
-
s = null;
|
|
1030
|
-
}), o.on("change:isFocused", () => {
|
|
1031
|
-
!o.isFocused && s !== null && (n.setData(s), s = null);
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Dispatches a Livewire event when the editor becomes ready.
|
|
1036
|
-
*
|
|
1037
|
-
* This allows the Livewire component or parent to react as soon as the
|
|
1038
|
-
* instance is fully initialized. The payload contains the editorId so the
|
|
1039
|
-
* listener can ignore events coming from other editors on the page.
|
|
1040
|
-
*/
|
|
1041
|
-
setupReadyDispatch() {
|
|
1042
|
-
const { $wire: n } = t;
|
|
1043
|
-
this.editor.once("ready", () => {
|
|
1044
|
-
n.dispatch("editor-ready", {
|
|
1045
|
-
editorId: t.canonical.editorId
|
|
1046
|
-
});
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Setups the content sync from Livewire to the editor when Livewire emits an event.
|
|
1051
|
-
*/
|
|
1052
|
-
setupSetEditorContentHandler() {
|
|
1053
|
-
Livewire.on("set-editor-content", ({ editorId: n, content: a }) => {
|
|
1054
|
-
if (n !== t.canonical.editorId)
|
|
1055
|
-
return;
|
|
1056
|
-
const o = this.getEditorRootsValues();
|
|
1057
|
-
C(o, a) || this.editor.setData(a);
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* Setups the content push event for the editor.
|
|
1062
|
-
*/
|
|
1063
|
-
setupTypingContentPush() {
|
|
1064
|
-
const { model: n } = this.editor, { $wire: a } = t, o = () => {
|
|
1065
|
-
const s = this.getEditorRootsValues();
|
|
1066
|
-
C(s, t.canonical.content ?? {}) || (a.set("content", s), a.dispatch("editor-content-changed", {
|
|
1067
|
-
editorId: t.canonical.editorId,
|
|
1068
|
-
content: s
|
|
1069
|
-
}));
|
|
1070
|
-
};
|
|
1071
|
-
n.document.on("change:data", S(i, o)), this.editor.once("ready", o);
|
|
1072
|
-
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Setups the event push for the editor.
|
|
1075
|
-
*/
|
|
1076
|
-
setupFocusableEventPush() {
|
|
1077
|
-
const { ui: n } = this.editor, { $wire: a } = t, o = () => {
|
|
1078
|
-
const s = this.getEditorRootsValues();
|
|
1079
|
-
a.set("focused", n.focusTracker.isFocused), C(s, t.canonical.content ?? {}) || a.set("content", s);
|
|
1080
|
-
};
|
|
1081
|
-
n.focusTracker.on("change:isFocused", o);
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Gets the current values of all editor roots.
|
|
1085
|
-
*/
|
|
1086
|
-
getEditorRootsValues() {
|
|
1087
|
-
return tt(this.editor);
|
|
1088
|
-
}
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
async function lt(i) {
|
|
1092
|
-
const { Plugin: t } = await import("ckeditor5");
|
|
1093
|
-
return class extends t {
|
|
1094
|
-
/**
|
|
1095
|
-
* The input element to synchronize with.
|
|
1096
|
-
*/
|
|
1097
|
-
input = null;
|
|
1098
|
-
/**
|
|
1099
|
-
* The form element reference for cleanup.
|
|
1100
|
-
*/
|
|
1101
|
-
form = null;
|
|
1102
|
-
/**
|
|
1103
|
-
* The name of the plugin.
|
|
1104
|
-
*/
|
|
1105
|
-
static get pluginName() {
|
|
1106
|
-
return "SyncEditorWithInput";
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Initializes the plugin.
|
|
1110
|
-
*/
|
|
1111
|
-
afterInit() {
|
|
1112
|
-
const { editor: r } = this, a = r.sourceElement.id.replace(/_editor$/, "");
|
|
1113
|
-
this.input = document.getElementById(`${a}_input`), this.input && (r.model.document.on("change:data", S(i, () => this.sync())), r.once("ready", this.sync), this.form = this.input.closest("form"), this.form?.addEventListener("submit", this.sync));
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* Synchronizes the editor's content with the input field.
|
|
1117
|
-
*/
|
|
1118
|
-
sync = () => {
|
|
1119
|
-
if (this.input) {
|
|
1120
|
-
const r = this.editor.getData();
|
|
1121
|
-
this.input.value = r, this.input.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
1122
|
-
}
|
|
1123
|
-
};
|
|
1124
|
-
/**
|
|
1125
|
-
* Destroys the plugin.
|
|
1126
|
-
*/
|
|
1127
|
-
destroy() {
|
|
1128
|
-
this.form && this.form.removeEventListener("submit", this.sync), this.input = null, this.form = null;
|
|
1129
|
-
}
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
class dt extends D {
|
|
1133
|
-
/**
|
|
1134
|
-
* The promise that resolves to the editor instance.
|
|
1135
|
-
*/
|
|
1136
|
-
editorPromise = null;
|
|
1137
|
-
/**
|
|
1138
|
-
* @inheritdoc
|
|
1139
|
-
*/
|
|
1140
|
-
async mounted() {
|
|
1141
|
-
const { editorId: t } = this.canonical;
|
|
1142
|
-
d.the.resetErrors(t);
|
|
1143
|
-
try {
|
|
1144
|
-
this.editorPromise = this.createEditor();
|
|
1145
|
-
const e = await this.editorPromise;
|
|
1146
|
-
this.isBeingDestroyed() || (d.the.register(t, e), e.once("destroy", () => {
|
|
1147
|
-
d.the.hasItem(t) && d.the.unregister(t);
|
|
1148
|
-
}));
|
|
1149
|
-
} catch (e) {
|
|
1150
|
-
console.error(`Error initializing CKEditor5 instance with ID "${t}":`, e), this.editorPromise = null, d.the.error(t, e);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
/**
|
|
1154
|
-
* Destroys the editor instance when the component is destroyed.
|
|
1155
|
-
* This is important to prevent memory leaks and ensure that the editor is properly cleaned up.
|
|
1156
|
-
*/
|
|
1157
|
-
async destroyed() {
|
|
1158
|
-
this.element.style.display = "none";
|
|
1159
|
-
try {
|
|
1160
|
-
const t = await this.editorPromise;
|
|
1161
|
-
if (!t)
|
|
1162
|
-
return;
|
|
1163
|
-
const e = Z(t), r = ot(t);
|
|
1164
|
-
e ? e.state !== "unavailable" && await e.context.remove(e.editorContextId) : r ? await r.destroy() : await t.destroy();
|
|
1165
|
-
} finally {
|
|
1166
|
-
this.editorPromise = null;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
/**
|
|
1170
|
-
* Updates the editor content when the component is updated after commit changes.
|
|
1171
|
-
*/
|
|
1172
|
-
async afterCommitSynced() {
|
|
1173
|
-
(await this.editorPromise)?.fire("afterCommitSynced");
|
|
1174
|
-
}
|
|
1175
|
-
/**
|
|
1176
|
-
* Creates the CKEditor instance.
|
|
1177
|
-
*/
|
|
1178
|
-
async createEditor() {
|
|
1179
|
-
const {
|
|
1180
|
-
preset: t,
|
|
1181
|
-
editorId: e,
|
|
1182
|
-
contextId: r,
|
|
1183
|
-
editableHeight: n,
|
|
1184
|
-
saveDebounceMs: a,
|
|
1185
|
-
language: o,
|
|
1186
|
-
watchdog: s,
|
|
1187
|
-
content: c
|
|
1188
|
-
} = this.canonical, {
|
|
1189
|
-
customTranslations: u,
|
|
1190
|
-
editorType: m,
|
|
1191
|
-
licenseKey: y,
|
|
1192
|
-
config: { plugins: T, ...E }
|
|
1193
|
-
} = t;
|
|
1194
|
-
let w = await et(m);
|
|
1195
|
-
const h = await (r ? g.the.waitFor(r) : null);
|
|
1196
|
-
if (s && !h) {
|
|
1197
|
-
const l = await at(w);
|
|
1198
|
-
({ Constructor: w } = l), l.watchdog.on("restart", () => {
|
|
1199
|
-
const f = l.watchdog.editor;
|
|
1200
|
-
this.editorPromise = Promise.resolve(f), d.the.register(e, f);
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
const { loadedPlugins: p, hasPremium: I } = await N(T);
|
|
1204
|
-
p.push(
|
|
1205
|
-
await ut(
|
|
1206
|
-
{
|
|
1207
|
-
saveDebounceMs: a,
|
|
1208
|
-
component: this
|
|
1209
|
-
}
|
|
1210
|
-
)
|
|
1211
|
-
), k(m) && p.push(
|
|
1212
|
-
await lt(a)
|
|
1213
|
-
);
|
|
1214
|
-
const x = [
|
|
1215
|
-
...await q(o, I),
|
|
1216
|
-
_(u || {})
|
|
1217
|
-
].filter((l) => !W(l));
|
|
1218
|
-
let b = {
|
|
1219
|
-
...c,
|
|
1220
|
-
...F(e)
|
|
1221
|
-
};
|
|
1222
|
-
k(m) && (b = b.main || "");
|
|
1223
|
-
const M = await (async () => {
|
|
1224
|
-
let l = j(e);
|
|
1225
|
-
if (!(l instanceof HTMLElement) && !("main" in l)) {
|
|
1226
|
-
const A = m === "decoupled" ? ["main"] : Object.keys(b);
|
|
1227
|
-
K(l, A) || (l = await mt(e, A), b = {
|
|
1228
|
-
...c,
|
|
1229
|
-
...F(e)
|
|
1230
|
-
});
|
|
1231
|
-
}
|
|
1232
|
-
k(m) && "main" in l && (l = l.main);
|
|
1233
|
-
let f = v(E);
|
|
1234
|
-
f = P([...x].reverse(), o.ui, f);
|
|
1235
|
-
const z = {
|
|
1236
|
-
...f,
|
|
1237
|
-
initialData: b,
|
|
1238
|
-
licenseKey: y,
|
|
1239
|
-
plugins: p,
|
|
1240
|
-
language: o,
|
|
1241
|
-
...x.length && {
|
|
1242
|
-
translations: x
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
return !h || !(l instanceof HTMLElement) ? w.create(l, z) : (await Q({
|
|
1246
|
-
context: h,
|
|
1247
|
-
element: l,
|
|
1248
|
-
creator: w,
|
|
1249
|
-
config: z
|
|
1250
|
-
})).editor;
|
|
1251
|
-
})();
|
|
1252
|
-
return k(m) && n && nt(M, n), M;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
function K(i, t) {
|
|
1256
|
-
return t.every((e) => i[e]);
|
|
1
|
+
//#region src/hooks/hook.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
state = "mounting";
|
|
4
|
+
_beforeDestroyCallbacks = [];
|
|
5
|
+
constructor(e) {
|
|
6
|
+
this.livewireComponent = e;
|
|
7
|
+
}
|
|
8
|
+
onBeforeDestroy(e) {
|
|
9
|
+
this._beforeDestroyCallbacks.push(e);
|
|
10
|
+
}
|
|
11
|
+
get canonical() {
|
|
12
|
+
return this.livewireComponent.canonical;
|
|
13
|
+
}
|
|
14
|
+
get element() {
|
|
15
|
+
return this.livewireComponent.el;
|
|
16
|
+
}
|
|
17
|
+
get $wire() {
|
|
18
|
+
return this.livewireComponent.$wire;
|
|
19
|
+
}
|
|
20
|
+
isBeingDestroyed() {
|
|
21
|
+
return ["destroyed", "destroying"].includes(this.state);
|
|
22
|
+
}
|
|
23
|
+
_runBeforeDestroyCallbacks() {
|
|
24
|
+
for (let e of this._beforeDestroyCallbacks.reverse()) e();
|
|
25
|
+
this._beforeDestroyCallbacks = [];
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function t(e, t) {
|
|
29
|
+
let n = /* @__PURE__ */ new Map();
|
|
30
|
+
window.Livewire?.hook("component.init", async ({ component: r, cleanup: i }) => {
|
|
31
|
+
if (r.name !== e) return;
|
|
32
|
+
let a = new t(r);
|
|
33
|
+
n.set(r.id, a), i(async () => {
|
|
34
|
+
a.state = "destroying", a._runBeforeDestroyCallbacks(), await a.destroyed(), a.state = "destroyed", n.delete(r.id);
|
|
35
|
+
}), await a.mounted(), a.state = "mounted";
|
|
36
|
+
}), window.Livewire?.hook("commit", async ({ component: t, succeed: r }) => {
|
|
37
|
+
t.name === e && r(() => {
|
|
38
|
+
let e = n.get(t.id);
|
|
39
|
+
/* v8 ignore next if -- @preserve */
|
|
40
|
+
e?.state === "mounted" && e?.afterCommitSynced?.();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/shared/async-registry.ts
|
|
46
|
+
var n = class {
|
|
47
|
+
items = /* @__PURE__ */ new Map();
|
|
48
|
+
initializationErrors = /* @__PURE__ */ new Map();
|
|
49
|
+
pendingCallbacks = /* @__PURE__ */ new Map();
|
|
50
|
+
watchers = /* @__PURE__ */ new Set();
|
|
51
|
+
execute(e, t, n) {
|
|
52
|
+
let r = this.items.get(e), i = this.initializationErrors.get(e);
|
|
53
|
+
return i ? (n?.(i), Promise.reject(i)) : r ? Promise.resolve(t(r)) : new Promise((r, i) => {
|
|
54
|
+
let a = this.getPendingCallbacks(e);
|
|
55
|
+
a.success.push(async (e) => {
|
|
56
|
+
r(await t(e));
|
|
57
|
+
}), n ? a.error.push(n) : a.error.push(i);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
register(e, t) {
|
|
61
|
+
if (this.items.has(e)) throw Error(`Item with ID "${e}" is already registered.`);
|
|
62
|
+
this.resetErrors(e), this.items.set(e, t);
|
|
63
|
+
let n = this.pendingCallbacks.get(e);
|
|
64
|
+
n && (n.success.forEach((e) => e(t)), this.pendingCallbacks.delete(e)), this.registerAsDefault(e, t), this.notifyWatchers();
|
|
65
|
+
}
|
|
66
|
+
error(e, t) {
|
|
67
|
+
this.items.delete(e), this.initializationErrors.set(e, t);
|
|
68
|
+
let n = this.pendingCallbacks.get(e);
|
|
69
|
+
n && (n.error.forEach((e) => e(t)), this.pendingCallbacks.delete(e)), this.initializationErrors.size === 1 && !this.items.size && this.error(null, t), this.notifyWatchers();
|
|
70
|
+
}
|
|
71
|
+
resetErrors(e) {
|
|
72
|
+
let { initializationErrors: t } = this;
|
|
73
|
+
t.has(null) && t.get(null) === t.get(e) && t.delete(null), t.delete(e);
|
|
74
|
+
}
|
|
75
|
+
unregister(e) {
|
|
76
|
+
if (!this.items.has(e)) throw Error(`Item with ID "${e}" is not registered.`);
|
|
77
|
+
e && this.items.get(null) === this.items.get(e) && this.unregister(null), this.items.delete(e), this.pendingCallbacks.delete(e), this.notifyWatchers();
|
|
78
|
+
}
|
|
79
|
+
getItems() {
|
|
80
|
+
return Array.from(this.items.values());
|
|
81
|
+
}
|
|
82
|
+
hasItem(e) {
|
|
83
|
+
return this.items.has(e);
|
|
84
|
+
}
|
|
85
|
+
waitFor(e) {
|
|
86
|
+
return new Promise((t, n) => {
|
|
87
|
+
this.execute(e, t, n);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async destroyAll() {
|
|
91
|
+
let e = Array.from(new Set(this.items.values())).map((e) => e.destroy());
|
|
92
|
+
this.items.clear(), this.pendingCallbacks.clear(), await Promise.all(e), this.notifyWatchers();
|
|
93
|
+
}
|
|
94
|
+
watch(e) {
|
|
95
|
+
return this.watchers.add(e), e(new Map(this.items), new Map(this.initializationErrors)), this.unwatch.bind(this, e);
|
|
96
|
+
}
|
|
97
|
+
unwatch(e) {
|
|
98
|
+
this.watchers.delete(e);
|
|
99
|
+
}
|
|
100
|
+
notifyWatchers() {
|
|
101
|
+
this.watchers.forEach((e) => e(new Map(this.items), new Map(this.initializationErrors)));
|
|
102
|
+
}
|
|
103
|
+
getPendingCallbacks(e) {
|
|
104
|
+
let t = this.pendingCallbacks.get(e);
|
|
105
|
+
return t || (t = {
|
|
106
|
+
success: [],
|
|
107
|
+
error: []
|
|
108
|
+
}, this.pendingCallbacks.set(e, t)), t;
|
|
109
|
+
}
|
|
110
|
+
registerAsDefault(e, t) {
|
|
111
|
+
this.items.size === 1 && e !== null && this.register(null, t);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/shared/debounce.ts
|
|
116
|
+
function r(e, t) {
|
|
117
|
+
let n = null;
|
|
118
|
+
return (...r) => {
|
|
119
|
+
n && clearTimeout(n), n = setTimeout(() => {
|
|
120
|
+
t(...r);
|
|
121
|
+
}, e);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/shared/filter-object-values.ts
|
|
126
|
+
function i(e, t) {
|
|
127
|
+
let n = Object.entries(e).filter(([e, n]) => t(n, e));
|
|
128
|
+
return Object.fromEntries(n);
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/shared/is-empty-object.ts
|
|
132
|
+
function a(e) {
|
|
133
|
+
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/shared/map-object-values.ts
|
|
137
|
+
function o(e, t) {
|
|
138
|
+
let n = Object.entries(e).map(([e, n]) => [e, t(n, e)]);
|
|
139
|
+
return Object.fromEntries(n);
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/shared/shallow-equal.ts
|
|
143
|
+
function s(e, t) {
|
|
144
|
+
if (e === t) return !0;
|
|
145
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
146
|
+
if (n.length !== r.length) return !1;
|
|
147
|
+
for (let r of n) if (e[r] !== t[r] || !Object.prototype.hasOwnProperty.call(t, r)) return !1;
|
|
148
|
+
return !0;
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/shared/uid.ts
|
|
152
|
+
function c() {
|
|
153
|
+
return Math.random().toString(36).substring(2);
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/shared/wait-for.ts
|
|
157
|
+
function l(e, { timeOutAfter: t = 500, retryAfter: n = 100 } = {}) {
|
|
158
|
+
return new Promise((r, i) => {
|
|
159
|
+
let a = Date.now(), o = null, s = setTimeout(() => {
|
|
160
|
+
i(o ?? /* @__PURE__ */ Error("Timeout"));
|
|
161
|
+
}, t), c = async () => {
|
|
162
|
+
try {
|
|
163
|
+
let t = await e();
|
|
164
|
+
clearTimeout(s), r(t);
|
|
165
|
+
} catch (e) {
|
|
166
|
+
o = e, Date.now() - a > t ? i(e) : setTimeout(c, n);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
c();
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/hooks/editor/utils/create-editor-in-context.ts
|
|
174
|
+
var u = Symbol.for("context-editor-watchdog");
|
|
175
|
+
async function d({ element: e, context: t, creator: n, config: r }) {
|
|
176
|
+
let i = c();
|
|
177
|
+
await t.add({
|
|
178
|
+
creator: (e, t) => n.create(e, t),
|
|
179
|
+
id: i,
|
|
180
|
+
sourceElementOrData: e,
|
|
181
|
+
type: "editor",
|
|
182
|
+
config: r
|
|
183
|
+
});
|
|
184
|
+
let a = t.getItem(i), o = {
|
|
185
|
+
state: "available",
|
|
186
|
+
editorContextId: i,
|
|
187
|
+
context: t
|
|
188
|
+
};
|
|
189
|
+
a[u] = o;
|
|
190
|
+
let s = t.destroy.bind(t);
|
|
191
|
+
return t.destroy = async () => (o.state = "unavailable", s()), {
|
|
192
|
+
...o,
|
|
193
|
+
editor: a
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function f(e) {
|
|
197
|
+
return u in e ? e[u] : null;
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/hooks/editor/utils/get-editor-roots-values.ts
|
|
201
|
+
function p(e) {
|
|
202
|
+
return e.model.document.getRootNames().reduce((t, n) => (t[n] = e.getData({ rootName: n }), t), Object.create({}));
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/hooks/editor/utils/is-single-root-editor.ts
|
|
206
|
+
function m(e) {
|
|
207
|
+
return [
|
|
208
|
+
"inline",
|
|
209
|
+
"classic",
|
|
210
|
+
"balloon",
|
|
211
|
+
"decoupled"
|
|
212
|
+
].includes(e);
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/hooks/editor/utils/load-editor-constructor.ts
|
|
216
|
+
async function h(e) {
|
|
217
|
+
let t = await import("ckeditor5"), n = {
|
|
218
|
+
inline: t.InlineEditor,
|
|
219
|
+
balloon: t.BalloonEditor,
|
|
220
|
+
classic: t.ClassicEditor,
|
|
221
|
+
decoupled: t.DecoupledEditor,
|
|
222
|
+
multiroot: t.MultiRootEditor
|
|
223
|
+
}[e];
|
|
224
|
+
if (!n) throw Error(`Unsupported editor type: ${e}`);
|
|
225
|
+
return n;
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/hooks/editor/custom-editor-plugins.ts
|
|
229
|
+
var g = class e {
|
|
230
|
+
static the = new e();
|
|
231
|
+
plugins = /* @__PURE__ */ new Map();
|
|
232
|
+
constructor() {}
|
|
233
|
+
register(e, t) {
|
|
234
|
+
if (this.plugins.has(e)) throw Error(`Plugin with name "${e}" is already registered.`);
|
|
235
|
+
return this.plugins.set(e, t), this.unregister.bind(this, e);
|
|
236
|
+
}
|
|
237
|
+
unregister(e) {
|
|
238
|
+
if (!this.plugins.has(e)) throw Error(`Plugin with name "${e}" is not registered.`);
|
|
239
|
+
this.plugins.delete(e);
|
|
240
|
+
}
|
|
241
|
+
unregisterAll() {
|
|
242
|
+
this.plugins.clear();
|
|
243
|
+
}
|
|
244
|
+
async get(e) {
|
|
245
|
+
return this.plugins.get(e)?.();
|
|
246
|
+
}
|
|
247
|
+
has(e) {
|
|
248
|
+
return this.plugins.has(e);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/hooks/editor/utils/load-editor-plugins.ts
|
|
253
|
+
async function _(e) {
|
|
254
|
+
let t = await import("ckeditor5"), n = null, r = e.map(async (e) => {
|
|
255
|
+
let r = await g.the.get(e);
|
|
256
|
+
if (r) return r;
|
|
257
|
+
let { [e]: i } = t;
|
|
258
|
+
if (i) return i;
|
|
259
|
+
/* v8 ignore start -- @preserve */
|
|
260
|
+
if (!n) try {
|
|
261
|
+
n = await import("ckeditor5-premium-features");
|
|
262
|
+
} catch (e) {
|
|
263
|
+
console.error(`Failed to load premium package: ${e}`);
|
|
264
|
+
}
|
|
265
|
+
/* v8 ignore end */
|
|
266
|
+
let { [e]: a } = n || {};
|
|
267
|
+
if (a) return a;
|
|
268
|
+
throw Error(`Plugin "${e}" not found in base or premium packages.`);
|
|
269
|
+
});
|
|
270
|
+
return {
|
|
271
|
+
loadedPlugins: await Promise.all(r),
|
|
272
|
+
hasPremium: !!n
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/hooks/editor/utils/load-editor-translations.ts
|
|
277
|
+
async function v(e, t) {
|
|
278
|
+
let n = [e.ui, e.content], r = [y("ckeditor5", n)];
|
|
279
|
+
return t && r.push(y("ckeditor5-premium-features", n)), await Promise.all(r).then((e) => e.flat());
|
|
280
|
+
}
|
|
281
|
+
async function y(e, t) {
|
|
282
|
+
/* v8 ignore next */
|
|
283
|
+
return await Promise.all(t.filter((e) => e !== "en").map(async (t) => {
|
|
284
|
+
let n = await b(e, t);
|
|
285
|
+
/* v8 ignore next -- @preserve */
|
|
286
|
+
return n?.default ?? n;
|
|
287
|
+
}).filter(Boolean));
|
|
288
|
+
}
|
|
289
|
+
async function b(e, t) {
|
|
290
|
+
try {
|
|
291
|
+
/* v8 ignore next if -- @preserve */
|
|
292
|
+
if (e === "ckeditor5") switch (t) {
|
|
293
|
+
case "af": return await import("ckeditor5/translations/af.js");
|
|
294
|
+
case "ar": return await import("ckeditor5/translations/ar.js");
|
|
295
|
+
case "ast": return await import("ckeditor5/translations/ast.js");
|
|
296
|
+
case "az": return await import("ckeditor5/translations/az.js");
|
|
297
|
+
case "bg": return await import("ckeditor5/translations/bg.js");
|
|
298
|
+
case "bn": return await import("ckeditor5/translations/bn.js");
|
|
299
|
+
case "bs": return await import("ckeditor5/translations/bs.js");
|
|
300
|
+
case "ca": return await import("ckeditor5/translations/ca.js");
|
|
301
|
+
case "cs": return await import("ckeditor5/translations/cs.js");
|
|
302
|
+
case "da": return await import("ckeditor5/translations/da.js");
|
|
303
|
+
case "de": return await import("ckeditor5/translations/de.js");
|
|
304
|
+
case "de-ch": return await import("ckeditor5/translations/de-ch.js");
|
|
305
|
+
case "el": return await import("ckeditor5/translations/el.js");
|
|
306
|
+
case "en": return await import("ckeditor5/translations/en.js");
|
|
307
|
+
case "en-au": return await import("ckeditor5/translations/en-au.js");
|
|
308
|
+
case "en-gb": return await import("ckeditor5/translations/en-gb.js");
|
|
309
|
+
case "eo": return await import("ckeditor5/translations/eo.js");
|
|
310
|
+
case "es": return await import("ckeditor5/translations/es.js");
|
|
311
|
+
case "es-co": return await import("ckeditor5/translations/es-co.js");
|
|
312
|
+
case "et": return await import("ckeditor5/translations/et.js");
|
|
313
|
+
case "eu": return await import("ckeditor5/translations/eu.js");
|
|
314
|
+
case "fa": return await import("ckeditor5/translations/fa.js");
|
|
315
|
+
case "fi": return await import("ckeditor5/translations/fi.js");
|
|
316
|
+
case "fr": return await import("ckeditor5/translations/fr.js");
|
|
317
|
+
case "gl": return await import("ckeditor5/translations/gl.js");
|
|
318
|
+
case "gu": return await import("ckeditor5/translations/gu.js");
|
|
319
|
+
case "he": return await import("ckeditor5/translations/he.js");
|
|
320
|
+
case "hi": return await import("ckeditor5/translations/hi.js");
|
|
321
|
+
case "hr": return await import("ckeditor5/translations/hr.js");
|
|
322
|
+
case "hu": return await import("ckeditor5/translations/hu.js");
|
|
323
|
+
case "hy": return await import("ckeditor5/translations/hy.js");
|
|
324
|
+
case "id": return await import("ckeditor5/translations/id.js");
|
|
325
|
+
case "it": return await import("ckeditor5/translations/it.js");
|
|
326
|
+
case "ja": return await import("ckeditor5/translations/ja.js");
|
|
327
|
+
case "jv": return await import("ckeditor5/translations/jv.js");
|
|
328
|
+
case "kk": return await import("ckeditor5/translations/kk.js");
|
|
329
|
+
case "km": return await import("ckeditor5/translations/km.js");
|
|
330
|
+
case "kn": return await import("ckeditor5/translations/kn.js");
|
|
331
|
+
case "ko": return await import("ckeditor5/translations/ko.js");
|
|
332
|
+
case "ku": return await import("ckeditor5/translations/ku.js");
|
|
333
|
+
case "lt": return await import("ckeditor5/translations/lt.js");
|
|
334
|
+
case "lv": return await import("ckeditor5/translations/lv.js");
|
|
335
|
+
case "ms": return await import("ckeditor5/translations/ms.js");
|
|
336
|
+
case "nb": return await import("ckeditor5/translations/nb.js");
|
|
337
|
+
case "ne": return await import("ckeditor5/translations/ne.js");
|
|
338
|
+
case "nl": return await import("ckeditor5/translations/nl.js");
|
|
339
|
+
case "no": return await import("ckeditor5/translations/no.js");
|
|
340
|
+
case "oc": return await import("ckeditor5/translations/oc.js");
|
|
341
|
+
case "pl": return await import("ckeditor5/translations/pl.js");
|
|
342
|
+
case "pt": return await import("ckeditor5/translations/pt.js");
|
|
343
|
+
case "pt-br": return await import("ckeditor5/translations/pt-br.js");
|
|
344
|
+
case "ro": return await import("ckeditor5/translations/ro.js");
|
|
345
|
+
case "ru": return await import("ckeditor5/translations/ru.js");
|
|
346
|
+
case "si": return await import("ckeditor5/translations/si.js");
|
|
347
|
+
case "sk": return await import("ckeditor5/translations/sk.js");
|
|
348
|
+
case "sl": return await import("ckeditor5/translations/sl.js");
|
|
349
|
+
case "sq": return await import("ckeditor5/translations/sq.js");
|
|
350
|
+
case "sr": return await import("ckeditor5/translations/sr.js");
|
|
351
|
+
case "sr-latn": return await import("ckeditor5/translations/sr-latn.js");
|
|
352
|
+
case "sv": return await import("ckeditor5/translations/sv.js");
|
|
353
|
+
case "th": return await import("ckeditor5/translations/th.js");
|
|
354
|
+
case "tk": return await import("ckeditor5/translations/tk.js");
|
|
355
|
+
case "tr": return await import("ckeditor5/translations/tr.js");
|
|
356
|
+
case "tt": return await import("ckeditor5/translations/tt.js");
|
|
357
|
+
case "ug": return await import("ckeditor5/translations/ug.js");
|
|
358
|
+
case "uk": return await import("ckeditor5/translations/uk.js");
|
|
359
|
+
case "ur": return await import("ckeditor5/translations/ur.js");
|
|
360
|
+
case "uz": return await import("ckeditor5/translations/uz.js");
|
|
361
|
+
case "vi": return await import("ckeditor5/translations/vi.js");
|
|
362
|
+
case "zh": return await import("ckeditor5/translations/zh.js");
|
|
363
|
+
case "zh-cn": return await import("ckeditor5/translations/zh-cn.js");
|
|
364
|
+
default: return console.warn(`Language ${t} not found in ckeditor5 translations`), null;
|
|
365
|
+
}
|
|
366
|
+
else switch (t) {
|
|
367
|
+
case "af": return await import("ckeditor5-premium-features/translations/af.js");
|
|
368
|
+
case "ar": return await import("ckeditor5-premium-features/translations/ar.js");
|
|
369
|
+
case "ast": return await import("ckeditor5-premium-features/translations/ast.js");
|
|
370
|
+
case "az": return await import("ckeditor5-premium-features/translations/az.js");
|
|
371
|
+
case "bg": return await import("ckeditor5-premium-features/translations/bg.js");
|
|
372
|
+
case "bn": return await import("ckeditor5-premium-features/translations/bn.js");
|
|
373
|
+
case "bs": return await import("ckeditor5-premium-features/translations/bs.js");
|
|
374
|
+
case "ca": return await import("ckeditor5-premium-features/translations/ca.js");
|
|
375
|
+
case "cs": return await import("ckeditor5-premium-features/translations/cs.js");
|
|
376
|
+
case "da": return await import("ckeditor5-premium-features/translations/da.js");
|
|
377
|
+
case "de": return await import("ckeditor5-premium-features/translations/de.js");
|
|
378
|
+
case "de-ch": return await import("ckeditor5-premium-features/translations/de-ch.js");
|
|
379
|
+
case "el": return await import("ckeditor5-premium-features/translations/el.js");
|
|
380
|
+
case "en": return await import("ckeditor5-premium-features/translations/en.js");
|
|
381
|
+
case "en-au": return await import("ckeditor5-premium-features/translations/en-au.js");
|
|
382
|
+
case "en-gb": return await import("ckeditor5-premium-features/translations/en-gb.js");
|
|
383
|
+
case "eo": return await import("ckeditor5-premium-features/translations/eo.js");
|
|
384
|
+
case "es": return await import("ckeditor5-premium-features/translations/es.js");
|
|
385
|
+
case "es-co": return await import("ckeditor5-premium-features/translations/es-co.js");
|
|
386
|
+
case "et": return await import("ckeditor5-premium-features/translations/et.js");
|
|
387
|
+
case "eu": return await import("ckeditor5-premium-features/translations/eu.js");
|
|
388
|
+
case "fa": return await import("ckeditor5-premium-features/translations/fa.js");
|
|
389
|
+
case "fi": return await import("ckeditor5-premium-features/translations/fi.js");
|
|
390
|
+
case "fr": return await import("ckeditor5-premium-features/translations/fr.js");
|
|
391
|
+
case "gl": return await import("ckeditor5-premium-features/translations/gl.js");
|
|
392
|
+
case "gu": return await import("ckeditor5-premium-features/translations/gu.js");
|
|
393
|
+
case "he": return await import("ckeditor5-premium-features/translations/he.js");
|
|
394
|
+
case "hi": return await import("ckeditor5-premium-features/translations/hi.js");
|
|
395
|
+
case "hr": return await import("ckeditor5-premium-features/translations/hr.js");
|
|
396
|
+
case "hu": return await import("ckeditor5-premium-features/translations/hu.js");
|
|
397
|
+
case "hy": return await import("ckeditor5-premium-features/translations/hy.js");
|
|
398
|
+
case "id": return await import("ckeditor5-premium-features/translations/id.js");
|
|
399
|
+
case "it": return await import("ckeditor5-premium-features/translations/it.js");
|
|
400
|
+
case "ja": return await import("ckeditor5-premium-features/translations/ja.js");
|
|
401
|
+
case "jv": return await import("ckeditor5-premium-features/translations/jv.js");
|
|
402
|
+
case "kk": return await import("ckeditor5-premium-features/translations/kk.js");
|
|
403
|
+
case "km": return await import("ckeditor5-premium-features/translations/km.js");
|
|
404
|
+
case "kn": return await import("ckeditor5-premium-features/translations/kn.js");
|
|
405
|
+
case "ko": return await import("ckeditor5-premium-features/translations/ko.js");
|
|
406
|
+
case "ku": return await import("ckeditor5-premium-features/translations/ku.js");
|
|
407
|
+
case "lt": return await import("ckeditor5-premium-features/translations/lt.js");
|
|
408
|
+
case "lv": return await import("ckeditor5-premium-features/translations/lv.js");
|
|
409
|
+
case "ms": return await import("ckeditor5-premium-features/translations/ms.js");
|
|
410
|
+
case "nb": return await import("ckeditor5-premium-features/translations/nb.js");
|
|
411
|
+
case "ne": return await import("ckeditor5-premium-features/translations/ne.js");
|
|
412
|
+
case "nl": return await import("ckeditor5-premium-features/translations/nl.js");
|
|
413
|
+
case "no": return await import("ckeditor5-premium-features/translations/no.js");
|
|
414
|
+
case "oc": return await import("ckeditor5-premium-features/translations/oc.js");
|
|
415
|
+
case "pl": return await import("ckeditor5-premium-features/translations/pl.js");
|
|
416
|
+
case "pt": return await import("ckeditor5-premium-features/translations/pt.js");
|
|
417
|
+
case "pt-br": return await import("ckeditor5-premium-features/translations/pt-br.js");
|
|
418
|
+
case "ro": return await import("ckeditor5-premium-features/translations/ro.js");
|
|
419
|
+
case "ru": return await import("ckeditor5-premium-features/translations/ru.js");
|
|
420
|
+
case "si": return await import("ckeditor5-premium-features/translations/si.js");
|
|
421
|
+
case "sk": return await import("ckeditor5-premium-features/translations/sk.js");
|
|
422
|
+
case "sl": return await import("ckeditor5-premium-features/translations/sl.js");
|
|
423
|
+
case "sq": return await import("ckeditor5-premium-features/translations/sq.js");
|
|
424
|
+
case "sr": return await import("ckeditor5-premium-features/translations/sr.js");
|
|
425
|
+
case "sr-latn": return await import("ckeditor5-premium-features/translations/sr-latn.js");
|
|
426
|
+
case "sv": return await import("ckeditor5-premium-features/translations/sv.js");
|
|
427
|
+
case "th": return await import("ckeditor5-premium-features/translations/th.js");
|
|
428
|
+
case "tk": return await import("ckeditor5-premium-features/translations/tk.js");
|
|
429
|
+
case "tr": return await import("ckeditor5-premium-features/translations/tr.js");
|
|
430
|
+
case "tt": return await import("ckeditor5-premium-features/translations/tt.js");
|
|
431
|
+
case "ug": return await import("ckeditor5-premium-features/translations/ug.js");
|
|
432
|
+
case "uk": return await import("ckeditor5-premium-features/translations/uk.js");
|
|
433
|
+
case "ur": return await import("ckeditor5-premium-features/translations/ur.js");
|
|
434
|
+
case "uz": return await import("ckeditor5-premium-features/translations/uz.js");
|
|
435
|
+
case "vi": return await import("ckeditor5-premium-features/translations/vi.js");
|
|
436
|
+
case "zh": return await import("ckeditor5-premium-features/translations/zh.js");
|
|
437
|
+
case "zh-cn": return await import("ckeditor5-premium-features/translations/zh-cn.js");
|
|
438
|
+
default: return console.warn(`Language ${t} not found in premium translations`), await import("ckeditor5-premium-features/translations/en.js");
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
/* v8 ignore start -- @preserve */
|
|
442
|
+
catch (n) {
|
|
443
|
+
return console.error(`Failed to load translation for ${e}/${t}:`, n), null;
|
|
444
|
+
}
|
|
445
|
+
/* v8 ignore stop -- @preserve */
|
|
446
|
+
}
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/hooks/editor/utils/normalize-custom-translations.ts
|
|
449
|
+
function x(e) {
|
|
450
|
+
return o(e, (e) => ({ dictionary: e }));
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/hooks/editor/utils/query-editor-editables.ts
|
|
454
|
+
function S(e) {
|
|
455
|
+
return o(C(e), ({ element: e }) => e);
|
|
456
|
+
}
|
|
457
|
+
function C(e) {
|
|
458
|
+
let t = window.Livewire.all().filter(({ name: t, canonical: n }) => t === "ckeditor5-editable" && n.editorId === e).reduce((e, { canonical: t, el: n }) => ({
|
|
459
|
+
...e,
|
|
460
|
+
[t.rootName]: {
|
|
461
|
+
element: n.querySelector("[data-cke-editable-content]"),
|
|
462
|
+
content: t.content
|
|
463
|
+
}
|
|
464
|
+
}), Object.create({})), n = window.Livewire.all().find(({ name: t, canonical: n }) => t === "ckeditor5" && n.editorId === e)?.canonical.content, r = document.querySelector(`#${e}_editor `), i = t.main;
|
|
465
|
+
return i && n?.main ? {
|
|
466
|
+
...t,
|
|
467
|
+
main: {
|
|
468
|
+
...i,
|
|
469
|
+
content: i.content || n.main
|
|
470
|
+
}
|
|
471
|
+
} : r ? {
|
|
472
|
+
...t,
|
|
473
|
+
main: {
|
|
474
|
+
element: r,
|
|
475
|
+
content: n?.main || null
|
|
476
|
+
}
|
|
477
|
+
} : t;
|
|
478
|
+
}
|
|
479
|
+
function w(e) {
|
|
480
|
+
return i(o(C(e), ({ content: e }) => e), (e) => typeof e == "string");
|
|
481
|
+
}
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/hooks/editor/utils/resolve-editor-config-elements-references.ts
|
|
484
|
+
function T(e) {
|
|
485
|
+
if (!e || typeof e != "object") return e;
|
|
486
|
+
if (Array.isArray(e)) return e.map((e) => T(e));
|
|
487
|
+
let t = e;
|
|
488
|
+
if (t.$element && typeof t.$element == "string") {
|
|
489
|
+
let e = document.querySelector(t.$element);
|
|
490
|
+
return e || console.warn(`Element not found for selector: ${t.$element}`), e || null;
|
|
491
|
+
}
|
|
492
|
+
let n = Object.create(null);
|
|
493
|
+
for (let [t, r] of Object.entries(e)) n[t] = T(r);
|
|
494
|
+
return n;
|
|
495
|
+
}
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/hooks/editor/utils/resolve-editor-config-translations.ts
|
|
498
|
+
function E(e, t, n) {
|
|
499
|
+
if (!n || typeof n != "object") return n;
|
|
500
|
+
if (Array.isArray(n)) return n.map((n) => E(e, t, n));
|
|
501
|
+
let r = n;
|
|
502
|
+
if (r.$translation && typeof r.$translation == "string") {
|
|
503
|
+
let n = r.$translation, i = D(e, n, t);
|
|
504
|
+
return i === void 0 && console.warn(`Translation not found for key: ${n}`), i === void 0 ? null : i;
|
|
505
|
+
}
|
|
506
|
+
let i = Object.create(null);
|
|
507
|
+
for (let [r, a] of Object.entries(n)) i[r] = E(e, t, a);
|
|
508
|
+
return i;
|
|
509
|
+
}
|
|
510
|
+
function D(e, t, n) {
|
|
511
|
+
for (let r of e) {
|
|
512
|
+
let e = r[n];
|
|
513
|
+
if (e?.dictionary && t in e.dictionary) return e.dictionary[t];
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/hooks/editor/utils/set-editor-editable-height.ts
|
|
518
|
+
function O(e, t) {
|
|
519
|
+
let { editing: n } = e;
|
|
520
|
+
n.view.change((e) => {
|
|
521
|
+
e.setStyle("height", `${t}px`, n.view.document.getRoot());
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region src/hooks/editor/utils/wrap-with-watchdog.ts
|
|
526
|
+
var k = Symbol.for("elixir-editor-watchdog");
|
|
527
|
+
async function A(e) {
|
|
528
|
+
let { EditorWatchdog: t } = await import("ckeditor5"), n = new t(e);
|
|
529
|
+
return n.setCreator(async (...t) => {
|
|
530
|
+
let r = await e.create(...t);
|
|
531
|
+
return r[k] = n, r;
|
|
532
|
+
}), {
|
|
533
|
+
watchdog: n,
|
|
534
|
+
Constructor: { create: async (...e) => (await n.create(...e), n.editor) }
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function j(e) {
|
|
538
|
+
return k in e ? e[k] : null;
|
|
539
|
+
}
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/hooks/context/contexts-registry.ts
|
|
542
|
+
var M = class e extends n {
|
|
543
|
+
static the = new e();
|
|
544
|
+
}, N = class extends e {
|
|
545
|
+
contextPromise = null;
|
|
546
|
+
async mounted() {
|
|
547
|
+
let { contextId: e, language: t, context: n } = this.canonical, { customTranslations: r, watchdogConfig: i, config: { plugins: o, ...s } } = n, { loadedPlugins: c, hasPremium: l } = await _(o ?? []), u = [...await v(t, l), x(r || {})].filter((e) => !a(e));
|
|
548
|
+
this.contextPromise = (async () => {
|
|
549
|
+
let { ContextWatchdog: e, Context: n } = await import("ckeditor5"), r = new e(n, {
|
|
550
|
+
crashNumberLimit: 10,
|
|
551
|
+
...i
|
|
552
|
+
}), a = T(s);
|
|
553
|
+
return a = E([...u].reverse(), t.ui, a), await r.create({
|
|
554
|
+
...a,
|
|
555
|
+
language: t,
|
|
556
|
+
plugins: c,
|
|
557
|
+
...u.length && { translations: u }
|
|
558
|
+
}), r.on("itemError", (...e) => {
|
|
559
|
+
console.error("Context item error:", ...e);
|
|
560
|
+
}), r;
|
|
561
|
+
})();
|
|
562
|
+
let d = await this.contextPromise;
|
|
563
|
+
/* v8 ignore next if -- @preserve */
|
|
564
|
+
this.isBeingDestroyed() || M.the.register(e, d);
|
|
565
|
+
}
|
|
566
|
+
async destroyed() {
|
|
567
|
+
let { contextId: e } = this.canonical;
|
|
568
|
+
this.element.style.display = "none";
|
|
569
|
+
try {
|
|
570
|
+
await (await this.contextPromise)?.destroy();
|
|
571
|
+
} finally {
|
|
572
|
+
this.contextPromise = null, M.the.hasItem(e) && M.the.unregister(e);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}, P = class e extends n {
|
|
576
|
+
static the = new e();
|
|
577
|
+
};
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/hooks/utils/is-wire-model-connected.ts
|
|
580
|
+
function F(e) {
|
|
581
|
+
let t = e;
|
|
582
|
+
for (; t;) {
|
|
583
|
+
for (let e of t.attributes) if (e.name.startsWith("wire:model")) return !0;
|
|
584
|
+
t = t.parentElement;
|
|
585
|
+
}
|
|
586
|
+
return !1;
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/hooks/utils/root-attributes-updater.ts
|
|
590
|
+
function I(e, t) {
|
|
591
|
+
let n = /* @__PURE__ */ new Set();
|
|
592
|
+
return (r) => {
|
|
593
|
+
e.model.enqueueChange({ isUndoable: !1 }, (i) => {
|
|
594
|
+
let a = e.model.document.getRoot(t);
|
|
595
|
+
if (a) {
|
|
596
|
+
for (let e of n) r && e in r || (i.removeAttribute(e, a), n.delete(e));
|
|
597
|
+
for (let [e, t] of Object.entries(r ?? {})) i.setAttribute(e, t, a), n.add(e);
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/hooks/editable.ts
|
|
604
|
+
var L = class extends e {
|
|
605
|
+
editorPromise = null;
|
|
606
|
+
rootAttributesUpdater = null;
|
|
607
|
+
pendingContent = null;
|
|
608
|
+
mounted() {
|
|
609
|
+
let { editorId: e, rootName: t, content: n } = this.canonical;
|
|
610
|
+
this.editorPromise = P.the.execute(e, (e) => {
|
|
611
|
+
/* v8 ignore next if -- @preserve */
|
|
612
|
+
if (this.isBeingDestroyed()) return null;
|
|
613
|
+
let { ui: r, editing: i, model: a } = e;
|
|
614
|
+
if (a.document.getRoot(t)) {
|
|
615
|
+
if (n !== null) {
|
|
616
|
+
let r = e.getData({ rootName: t });
|
|
617
|
+
r && r !== n && e.setData({ [t]: n });
|
|
618
|
+
}
|
|
619
|
+
} else {
|
|
620
|
+
e.addRoot(t, {
|
|
621
|
+
isUndoable: !1,
|
|
622
|
+
...n !== null && { data: n }
|
|
623
|
+
});
|
|
624
|
+
let a = this.element.querySelector("[data-cke-editable-content]"), o = r.view.createEditable(t, a);
|
|
625
|
+
r.addEditable(o), i.view.forceRender();
|
|
626
|
+
}
|
|
627
|
+
return this.syncTypingContentPush(e), this.setupPendingReceivedContentHandlers(e), this.applyRootAttributes(e), e;
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
async afterCommitSynced() {
|
|
631
|
+
let e = await this.editorPromise;
|
|
632
|
+
this.applyCanonicalContentToEditor(e), this.applyRootAttributes(e);
|
|
633
|
+
}
|
|
634
|
+
async destroyed() {
|
|
635
|
+
let { rootName: e } = this.canonical;
|
|
636
|
+
this.element.style.display = "none";
|
|
637
|
+
let t = await this.editorPromise;
|
|
638
|
+
if (this.editorPromise = null, this.rootAttributesUpdater?.(null), t && t.state !== "destroyed") {
|
|
639
|
+
let n = t.model.document.getRoot(e);
|
|
640
|
+
/* v8 ignore next if -- @preserve */
|
|
641
|
+
n && "detachEditable" in t && (t.detachEditable(n), t.detachRoot(e, !1));
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
syncTypingContentPush(e) {
|
|
645
|
+
let { rootName: t, saveDebounceMs: n } = this.canonical, i = this.element.querySelector("input"), a = !1, o = () => {
|
|
646
|
+
if (a) return;
|
|
647
|
+
let n = e.getData({ rootName: t });
|
|
648
|
+
i && (i.value = n), this.$wire.set("content", n);
|
|
649
|
+
}, s = r(n, o), c = () => {
|
|
650
|
+
e.ui.focusTracker.isFocused ? s() : o();
|
|
651
|
+
};
|
|
652
|
+
e.model.document.on("change:data", c), o(), this.onBeforeDestroy(() => {
|
|
653
|
+
a = !0, e.model.document.off("change:data", c);
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
setupPendingReceivedContentHandlers(e) {
|
|
657
|
+
let { ui: t, model: n } = e, { focusTracker: r } = t, { rootName: i } = this.canonical, a = () => {
|
|
658
|
+
this.pendingContent = null;
|
|
659
|
+
}, o = () => {
|
|
660
|
+
!r.isFocused && this.pendingContent !== null && (e.setData({ [i]: this.pendingContent }), this.pendingContent = null);
|
|
661
|
+
};
|
|
662
|
+
n.document.on("change:data", a), r.on("change:isFocused", o), this.onBeforeDestroy(() => {
|
|
663
|
+
n.document.off("change:data", a), r.off("change:isFocused", o);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
applyCanonicalContentToEditor(e) {
|
|
667
|
+
if (!F(this.element)) return;
|
|
668
|
+
let { content: t, rootName: n } = this.canonical, { ui: r } = e;
|
|
669
|
+
if (e.getData({ rootName: n }) !== (t ?? "")) {
|
|
670
|
+
if (r.focusTracker.isFocused) {
|
|
671
|
+
this.pendingContent = t ?? "";
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
e.setData({ [n]: t ?? "" });
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
applyRootAttributes(e) {
|
|
678
|
+
let { rootName: t, rootAttributes: n } = this.canonical;
|
|
679
|
+
this.rootAttributesUpdater ??= I(e, t), this.rootAttributesUpdater(n);
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/hooks/editor/plugins/livewire-sync.ts
|
|
684
|
+
async function R({ saveDebounceMs: e, component: t }) {
|
|
685
|
+
let { Plugin: n } = await import("ckeditor5");
|
|
686
|
+
return class extends n {
|
|
687
|
+
static get pluginName() {
|
|
688
|
+
return "LivewireSync";
|
|
689
|
+
}
|
|
690
|
+
init() {
|
|
691
|
+
this.setupTypingContentPush(), this.setupFocusableEventPush(), this.setupAfterCommitHandler(), this.setupSetEditorContentHandler(), this.setupReadyDispatch();
|
|
692
|
+
}
|
|
693
|
+
setupAfterCommitHandler() {
|
|
694
|
+
let { editor: e } = this, { model: n, ui: { focusTracker: r } } = e, i = null;
|
|
695
|
+
e.on("afterCommitSynced", () => {
|
|
696
|
+
if (!F(t.element)) return;
|
|
697
|
+
let { content: n } = t.canonical, a = this.getEditorRootsValues();
|
|
698
|
+
if (r.isFocused) {
|
|
699
|
+
/* v8 ignore next else -- @preserve */
|
|
700
|
+
s(n, a) || (i = n);
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
/* v8 ignore next else -- @preserve */
|
|
704
|
+
s(n, a) || e.setData(n);
|
|
705
|
+
}), n.document.on("change:data", () => {
|
|
706
|
+
i = null;
|
|
707
|
+
}), r.on("change:isFocused", () => {
|
|
708
|
+
!r.isFocused && i !== null && (e.setData(i), i = null);
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
setupReadyDispatch() {
|
|
712
|
+
let { $wire: e } = t;
|
|
713
|
+
this.editor.once("ready", () => {
|
|
714
|
+
e.dispatch("editor-ready", { editorId: t.canonical.editorId });
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
setupSetEditorContentHandler() {
|
|
718
|
+
Livewire.on("set-editor-content", ({ editorId: e, content: n }) => {
|
|
719
|
+
e === t.canonical.editorId && (s(this.getEditorRootsValues(), n) || this.editor.setData(n));
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
setupTypingContentPush() {
|
|
723
|
+
let { editor: n } = this, { model: i, ui: a } = n, { $wire: o } = t, c = !1, l = () => {
|
|
724
|
+
/* v8 ignore next if -- @preserve */
|
|
725
|
+
if (c) return;
|
|
726
|
+
let e = this.getEditorRootsValues();
|
|
727
|
+
s(e, t.canonical.content ?? {}) || (o.set("content", e), o.dispatch("editor-content-changed", {
|
|
728
|
+
editorId: t.canonical.editorId,
|
|
729
|
+
content: e
|
|
730
|
+
}));
|
|
731
|
+
}, u = r(e, l), d = () => {
|
|
732
|
+
a.focusTracker.isFocused ? u() : l();
|
|
733
|
+
};
|
|
734
|
+
i.document.on("change:data", d), n.once("ready", l), n.once("destroy", () => {
|
|
735
|
+
c = !0, i.document.off("change:data", d);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
setupFocusableEventPush() {
|
|
739
|
+
let { ui: e } = this.editor, { $wire: n } = t;
|
|
740
|
+
e.focusTracker.on("change:isFocused", () => {
|
|
741
|
+
let r = this.getEditorRootsValues();
|
|
742
|
+
n.set("focused", e.focusTracker.isFocused), s(r, t.canonical.content ?? {}) || n.set("content", r);
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
getEditorRootsValues() {
|
|
746
|
+
return p(this.editor);
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/hooks/editor/plugins/sync-editor-with-input.ts
|
|
752
|
+
async function z(e) {
|
|
753
|
+
let { Plugin: t } = await import("ckeditor5");
|
|
754
|
+
return class extends t {
|
|
755
|
+
input = null;
|
|
756
|
+
form = null;
|
|
757
|
+
static get pluginName() {
|
|
758
|
+
return "SyncEditorWithInput";
|
|
759
|
+
}
|
|
760
|
+
afterInit() {
|
|
761
|
+
let { editor: t } = this, n = t.sourceElement.id.replace(/_editor$/, "");
|
|
762
|
+
this.input = document.getElementById(`${n}_input`), this.input && (t.model.document.on("change:data", r(e, () => this.sync())), t.once("ready", this.sync), this.form = this.input.closest("form"), this.form?.addEventListener("submit", this.sync));
|
|
763
|
+
}
|
|
764
|
+
sync = () => {
|
|
765
|
+
/* v8 ignore next else -- @preserve */
|
|
766
|
+
if (this.input) {
|
|
767
|
+
let e = this.editor.getData();
|
|
768
|
+
this.input.value = e, this.input.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
destroy() {
|
|
772
|
+
this.form && this.form.removeEventListener("submit", this.sync), this.input = null, this.form = null;
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region src/hooks/editor/editor.ts
|
|
778
|
+
var B = class extends e {
|
|
779
|
+
editorPromise = null;
|
|
780
|
+
rootAttributesUpdater = null;
|
|
781
|
+
async mounted() {
|
|
782
|
+
let { editorId: e } = this.canonical;
|
|
783
|
+
P.the.resetErrors(e);
|
|
784
|
+
try {
|
|
785
|
+
this.editorPromise = this.createEditor();
|
|
786
|
+
let t = await this.editorPromise;
|
|
787
|
+
/* v8 ignore next if -- @preserve */
|
|
788
|
+
this.isBeingDestroyed() || (P.the.register(e, t), t.once("destroy", () => {
|
|
789
|
+
/* v8 ignore next if -- @preserve */
|
|
790
|
+
P.the.hasItem(e) && P.the.unregister(e);
|
|
791
|
+
}));
|
|
792
|
+
} catch (t) {
|
|
793
|
+
console.error(`Error initializing CKEditor5 instance with ID "${e}":`, t), this.editorPromise = null, P.the.error(e, t);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
async destroyed() {
|
|
797
|
+
this.element.style.display = "none";
|
|
798
|
+
try {
|
|
799
|
+
let e = await this.editorPromise;
|
|
800
|
+
if (!e) return;
|
|
801
|
+
let t = f(e), n = j(e);
|
|
802
|
+
t ? t.state !== "unavailable" && await t.context.remove(t.editorContextId) : n ? await n.destroy() : await e.destroy();
|
|
803
|
+
} finally {
|
|
804
|
+
this.editorPromise = null;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
async afterCommitSynced() {
|
|
808
|
+
let e = await this.editorPromise;
|
|
809
|
+
/* v8 ignore if -- @preserve */
|
|
810
|
+
e && (e.fire("afterCommitSynced"), this.applyRootAttributes(e));
|
|
811
|
+
}
|
|
812
|
+
applyRootAttributes(e) {
|
|
813
|
+
let { rootAttributes: t } = this.canonical;
|
|
814
|
+
this.rootAttributesUpdater ??= I(e, "main"), this.rootAttributesUpdater(t);
|
|
815
|
+
}
|
|
816
|
+
async createEditor() {
|
|
817
|
+
let { preset: e, editorId: t, contextId: n, editableHeight: r, saveDebounceMs: i, language: o, watchdog: s, content: c } = this.canonical, { customTranslations: l, editorType: u, licenseKey: f, config: { plugins: p, ...g } } = e, y = await h(u), b = await (n ? M.the.waitFor(n) : null);
|
|
818
|
+
if (s && !b) {
|
|
819
|
+
let e = await A(y);
|
|
820
|
+
({Constructor: y} = e), e.watchdog.on("restart", () => {
|
|
821
|
+
let n = e.watchdog.editor;
|
|
822
|
+
this.editorPromise = Promise.resolve(n), P.the.register(t, n);
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
let { loadedPlugins: C, hasPremium: D } = await _(p);
|
|
826
|
+
C.push(await R({
|
|
827
|
+
saveDebounceMs: i,
|
|
828
|
+
component: this
|
|
829
|
+
})), m(u) && C.push(await z(i));
|
|
830
|
+
let k = [...await v(o, D), x(l || {})].filter((e) => !a(e)), j = {
|
|
831
|
+
...c,
|
|
832
|
+
...w(t)
|
|
833
|
+
};
|
|
834
|
+
m(u) && (j = j.main || "");
|
|
835
|
+
let N = await (async () => {
|
|
836
|
+
let e = S(t);
|
|
837
|
+
if (!(e instanceof HTMLElement) && !("main" in e)) {
|
|
838
|
+
let n = u === "decoupled" ? ["main"] : Object.keys(j);
|
|
839
|
+
V(e, n) || (e = await H(t, n), j = {
|
|
840
|
+
...c,
|
|
841
|
+
...w(t)
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
m(u) && "main" in e && (e = e.main);
|
|
845
|
+
let n = T(g);
|
|
846
|
+
n = E([...k].reverse(), o.ui, n);
|
|
847
|
+
let r = {
|
|
848
|
+
...n,
|
|
849
|
+
initialData: j,
|
|
850
|
+
licenseKey: f,
|
|
851
|
+
plugins: C,
|
|
852
|
+
language: o,
|
|
853
|
+
...k.length && { translations: k }
|
|
854
|
+
};
|
|
855
|
+
return !b || !(e instanceof HTMLElement) ? y.create(e, r) : (await d({
|
|
856
|
+
context: b,
|
|
857
|
+
element: e,
|
|
858
|
+
creator: y,
|
|
859
|
+
config: r
|
|
860
|
+
})).editor;
|
|
861
|
+
})();
|
|
862
|
+
return m(u) && r && O(N, r), this.applyRootAttributes(N), N;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
function V(e, t) {
|
|
866
|
+
return t.every((t) => e[t]);
|
|
1257
867
|
}
|
|
1258
|
-
async function
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
if (!K(e, t))
|
|
1263
|
-
throw new Error(
|
|
1264
|
-
`It looks like not all required root elements are present yet.
|
|
868
|
+
async function H(e, t) {
|
|
869
|
+
return l(() => {
|
|
870
|
+
let n = S(e);
|
|
871
|
+
if (!V(n, t)) throw Error(`It looks like not all required root elements are present yet.
|
|
1265
872
|
* If you want to wait for them, ensure they are registered before editor initialization.
|
|
1266
873
|
* If you want lazy initialize roots, consider removing root values from the \`initialData\` config and assign initial data in editable components.
|
|
1267
|
-
Missing roots: ${t.filter((
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
}
|
|
1295
|
-
/**
|
|
1296
|
-
* Destroys the UI part component. Unmounts UI parts from the editor.
|
|
1297
|
-
*/
|
|
1298
|
-
async destroyed() {
|
|
1299
|
-
this.element.style.display = "none", await this.mountedPromise, this.mountedPromise = null, this.element.innerHTML = "";
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
function pt(i) {
|
|
1303
|
-
switch (i) {
|
|
1304
|
-
case "toolbar":
|
|
1305
|
-
return "toolbar";
|
|
1306
|
-
case "menubar":
|
|
1307
|
-
return "menuBarView";
|
|
1308
|
-
default:
|
|
1309
|
-
return null;
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
const wt = {
|
|
1313
|
-
ckeditor5: dt,
|
|
1314
|
-
"ckeditor5-context": st,
|
|
1315
|
-
"ckeditor5-ui-part": ht,
|
|
1316
|
-
"ckeditor5-editable": ct
|
|
874
|
+
Missing roots: ${t.filter((e) => !n[e]).join(", ")}.`);
|
|
875
|
+
return n;
|
|
876
|
+
}, {
|
|
877
|
+
timeOutAfter: 2e3,
|
|
878
|
+
retryAfter: 100
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region src/hooks/ui-part.ts
|
|
883
|
+
var U = class extends e {
|
|
884
|
+
mountedPromise = null;
|
|
885
|
+
async mounted() {
|
|
886
|
+
let { editorId: e, name: t } = this.canonical;
|
|
887
|
+
this.mountedPromise = P.the.execute(e, (e) => {
|
|
888
|
+
/* v8 ignore next if -- @preserve */
|
|
889
|
+
if (this.isBeingDestroyed()) return;
|
|
890
|
+
let { ui: n } = e, r = W(t), i = n.view[r];
|
|
891
|
+
if (!i) {
|
|
892
|
+
console.error(`Unknown UI part name: "${t}". Supported names are "toolbar" and "menubar".`);
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
this.element.appendChild(i.element);
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
async destroyed() {
|
|
899
|
+
this.element.style.display = "none", await this.mountedPromise, this.mountedPromise = null, this.element.innerHTML = "";
|
|
900
|
+
}
|
|
1317
901
|
};
|
|
1318
|
-
function
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
902
|
+
function W(e) {
|
|
903
|
+
switch (e) {
|
|
904
|
+
case "toolbar": return "toolbar";
|
|
905
|
+
case "menubar": return "menuBarView";
|
|
906
|
+
default: return null;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/hooks/index.ts
|
|
911
|
+
var G = {
|
|
912
|
+
ckeditor5: B,
|
|
913
|
+
"ckeditor5-context": N,
|
|
914
|
+
"ckeditor5-ui-part": U,
|
|
915
|
+
"ckeditor5-editable": L
|
|
1332
916
|
};
|
|
1333
|
-
|
|
917
|
+
function K() {
|
|
918
|
+
for (let [e, n] of Object.entries(G)) t(e, n);
|
|
919
|
+
}
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region src/index.ts
|
|
922
|
+
K();
|
|
923
|
+
//#endregion
|
|
924
|
+
export { e as ClassHook, M as ContextsRegistry, g as CustomEditorPluginsRegistry, L as EditableComponentHook, B as EditorComponentHook, P as EditorsRegistry, U as UIPartComponentHook, t as registerLivewireComponentHook };
|
|
925
|
+
|
|
926
|
+
//# sourceMappingURL=index.mjs.map
|