ckeditor5-blazor 1.11.0 → 1.11.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 (25) hide show
  1. package/dist/elements/editor/editor.d.ts.map +1 -1
  2. package/dist/elements/editor/utils/assign-editor-roots-to-config.d.ts +17 -0
  3. package/dist/elements/editor/utils/assign-editor-roots-to-config.d.ts.map +1 -0
  4. package/dist/elements/editor/utils/index.d.ts +2 -3
  5. package/dist/elements/editor/utils/index.d.ts.map +1 -1
  6. package/dist/elements/editor/utils/query-all-editor-editables.d.ts +23 -0
  7. package/dist/elements/editor/utils/query-all-editor-editables.d.ts.map +1 -0
  8. package/dist/index.cjs +2 -2
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.mjs +300 -348
  11. package/dist/index.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/src/elements/editor/editor.ts +39 -64
  14. package/src/elements/editor/utils/assign-editor-roots-to-config.ts +60 -0
  15. package/src/elements/editor/utils/index.ts +2 -3
  16. package/src/elements/editor/utils/query-all-editor-editables.ts +74 -0
  17. package/dist/elements/editor/utils/assign-initial-data-to-editor-config.d.ts +0 -10
  18. package/dist/elements/editor/utils/assign-initial-data-to-editor-config.d.ts.map +0 -1
  19. package/dist/elements/editor/utils/assign-source-elements-to-editor-config.d.ts +0 -12
  20. package/dist/elements/editor/utils/assign-source-elements-to-editor-config.d.ts.map +0 -1
  21. package/dist/elements/editor/utils/query-editor-editables.d.ts +0 -25
  22. package/dist/elements/editor/utils/query-editor-editables.d.ts.map +0 -1
  23. package/src/elements/editor/utils/assign-initial-data-to-editor-config.ts +0 -47
  24. package/src/elements/editor/utils/assign-source-elements-to-editor-config.ts +0 -59
  25. package/src/elements/editor/utils/query-editor-editables.ts +0 -101
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- class v extends Error {
1
+ class k extends Error {
2
2
  constructor(t) {
3
3
  super(t), this.name = "CKEditor5BlazorError";
4
4
  }
5
5
  }
6
- function B(r, t) {
6
+ function j(r, t) {
7
7
  if (!r || r.size !== t.size)
8
8
  return !1;
9
9
  for (const [e, a] of r)
@@ -11,7 +11,7 @@ function B(r, t) {
11
11
  return !1;
12
12
  return !0;
13
13
  }
14
- class Y {
14
+ class H {
15
15
  /**
16
16
  * Map of registered items.
17
17
  */
@@ -48,11 +48,11 @@ class Y {
48
48
  */
49
49
  execute(t, e, a) {
50
50
  const n = this.items.get(t), i = this.initializationErrors.get(t);
51
- return i ? (a?.(i), Promise.reject(i)) : n ? Promise.resolve(e(n)) : new Promise((o, s) => {
52
- const c = this.getPendingCallbacks(t);
53
- c.success.push(async (u) => {
54
- o(await e(u));
55
- }), a ? c.error.push(a) : c.error.push(s);
51
+ return i ? (a?.(i), Promise.reject(i)) : n ? Promise.resolve(e(n)) : new Promise((o, u) => {
52
+ const s = this.getPendingCallbacks(t);
53
+ s.success.push(async (c) => {
54
+ o(await e(c));
55
+ }), a ? s.error.push(a) : s.error.push(u);
56
56
  });
57
57
  }
58
58
  /**
@@ -64,14 +64,14 @@ class Y {
64
64
  */
65
65
  mountEffect(t, e) {
66
66
  let a, n, i = !1;
67
- const o = this.watch((s) => {
68
- const c = s.get(t);
69
- if (c !== n && (a?.(), a = void 0, n = c, !!c))
67
+ const o = this.watch((u) => {
68
+ const s = u.get(t);
69
+ if (s !== n && (a?.(), a = void 0, n = s, !!s))
70
70
  try {
71
- const u = e(c);
72
- i ? (u?.(), o()) : a = u;
73
- } catch (u) {
74
- throw console.error(u), u;
71
+ const c = e(s);
72
+ i ? (c?.(), o()) : a = c;
73
+ } catch (c) {
74
+ throw console.error(c), c;
75
75
  }
76
76
  });
77
77
  return () => {
@@ -220,7 +220,7 @@ class Y {
220
220
  * Immediately dispatches the current state to all watchers if it changed.
221
221
  */
222
222
  flushWatchers() {
223
- B(this.lastNotifiedItems, this.items) && B(this.lastNotifiedErrors, this.initializationErrors) || (this.lastNotifiedItems = new Map(this.items), this.lastNotifiedErrors = new Map(this.initializationErrors), this.watchers.forEach((t) => t(
223
+ j(this.lastNotifiedItems, this.items) && j(this.lastNotifiedErrors, this.initializationErrors) || (this.lastNotifiedItems = new Map(this.items), this.lastNotifiedErrors = new Map(this.initializationErrors), this.watchers.forEach((t) => t(
224
224
  new Map(this.items),
225
225
  new Map(this.initializationErrors)
226
226
  )));
@@ -236,7 +236,7 @@ class Y {
236
236
  return e || (e = { success: [], error: [] }, this.pendingCallbacks.set(t, e)), e;
237
237
  }
238
238
  }
239
- function $(r, t) {
239
+ function W(r, t) {
240
240
  let e = null;
241
241
  return (...a) => {
242
242
  e && clearTimeout(e), e = setTimeout(() => {
@@ -244,18 +244,14 @@ function $(r, t) {
244
244
  }, r);
245
245
  };
246
246
  }
247
- function st(r, t) {
248
- const e = Object.entries(r).filter(([a, n]) => t(n, a));
249
- return Object.fromEntries(e);
250
- }
251
- function S(r) {
247
+ function P(r) {
252
248
  return Object.keys(r).length === 0 && r.constructor === Object;
253
249
  }
254
- function W(r, t) {
250
+ function at(r, t) {
255
251
  const e = Object.entries(r).map(([a, n]) => [a, t(n, a)]);
256
252
  return Object.fromEntries(e);
257
253
  }
258
- function ct(r, t) {
254
+ function it(r, t) {
259
255
  if (r === t)
260
256
  return !0;
261
257
  const e = Object.keys(r), a = Object.keys(t);
@@ -266,30 +262,30 @@ function ct(r, t) {
266
262
  return !1;
267
263
  return !0;
268
264
  }
269
- function ut() {
265
+ function nt() {
270
266
  return Math.random().toString(36).substring(2);
271
267
  }
272
- function lt(r, {
268
+ function ot(r, {
273
269
  timeOutAfter: t = 500,
274
270
  retryAfter: e = 100
275
271
  } = {}) {
276
272
  return new Promise((a, n) => {
277
273
  const i = Date.now();
278
274
  let o = null;
279
- const s = setTimeout(() => {
275
+ const u = setTimeout(() => {
280
276
  n(o ?? new Error("Timeout"));
281
- }, t), c = async () => {
277
+ }, t), s = async () => {
282
278
  try {
283
- const u = await r();
284
- clearTimeout(s), a(u);
285
- } catch (u) {
286
- o = u, Date.now() - i > t ? n(u) : setTimeout(c, e);
279
+ const c = await r();
280
+ clearTimeout(u), a(c);
281
+ } catch (c) {
282
+ o = c, Date.now() - i > t ? n(c) : setTimeout(s, e);
287
283
  }
288
284
  };
289
- c();
285
+ s();
290
286
  });
291
287
  }
292
- function R() {
288
+ function x() {
293
289
  return new Promise((r) => {
294
290
  switch (document.readyState) {
295
291
  case "loading":
@@ -322,63 +318,39 @@ function L(r) {
322
318
  disconnect: () => t?.disconnect()
323
319
  };
324
320
  }
325
- function x(r) {
321
+ function D(r) {
326
322
  r.setAttribute("data-cke-interactive", "true");
327
323
  }
328
- function dt(r, t) {
329
- const e = mt(r), a = /* @__PURE__ */ new Set([
330
- ...Object.keys(e),
331
- ...Object.keys(t.roots ?? {})
332
- ]), n = Array.from(a).reduce((o, s) => ({
333
- ...o,
334
- [s]: {
335
- ...t.roots?.[s],
336
- ...s === "main" ? t.root : {},
337
- /* v8 ignore next 5 */
338
- ...s in e ? {
339
- initialData: e[s]
340
- } : {}
341
- }
342
- }), Object.create(t.roots || {})), i = {
343
- ...t,
344
- roots: n
345
- };
346
- return delete i.root, i;
347
- }
348
- function mt(r) {
349
- return typeof r == "string" ? { main: r } : { ...r };
350
- }
351
- function ht(r, t, e) {
352
- const a = ft(t);
353
- if (!r.editorName || r.editorName === "ClassicEditor")
354
- return {
355
- ...e,
356
- attachTo: a.main
357
- };
358
- const n = /* @__PURE__ */ new Set([
359
- ...Object.keys(a),
324
+ function st(r, t, e) {
325
+ const a = !r.editorName || r.editorName === "ClassicEditor", n = /* @__PURE__ */ new Set([
326
+ ...Object.keys(t),
360
327
  ...Object.keys(e.roots ?? {})
361
- ]), i = Array.from(n).reduce((s, c) => ({
362
- ...s,
363
- [c]: {
364
- /* v8 ignore next */
365
- ...e.roots?.[c],
366
- ...c === "main" ? e.root : {},
367
- /* v8 ignore next 5 */
368
- ...c in a ? {
369
- element: a[c]
328
+ ]), i = Array.from(n).reduce((u, s) => ({
329
+ ...u,
330
+ [s]: {
331
+ /* v8 ignore next 1 */
332
+ ...e.roots?.[s],
333
+ ...s === "main" ? e.root : {},
334
+ /* v8 ignore next 11 */
335
+ ...s in t ? {
336
+ ...t[s].content !== null && {
337
+ initialData: t[s].content
338
+ },
339
+ ...!a && t[s].element !== null && {
340
+ element: t[s].element
341
+ }
370
342
  } : {}
371
343
  }
372
344
  }), Object.create(e.roots || {})), o = {
373
345
  ...e,
374
- roots: i
346
+ roots: i,
347
+ ...a && t.main?.element && {
348
+ attachTo: t.main.element
349
+ }
375
350
  };
376
351
  return delete o.root, o;
377
352
  }
378
- function ft(r) {
379
- return r instanceof HTMLElement ? { main: r } : { ...r };
380
- }
381
- function pt(r) {
353
+ function ct(r) {
382
354
  const t = [
383
355
  r.ui?.element,
384
356
  r.ui?.view?.toolbar?.element,
@@ -404,9 +376,9 @@ function pt(r) {
404
376
  i.hasAttribute("data-cke-controlled") ? i.innerHTML = "" : i.remove();
405
377
  }
406
378
  }
407
- const V = /* @__PURE__ */ Symbol.for("context-editor-watchdog");
408
- async function wt({ context: r, creator: t, config: e }) {
409
- const a = ut();
379
+ const z = /* @__PURE__ */ Symbol.for("context-editor-watchdog");
380
+ async function ut({ context: r, creator: t, config: e }) {
381
+ const a = nt();
410
382
  await r.add({
411
383
  creator: t.create.bind(t),
412
384
  id: a,
@@ -418,23 +390,23 @@ async function wt({ context: r, creator: t, config: e }) {
418
390
  editorContextId: a,
419
391
  context: r
420
392
  };
421
- n[V] = i;
393
+ n[z] = i;
422
394
  const o = r.destroy.bind(r);
423
395
  return r.destroy = async () => (i.state = "unavailable", o()), {
424
396
  ...i,
425
397
  editor: n
426
398
  };
427
399
  }
428
- function gt(r) {
429
- return V in r ? r[V] : null;
400
+ function lt(r) {
401
+ return z in r ? r[z] : null;
430
402
  }
431
- function X(r) {
403
+ function J(r) {
432
404
  return Array.from(r.model.document.getRoots()).reduce((t, e) => (e.rootName === "$graveyard" || (t[e.rootName] = r.getData({ rootName: e.rootName })), t), /* @__PURE__ */ Object.create({}));
433
405
  }
434
- function T(r) {
406
+ function V(r) {
435
407
  return ["inline", "classic", "balloon", "decoupled"].includes(r);
436
408
  }
437
- async function H(r) {
409
+ async function U(r) {
438
410
  const t = await import("ckeditor5"), a = {
439
411
  inline: t.InlineEditor,
440
412
  balloon: t.BalloonEditor,
@@ -443,11 +415,11 @@ async function H(r) {
443
415
  multiroot: t.MultiRootEditor
444
416
  }[r];
445
417
  if (!a)
446
- throw new v(`Unsupported editor type: ${r}`);
418
+ throw new k(`Unsupported editor type: ${r}`);
447
419
  return a;
448
420
  }
449
- class j {
450
- static the = new j();
421
+ class _ {
422
+ static the = new _();
451
423
  /**
452
424
  * Map of registered custom plugins.
453
425
  */
@@ -466,7 +438,7 @@ class j {
466
438
  */
467
439
  register(t, e) {
468
440
  if (this.plugins.has(t))
469
- throw new v(`Plugin with name "${t}" is already registered.`);
441
+ throw new k(`Plugin with name "${t}" is already registered.`);
470
442
  return this.plugins.set(t, e), this.unregister.bind(this, t);
471
443
  }
472
444
  /**
@@ -477,7 +449,7 @@ class j {
477
449
  */
478
450
  unregister(t) {
479
451
  if (!this.plugins.has(t))
480
- throw new v(`Plugin with name "${t}" is not registered.`);
452
+ throw new k(`Plugin with name "${t}" is not registered.`);
481
453
  this.plugins.delete(t);
482
454
  }
483
455
  /**
@@ -506,20 +478,20 @@ class j {
506
478
  return this.plugins.has(t);
507
479
  }
508
480
  }
509
- async function K(r) {
481
+ async function G(r) {
510
482
  const t = await import("ckeditor5");
511
483
  let e = null;
512
484
  const a = r.map(async (n) => {
513
- if (bt(n)) {
514
- const { name: c, path: u } = n.$import, d = await import(
485
+ if (dt(n)) {
486
+ const { name: s, path: c } = n.$import, d = await import(
515
487
  /* @vite-ignore */
516
- u
517
- ), f = (Object.prototype.hasOwnProperty.call(d, c) ? d[c] : void 0) ?? (Object.prototype.hasOwnProperty.call(d, "default") ? d.default : void 0);
488
+ c
489
+ ), f = (Object.prototype.hasOwnProperty.call(d, s) ? d[s] : void 0) ?? (Object.prototype.hasOwnProperty.call(d, "default") ? d.default : void 0);
518
490
  if (!f)
519
- throw new v(`Plugin "${c}" not found in module "${u}".`);
491
+ throw new k(`Plugin "${s}" not found in module "${c}".`);
520
492
  return f;
521
493
  }
522
- const i = await j.the.get(n);
494
+ const i = await _.the.get(n);
523
495
  if (i)
524
496
  return i;
525
497
  const { [n]: o } = t;
@@ -528,41 +500,41 @@ async function K(r) {
528
500
  if (!e)
529
501
  try {
530
502
  e = await import("ckeditor5-premium-features");
531
- } catch (c) {
532
- throw console.error(`Failed to load premium package: ${c}`), new v(`Plugin "${n}" not found in base package and failed to load premium package.`);
503
+ } catch (s) {
504
+ throw console.error(`Failed to load premium package: ${s}`), new k(`Plugin "${n}" not found in base package and failed to load premium package.`);
533
505
  }
534
- const { [n]: s } = e || {};
535
- if (s)
536
- return s;
537
- throw new v(`Plugin "${n}" not found in base or premium packages.`);
506
+ const { [n]: u } = e || {};
507
+ if (u)
508
+ return u;
509
+ throw new k(`Plugin "${n}" not found in base or premium packages.`);
538
510
  });
539
511
  return {
540
512
  loadedPlugins: await Promise.all(a),
541
513
  hasPremium: !!e
542
514
  };
543
515
  }
544
- function bt(r) {
516
+ function dt(r) {
545
517
  return typeof r == "object" && r !== null && "$import" in r;
546
518
  }
547
- async function Q(r, t) {
519
+ async function Y(r, t) {
548
520
  const e = [r.ui, r.content];
549
521
  return await Promise.all(
550
522
  [
551
- J("ckeditor5", e),
523
+ B("ckeditor5", e),
552
524
  /* v8 ignore next -- @preserve */
553
- t && J("ckeditor5-premium-features", e)
525
+ t && B("ckeditor5-premium-features", e)
554
526
  ].filter((n) => !!n)
555
527
  ).then((n) => n.flat());
556
528
  }
557
- async function J(r, t) {
529
+ async function B(r, t) {
558
530
  return await Promise.all(
559
531
  t.filter((e) => e !== "en").map(async (e) => {
560
- const a = await yt(r, e);
532
+ const a = await mt(r, e);
561
533
  return a?.default ?? a;
562
534
  }).filter(Boolean)
563
535
  );
564
536
  }
565
- async function yt(r, t) {
537
+ async function mt(r, t) {
566
538
  try {
567
539
  if (r === "ckeditor5")
568
540
  switch (t) {
@@ -862,12 +834,12 @@ async function yt(r, t) {
862
834
  return console.error(`Failed to load translation for ${r}/${t}:`, e), null;
863
835
  }
864
836
  }
865
- function Z(r) {
866
- return W(r, (t) => ({
837
+ function X(r) {
838
+ return at(r, (t) => ({
867
839
  dictionary: t
868
840
  }));
869
841
  }
870
- function tt(r) {
842
+ function K(r) {
871
843
  return r ? typeof r == "string" ? {
872
844
  ui: r,
873
845
  content: r
@@ -876,47 +848,39 @@ function tt(r) {
876
848
  content: "en"
877
849
  };
878
850
  }
879
- function _() {
880
- return Array.from(document.querySelectorAll("cke5-editor")).map((r) => r.getAttribute("data-cke-editor-id")).filter((r) => r !== null);
881
- }
882
- function et(r) {
883
- const t = rt(r);
884
- return W(t, ({ element: e }) => e);
885
- }
886
- function G(r) {
887
- const t = rt(r), e = W(t, ({ content: a }) => a);
888
- return st(e, (a) => typeof a == "string");
889
- }
890
- function rt(r) {
891
- const t = Array.from(document.querySelectorAll(`cke5-editable[data-cke-editor-id="${r}"]`)).reduce((o, s) => {
892
- const c = s.getAttribute("data-cke-root-name"), u = s.getAttribute("data-cke-content");
893
- return o[c] = {
894
- element: s.querySelector("[data-cke-editable-content]"),
895
- content: u
896
- }, o;
851
+ function Q(r) {
852
+ const t = Array.from(document.querySelectorAll(`cke5-editable[data-cke-editor-id="${r}"]`)).reduce((i, o) => {
853
+ const u = o.getAttribute("data-cke-root-name");
854
+ return i[u] = {
855
+ element: o.querySelector("[data-cke-editable-content]"),
856
+ content: o.getAttribute("data-cke-content")
857
+ }, i;
897
858
  }, /* @__PURE__ */ Object.create({})), e = document.querySelector(`cke5-editor[data-cke-editor-id="${r}"]`);
898
859
  if (!e)
899
860
  return t;
900
- const a = t.main, n = JSON.parse(e.getAttribute("data-cke-content")), i = document.querySelector(`#${r}_editor `);
901
- return a && n?.main ? {
902
- ...t,
903
- main: {
904
- ...a,
905
- content: a.content || n.main
906
- }
907
- } : i ? {
908
- ...t,
909
- main: {
910
- element: i,
911
- content: n?.main || null
912
- }
913
- } : t;
861
+ const a = JSON.parse(e.getAttribute("data-cke-content")) ?? {}, n = document.querySelector(`#${r}_editor`);
862
+ n && !t.main && (t.main = {
863
+ element: n,
864
+ content: a.main || ""
865
+ });
866
+ for (const [i, o] of Object.entries(a))
867
+ t[i] ? t[i] = {
868
+ ...t[i],
869
+ content: t[i].content ?? o
870
+ } : t[i] = {
871
+ element: null,
872
+ content: o
873
+ };
874
+ return t;
875
+ }
876
+ function F() {
877
+ return Array.from(document.querySelectorAll("cke5-editor")).map((r) => r.getAttribute("data-cke-editor-id")).filter((r) => r !== null);
914
878
  }
915
- function M(r) {
879
+ function S(r) {
916
880
  if (!r || typeof r != "object")
917
881
  return r;
918
882
  if (Array.isArray(r))
919
- return r.map((a) => M(a));
883
+ return r.map((a) => S(a));
920
884
  const t = r;
921
885
  if (t.$element && typeof t.$element == "string") {
922
886
  const a = document.querySelector(t.$element);
@@ -924,55 +888,55 @@ function M(r) {
924
888
  }
925
889
  const e = /* @__PURE__ */ Object.create(null);
926
890
  for (const [a, n] of Object.entries(r))
927
- e[a] = M(n);
891
+ e[a] = S(n);
928
892
  return e;
929
893
  }
930
- function D(r, t, e) {
894
+ function R(r, t, e) {
931
895
  if (!e || typeof e != "object")
932
896
  return e;
933
897
  if (Array.isArray(e))
934
- return e.map((i) => D(r, t, i));
898
+ return e.map((i) => R(r, t, i));
935
899
  const a = e;
936
900
  if (a.$translation && typeof a.$translation == "string") {
937
- const i = a.$translation, o = Et(r, i, t);
901
+ const i = a.$translation, o = ht(r, i, t);
938
902
  return o === void 0 && console.warn(`Translation not found for key: ${i}`), o !== void 0 ? o : null;
939
903
  }
940
904
  const n = /* @__PURE__ */ Object.create(null);
941
905
  for (const [i, o] of Object.entries(e))
942
- n[i] = D(r, t, o);
906
+ n[i] = R(r, t, o);
943
907
  return n;
944
908
  }
945
- function Et(r, t, e) {
909
+ function ht(r, t, e) {
946
910
  for (const a of r) {
947
911
  const n = a[e];
948
912
  if (n?.dictionary && t in n.dictionary)
949
913
  return n.dictionary[t];
950
914
  }
951
915
  }
952
- function kt(r, t) {
916
+ function ft(r, t) {
953
917
  const { editing: e } = r;
954
918
  e.view.change((a) => {
955
919
  a.setStyle("height", `${t}px`, e.view.document.getRoot());
956
920
  });
957
921
  }
958
- const z = /* @__PURE__ */ Symbol.for("elixir-editor-watchdog");
959
- async function vt(r, t) {
922
+ const $ = /* @__PURE__ */ Symbol.for("elixir-editor-watchdog");
923
+ async function pt(r, t) {
960
924
  const { EditorWatchdog: e } = await import("ckeditor5"), a = new e(null, t ?? {
961
925
  crashNumberLimit: 10,
962
926
  minimumNonErrorTimePeriod: 5e3
963
927
  });
964
928
  return a.setCreator(async () => {
965
929
  const n = await r();
966
- return n[z] = a, n;
930
+ return n[$] = a, n;
967
931
  }), a;
968
932
  }
969
- function At(r) {
970
- return z in r ? r[z] : null;
933
+ function wt(r) {
934
+ return $ in r ? r[$] : null;
971
935
  }
972
- class O extends Y {
973
- static the = new O();
936
+ class C extends H {
937
+ static the = new C();
974
938
  }
975
- class Ct extends HTMLElement {
939
+ class gt extends HTMLElement {
976
940
  /**
977
941
  * The promise that resolves to the context instance.
978
942
  */
@@ -985,35 +949,35 @@ class Ct extends HTMLElement {
985
949
  * Mounts the context component.
986
950
  */
987
951
  async connectedCallback() {
988
- await R(), this.interactiveWait = L(this), await this.interactiveWait.promise, await this.initializeContext();
952
+ await x(), this.interactiveWait = L(this), await this.interactiveWait.promise, await this.initializeContext();
989
953
  }
990
954
  /**
991
955
  * Initializes the context component.
992
956
  */
993
957
  async initializeContext() {
994
- const t = JSON.parse(this.getAttribute("data-cke-context")), { customTranslations: e, watchdogConfig: a, config: { plugins: n, ...i } } = t, o = this.getAttribute("data-cke-context-id"), s = this.getAttribute("data-cke-language") ? JSON.parse(this.getAttribute("data-cke-language")) : tt(i.language), { loadedPlugins: c, hasPremium: u } = await K(n ?? []), d = [
995
- ...await Q(s, u),
996
- Z(e || {})
997
- ].filter((b) => !S(b));
958
+ const t = JSON.parse(this.getAttribute("data-cke-context")), { customTranslations: e, watchdogConfig: a, config: { plugins: n, ...i } } = t, o = this.getAttribute("data-cke-context-id"), u = this.getAttribute("data-cke-language") ? JSON.parse(this.getAttribute("data-cke-language")) : K(i.language), { loadedPlugins: s, hasPremium: c } = await G(n ?? []), d = [
959
+ ...await Y(u, c),
960
+ X(e || {})
961
+ ].filter((g) => !P(g));
998
962
  this.contextPromise = (async () => {
999
- const { ContextWatchdog: b, Context: y } = await import("ckeditor5"), w = new b(y, {
963
+ const { ContextWatchdog: g, Context: p } = await import("ckeditor5"), w = new g(p, {
1000
964
  crashNumberLimit: 10,
1001
965
  ...a
1002
966
  });
1003
- let h = M(i);
1004
- return h = D([...d].reverse(), s.ui, h), await w.create({
967
+ let h = S(i);
968
+ return h = R([...d].reverse(), u.ui, h), await w.create({
1005
969
  ...h,
1006
- language: s,
1007
- plugins: c,
970
+ language: u,
971
+ plugins: s,
1008
972
  ...d.length && {
1009
973
  translations: d
1010
974
  }
1011
- }), w.on("itemError", (...A) => {
1012
- console.error("Context item error:", ...A);
975
+ }), w.on("itemError", (...v) => {
976
+ console.error("Context item error:", ...v);
1013
977
  }), w;
1014
978
  })();
1015
979
  const f = await this.contextPromise;
1016
- this.isConnected && O.the.register(o, f);
980
+ this.isConnected && C.the.register(o, f);
1017
981
  }
1018
982
  /**
1019
983
  * Destroys the context component. Unmounts root from the editor.
@@ -1025,14 +989,14 @@ class Ct extends HTMLElement {
1025
989
  try {
1026
990
  await (await this.contextPromise)?.destroy();
1027
991
  } finally {
1028
- this.contextPromise = null, t && O.the.hasItem(t) && O.the.unregister(t);
992
+ this.contextPromise = null, t && C.the.hasItem(t) && C.the.unregister(t);
1029
993
  }
1030
994
  }
1031
995
  }
1032
- class m extends Y {
996
+ class m extends H {
1033
997
  static the = new m();
1034
998
  }
1035
- class Ot extends HTMLElement {
999
+ class bt extends HTMLElement {
1036
1000
  /**
1037
1001
  * Stops observing the editor registry and immediately runs any pending cleanup.
1038
1002
  */
@@ -1045,20 +1009,20 @@ class Ot extends HTMLElement {
1045
1009
  * Mounts the editable component.
1046
1010
  */
1047
1011
  async connectedCallback() {
1048
- await R(), this.interactiveWait = L(this), await this.interactiveWait.promise, await this.initializeEditable();
1012
+ await x(), this.interactiveWait = L(this), await this.interactiveWait.promise, await this.initializeEditable();
1049
1013
  }
1050
1014
  /**
1051
1015
  * Initializes the editable instance.
1052
1016
  */
1053
1017
  async initializeEditable() {
1054
- this.hasAttribute("data-cke-editor-id") || this.setAttribute("data-cke-editor-id", _()[0]);
1018
+ this.hasAttribute("data-cke-editor-id") || this.setAttribute("data-cke-editor-id", F()[0]);
1055
1019
  const t = this.getAttribute("data-cke-editor-id"), e = this.getAttribute("data-cke-root-name"), a = JSON.parse(this.getAttribute("data-cke-root-attributes") || "{}"), n = this.getAttribute("data-cke-content"), i = Number.parseInt(this.getAttribute("data-cke-save-debounce-ms"), 10);
1056
1020
  if (!t || !e)
1057
- throw new v("Editor ID or Root Name is missing.");
1021
+ throw new k("Editor ID or Root Name is missing.");
1058
1022
  this.style.display = "block", this.unmountEffect = m.the.mountEffect(t, (o) => {
1059
1023
  if (!this.isConnected)
1060
1024
  return;
1061
- const { ui: s, editing: c, model: u } = o, l = this.querySelector("input"), d = u.document.getRoot(e);
1025
+ const { ui: u, editing: s, model: c } = o, l = this.querySelector("input"), d = c.document.getRoot(e);
1062
1026
  if (d?.isAttached()) {
1063
1027
  if (n !== null) {
1064
1028
  const h = o.getData({ rootName: e });
@@ -1066,7 +1030,7 @@ class Ot extends HTMLElement {
1066
1030
  [e]: n
1067
1031
  });
1068
1032
  }
1069
- S(a) || o.model.change((h) => {
1033
+ P(a) || o.model.change((h) => {
1070
1034
  h.setAttributes(a, d);
1071
1035
  });
1072
1036
  return;
@@ -1078,10 +1042,10 @@ class Ot extends HTMLElement {
1078
1042
  initialData: n
1079
1043
  }
1080
1044
  });
1081
- const f = this.querySelector("[data-cke-editable-content]"), b = s.view.createEditable(e, f);
1082
- s.addEditable(b), c.view.forceRender();
1083
- const y = () => {
1084
- if (!u.document.getRoot(e)?.isAttached())
1045
+ const f = this.querySelector("[data-cke-editable-content]"), g = u.view.createEditable(e, f);
1046
+ u.addEditable(g), s.view.forceRender();
1047
+ const p = () => {
1048
+ if (!c.document.getRoot(e)?.isAttached())
1085
1049
  return;
1086
1050
  const h = o.getData({ rootName: e });
1087
1051
  l && (l.value = h, l.dispatchEvent(new Event("input"))), this.dispatchEvent(new CustomEvent("change", {
@@ -1089,15 +1053,15 @@ class Ot extends HTMLElement {
1089
1053
  value: h
1090
1054
  }
1091
1055
  }));
1092
- }, w = $(i, y);
1093
- return o.model.document.on("change:data", w), y(), () => {
1056
+ }, w = W(i, p);
1057
+ return o.model.document.on("change:data", w), p(), () => {
1094
1058
  if (o.model.document.off("change:data", w), o.state !== "destroyed" && e) {
1095
1059
  const h = o.model.document.getRoot(e);
1096
1060
  if (h && "detachEditable" in o) {
1097
1061
  try {
1098
1062
  o.ui.view.editables[e] && o.detachEditable(h);
1099
- } catch (A) {
1100
- console.error("Unable unmount editable from root:", A);
1063
+ } catch (v) {
1064
+ console.error("Unable unmount editable from root:", v);
1101
1065
  }
1102
1066
  h.isAttached() && o.detachRoot(e, !1);
1103
1067
  }
@@ -1112,7 +1076,7 @@ class Ot extends HTMLElement {
1112
1076
  this.interactiveWait?.disconnect(), this.style.display = "none", this.unmountEffect?.(), this.unmountEffect = null;
1113
1077
  }
1114
1078
  }
1115
- async function It({
1079
+ async function yt({
1116
1080
  saveDebounceMs: r,
1117
1081
  editorId: t,
1118
1082
  targetElement: e
@@ -1129,7 +1093,7 @@ async function It({
1129
1093
  * Initializes the plugin.
1130
1094
  */
1131
1095
  afterInit() {
1132
- const { editor: i } = this, o = $(r, this.dispatch);
1096
+ const { editor: i } = this, o = W(r, this.dispatch);
1133
1097
  i.model.document.on("change:data", o), i.once("ready", this.dispatch);
1134
1098
  }
1135
1099
  /**
@@ -1138,25 +1102,25 @@ async function It({
1138
1102
  dispatch = () => {
1139
1103
  const { editor: i } = this;
1140
1104
  e.dispatchEvent(
1141
- new k({
1105
+ new y({
1142
1106
  editorId: t,
1143
1107
  editor: i,
1144
- roots: X(i)
1108
+ roots: J(i)
1145
1109
  })
1146
1110
  );
1147
1111
  };
1148
1112
  };
1149
1113
  }
1150
- class k extends CustomEvent {
1114
+ class y extends CustomEvent {
1151
1115
  static EVENT_NAME = "ckeditor5:change:data";
1152
1116
  constructor(t) {
1153
- super(k.EVENT_NAME, {
1117
+ super(y.EVENT_NAME, {
1154
1118
  detail: t,
1155
1119
  bubbles: !0
1156
1120
  });
1157
1121
  }
1158
1122
  }
1159
- async function Tt(r) {
1123
+ async function Et(r) {
1160
1124
  const { Plugin: t } = await import("ckeditor5");
1161
1125
  return class extends t {
1162
1126
  /**
@@ -1178,7 +1142,7 @@ async function Tt(r) {
1178
1142
  */
1179
1143
  afterInit() {
1180
1144
  const { editor: a } = this, i = a.sourceElement.id.replace(/_editor$/, "");
1181
- this.input = document.getElementById(`${i}_input`), this.input && (a.model.document.on("change:data", $(r, () => this.sync())), a.once("ready", this.sync), this.form = this.input.closest("form"), this.form?.addEventListener("submit", this.sync));
1145
+ this.input = document.getElementById(`${i}_input`), this.input && (a.model.document.on("change:data", W(r, () => this.sync())), a.once("ready", this.sync), this.form = this.input.closest("form"), this.form?.addEventListener("submit", this.sync));
1182
1146
  }
1183
1147
  /**
1184
1148
  * Synchronizes the editor's content with the input field.
@@ -1197,7 +1161,7 @@ async function Tt(r) {
1197
1161
  }
1198
1162
  };
1199
1163
  }
1200
- class Nt extends HTMLElement {
1164
+ class kt extends HTMLElement {
1201
1165
  /**
1202
1166
  * Stops observing the editor registry and immediately runs any pending cleanup.
1203
1167
  */
@@ -1210,7 +1174,7 @@ class Nt extends HTMLElement {
1210
1174
  * Mounts the editor component.
1211
1175
  */
1212
1176
  async connectedCallback() {
1213
- await R(), this.interactiveWait = L(this), H("classic"), await this.interactiveWait.promise, await this.initializeEditor();
1177
+ await x(), this.interactiveWait = L(this), U("classic"), await this.interactiveWait.promise, await this.initializeEditor();
1214
1178
  }
1215
1179
  /**
1216
1180
  * Initializes the editor instance.
@@ -1220,7 +1184,7 @@ class Nt extends HTMLElement {
1220
1184
  m.the.resetErrors(t);
1221
1185
  try {
1222
1186
  this.style.display = "block";
1223
- const e = await this.createEditor(), a = gt(e), n = At(e);
1187
+ const e = await this.createEditor(), a = lt(e), n = wt(e);
1224
1188
  if (this.isConnected) {
1225
1189
  const i = m.the.mountEffect(t, (o) => {
1226
1190
  o.once("destroy", () => {
@@ -1251,91 +1215,79 @@ class Nt extends HTMLElement {
1251
1215
  editorType: a,
1252
1216
  licenseKey: n,
1253
1217
  watchdogConfig: i,
1254
- config: { plugins: o, ...s }
1255
- } = t, c = this.getAttribute("data-cke-editor-id"), u = this.getAttribute("data-cke-context-id"), l = JSON.parse(this.getAttribute("data-cke-root-attributes") || "{}"), d = this.getAttribute("data-cke-editable-height") ? Number.parseInt(this.getAttribute("data-cke-editable-height"), 10) : null, f = Number.parseInt(this.getAttribute("data-cke-save-debounce-ms"), 10), b = this.hasAttribute("data-cke-watchdog"), y = JSON.parse(this.getAttribute("data-cke-content")), w = this.getAttribute("data-cke-language") ? JSON.parse(this.getAttribute("data-cke-language")) : tt(t.config.language), h = await H(a), A = await (u ? O.the.waitFor(u) : null), q = async () => {
1256
- const { loadedPlugins: E, hasPremium: N } = await K(o);
1257
- E.push(
1258
- await It({
1218
+ config: { plugins: o, ...u }
1219
+ } = t, s = this.getAttribute("data-cke-editor-id"), c = this.getAttribute("data-cke-context-id"), l = JSON.parse(this.getAttribute("data-cke-root-attributes") || "{}"), d = this.getAttribute("data-cke-editable-height") ? Number.parseInt(this.getAttribute("data-cke-editable-height"), 10) : null, f = Number.parseInt(this.getAttribute("data-cke-save-debounce-ms"), 10), g = this.hasAttribute("data-cke-watchdog"), p = this.getAttribute("data-cke-language") ? JSON.parse(this.getAttribute("data-cke-language")) : K(t.config.language), w = await U(a), h = await (c ? C.the.waitFor(c) : null), v = async () => {
1220
+ const { loadedPlugins: b, hasPremium: I } = await G(o);
1221
+ b.push(
1222
+ await yt({
1259
1223
  saveDebounceMs: f,
1260
- editorId: c,
1224
+ editorId: s,
1261
1225
  targetElement: this
1262
1226
  })
1263
- ), T(a) && E.push(
1264
- await Tt(f)
1227
+ ), V(a) && b.push(
1228
+ await Et(f)
1265
1229
  );
1266
- const C = [
1267
- ...await Q(w, N),
1268
- Z(e || {})
1269
- ].filter((p) => !S(p));
1270
- let I = {
1271
- ...y,
1272
- ...G(c)
1273
- };
1274
- T(a) && (I = I.main || "");
1275
- const P = await (async () => {
1276
- let p = et(c);
1277
- if (!p.main) {
1278
- const U = T(a) ? ["main"] : Object.keys(I);
1279
- at(p, U) || (p = await Pt(c, U), I = {
1280
- ...y,
1281
- ...G(c)
1282
- });
1230
+ const A = [
1231
+ ...await Y(p, I),
1232
+ X(e || {})
1233
+ ].filter((N) => !P(N));
1234
+ let T = Q(s);
1235
+ const M = Object.keys(T);
1236
+ V(a) && M.push("main"), Z(T, M) || (T = await vt(s, M));
1237
+ let E = {
1238
+ ...u,
1239
+ licenseKey: n,
1240
+ plugins: b,
1241
+ language: p,
1242
+ ...A.length && {
1243
+ translations: A
1283
1244
  }
1284
- T(a) && "main" in p && (p = p.main);
1285
- let g = {
1286
- ...s,
1287
- licenseKey: n,
1288
- plugins: E,
1289
- language: w,
1290
- ...C.length && {
1291
- translations: C
1292
- }
1293
- };
1294
- return g = M(g), g = D([...C].reverse(), w.ui, g), g = ht(h, p, g), g = dt(I, g), A ? (await wt({
1295
- context: A,
1296
- creator: h,
1297
- config: g
1298
- })).editor : h.create(g);
1299
- })();
1300
- return S(l) || P.model.change((p) => {
1301
- p.setAttributes(l, P.model.document.getRoot());
1302
- }), T(a) && d && kt(P, d), P;
1245
+ };
1246
+ E = S(E), E = R([...A].reverse(), p.ui, E), E = st(w, T, E);
1247
+ const O = await (async () => h ? (await ut({
1248
+ context: h,
1249
+ creator: w,
1250
+ config: E
1251
+ })).editor : w.create(E))();
1252
+ return P(l) || O.model.change((N) => {
1253
+ N.setAttributes(l, O.model.document.getRoot());
1254
+ }), V(a) && d && ft(O, d), O;
1303
1255
  };
1304
- if (b && !A) {
1305
- const E = await vt(q, i);
1306
- return E.on("error", (N, { causesRestart: F }) => {
1307
- if (F) {
1308
- const C = m.the.getItem(c);
1309
- C && (pt(C), m.the.unregister(c));
1256
+ if (g && !h) {
1257
+ const b = await pt(v, i);
1258
+ return b.on("error", (I, { causesRestart: q }) => {
1259
+ if (q) {
1260
+ const A = m.the.getItem(s);
1261
+ A && (ct(A), m.the.unregister(s));
1310
1262
  }
1311
- }), E.on("restart", () => {
1312
- const N = E.editor;
1313
- m.the.register(c, N);
1314
- }), await E.create({}), E.editor;
1263
+ }), b.on("restart", () => {
1264
+ const I = b.editor;
1265
+ m.the.register(s, I);
1266
+ }), await b.create({}), b.editor;
1315
1267
  }
1316
- return q();
1268
+ return v();
1317
1269
  }
1318
1270
  }
1319
- function at(r, t) {
1320
- return t.every((e) => r[e]);
1271
+ function Z(r, t) {
1272
+ return t.every((e) => r[e]?.element);
1321
1273
  }
1322
- async function Pt(r, t) {
1323
- return lt(
1274
+ async function vt(r, t) {
1275
+ return ot(
1324
1276
  () => {
1325
- const e = et(r);
1326
- if (!at(e, t))
1277
+ const e = Q(r);
1278
+ if (!Z(e, t))
1327
1279
  throw new Error(
1328
1280
  `It looks like not all required root elements are present yet.
1329
1281
  * If you want to wait for them, ensure they are registered before editor initialization.
1330
1282
  * If you want lazy initialize roots, consider removing root values from the \`initialData\` config and assign initial data in editable components.
1331
- Missing roots: ${t.filter((a) => !e[a]).join(", ")}.`
1283
+ Missing roots: ${t.filter((a) => !e[a]?.element).join(", ")}.`
1332
1284
  );
1333
1285
  return e;
1334
1286
  },
1335
1287
  { timeOutAfter: 2e3, retryAfter: 100 }
1336
1288
  );
1337
1289
  }
1338
- class St extends HTMLElement {
1290
+ class At extends HTMLElement {
1339
1291
  /**
1340
1292
  * Stops observing the editor registry and immediately runs any pending cleanup.
1341
1293
  */
@@ -1344,14 +1296,14 @@ class St extends HTMLElement {
1344
1296
  * Mounts the UI part component.
1345
1297
  */
1346
1298
  async connectedCallback() {
1347
- await R();
1348
- const t = this.getAttribute("data-cke-editor-id") || _()[0], e = this.getAttribute("data-cke-name");
1299
+ await x();
1300
+ const t = this.getAttribute("data-cke-editor-id") || F()[0], e = this.getAttribute("data-cke-name");
1349
1301
  !t || !e || (this.style.display = "block", this.unmountEffect = m.the.mountEffect(t, (a) => {
1350
1302
  if (!this.isConnected)
1351
1303
  return;
1352
- const { ui: n } = a, i = Mt(e), o = n.view[i];
1304
+ const { ui: n } = a, i = Ct(e), o = n.view[i];
1353
1305
  if (!o)
1354
- throw new v(`Unknown UI part name: "${e}". Supported names are "toolbar" and "menubar".`);
1306
+ throw new k(`Unknown UI part name: "${e}". Supported names are "toolbar" and "menubar".`);
1355
1307
  return this.appendChild(o.element), () => {
1356
1308
  this.innerHTML = "";
1357
1309
  };
@@ -1364,7 +1316,7 @@ class St extends HTMLElement {
1364
1316
  this.style.display = "none", this.unmountEffect?.(), this.unmountEffect = null;
1365
1317
  }
1366
1318
  }
1367
- function Mt(r) {
1319
+ function Ct(r) {
1368
1320
  switch (r) {
1369
1321
  case "toolbar":
1370
1322
  return "toolbar";
@@ -1375,23 +1327,23 @@ function Mt(r) {
1375
1327
  return null;
1376
1328
  }
1377
1329
  }
1378
- const Dt = {
1379
- "cke5-editor": Nt,
1380
- "cke5-context": Ct,
1381
- "cke5-ui-part": St,
1382
- "cke5-editable": Ot
1330
+ const It = {
1331
+ "cke5-editor": kt,
1332
+ "cke5-context": gt,
1333
+ "cke5-ui-part": At,
1334
+ "cke5-editable": bt
1383
1335
  };
1384
- function Rt() {
1385
- for (const [r, t] of Object.entries(Dt))
1336
+ function Tt() {
1337
+ for (const [r, t] of Object.entries(It))
1386
1338
  window.customElements.get(r) || window.customElements.define(r, t);
1387
1339
  }
1388
- function Lt(r) {
1389
- return x(r), {
1340
+ function Rt(r) {
1341
+ return D(r), {
1390
1342
  unmount() {
1391
1343
  }
1392
1344
  };
1393
1345
  }
1394
- function nt(r, t) {
1346
+ function tt(r, t) {
1395
1347
  const e = {
1396
1348
  /** Value received from Blazor while the editor was focused, pending application on blur. */
1397
1349
  pendingValue: null,
@@ -1399,11 +1351,11 @@ function nt(r, t) {
1399
1351
  lastSyncedValue: null
1400
1352
  }, a = () => {
1401
1353
  e.pendingValue = null;
1402
- }, n = (i, o, s) => {
1403
- if (s || e.pendingValue === null)
1354
+ }, n = (i, o, u) => {
1355
+ if (u || e.pendingValue === null)
1404
1356
  return;
1405
- const c = t.getCurrentValue();
1406
- t.isEqual(c, e.pendingValue) || t.applyValue(e.pendingValue), e.pendingValue = null;
1357
+ const s = t.getCurrentValue();
1358
+ t.isEqual(s, e.pendingValue) || t.applyValue(e.pendingValue), e.pendingValue = null;
1407
1359
  };
1408
1360
  return r.model.document.on("change:data", a), r.ui.focusTracker.on("change:isFocused", n), {
1409
1361
  /**
@@ -1437,7 +1389,7 @@ function nt(r, t) {
1437
1389
  }
1438
1390
  };
1439
1391
  }
1440
- function it() {
1392
+ function et() {
1441
1393
  return {
1442
1394
  unmount() {
1443
1395
  },
@@ -1448,7 +1400,7 @@ function it() {
1448
1400
  }
1449
1401
  };
1450
1402
  }
1451
- function ot(r, t) {
1403
+ function rt(r, t) {
1452
1404
  const e = /* @__PURE__ */ new Set();
1453
1405
  return (a) => {
1454
1406
  r.model.enqueueChange({ isUndoable: !1 }, (n) => {
@@ -1456,87 +1408,87 @@ function ot(r, t) {
1456
1408
  if (i) {
1457
1409
  for (const o of e)
1458
1410
  a && o in a || (n.removeAttribute(o, i), e.delete(o));
1459
- for (const [o, s] of Object.entries(a ?? {}))
1460
- n.setAttribute(o, s, i), e.add(o);
1411
+ for (const [o, u] of Object.entries(a ?? {}))
1412
+ n.setAttribute(o, u, i), e.add(o);
1461
1413
  }
1462
1414
  });
1463
1415
  };
1464
1416
  }
1465
- function jt(r, t) {
1466
- const e = r.getAttribute("data-cke-editor-id") ?? _()[0], a = r.getAttribute("data-cke-root-name") ?? "main";
1467
- let n = !1, i = null, o = null, s = it(), c = null;
1468
- const u = (l) => {
1469
- if (!(l instanceof k) || l.detail.editorId !== e)
1417
+ function xt(r, t) {
1418
+ const e = r.getAttribute("data-cke-editor-id") ?? F()[0], a = r.getAttribute("data-cke-root-name") ?? "main";
1419
+ let n = !1, i = null, o = null, u = et(), s = null;
1420
+ const c = (l) => {
1421
+ if (!(l instanceof y) || l.detail.editorId !== e)
1470
1422
  return;
1471
1423
  const d = l.detail.roots[a];
1472
- d !== void 0 && s.shouldNotify(d) && t.invokeMethodAsync("OnChangeEditableData", o, d);
1424
+ d !== void 0 && u.shouldNotify(d) && t.invokeMethodAsync("OnChangeEditableData", o, d);
1473
1425
  };
1474
- return i = m.the.mountEffect(e, (l) => (o = globalThis.DotNet.createJSObjectReference(l), s = nt(l, {
1426
+ return i = m.the.mountEffect(e, (l) => (o = globalThis.DotNet.createJSObjectReference(l), u = tt(l, {
1475
1427
  getCurrentValue: () => l.getData({ rootName: a }) ?? "",
1476
1428
  applyValue: (d) => l.setData({ [a]: d }),
1477
1429
  isEqual: (d, f) => d === f
1478
- }), c = ot(l, a), () => {
1479
- s.unmount(), o && (globalThis.DotNet?.disposeJSObjectReference(o), o = null), c = null;
1480
- })), document.body.addEventListener(k.EVENT_NAME, u), x(r), {
1430
+ }), s = rt(l, a), () => {
1431
+ u.unmount(), o && (globalThis.DotNet?.disposeJSObjectReference(o), o = null), s = null;
1432
+ })), document.body.addEventListener(y.EVENT_NAME, c), D(r), {
1481
1433
  /**
1482
1434
  * Cleans up all event listeners when the Blazor component is disposed.
1483
1435
  */
1484
1436
  unmount() {
1485
- n || (document.body.removeEventListener(k.EVENT_NAME, u), i?.(), i = null, n = !0);
1437
+ n || (document.body.removeEventListener(y.EVENT_NAME, c), i?.(), i = null, n = !0);
1486
1438
  },
1487
1439
  /**
1488
1440
  * Updates this editable root's data from Blazor.
1489
1441
  * If the editor is focused, the update is deferred until blur to avoid interrupting the user.
1490
1442
  */
1491
1443
  setValue: async (l) => {
1492
- n || (await m.the.waitFor(e), s.setValue(l));
1444
+ n || (await m.the.waitFor(e), u.setValue(l));
1493
1445
  },
1494
1446
  /**
1495
1447
  * Updates the root attributes on the editor. This is useful when the Blazor component
1496
1448
  * re-renders with new root attributes.
1497
1449
  */
1498
1450
  setRootAttributes: async (l) => {
1499
- n || (await m.the.waitFor(e), c?.(l));
1451
+ n || (await m.the.waitFor(e), s?.(l));
1500
1452
  }
1501
1453
  };
1502
1454
  }
1503
- function _t(r, t) {
1455
+ function Dt(r, t) {
1504
1456
  const e = r.getAttribute("data-cke-editor-id");
1505
- let a = !1, n = null, i = it(), o = null, s = null;
1506
- const c = (u) => {
1507
- !(u instanceof k) || u.detail.editorId !== e || i.shouldNotify(u.detail.roots) && t.invokeMethodAsync("OnChangeEditorData", s, u.detail.roots);
1457
+ let a = !1, n = null, i = et(), o = null, u = null;
1458
+ const s = (c) => {
1459
+ !(c instanceof y) || c.detail.editorId !== e || i.shouldNotify(c.detail.roots) && t.invokeMethodAsync("OnChangeEditorData", u, c.detail.roots);
1508
1460
  };
1509
- return n = m.the.mountEffect(e, (u) => {
1510
- s = globalThis.DotNet.createJSObjectReference(u), i = nt(u, {
1511
- getCurrentValue: () => X(u),
1512
- applyValue: (d) => u.setData(d),
1513
- isEqual: ct
1514
- }), o = ot(u, "main");
1515
- const l = (d, f, b) => {
1516
- const y = b ? "OnEditorFocus" : "OnEditorBlur";
1517
- t.invokeMethodAsync(y, s);
1461
+ return n = m.the.mountEffect(e, (c) => {
1462
+ u = globalThis.DotNet.createJSObjectReference(c), i = tt(c, {
1463
+ getCurrentValue: () => J(c),
1464
+ applyValue: (d) => c.setData(d),
1465
+ isEqual: it
1466
+ }), o = rt(c, "main");
1467
+ const l = (d, f, g) => {
1468
+ const p = g ? "OnEditorFocus" : "OnEditorBlur";
1469
+ t.invokeMethodAsync(p, u);
1518
1470
  };
1519
- return u.ui.focusTracker.on("change:isFocused", l), t.invokeMethodAsync("OnEditorReady", s), () => {
1520
- u.ui.focusTracker.off("change:isFocused", l), i.unmount(), s && (globalThis.DotNet?.disposeJSObjectReference(s), s = null), o = null;
1471
+ return c.ui.focusTracker.on("change:isFocused", l), t.invokeMethodAsync("OnEditorReady", u), () => {
1472
+ c.ui.focusTracker.off("change:isFocused", l), i.unmount(), u && (globalThis.DotNet?.disposeJSObjectReference(u), u = null), o = null;
1521
1473
  };
1522
- }), document.body.addEventListener(k.EVENT_NAME, c), Rt(), x(r), {
1474
+ }), document.body.addEventListener(y.EVENT_NAME, s), Tt(), D(r), {
1523
1475
  /**
1524
1476
  * Updates the editor data from Blazor. If the editor is focused, the update is deferred until blur to avoid interrupting the user.
1525
1477
  */
1526
- setValue: async (u) => {
1527
- a || (await m.the.waitFor(e), i.setValue(u));
1478
+ setValue: async (c) => {
1479
+ a || (await m.the.waitFor(e), i.setValue(c));
1528
1480
  },
1529
1481
  /**
1530
1482
  * Updates the root attributes on the editor instance.
1531
1483
  */
1532
- setRootAttributes: async (u) => {
1533
- a || (await m.the.waitFor(e), o?.(u));
1484
+ setRootAttributes: async (c) => {
1485
+ a || (await m.the.waitFor(e), o?.(c));
1534
1486
  },
1535
1487
  /**
1536
1488
  * Cleans up all event listeners when the Blazor component is disposed.
1537
1489
  */
1538
1490
  unmount() {
1539
- a || (document.body.removeEventListener(k.EVENT_NAME, c), n?.(), n = null, a = !0);
1491
+ a || (document.body.removeEventListener(y.EVENT_NAME, s), n?.(), n = null, a = !0);
1540
1492
  },
1541
1493
  /**
1542
1494
  * Installs the custom image upload adapter that delegates uploads to Blazor.
@@ -1544,13 +1496,13 @@ function _t(r, t) {
1544
1496
  * to avoid unnecessary overhead for consumers that don't use this feature.
1545
1497
  */
1546
1498
  attachImageUploadAdapter: async () => {
1547
- a || m.the.mountEffect(e, (u) => {
1548
- xt(u, t);
1499
+ a || m.the.mountEffect(e, (c) => {
1500
+ Ot(c, t);
1549
1501
  });
1550
1502
  }
1551
1503
  };
1552
1504
  }
1553
- function xt(r, t) {
1505
+ function Ot(r, t) {
1554
1506
  if (!r.plugins.has("FileRepository"))
1555
1507
  return;
1556
1508
  const e = r.plugins.get("FileRepository");
@@ -1561,16 +1513,16 @@ function xt(r, t) {
1561
1513
  const i = await a.file;
1562
1514
  if (n)
1563
1515
  throw new Error("Upload aborted.");
1564
- const o = await Vt(i), s = await t.invokeMethodAsync("OnEditorImageUpload", {
1516
+ const o = await Nt(i), u = await t.invokeMethodAsync("OnEditorImageUpload", {
1565
1517
  fileName: i.name,
1566
1518
  mimeType: i.type,
1567
1519
  payload: o
1568
1520
  });
1569
- if (!s)
1521
+ if (!u)
1570
1522
  throw new Error(
1571
1523
  "OnImageUpload handler returned null. Make sure the OnImageUpload parameter is set on the <CKE5Editor> component."
1572
1524
  );
1573
- return { default: s };
1525
+ return { default: u };
1574
1526
  },
1575
1527
  abort() {
1576
1528
  n = !0;
@@ -1578,7 +1530,7 @@ function xt(r, t) {
1578
1530
  };
1579
1531
  };
1580
1532
  }
1581
- function Vt(r) {
1533
+ function Nt(r) {
1582
1534
  return new Promise((t, e) => {
1583
1535
  const a = new FileReader();
1584
1536
  a.onload = () => {
@@ -1587,25 +1539,25 @@ function Vt(r) {
1587
1539
  }, a.onerror = () => e(a.error), a.readAsDataURL(r);
1588
1540
  });
1589
1541
  }
1590
- function qt(r) {
1591
- return x(r), {
1542
+ function Mt(r) {
1543
+ return D(r), {
1592
1544
  unmount() {
1593
1545
  }
1594
1546
  };
1595
1547
  }
1596
1548
  export {
1597
- v as CKEditor5BlazorError,
1598
- k as CKEditor5ChangeDataEvent,
1599
- O as ContextsRegistry,
1600
- j as CustomEditorPluginsRegistry,
1601
- Ot as EditableComponentElement,
1602
- Nt as EditorComponentElement,
1549
+ k as CKEditor5BlazorError,
1550
+ y as CKEditor5ChangeDataEvent,
1551
+ C as ContextsRegistry,
1552
+ _ as CustomEditorPluginsRegistry,
1553
+ bt as EditableComponentElement,
1554
+ kt as EditorComponentElement,
1603
1555
  m as EditorsRegistry,
1604
- St as UIPartComponentElement,
1605
- Lt as createContextBlazorInterop,
1606
- jt as createEditableBlazorInterop,
1607
- _t as createEditorBlazorInterop,
1608
- qt as createUIPartBlazorInterop,
1609
- Rt as ensureEditorElementsRegistered
1556
+ At as UIPartComponentElement,
1557
+ Rt as createContextBlazorInterop,
1558
+ xt as createEditableBlazorInterop,
1559
+ Dt as createEditorBlazorInterop,
1560
+ Mt as createUIPartBlazorInterop,
1561
+ Tt as ensureEditorElementsRegistered
1610
1562
  };
1611
1563
  //# sourceMappingURL=index.mjs.map