ckeditor5-livewire 1.8.0 → 1.10.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.
Files changed (30) hide show
  1. package/dist/hooks/editable.d.ts +18 -6
  2. package/dist/hooks/editable.d.ts.map +1 -1
  3. package/dist/hooks/editor/editor.d.ts +14 -0
  4. package/dist/hooks/editor/editor.d.ts.map +1 -1
  5. package/dist/hooks/editor/plugins/livewire-sync.d.ts.map +1 -1
  6. package/dist/hooks/editor/utils/index.d.ts +0 -1
  7. package/dist/hooks/editor/utils/index.d.ts.map +1 -1
  8. package/dist/hooks/utils/index.d.ts +3 -0
  9. package/dist/hooks/utils/index.d.ts.map +1 -0
  10. package/dist/hooks/utils/is-wire-model-connected.d.ts +8 -0
  11. package/dist/hooks/utils/is-wire-model-connected.d.ts.map +1 -0
  12. package/dist/hooks/utils/root-attributes-updater.d.ts +16 -0
  13. package/dist/hooks/utils/root-attributes-updater.d.ts.map +1 -0
  14. package/dist/index.cjs +2 -2
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.mjs +160 -122
  17. package/dist/index.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/src/hooks/editable.test.ts +103 -0
  20. package/src/hooks/editable.ts +74 -32
  21. package/src/hooks/editor/editor.test.ts +68 -0
  22. package/src/hooks/editor/editor.ts +31 -1
  23. package/src/hooks/editor/plugins/livewire-sync.ts +28 -4
  24. package/src/hooks/editor/utils/index.ts +0 -1
  25. package/src/hooks/utils/index.ts +2 -0
  26. package/src/hooks/{editor/utils → utils}/is-wire-model-connected.test.ts +2 -1
  27. package/src/hooks/{editor/utils → utils}/is-wire-model-connected.ts +6 -0
  28. package/src/hooks/utils/root-attributes-updater.ts +46 -0
  29. package/dist/hooks/editor/utils/is-wire-model-connected.d.ts +0 -2
  30. package/dist/hooks/editor/utils/is-wire-model-connected.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -212,18 +212,8 @@ function m(e) {
212
212
  ].includes(e);
213
213
  }
214
214
  //#endregion
215
- //#region src/hooks/editor/utils/is-wire-model-connected.ts
216
- function h(e) {
217
- let t = e;
218
- for (; t;) {
219
- for (let e of t.attributes) if (e.name.startsWith("wire:model")) return !0;
220
- t = t.parentElement;
221
- }
222
- return !1;
223
- }
224
- //#endregion
225
215
  //#region src/hooks/editor/utils/load-editor-constructor.ts
226
- async function g(e) {
216
+ async function h(e) {
227
217
  let t = await import("ckeditor5"), n = {
228
218
  inline: t.InlineEditor,
229
219
  balloon: t.BalloonEditor,
@@ -236,7 +226,7 @@ async function g(e) {
236
226
  }
237
227
  //#endregion
238
228
  //#region src/hooks/editor/custom-editor-plugins.ts
239
- var _ = class e {
229
+ var g = class e {
240
230
  static the = new e();
241
231
  plugins = /* @__PURE__ */ new Map();
242
232
  constructor() {}
@@ -260,9 +250,9 @@ var _ = class e {
260
250
  };
261
251
  //#endregion
262
252
  //#region src/hooks/editor/utils/load-editor-plugins.ts
263
- async function v(e) {
253
+ async function _(e) {
264
254
  let t = await import("ckeditor5"), n = null, r = e.map(async (e) => {
265
- let r = await _.the.get(e);
255
+ let r = await g.the.get(e);
266
256
  if (r) return r;
267
257
  let { [e]: i } = t;
268
258
  if (i) return i;
@@ -284,19 +274,19 @@ async function v(e) {
284
274
  }
285
275
  //#endregion
286
276
  //#region src/hooks/editor/utils/load-editor-translations.ts
287
- async function y(e, t) {
288
- let n = [e.ui, e.content], r = [b("ckeditor5", n)];
289
- return t && r.push(b("ckeditor5-premium-features", n)), await Promise.all(r).then((e) => e.flat());
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());
290
280
  }
291
- async function b(e, t) {
281
+ async function y(e, t) {
292
282
  /* v8 ignore next */
293
283
  return await Promise.all(t.filter((e) => e !== "en").map(async (t) => {
294
- let n = await x(e, t);
284
+ let n = await b(e, t);
295
285
  /* v8 ignore next -- @preserve */
296
286
  return n?.default ?? n;
297
287
  }).filter(Boolean));
298
288
  }
299
- async function x(e, t) {
289
+ async function b(e, t) {
300
290
  try {
301
291
  /* v8 ignore next if -- @preserve */
302
292
  if (e === "ckeditor5") switch (t) {
@@ -456,15 +446,15 @@ catch (n) {
456
446
  }
457
447
  //#endregion
458
448
  //#region src/hooks/editor/utils/normalize-custom-translations.ts
459
- function S(e) {
449
+ function x(e) {
460
450
  return o(e, (e) => ({ dictionary: e }));
461
451
  }
462
452
  //#endregion
463
453
  //#region src/hooks/editor/utils/query-editor-editables.ts
464
- function C(e) {
465
- return o(w(e), ({ element: e }) => e);
454
+ function S(e) {
455
+ return o(C(e), ({ element: e }) => e);
466
456
  }
467
- function w(e) {
457
+ function C(e) {
468
458
  let t = window.Livewire.all().filter(({ name: t, canonical: n }) => t === "ckeditor5-editable" && n.editorId === e).reduce((e, { canonical: t, el: n }) => ({
469
459
  ...e,
470
460
  [t.rootName]: {
@@ -486,38 +476,38 @@ function w(e) {
486
476
  }
487
477
  } : t;
488
478
  }
489
- function T(e) {
490
- return i(o(w(e), ({ content: e }) => e), (e) => typeof e == "string");
479
+ function w(e) {
480
+ return i(o(C(e), ({ content: e }) => e), (e) => typeof e == "string");
491
481
  }
492
482
  //#endregion
493
483
  //#region src/hooks/editor/utils/resolve-editor-config-elements-references.ts
494
- function E(e) {
484
+ function T(e) {
495
485
  if (!e || typeof e != "object") return e;
496
- if (Array.isArray(e)) return e.map((e) => E(e));
486
+ if (Array.isArray(e)) return e.map((e) => T(e));
497
487
  let t = e;
498
488
  if (t.$element && typeof t.$element == "string") {
499
489
  let e = document.querySelector(t.$element);
500
490
  return e || console.warn(`Element not found for selector: ${t.$element}`), e || null;
501
491
  }
502
492
  let n = Object.create(null);
503
- for (let [t, r] of Object.entries(e)) n[t] = E(r);
493
+ for (let [t, r] of Object.entries(e)) n[t] = T(r);
504
494
  return n;
505
495
  }
506
496
  //#endregion
507
497
  //#region src/hooks/editor/utils/resolve-editor-config-translations.ts
508
- function D(e, t, n) {
498
+ function E(e, t, n) {
509
499
  if (!n || typeof n != "object") return n;
510
- if (Array.isArray(n)) return n.map((n) => D(e, t, n));
500
+ if (Array.isArray(n)) return n.map((n) => E(e, t, n));
511
501
  let r = n;
512
502
  if (r.$translation && typeof r.$translation == "string") {
513
- let n = r.$translation, i = O(e, n, t);
503
+ let n = r.$translation, i = D(e, n, t);
514
504
  return i === void 0 && console.warn(`Translation not found for key: ${n}`), i === void 0 ? null : i;
515
505
  }
516
506
  let i = Object.create(null);
517
- for (let [r, a] of Object.entries(n)) i[r] = D(e, t, a);
507
+ for (let [r, a] of Object.entries(n)) i[r] = E(e, t, a);
518
508
  return i;
519
509
  }
520
- function O(e, t, n) {
510
+ function D(e, t, n) {
521
511
  for (let r of e) {
522
512
  let e = r[n];
523
513
  if (e?.dictionary && t in e.dictionary) return e.dictionary[t];
@@ -525,7 +515,7 @@ function O(e, t, n) {
525
515
  }
526
516
  //#endregion
527
517
  //#region src/hooks/editor/utils/set-editor-editable-height.ts
528
- function k(e, t) {
518
+ function O(e, t) {
529
519
  let { editing: n } = e;
530
520
  n.view.change((e) => {
531
521
  e.setStyle("height", `${t}px`, n.view.document.getRoot());
@@ -533,34 +523,34 @@ function k(e, t) {
533
523
  }
534
524
  //#endregion
535
525
  //#region src/hooks/editor/utils/wrap-with-watchdog.ts
536
- var A = Symbol.for("elixir-editor-watchdog");
537
- async function j(e) {
526
+ var k = Symbol.for("elixir-editor-watchdog");
527
+ async function A(e) {
538
528
  let { EditorWatchdog: t } = await import("ckeditor5"), n = new t(e);
539
529
  return n.setCreator(async (...t) => {
540
530
  let r = await e.create(...t);
541
- return r[A] = n, r;
531
+ return r[k] = n, r;
542
532
  }), {
543
533
  watchdog: n,
544
534
  Constructor: { create: async (...e) => (await n.create(...e), n.editor) }
545
535
  };
546
536
  }
547
- function M(e) {
548
- return A in e ? e[A] : null;
537
+ function j(e) {
538
+ return k in e ? e[k] : null;
549
539
  }
550
540
  //#endregion
551
541
  //#region src/hooks/context/contexts-registry.ts
552
- var N = class e extends n {
542
+ var M = class e extends n {
553
543
  static the = new e();
554
- }, P = class extends e {
544
+ }, N = class extends e {
555
545
  contextPromise = null;
556
546
  async mounted() {
557
- let { contextId: e, language: t, context: n } = this.canonical, { customTranslations: r, watchdogConfig: i, config: { plugins: o, ...s } } = n, { loadedPlugins: c, hasPremium: l } = await v(o ?? []), u = [...await y(t, l), S(r || {})].filter((e) => !a(e));
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));
558
548
  this.contextPromise = (async () => {
559
549
  let { ContextWatchdog: e, Context: n } = await import("ckeditor5"), r = new e(n, {
560
550
  crashNumberLimit: 10,
561
551
  ...i
562
- }), a = E(s);
563
- return a = D([...u].reverse(), t.ui, a), await r.create({
552
+ }), a = T(s);
553
+ return a = E([...u].reverse(), t.ui, a), await r.create({
564
554
  ...a,
565
555
  language: t,
566
556
  plugins: c,
@@ -571,7 +561,7 @@ var N = class e extends n {
571
561
  })();
572
562
  let d = await this.contextPromise;
573
563
  /* v8 ignore next if -- @preserve */
574
- this.isBeingDestroyed() || N.the.register(e, d);
564
+ this.isBeingDestroyed() || M.the.register(e, d);
575
565
  }
576
566
  async destroyed() {
577
567
  let { contextId: e } = this.canonical;
@@ -579,17 +569,45 @@ var N = class e extends n {
579
569
  try {
580
570
  await (await this.contextPromise)?.destroy();
581
571
  } finally {
582
- this.contextPromise = null, N.the.hasItem(e) && N.the.unregister(e);
572
+ this.contextPromise = null, M.the.hasItem(e) && M.the.unregister(e);
583
573
  }
584
574
  }
585
- }, F = class e extends n {
575
+ }, P = class e extends n {
586
576
  static the = new e();
587
- }, I = class extends 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 {
588
605
  editorPromise = null;
606
+ rootAttributesUpdater = null;
589
607
  pendingContent = null;
590
608
  mounted() {
591
609
  let { editorId: e, rootName: t, content: n } = this.canonical;
592
- this.editorPromise = F.the.execute(e, (e) => {
610
+ this.editorPromise = P.the.execute(e, (e) => {
593
611
  /* v8 ignore next if -- @preserve */
594
612
  if (this.isBeingDestroyed()) return null;
595
613
  let { ui: r, editing: i, model: a } = e;
@@ -606,16 +624,33 @@ var N = class e extends n {
606
624
  let a = this.element.querySelector("[data-cke-editable-content]"), o = r.view.createEditable(t, a);
607
625
  r.addEditable(o), i.view.forceRender();
608
626
  }
609
- return this.syncTypingContentPush(e), this.setupPendingReceivedContentHandlers(e), e;
627
+ return this.syncTypingContentPush(e), this.setupPendingReceivedContentHandlers(e), this.applyRootAttributes(e), e;
610
628
  });
611
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
+ }
612
644
  syncTypingContentPush(e) {
613
- let { rootName: t, saveDebounceMs: n } = this.canonical, i = this.element.querySelector("input"), a = () => {
645
+ let { rootName: t, saveDebounceMs: n } = this.canonical, i = this.element.querySelector("input"), a = !1, o = () => {
646
+ if (a) return;
614
647
  let n = e.getData({ rootName: t });
615
648
  i && (i.value = n), this.$wire.set("content", n);
616
- }, o = r(n, a);
617
- e.model.document.on("change:data", o), a(), this.onBeforeDestroy(() => {
618
- e.model.document.off("change:data", o);
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);
619
654
  });
620
655
  }
621
656
  setupPendingReceivedContentHandlers(e) {
@@ -629,7 +664,7 @@ var N = class e extends n {
629
664
  });
630
665
  }
631
666
  applyCanonicalContentToEditor(e) {
632
- if (!h(this.element)) return;
667
+ if (!F(this.element)) return;
633
668
  let { content: t, rootName: n } = this.canonical, { ui: r } = e;
634
669
  if (e.getData({ rootName: n }) !== (t ?? "")) {
635
670
  if (r.focusTracker.isFocused) {
@@ -639,24 +674,14 @@ var N = class e extends n {
639
674
  e.setData({ [n]: t ?? "" });
640
675
  }
641
676
  }
642
- async afterCommitSynced() {
643
- let e = await this.editorPromise;
644
- this.applyCanonicalContentToEditor(e);
645
- }
646
- async destroyed() {
647
- let { rootName: e } = this.canonical;
648
- this.element.style.display = "none";
649
- let t = await this.editorPromise;
650
- if (this.editorPromise = null, t && t.state !== "destroyed") {
651
- let n = t.model.document.getRoot(e);
652
- /* v8 ignore next if -- @preserve */
653
- n && "detachEditable" in t && (t.detachEditable(n), t.detachRoot(e, !1));
654
- }
677
+ applyRootAttributes(e) {
678
+ let { rootName: t, rootAttributes: n } = this.canonical;
679
+ this.rootAttributesUpdater ??= I(e, t), this.rootAttributesUpdater(n);
655
680
  }
656
681
  };
657
682
  //#endregion
658
683
  //#region src/hooks/editor/plugins/livewire-sync.ts
659
- async function L({ saveDebounceMs: e, component: t }) {
684
+ async function R({ saveDebounceMs: e, component: t }) {
660
685
  let { Plugin: n } = await import("ckeditor5");
661
686
  return class extends n {
662
687
  static get pluginName() {
@@ -668,7 +693,7 @@ async function L({ saveDebounceMs: e, component: t }) {
668
693
  setupAfterCommitHandler() {
669
694
  let { editor: e } = this, { model: n, ui: { focusTracker: r } } = e, i = null;
670
695
  e.on("afterCommitSynced", () => {
671
- if (!h(t.element)) return;
696
+ if (!F(t.element)) return;
672
697
  let { content: n } = t.canonical, a = this.getEditorRootsValues();
673
698
  if (r.isFocused) {
674
699
  /* v8 ignore next else -- @preserve */
@@ -695,14 +720,20 @@ async function L({ saveDebounceMs: e, component: t }) {
695
720
  });
696
721
  }
697
722
  setupTypingContentPush() {
698
- let { model: n } = this.editor, { $wire: i } = t, a = () => {
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;
699
726
  let e = this.getEditorRootsValues();
700
- s(e, t.canonical.content ?? {}) || (i.set("content", e), i.dispatch("editor-content-changed", {
727
+ s(e, t.canonical.content ?? {}) || (o.set("content", e), o.dispatch("editor-content-changed", {
701
728
  editorId: t.canonical.editorId,
702
729
  content: e
703
730
  }));
731
+ }, u = r(e, l), d = () => {
732
+ a.focusTracker.isFocused ? u() : l();
704
733
  };
705
- n.document.on("change:data", r(e, a)), this.editor.once("ready", a);
734
+ i.document.on("change:data", d), n.once("ready", l), n.once("destroy", () => {
735
+ c = !0, i.document.off("change:data", d);
736
+ });
706
737
  }
707
738
  setupFocusableEventPush() {
708
739
  let { ui: e } = this.editor, { $wire: n } = t;
@@ -718,7 +749,7 @@ async function L({ saveDebounceMs: e, component: t }) {
718
749
  }
719
750
  //#endregion
720
751
  //#region src/hooks/editor/plugins/sync-editor-with-input.ts
721
- async function R(e) {
752
+ async function z(e) {
722
753
  let { Plugin: t } = await import("ckeditor5");
723
754
  return class extends t {
724
755
  input = null;
@@ -744,21 +775,22 @@ async function R(e) {
744
775
  }
745
776
  //#endregion
746
777
  //#region src/hooks/editor/editor.ts
747
- var z = class extends e {
778
+ var B = class extends e {
748
779
  editorPromise = null;
780
+ rootAttributesUpdater = null;
749
781
  async mounted() {
750
782
  let { editorId: e } = this.canonical;
751
- F.the.resetErrors(e);
783
+ P.the.resetErrors(e);
752
784
  try {
753
785
  this.editorPromise = this.createEditor();
754
786
  let t = await this.editorPromise;
755
787
  /* v8 ignore next if -- @preserve */
756
- this.isBeingDestroyed() || (F.the.register(e, t), t.once("destroy", () => {
788
+ this.isBeingDestroyed() || (P.the.register(e, t), t.once("destroy", () => {
757
789
  /* v8 ignore next if -- @preserve */
758
- F.the.hasItem(e) && F.the.unregister(e);
790
+ P.the.hasItem(e) && P.the.unregister(e);
759
791
  }));
760
792
  } catch (t) {
761
- console.error(`Error initializing CKEditor5 instance with ID "${e}":`, t), this.editorPromise = null, F.the.error(e, t);
793
+ console.error(`Error initializing CKEditor5 instance with ID "${e}":`, t), this.editorPromise = null, P.the.error(e, t);
762
794
  }
763
795
  }
764
796
  async destroyed() {
@@ -766,71 +798,77 @@ var z = class extends e {
766
798
  try {
767
799
  let e = await this.editorPromise;
768
800
  if (!e) return;
769
- let t = f(e), n = M(e);
801
+ let t = f(e), n = j(e);
770
802
  t ? t.state !== "unavailable" && await t.context.remove(t.editorContextId) : n ? await n.destroy() : await e.destroy();
771
803
  } finally {
772
804
  this.editorPromise = null;
773
805
  }
774
806
  }
775
807
  async afterCommitSynced() {
776
- (await this.editorPromise)?.fire("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);
777
815
  }
778
816
  async createEditor() {
779
- 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, ...h } } = e, _ = await g(u), b = await (n ? N.the.waitFor(n) : null);
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);
780
818
  if (s && !b) {
781
- let e = await j(_);
782
- ({Constructor: _} = e), e.watchdog.on("restart", () => {
819
+ let e = await A(y);
820
+ ({Constructor: y} = e), e.watchdog.on("restart", () => {
783
821
  let n = e.watchdog.editor;
784
- this.editorPromise = Promise.resolve(n), F.the.register(t, n);
822
+ this.editorPromise = Promise.resolve(n), P.the.register(t, n);
785
823
  });
786
824
  }
787
- let { loadedPlugins: x, hasPremium: w } = await v(p);
788
- x.push(await L({
825
+ let { loadedPlugins: C, hasPremium: D } = await _(p);
826
+ C.push(await R({
789
827
  saveDebounceMs: i,
790
828
  component: this
791
- })), m(u) && x.push(await R(i));
792
- let O = [...await y(o, w), S(l || {})].filter((e) => !a(e)), A = {
829
+ })), m(u) && C.push(await z(i));
830
+ let k = [...await v(o, D), x(l || {})].filter((e) => !a(e)), j = {
793
831
  ...c,
794
- ...T(t)
832
+ ...w(t)
795
833
  };
796
- m(u) && (A = A.main || "");
797
- let M = await (async () => {
798
- let e = C(t);
834
+ m(u) && (j = j.main || "");
835
+ let N = await (async () => {
836
+ let e = S(t);
799
837
  if (!(e instanceof HTMLElement) && !("main" in e)) {
800
- let n = u === "decoupled" ? ["main"] : Object.keys(A);
801
- B(e, n) || (e = await V(t, n), A = {
838
+ let n = u === "decoupled" ? ["main"] : Object.keys(j);
839
+ V(e, n) || (e = await H(t, n), j = {
802
840
  ...c,
803
- ...T(t)
841
+ ...w(t)
804
842
  });
805
843
  }
806
844
  m(u) && "main" in e && (e = e.main);
807
- let n = E(h);
808
- n = D([...O].reverse(), o.ui, n);
845
+ let n = T(g);
846
+ n = E([...k].reverse(), o.ui, n);
809
847
  let r = {
810
848
  ...n,
811
- initialData: A,
849
+ initialData: j,
812
850
  licenseKey: f,
813
- plugins: x,
851
+ plugins: C,
814
852
  language: o,
815
- ...O.length && { translations: O }
853
+ ...k.length && { translations: k }
816
854
  };
817
- return !b || !(e instanceof HTMLElement) ? _.create(e, r) : (await d({
855
+ return !b || !(e instanceof HTMLElement) ? y.create(e, r) : (await d({
818
856
  context: b,
819
857
  element: e,
820
- creator: _,
858
+ creator: y,
821
859
  config: r
822
860
  })).editor;
823
861
  })();
824
- return m(u) && r && k(M, r), M;
862
+ return m(u) && r && O(N, r), this.applyRootAttributes(N), N;
825
863
  }
826
864
  };
827
- function B(e, t) {
865
+ function V(e, t) {
828
866
  return t.every((t) => e[t]);
829
867
  }
830
- async function V(e, t) {
868
+ async function H(e, t) {
831
869
  return l(() => {
832
- let n = C(e);
833
- if (!B(n, t)) throw Error(`It looks like not all required root elements are present yet.
870
+ let n = S(e);
871
+ if (!V(n, t)) throw Error(`It looks like not all required root elements are present yet.
834
872
  * If you want to wait for them, ensure they are registered before editor initialization.
835
873
  * If you want lazy initialize roots, consider removing root values from the \`initialData\` config and assign initial data in editable components.
836
874
  Missing roots: ${t.filter((e) => !n[e]).join(", ")}.`);
@@ -842,14 +880,14 @@ Missing roots: ${t.filter((e) => !n[e]).join(", ")}.`);
842
880
  }
843
881
  //#endregion
844
882
  //#region src/hooks/ui-part.ts
845
- var H = class extends e {
883
+ var U = class extends e {
846
884
  mountedPromise = null;
847
885
  async mounted() {
848
886
  let { editorId: e, name: t } = this.canonical;
849
- this.mountedPromise = F.the.execute(e, (e) => {
887
+ this.mountedPromise = P.the.execute(e, (e) => {
850
888
  /* v8 ignore next if -- @preserve */
851
889
  if (this.isBeingDestroyed()) return;
852
- let { ui: n } = e, r = U(t), i = n.view[r];
890
+ let { ui: n } = e, r = W(t), i = n.view[r];
853
891
  if (!i) {
854
892
  console.error(`Unknown UI part name: "${t}". Supported names are "toolbar" and "menubar".`);
855
893
  return;
@@ -861,7 +899,7 @@ var H = class extends e {
861
899
  this.element.style.display = "none", await this.mountedPromise, this.mountedPromise = null, this.element.innerHTML = "";
862
900
  }
863
901
  };
864
- function U(e) {
902
+ function W(e) {
865
903
  switch (e) {
866
904
  case "toolbar": return "toolbar";
867
905
  case "menubar": return "menuBarView";
@@ -870,19 +908,19 @@ function U(e) {
870
908
  }
871
909
  //#endregion
872
910
  //#region src/hooks/index.ts
873
- var W = {
874
- ckeditor5: z,
875
- "ckeditor5-context": P,
876
- "ckeditor5-ui-part": H,
877
- "ckeditor5-editable": I
911
+ var G = {
912
+ ckeditor5: B,
913
+ "ckeditor5-context": N,
914
+ "ckeditor5-ui-part": U,
915
+ "ckeditor5-editable": L
878
916
  };
879
- function G() {
880
- for (let [e, n] of Object.entries(W)) t(e, n);
917
+ function K() {
918
+ for (let [e, n] of Object.entries(G)) t(e, n);
881
919
  }
882
920
  //#endregion
883
921
  //#region src/index.ts
884
- G();
922
+ K();
885
923
  //#endregion
886
- export { e as ClassHook, N as ContextsRegistry, _ as CustomEditorPluginsRegistry, I as EditableComponentHook, z as EditorComponentHook, F as EditorsRegistry, H as UIPartComponentHook, t as registerLivewireComponentHook };
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 };
887
925
 
888
926
  //# sourceMappingURL=index.mjs.map