ckeditor5-livewire 1.11.0 → 1.12.1

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 (26) hide show
  1. package/dist/hooks/editor/editor.d.ts.map +1 -1
  2. package/dist/hooks/editor/types/editor-relaxed-constructor.type.d.ts +6 -0
  3. package/dist/hooks/editor/types/editor-relaxed-constructor.type.d.ts.map +1 -0
  4. package/dist/hooks/editor/types/index.d.ts +2 -0
  5. package/dist/hooks/editor/types/index.d.ts.map +1 -0
  6. package/dist/hooks/editor/utils/assign-initial-data-to-editor-config.d.ts +10 -0
  7. package/dist/hooks/editor/utils/assign-initial-data-to-editor-config.d.ts.map +1 -0
  8. package/dist/hooks/editor/utils/assign-source-elements-to-editor-config.d.ts +12 -0
  9. package/dist/hooks/editor/utils/assign-source-elements-to-editor-config.d.ts.map +1 -0
  10. package/dist/hooks/editor/utils/create-editor-in-context.d.ts +1 -3
  11. package/dist/hooks/editor/utils/create-editor-in-context.d.ts.map +1 -1
  12. package/dist/hooks/editor/utils/index.d.ts +2 -0
  13. package/dist/hooks/editor/utils/index.d.ts.map +1 -1
  14. package/dist/index.cjs +2 -2
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.mjs +168 -130
  17. package/dist/index.mjs.map +1 -1
  18. package/package.json +3 -3
  19. package/src/hooks/editable.ts +1 -1
  20. package/src/hooks/editor/editor.ts +13 -14
  21. package/src/hooks/editor/types/editor-relaxed-constructor.type.ts +6 -0
  22. package/src/hooks/editor/types/index.ts +1 -0
  23. package/src/hooks/editor/utils/assign-initial-data-to-editor-config.ts +48 -0
  24. package/src/hooks/editor/utils/assign-source-elements-to-editor-config.ts +61 -0
  25. package/src/hooks/editor/utils/create-editor-in-context.ts +2 -5
  26. package/src/hooks/editor/utils/index.ts +2 -0
package/dist/index.mjs CHANGED
@@ -210,8 +210,51 @@ function u(e, { timeOutAfter: t = 500, retryAfter: n = 100 } = {}) {
210
210
  });
211
211
  }
212
212
  //#endregion
213
+ //#region src/hooks/editor/utils/assign-initial-data-to-editor-config.ts
214
+ function d(e, t) {
215
+ let n = f(e), r = new Set([...Object.keys(n), ...Object.keys(t.roots ?? {})]), i = Array.from(r).reduce((e, r) => ({
216
+ ...e,
217
+ [r]: {
218
+ ...t.roots?.[r],
219
+ ...r === "main" ? t.root : {},
220
+ ...r in n ? { initialData: n[r] } : {}
221
+ }
222
+ }), Object.create(t.roots || {})), a = {
223
+ ...t,
224
+ roots: i
225
+ };
226
+ return delete a.root, a;
227
+ }
228
+ function f(e) {
229
+ return typeof e == "string" ? { main: e } : { ...e };
230
+ }
231
+ //#endregion
232
+ //#region src/hooks/editor/utils/assign-source-elements-to-editor-config.ts
233
+ function p(e, t, n) {
234
+ let r = m(t);
235
+ if (!e.editorName || e.editorName === "ClassicEditor") return {
236
+ ...n,
237
+ attachTo: r.main
238
+ };
239
+ let i = new Set([...Object.keys(r), ...Object.keys(n.roots ?? {})]), a = Array.from(i).reduce((e, t) => ({
240
+ ...e,
241
+ [t]: {
242
+ ...n.roots?.[t],
243
+ ...t === "main" ? n.root : {},
244
+ ...t in r ? { element: r[t] } : {}
245
+ }
246
+ }), Object.create(n.roots || {})), o = {
247
+ ...n,
248
+ roots: a
249
+ };
250
+ return delete o.root, o;
251
+ }
252
+ function m(e) {
253
+ return e instanceof HTMLElement ? { main: e } : { ...e };
254
+ }
255
+ //#endregion
213
256
  //#region src/hooks/editor/utils/cleanup-orphan-editor-elements.ts
214
- function d(e) {
257
+ function h(e) {
215
258
  let t = [
216
259
  e.ui?.element,
217
260
  e.ui?.view?.toolbar?.element,
@@ -228,44 +271,43 @@ function d(e) {
228
271
  }
229
272
  //#endregion
230
273
  //#region src/hooks/editor/utils/create-editor-in-context.ts
231
- var f = Symbol.for("context-editor-watchdog");
232
- async function p({ element: e, context: t, creator: n, config: r }) {
233
- let i = l();
234
- await t.add({
235
- creator: (e, t) => n.create(e, t),
236
- id: i,
237
- sourceElementOrData: e,
274
+ var g = Symbol.for("context-editor-watchdog");
275
+ async function _({ context: e, creator: t, config: n }) {
276
+ let r = l();
277
+ await e.add({
278
+ creator: t.create.bind(t),
279
+ id: r,
238
280
  type: "editor",
239
- config: r
281
+ config: n
240
282
  });
241
- let a = t.getItem(i), o = {
283
+ let i = e.getItem(r), a = {
242
284
  state: "available",
243
- editorContextId: i,
244
- context: t
285
+ editorContextId: r,
286
+ context: e
245
287
  };
246
- a[f] = o;
247
- let s = t.destroy.bind(t);
248
- return t.destroy = async () => (o.state = "unavailable", s()), {
249
- ...o,
250
- editor: a
288
+ i[g] = a;
289
+ let o = e.destroy.bind(e);
290
+ return e.destroy = async () => (a.state = "unavailable", o()), {
291
+ ...a,
292
+ editor: i
251
293
  };
252
294
  }
253
- function m(e) {
254
- return f in e ? e[f] : null;
295
+ function v(e) {
296
+ return g in e ? e[g] : null;
255
297
  }
256
298
  //#endregion
257
299
  //#region src/hooks/editor/utils/get-editor-roots-values.ts
258
- function h(e) {
300
+ function y(e) {
259
301
  return e.model.document.getRootNames().reduce((t, n) => (t[n] = e.getData({ rootName: n }), t), Object.create({}));
260
302
  }
261
303
  //#endregion
262
304
  //#region src/hooks/editor/utils/is-multiroot-editor-instance.ts
263
- function g(e) {
305
+ function b(e) {
264
306
  return "addEditable" in e.ui;
265
307
  }
266
308
  //#endregion
267
309
  //#region src/hooks/editor/utils/is-single-root-editor.ts
268
- function _(e) {
310
+ function x(e) {
269
311
  return [
270
312
  "inline",
271
313
  "classic",
@@ -275,7 +317,7 @@ function _(e) {
275
317
  }
276
318
  //#endregion
277
319
  //#region src/hooks/editor/utils/load-editor-constructor.ts
278
- async function v(e) {
320
+ async function S(e) {
279
321
  let t = await import("ckeditor5"), n = {
280
322
  inline: t.InlineEditor,
281
323
  balloon: t.BalloonEditor,
@@ -288,7 +330,7 @@ async function v(e) {
288
330
  }
289
331
  //#endregion
290
332
  //#region src/hooks/editor/custom-editor-plugins.ts
291
- var y = class e {
333
+ var C = class e {
292
334
  static the = new e();
293
335
  plugins = /* @__PURE__ */ new Map();
294
336
  constructor() {}
@@ -312,9 +354,9 @@ var y = class e {
312
354
  };
313
355
  //#endregion
314
356
  //#region src/hooks/editor/utils/load-editor-plugins.ts
315
- async function b(e) {
357
+ async function w(e) {
316
358
  let t = await import("ckeditor5"), n = null, r = e.map(async (e) => {
317
- let r = await y.the.get(e);
359
+ let r = await C.the.get(e);
318
360
  if (r) return r;
319
361
  let { [e]: i } = t;
320
362
  if (i) return i;
@@ -336,19 +378,19 @@ async function b(e) {
336
378
  }
337
379
  //#endregion
338
380
  //#region src/hooks/editor/utils/load-editor-translations.ts
339
- async function x(e, t) {
340
- let n = [e.ui, e.content], r = [S("ckeditor5", n)];
341
- return t && r.push(S("ckeditor5-premium-features", n)), await Promise.all(r).then((e) => e.flat());
381
+ async function T(e, t) {
382
+ let n = [e.ui, e.content], r = [E("ckeditor5", n)];
383
+ return t && r.push(E("ckeditor5-premium-features", n)), await Promise.all(r).then((e) => e.flat());
342
384
  }
343
- async function S(e, t) {
385
+ async function E(e, t) {
344
386
  /* v8 ignore next */
345
387
  return await Promise.all(t.filter((e) => e !== "en").map(async (t) => {
346
- let n = await C(e, t);
388
+ let n = await D(e, t);
347
389
  /* v8 ignore next -- @preserve */
348
390
  return n?.default ?? n;
349
391
  }).filter(Boolean));
350
392
  }
351
- async function C(e, t) {
393
+ async function D(e, t) {
352
394
  try {
353
395
  /* v8 ignore next if -- @preserve */
354
396
  if (e === "ckeditor5") switch (t) {
@@ -508,15 +550,15 @@ catch (n) {
508
550
  }
509
551
  //#endregion
510
552
  //#region src/hooks/editor/utils/normalize-custom-translations.ts
511
- function w(e) {
553
+ function O(e) {
512
554
  return s(e, (e) => ({ dictionary: e }));
513
555
  }
514
556
  //#endregion
515
557
  //#region src/hooks/editor/utils/query-editor-editables.ts
516
- function T(e) {
517
- return s(E(e), ({ element: e }) => e);
558
+ function k(e) {
559
+ return s(A(e), ({ element: e }) => e);
518
560
  }
519
- function E(e) {
561
+ function A(e) {
520
562
  let t = window.Livewire.all().filter(({ name: t, canonical: n }) => t === "ckeditor5-editable" && n.editorId === e).reduce((e, { canonical: t, el: n }) => ({
521
563
  ...e,
522
564
  [t.rootName]: {
@@ -538,38 +580,38 @@ function E(e) {
538
580
  }
539
581
  } : t;
540
582
  }
541
- function D(e) {
542
- return a(s(E(e), ({ content: e }) => e), (e) => typeof e == "string");
583
+ function j(e) {
584
+ return a(s(A(e), ({ content: e }) => e), (e) => typeof e == "string");
543
585
  }
544
586
  //#endregion
545
587
  //#region src/hooks/editor/utils/resolve-editor-config-elements-references.ts
546
- function O(e) {
588
+ function M(e) {
547
589
  if (!e || typeof e != "object") return e;
548
- if (Array.isArray(e)) return e.map((e) => O(e));
590
+ if (Array.isArray(e)) return e.map((e) => M(e));
549
591
  let t = e;
550
592
  if (t.$element && typeof t.$element == "string") {
551
593
  let e = document.querySelector(t.$element);
552
594
  return e || console.warn(`Element not found for selector: ${t.$element}`), e || null;
553
595
  }
554
596
  let n = Object.create(null);
555
- for (let [t, r] of Object.entries(e)) n[t] = O(r);
597
+ for (let [t, r] of Object.entries(e)) n[t] = M(r);
556
598
  return n;
557
599
  }
558
600
  //#endregion
559
601
  //#region src/hooks/editor/utils/resolve-editor-config-translations.ts
560
- function k(e, t, n) {
602
+ function N(e, t, n) {
561
603
  if (!n || typeof n != "object") return n;
562
- if (Array.isArray(n)) return n.map((n) => k(e, t, n));
604
+ if (Array.isArray(n)) return n.map((n) => N(e, t, n));
563
605
  let r = n;
564
606
  if (r.$translation && typeof r.$translation == "string") {
565
- let n = r.$translation, i = A(e, n, t);
607
+ let n = r.$translation, i = P(e, n, t);
566
608
  return i === void 0 && console.warn(`Translation not found for key: ${n}`), i === void 0 ? null : i;
567
609
  }
568
610
  let i = Object.create(null);
569
- for (let [r, a] of Object.entries(n)) i[r] = k(e, t, a);
611
+ for (let [r, a] of Object.entries(n)) i[r] = N(e, t, a);
570
612
  return i;
571
613
  }
572
- function A(e, t, n) {
614
+ function P(e, t, n) {
573
615
  for (let r of e) {
574
616
  let e = r[n];
575
617
  if (e?.dictionary && t in e.dictionary) return e.dictionary[t];
@@ -577,7 +619,7 @@ function A(e, t, n) {
577
619
  }
578
620
  //#endregion
579
621
  //#region src/hooks/editor/utils/set-editor-editable-height.ts
580
- function j(e, t) {
622
+ function F(e, t) {
581
623
  let { editing: n } = e;
582
624
  n.view.change((e) => {
583
625
  e.setStyle("height", `${t}px`, n.view.document.getRoot());
@@ -585,34 +627,34 @@ function j(e, t) {
585
627
  }
586
628
  //#endregion
587
629
  //#region src/hooks/editor/utils/wrap-with-watchdog.ts
588
- var M = Symbol.for("livewire-editor-watchdog");
589
- async function N(e, t) {
630
+ var I = Symbol.for("livewire-editor-watchdog");
631
+ async function L(e, t) {
590
632
  let { EditorWatchdog: n } = await import("ckeditor5"), r = new n(null, t ?? {
591
633
  crashNumberLimit: 10,
592
634
  minimumNonErrorTimePeriod: 5e3
593
635
  });
594
636
  return r.setCreator(async () => {
595
637
  let t = await e();
596
- return t[M] = r, t;
638
+ return t[I] = r, t;
597
639
  }), r;
598
640
  }
599
- function P(e) {
600
- return M in e ? e[M] : null;
641
+ function R(e) {
642
+ return I in e ? e[I] : null;
601
643
  }
602
644
  //#endregion
603
645
  //#region src/hooks/context/contexts-registry.ts
604
- var F = class e extends r {
646
+ var z = class e extends r {
605
647
  static the = new e();
606
- }, I = class extends e {
648
+ }, B = class extends e {
607
649
  contextPromise = null;
608
650
  async mounted() {
609
- let { contextId: e, language: t, context: n } = this.canonical, { customTranslations: r, watchdogConfig: i, config: { plugins: a, ...s } } = n, { loadedPlugins: c, hasPremium: l } = await b(a ?? []), u = [...await x(t, l), w(r || {})].filter((e) => !o(e));
651
+ let { contextId: e, language: t, context: n } = this.canonical, { customTranslations: r, watchdogConfig: i, config: { plugins: a, ...s } } = n, { loadedPlugins: c, hasPremium: l } = await w(a ?? []), u = [...await T(t, l), O(r || {})].filter((e) => !o(e));
610
652
  this.contextPromise = (async () => {
611
653
  let { ContextWatchdog: e, Context: n } = await import("ckeditor5"), r = new e(n, {
612
654
  crashNumberLimit: 10,
613
655
  ...i
614
- }), a = O(s);
615
- return a = k([...u].reverse(), t.ui, a), await r.create({
656
+ }), a = M(s);
657
+ return a = N([...u].reverse(), t.ui, a), await r.create({
616
658
  ...a,
617
659
  language: t,
618
660
  plugins: c,
@@ -623,7 +665,7 @@ var F = class e extends r {
623
665
  })();
624
666
  let d = await this.contextPromise;
625
667
  /* v8 ignore next if -- @preserve */
626
- this.isBeingDestroyed() || F.the.register(e, d);
668
+ this.isBeingDestroyed() || z.the.register(e, d);
627
669
  }
628
670
  async destroyed() {
629
671
  let { contextId: e } = this.canonical;
@@ -631,15 +673,15 @@ var F = class e extends r {
631
673
  try {
632
674
  await (await this.contextPromise)?.destroy();
633
675
  } finally {
634
- this.contextPromise = null, F.the.hasItem(e) && F.the.unregister(e);
676
+ this.contextPromise = null, z.the.hasItem(e) && z.the.unregister(e);
635
677
  }
636
678
  }
637
- }, L = class e extends r {
679
+ }, V = class e extends r {
638
680
  static the = new e();
639
681
  };
640
682
  //#endregion
641
683
  //#region src/hooks/utils/is-wire-model-connected.ts
642
- function R(e) {
684
+ function H(e) {
643
685
  let t = e;
644
686
  for (; t;) {
645
687
  for (let e of t.attributes) if (e.name.startsWith("wire:model")) return !0;
@@ -649,7 +691,7 @@ function R(e) {
649
691
  }
650
692
  //#endregion
651
693
  //#region src/hooks/utils/root-attributes-updater.ts
652
- function z(e, t) {
694
+ function U(e, t) {
653
695
  let n = /* @__PURE__ */ new Set();
654
696
  return (r) => {
655
697
  e.model.enqueueChange({ isUndoable: !1 }, (i) => {
@@ -663,11 +705,11 @@ function z(e, t) {
663
705
  }
664
706
  //#endregion
665
707
  //#region src/hooks/editable.ts
666
- var B = class extends e {
708
+ var W = class extends e {
667
709
  rootAttributesUpdater = null;
668
710
  pendingContent = null;
669
711
  mounted() {
670
- let { editorId: e, rootName: t, content: n } = this.canonical, r = L.the.mountEffect(e, (e) => {
712
+ let { editorId: e, rootName: t, content: n } = this.canonical, r = V.the.mountEffect(e, (e) => {
671
713
  /* v8 ignore next if -- @preserve */
672
714
  if (this.isBeingDestroyed()) return;
673
715
  let r = e.model.document.getRoot(t);
@@ -676,11 +718,11 @@ var B = class extends e {
676
718
  r && r !== n && e.setData({ [t]: n });
677
719
  }
678
720
  /* v8 ignore next else -- @preserve */
679
- if (!r && g(e)) {
721
+ if (!r && b(e)) {
680
722
  let { ui: r, editing: i } = e;
681
723
  e.addRoot(t, {
682
724
  isUndoable: !1,
683
- ...n !== null && { data: n }
725
+ ...n !== null && { initialData: n }
684
726
  });
685
727
  let a = this.element.querySelector("[data-cke-editable-content]"), o = r.view.createEditable(t, a);
686
728
  r.addEditable(o), i.view.forceRender();
@@ -691,7 +733,7 @@ var B = class extends e {
691
733
  if (i(), a(), this.rootAttributesUpdater?.(null), e.state !== "destroyed") {
692
734
  let n = e.model.document.getRoot(t);
693
735
  /* v8 ignore next if -- @preserve */
694
- if (n && g(e)) {
736
+ if (n && b(e)) {
695
737
  try {
696
738
  /* v8 ignore else -- @preserve */
697
739
  e.ui.view.editables[t] && e.detachEditable(n);
@@ -707,7 +749,7 @@ var B = class extends e {
707
749
  this.onBeforeDestroy(r);
708
750
  }
709
751
  async afterCommitSynced() {
710
- let { editorId: e } = this.canonical, t = await L.the.waitFor(e);
752
+ let { editorId: e } = this.canonical, t = await V.the.waitFor(e);
711
753
  this.applyCanonicalContentToEditor(t), this.applyRootAttributes(t);
712
754
  }
713
755
  destroyed() {
@@ -736,7 +778,7 @@ var B = class extends e {
736
778
  };
737
779
  }
738
780
  applyCanonicalContentToEditor(e) {
739
- if (!R(this.element)) return;
781
+ if (!H(this.element)) return;
740
782
  let { content: t, rootName: n } = this.canonical, { ui: r } = e;
741
783
  if (e.getData({ rootName: n }) !== (t ?? "")) {
742
784
  if (r.focusTracker.isFocused) {
@@ -748,12 +790,12 @@ var B = class extends e {
748
790
  }
749
791
  applyRootAttributes(e) {
750
792
  let { rootName: t, rootAttributes: n } = this.canonical;
751
- this.rootAttributesUpdater ??= z(e, t), this.rootAttributesUpdater(n);
793
+ this.rootAttributesUpdater ??= U(e, t), this.rootAttributesUpdater(n);
752
794
  }
753
795
  };
754
796
  //#endregion
755
797
  //#region src/hooks/editor/plugins/livewire-sync.ts
756
- async function V({ saveDebounceMs: e, component: t }) {
798
+ async function G({ saveDebounceMs: e, component: t }) {
757
799
  let { Plugin: n } = await import("ckeditor5");
758
800
  return class extends n {
759
801
  static get pluginName() {
@@ -765,7 +807,7 @@ async function V({ saveDebounceMs: e, component: t }) {
765
807
  setupAfterCommitHandler() {
766
808
  let { editor: e } = this, { model: n, ui: { focusTracker: r } } = e, i = null;
767
809
  e.on("afterCommitSynced", () => {
768
- if (!R(t.element)) return;
810
+ if (!H(t.element)) return;
769
811
  let { content: n } = t.canonical, a = this.getEditorRootsValues();
770
812
  if (r.isFocused) {
771
813
  /* v8 ignore next else -- @preserve */
@@ -817,13 +859,13 @@ async function V({ saveDebounceMs: e, component: t }) {
817
859
  });
818
860
  }
819
861
  getEditorRootsValues() {
820
- return h(this.editor);
862
+ return y(this.editor);
821
863
  }
822
864
  };
823
865
  }
824
866
  //#endregion
825
867
  //#region src/hooks/editor/plugins/sync-editor-with-input.ts
826
- async function H(e) {
868
+ async function K(e) {
827
869
  let { Plugin: t } = await import("ckeditor5");
828
870
  return class extends t {
829
871
  input = null;
@@ -849,102 +891,98 @@ async function H(e) {
849
891
  }
850
892
  //#endregion
851
893
  //#region src/hooks/editor/editor.ts
852
- var U = class extends e {
894
+ var q = class extends e {
853
895
  rootAttributesUpdater = null;
854
896
  async mounted() {
855
897
  let { editorId: e } = this.canonical;
856
- L.the.resetErrors(e);
898
+ V.the.resetErrors(e);
857
899
  try {
858
- let t = await this.createEditor(), n = m(t), r = P(t);
900
+ let t = await this.createEditor(), n = v(t), r = R(t);
859
901
  /* v8 ignore next 3 */
860
902
  if (this.isBeingDestroyed()) return;
861
- let i = L.the.mountEffect(e, (t) => {
903
+ let i = V.the.mountEffect(e, (t) => {
862
904
  t.once("destroy", () => {
863
- L.the.unregister(e, !1);
905
+ V.the.unregister(e, !1);
864
906
  }, { priority: "highest" });
865
907
  });
866
908
  this.onBeforeDestroy(async () => {
867
- L.the.unregister(e), i(), n ? n.state !== "unavailable" && await n.context.remove(n.editorContextId) : r ? await r.destroy() : await t.destroy();
868
- }), L.the.register(e, t);
909
+ V.the.unregister(e), i(), n ? n.state !== "unavailable" && await n.context.remove(n.editorContextId) : r ? await r.destroy() : await t.destroy();
910
+ }), V.the.register(e, t);
869
911
  } catch (t) {
870
- console.error(`Error initializing CKEditor5 instance with ID "${e}":`, t), L.the.error(e, t);
912
+ console.error(`Error initializing CKEditor5 instance with ID "${e}":`, t), V.the.error(e, t);
871
913
  }
872
914
  }
873
915
  async destroyed() {
874
916
  this.element.style.display = "none";
875
917
  }
876
918
  async afterCommitSynced() {
877
- let e = await L.the.waitFor(this.canonical.editorId);
919
+ let e = await V.the.waitFor(this.canonical.editorId);
878
920
  /* v8 ignore if -- @preserve */
879
921
  e && (e.fire("afterCommitSynced"), this.applyRootAttributes(e));
880
922
  }
881
923
  applyRootAttributes(e) {
882
924
  let { rootAttributes: t } = this.canonical;
883
- this.rootAttributesUpdater ??= z(e, "main"), this.rootAttributesUpdater(t);
925
+ this.rootAttributesUpdater ??= U(e, "main"), this.rootAttributesUpdater(t);
884
926
  }
885
927
  async createEditor() {
886
- let { preset: e, editorId: t, contextId: n, editableHeight: r, saveDebounceMs: i, language: a, watchdog: s, content: c } = this.canonical, { customTranslations: l, editorType: u, licenseKey: f, watchdogConfig: m, config: { plugins: h, ...g } } = e, y = await v(u), S = await (n ? F.the.waitFor(n) : null), C = async () => {
887
- let { loadedPlugins: e, hasPremium: n } = await b(h);
888
- e.push(await V({
928
+ let { preset: e, editorId: t, contextId: n, editableHeight: r, saveDebounceMs: i, language: a, watchdog: s, content: c } = this.canonical, { customTranslations: l, editorType: u, licenseKey: f, watchdogConfig: m, config: { plugins: g, ...v } } = e, y = await S(u), b = await (n ? z.the.waitFor(n) : null), C = async () => {
929
+ let { loadedPlugins: e, hasPremium: n } = await w(g);
930
+ e.push(await G({
889
931
  saveDebounceMs: i,
890
932
  component: this
891
- })), _(u) && e.push(await H(i));
892
- let s = [...await x(a, n), w(l || {})].filter((e) => !o(e)), d = {
933
+ })), x(u) && e.push(await K(i));
934
+ let s = [...await T(a, n), O(l || {})].filter((e) => !o(e)), m = {
893
935
  ...c,
894
- ...D(t)
936
+ ...j(t)
895
937
  };
896
- _(u) && (d = d.main || "");
897
- let m = await (async () => {
898
- let n = T(t);
938
+ x(u) && (m = m.main || "");
939
+ let h = await (async () => {
940
+ let n = k(t);
899
941
  if (!(n instanceof HTMLElement) && !("main" in n)) {
900
- let e = u === "decoupled" ? ["main"] : Object.keys(d);
901
- W(n, e) || (n = await G(t, e), d = {
942
+ let e = u === "decoupled" ? ["main"] : Object.keys(m);
943
+ J(n, e) || (n = await Y(t, e), m = {
902
944
  ...c,
903
- ...D(t)
945
+ ...j(t)
904
946
  });
905
947
  }
906
- _(u) && "main" in n && (n = n.main);
907
- let r = O(g);
908
- r = k([...s].reverse(), a.ui, r);
909
- let i = {
910
- ...r,
911
- initialData: d,
948
+ x(u) && "main" in n && (n = n.main);
949
+ let r = {
950
+ ...v,
912
951
  licenseKey: f,
913
952
  plugins: e,
914
953
  language: a,
915
954
  ...s.length && { translations: s }
916
955
  };
917
- return !S || !(n instanceof HTMLElement) ? y.create(n, i) : (await p({
918
- context: S,
919
- element: n,
956
+ return r = M(r), r = N([...s].reverse(), a.ui, r), r = p(y, n, r), r = d(m, r), b ? (await _({
957
+ context: b,
920
958
  creator: y,
921
- config: i
922
- })).editor;
959
+ config: r
960
+ })).editor : y.create(r);
923
961
  })();
924
- return _(u) && r && j(m, r), this.applyRootAttributes(m), m;
962
+ return x(u) && r && F(h, r), this.applyRootAttributes(h), h;
925
963
  };
926
- if (s && !S) {
927
- let e = await N(C, m);
964
+ if (s && !b) {
965
+ let e = await L(C, m);
928
966
  return e.on("error", (e, { causesRestart: n }) => {
929
967
  if (n) {
930
- let e = L.the.getItem(t);
968
+ let e = V.the.getItem(t);
931
969
  /* v8 ignore next 3 */
932
- e && (d(e), L.the.unregister(t));
970
+ e && (h(e), V.the.unregister(t));
933
971
  }
934
972
  }), e.on("restart", () => {
935
- L.the.register(t, e.editor);
973
+ V.the.register(t, e.editor);
936
974
  }), await e.create({}), e.editor;
937
975
  }
938
976
  return C();
939
977
  }
940
978
  };
941
- function W(e, t) {
979
+ function J(e, t) {
942
980
  return t.every((t) => e[t]);
943
981
  }
944
- async function G(e, t) {
982
+ async function Y(e, t) {
945
983
  return u(() => {
946
- let n = T(e);
947
- if (!W(n, t)) throw Error(`It looks like not all required root elements are present yet.
984
+ let n = k(e);
985
+ if (!J(n, t)) throw Error(`It looks like not all required root elements are present yet.
948
986
  * If you want to wait for them, ensure they are registered before editor initialization.
949
987
  * If you want lazy initialize roots, consider removing root values from the \`initialData\` config and assign initial data in editable components.
950
988
  Missing roots: ${t.filter((e) => !n[e]).join(", ")}.`);
@@ -956,12 +994,12 @@ Missing roots: ${t.filter((e) => !n[e]).join(", ")}.`);
956
994
  }
957
995
  //#endregion
958
996
  //#region src/hooks/ui-part.ts
959
- var K = class extends e {
997
+ var X = class extends e {
960
998
  mounted() {
961
- let { editorId: e, name: t } = this.canonical, n = L.the.mountEffect(e, (e) => {
999
+ let { editorId: e, name: t } = this.canonical, n = V.the.mountEffect(e, (e) => {
962
1000
  /* v8 ignore next if -- @preserve */
963
1001
  if (this.isBeingDestroyed()) return;
964
- let { ui: n } = e, r = q(t), i = n.view[r];
1002
+ let { ui: n } = e, r = Z(t), i = n.view[r];
965
1003
  if (!i) {
966
1004
  console.error(`Unknown UI part name: "${t}". Supported names are "toolbar" and "menubar".`);
967
1005
  return;
@@ -976,7 +1014,7 @@ var K = class extends e {
976
1014
  this.element.style.display = "none";
977
1015
  }
978
1016
  };
979
- function q(e) {
1017
+ function Z(e) {
980
1018
  switch (e) {
981
1019
  case "toolbar": return "toolbar";
982
1020
  case "menubar": return "menuBarView";
@@ -985,19 +1023,19 @@ function q(e) {
985
1023
  }
986
1024
  //#endregion
987
1025
  //#region src/hooks/index.ts
988
- var J = {
989
- ckeditor5: U,
990
- "ckeditor5-context": I,
991
- "ckeditor5-ui-part": K,
992
- "ckeditor5-editable": B
1026
+ var Q = {
1027
+ ckeditor5: q,
1028
+ "ckeditor5-context": B,
1029
+ "ckeditor5-ui-part": X,
1030
+ "ckeditor5-editable": W
993
1031
  };
994
- function Y() {
995
- for (let [e, n] of Object.entries(J)) t(e, n);
1032
+ function $() {
1033
+ for (let [e, n] of Object.entries(Q)) t(e, n);
996
1034
  }
997
1035
  //#endregion
998
1036
  //#region src/index.ts
999
- Y();
1037
+ $();
1000
1038
  //#endregion
1001
- export { e as ClassHook, F as ContextsRegistry, y as CustomEditorPluginsRegistry, B as EditableComponentHook, U as EditorComponentHook, L as EditorsRegistry, K as UIPartComponentHook, t as registerLivewireComponentHook };
1039
+ export { e as ClassHook, z as ContextsRegistry, C as CustomEditorPluginsRegistry, W as EditableComponentHook, q as EditorComponentHook, V as EditorsRegistry, X as UIPartComponentHook, t as registerLivewireComponentHook };
1002
1040
 
1003
1041
  //# sourceMappingURL=index.mjs.map