ckeditor5-blazor 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ class b extends Error {
3
3
  super(t), this.name = "CKEditor5BlazorError";
4
4
  }
5
5
  }
6
- class _ {
6
+ class j {
7
7
  /**
8
8
  * Map of registered items.
9
9
  */
@@ -199,7 +199,7 @@ function et(r, t) {
199
199
  const e = Object.entries(r).filter(([i, a]) => t(a, i));
200
200
  return Object.fromEntries(e);
201
201
  }
202
- function B(r) {
202
+ function _(r) {
203
203
  return Object.keys(r).length === 0 && r.constructor === Object;
204
204
  }
205
205
  function V(r, t) {
@@ -240,7 +240,7 @@ function at(r, {
240
240
  u();
241
241
  });
242
242
  }
243
- function I() {
243
+ function T() {
244
244
  return new Promise((r) => {
245
245
  switch (document.readyState) {
246
246
  case "loading":
@@ -301,7 +301,7 @@ async function nt({ element: r, context: t, creator: e, config: i }) {
301
301
  function ot(r) {
302
302
  return x in r ? r[x] : null;
303
303
  }
304
- function j(r) {
304
+ function B(r) {
305
305
  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({}));
306
306
  }
307
307
  function A(r) {
@@ -383,6 +383,15 @@ async function H(r) {
383
383
  const t = await import("ckeditor5");
384
384
  let e = null;
385
385
  const i = r.map(async (a) => {
386
+ if (st(a)) {
387
+ const { name: u, path: s } = a.$import, d = await import(
388
+ /* @vite-ignore */
389
+ s
390
+ ), g = (Object.prototype.hasOwnProperty.call(d, u) ? d[u] : void 0) ?? (Object.prototype.hasOwnProperty.call(d, "default") ? d.default : void 0);
391
+ if (!g)
392
+ throw new b(`Plugin "${u}" not found in module "${s}".`);
393
+ return g;
394
+ }
386
395
  const n = await R.the.get(a);
387
396
  if (n)
388
397
  return n;
@@ -405,6 +414,9 @@ async function H(r) {
405
414
  hasPremium: !!e
406
415
  };
407
416
  }
417
+ function st(r) {
418
+ return typeof r == "object" && r !== null && "$import" in r;
419
+ }
408
420
  async function J(r, t) {
409
421
  const e = [r.ui, r.content];
410
422
  return await Promise.all(
@@ -418,12 +430,12 @@ async function J(r, t) {
418
430
  async function q(r, t) {
419
431
  return await Promise.all(
420
432
  t.filter((e) => e !== "en").map(async (e) => {
421
- const i = await st(r, e);
433
+ const i = await ct(r, e);
422
434
  return i?.default ?? i;
423
435
  }).filter(Boolean)
424
436
  );
425
437
  }
426
- async function st(r, t) {
438
+ async function ct(r, t) {
427
439
  try {
428
440
  if (r === "ckeditor5")
429
441
  switch (t) {
@@ -779,36 +791,36 @@ function P(r) {
779
791
  e[i] = P(a);
780
792
  return e;
781
793
  }
782
- function T(r, t, e) {
794
+ function I(r, t, e) {
783
795
  if (!e || typeof e != "object")
784
796
  return e;
785
797
  if (Array.isArray(e))
786
- return e.map((n) => T(r, t, n));
798
+ return e.map((n) => I(r, t, n));
787
799
  const i = e;
788
800
  if (i.$translation && typeof i.$translation == "string") {
789
- const n = i.$translation, o = ct(r, n, t);
801
+ const n = i.$translation, o = ut(r, n, t);
790
802
  return o === void 0 && console.warn(`Translation not found for key: ${n}`), o !== void 0 ? o : null;
791
803
  }
792
804
  const a = /* @__PURE__ */ Object.create(null);
793
805
  for (const [n, o] of Object.entries(e))
794
- a[n] = T(r, t, o);
806
+ a[n] = I(r, t, o);
795
807
  return a;
796
808
  }
797
- function ct(r, t, e) {
809
+ function ut(r, t, e) {
798
810
  for (const i of r) {
799
811
  const a = i[e];
800
812
  if (a?.dictionary && t in a.dictionary)
801
813
  return a.dictionary[t];
802
814
  }
803
815
  }
804
- function ut(r, t) {
816
+ function lt(r, t) {
805
817
  const { editing: e } = r;
806
818
  e.view.change((i) => {
807
819
  i.setStyle("height", `${t}px`, e.view.document.getRoot());
808
820
  });
809
821
  }
810
822
  const N = /* @__PURE__ */ Symbol.for("elixir-editor-watchdog");
811
- async function lt(r) {
823
+ async function dt(r) {
812
824
  const { EditorWatchdog: t } = await import("ckeditor5"), e = new t(r);
813
825
  return e.setCreator(async (...i) => {
814
826
  const a = await r.create(...i);
@@ -820,13 +832,13 @@ async function lt(r) {
820
832
  }
821
833
  };
822
834
  }
823
- function dt(r) {
835
+ function mt(r) {
824
836
  return N in r ? r[N] : null;
825
837
  }
826
- class v extends _ {
838
+ class v extends j {
827
839
  static the = new v();
828
840
  }
829
- class mt extends HTMLElement {
841
+ class ht extends HTMLElement {
830
842
  /**
831
843
  * The promise that resolves to the context instance.
832
844
  */
@@ -839,35 +851,35 @@ class mt extends HTMLElement {
839
851
  * Mounts the context component.
840
852
  */
841
853
  async connectedCallback() {
842
- await I(), this.interactiveWait = M(this), await this.interactiveWait.promise, await this.initializeContext();
854
+ await T(), this.interactiveWait = M(this), await this.interactiveWait.promise, await this.initializeContext();
843
855
  }
844
856
  /**
845
857
  * Initializes the context component.
846
858
  */
847
859
  async initializeContext() {
848
- const t = this.getAttribute("data-cke-context-id"), e = JSON.parse(this.getAttribute("data-cke-language")), i = JSON.parse(this.getAttribute("data-cke-context")), { customTranslations: a, watchdogConfig: n, config: { plugins: o, ...c } } = i, { loadedPlugins: u, hasPremium: s } = await H(o ?? []), p = [
860
+ const t = this.getAttribute("data-cke-context-id"), e = JSON.parse(this.getAttribute("data-cke-language")), i = JSON.parse(this.getAttribute("data-cke-context")), { customTranslations: a, watchdogConfig: n, config: { plugins: o, ...c } } = i, { loadedPlugins: u, hasPremium: s } = await H(o ?? []), d = [
849
861
  ...await J(e, s),
850
862
  K(a || {})
851
- ].filter((f) => !B(f));
863
+ ].filter((f) => !_(f));
852
864
  this.contextPromise = (async () => {
853
- const { ContextWatchdog: f, Context: w } = await import("ckeditor5"), h = new f(w, {
865
+ const { ContextWatchdog: f, Context: w } = await import("ckeditor5"), p = new f(w, {
854
866
  crashNumberLimit: 10,
855
867
  ...n
856
868
  });
857
- let y = P(c);
858
- return y = T([...p].reverse(), e.ui, y), await h.create({
859
- ...y,
869
+ let E = P(c);
870
+ return E = I([...d].reverse(), e.ui, E), await p.create({
871
+ ...E,
860
872
  language: e,
861
873
  plugins: u,
862
- ...p.length && {
863
- translations: p
874
+ ...d.length && {
875
+ translations: d
864
876
  }
865
- }), h.on("itemError", (...D) => {
877
+ }), p.on("itemError", (...D) => {
866
878
  console.error("Context item error:", ...D);
867
- }), h;
879
+ }), p;
868
880
  })();
869
- const E = await this.contextPromise;
870
- this.isConnected && v.the.register(t, E);
881
+ const g = await this.contextPromise;
882
+ this.isConnected && v.the.register(t, g);
871
883
  }
872
884
  /**
873
885
  * Destroys the context component. Unmounts root from the editor.
@@ -883,10 +895,10 @@ class mt extends HTMLElement {
883
895
  }
884
896
  }
885
897
  }
886
- class m extends _ {
887
- static the = new m();
898
+ class h extends j {
899
+ static the = new h();
888
900
  }
889
- class ht extends HTMLElement {
901
+ class pt extends HTMLElement {
890
902
  /**
891
903
  * The promise that resolves when the editable is mounted.
892
904
  */
@@ -909,7 +921,7 @@ class ht extends HTMLElement {
909
921
  * Mounts the editable component.
910
922
  */
911
923
  async connectedCallback() {
912
- await I(), this.interactiveWait = M(this), await this.interactiveWait.promise, await this.initializeEditable();
924
+ await T(), this.interactiveWait = M(this), await this.interactiveWait.promise, await this.initializeEditable();
913
925
  }
914
926
  /**
915
927
  * Initializes the editable instance.
@@ -919,14 +931,14 @@ class ht extends HTMLElement {
919
931
  const t = this.getAttribute("data-cke-editor-id"), e = this.getAttribute("data-cke-root-name"), i = this.getAttribute("data-cke-content"), a = Number.parseInt(this.getAttribute("data-cke-save-debounce-ms"), 10);
920
932
  if (!t || !e)
921
933
  throw new b("Editor ID or Root Name is missing.");
922
- this.style.display = "block", this.editorPromise = m.the.execute(t, async (n) => {
934
+ this.style.display = "block", this.editorPromise = h.the.execute(t, async (n) => {
923
935
  if (!this.isConnected)
924
936
  return null;
925
937
  const { ui: o, editing: c, model: u } = n, s = this.querySelector("input");
926
938
  if (u.document.getRoot(e)?.isAttached()) {
927
939
  if (i !== null) {
928
- const h = n.getData({ rootName: e });
929
- h && h !== i && n.setData({
940
+ const p = n.getData({ rootName: e });
941
+ p && p !== i && n.setData({
930
942
  [e]: i
931
943
  });
932
944
  }
@@ -938,15 +950,15 @@ class ht extends HTMLElement {
938
950
  data: i
939
951
  }
940
952
  });
941
- const p = this.querySelector("[data-cke-editable-content]"), E = o.view.createEditable(e, p);
942
- o.addEditable(E), c.view.forceRender();
953
+ const d = this.querySelector("[data-cke-editable-content]"), g = o.view.createEditable(e, d);
954
+ o.addEditable(g), c.view.forceRender();
943
955
  const f = () => {
944
956
  if (!u.document.getRoot(e)?.isAttached())
945
957
  return;
946
- const h = n.getData({ rootName: e });
947
- s && (s.value = h, s.dispatchEvent(new Event("input"))), this.dispatchEvent(new CustomEvent("change", {
958
+ const p = n.getData({ rootName: e });
959
+ s && (s.value = p, s.dispatchEvent(new Event("input"))), this.dispatchEvent(new CustomEvent("change", {
948
960
  detail: {
949
- value: h
961
+ value: p
950
962
  }
951
963
  }));
952
964
  }, w = z(a, f);
@@ -977,7 +989,7 @@ class ht extends HTMLElement {
977
989
  }
978
990
  }
979
991
  }
980
- async function pt({
992
+ async function wt({
981
993
  saveDebounceMs: r,
982
994
  editorId: t,
983
995
  targetElement: e
@@ -1003,25 +1015,25 @@ async function pt({
1003
1015
  dispatch = () => {
1004
1016
  const { editor: n } = this;
1005
1017
  e.dispatchEvent(
1006
- new g({
1018
+ new y({
1007
1019
  editorId: t,
1008
1020
  editor: n,
1009
- roots: j(n)
1021
+ roots: B(n)
1010
1022
  })
1011
1023
  );
1012
1024
  };
1013
1025
  };
1014
1026
  }
1015
- class g extends CustomEvent {
1027
+ class y extends CustomEvent {
1016
1028
  static EVENT_NAME = "ckeditor5:change:data";
1017
1029
  constructor(t) {
1018
- super(g.EVENT_NAME, {
1030
+ super(y.EVENT_NAME, {
1019
1031
  detail: t,
1020
1032
  bubbles: !0
1021
1033
  });
1022
1034
  }
1023
1035
  }
1024
- async function wt(r) {
1036
+ async function ft(r) {
1025
1037
  const { Plugin: t } = await import("ckeditor5");
1026
1038
  return class extends t {
1027
1039
  /**
@@ -1062,7 +1074,7 @@ async function wt(r) {
1062
1074
  }
1063
1075
  };
1064
1076
  }
1065
- class ft extends HTMLElement {
1077
+ class gt extends HTMLElement {
1066
1078
  /**
1067
1079
  * The promise that resolves to the editor instance.
1068
1080
  */
@@ -1075,22 +1087,22 @@ class ft extends HTMLElement {
1075
1087
  * Mounts the editor component.
1076
1088
  */
1077
1089
  async connectedCallback() {
1078
- await I(), this.interactiveWait = M(this), L("classic"), await this.interactiveWait.promise, await this.initializeEditor();
1090
+ await T(), this.interactiveWait = M(this), L("classic"), await this.interactiveWait.promise, await this.initializeEditor();
1079
1091
  }
1080
1092
  /**
1081
1093
  * Initializes the editor instance.
1082
1094
  */
1083
1095
  async initializeEditor() {
1084
1096
  const t = this.getAttribute("data-cke-editor-id");
1085
- m.the.resetErrors(t);
1097
+ h.the.resetErrors(t);
1086
1098
  try {
1087
1099
  this.style.display = "block", this.editorPromise = this.createEditor();
1088
1100
  const e = await this.editorPromise;
1089
- this.isConnected && (m.the.register(t, e), e.once("destroy", () => {
1090
- m.the.hasItem(t) && m.the.unregister(t);
1101
+ this.isConnected && (h.the.register(t, e), e.once("destroy", () => {
1102
+ h.the.hasItem(t) && h.the.unregister(t);
1091
1103
  }));
1092
1104
  } catch (e) {
1093
- console.error(`Error initializing CKEditor5 instance with ID "${t}":`, e), this.editorPromise = null, m.the.error(t, e);
1105
+ console.error(`Error initializing CKEditor5 instance with ID "${t}":`, e), this.editorPromise = null, h.the.error(t, e);
1094
1106
  }
1095
1107
  }
1096
1108
  /**
@@ -1103,7 +1115,7 @@ class ft extends HTMLElement {
1103
1115
  const t = await this.editorPromise;
1104
1116
  if (!t)
1105
1117
  return;
1106
- const e = ot(t), i = dt(t);
1118
+ const e = ot(t), i = mt(t);
1107
1119
  e ? e.state !== "unavailable" && await e.context.remove(e.editorContextId) : i ? await i.destroy() : await t.destroy();
1108
1120
  } finally {
1109
1121
  this.editorPromise = null;
@@ -1116,73 +1128,73 @@ class ft extends HTMLElement {
1116
1128
  const t = this.getAttribute("data-cke-editor-id"), e = JSON.parse(this.getAttribute("data-cke-preset")), i = this.getAttribute("data-cke-context-id"), a = this.getAttribute("data-cke-editable-height") ? Number.parseInt(this.getAttribute("data-cke-editable-height"), 10) : null, n = Number.parseInt(this.getAttribute("data-cke-save-debounce-ms"), 10), o = JSON.parse(this.getAttribute("data-cke-language")), c = this.hasAttribute("data-cke-watchdog"), u = JSON.parse(this.getAttribute("data-cke-content")), {
1117
1129
  customTranslations: s,
1118
1130
  editorType: l,
1119
- licenseKey: p,
1120
- config: { plugins: E, ...f }
1131
+ licenseKey: d,
1132
+ config: { plugins: g, ...f }
1121
1133
  } = e;
1122
1134
  let w = await L(l);
1123
- const h = await (i ? v.the.waitFor(i) : null);
1124
- if (c && !h) {
1125
- const d = await lt(w);
1126
- ({ Constructor: w } = d), d.watchdog.on("restart", () => {
1127
- const k = d.watchdog.editor;
1128
- this.editorPromise = Promise.resolve(k), m.the.register(t, k);
1135
+ const p = await (i ? v.the.waitFor(i) : null);
1136
+ if (c && !p) {
1137
+ const m = await dt(w);
1138
+ ({ Constructor: w } = m), m.watchdog.on("restart", () => {
1139
+ const k = m.watchdog.editor;
1140
+ this.editorPromise = Promise.resolve(k), h.the.register(t, k);
1129
1141
  });
1130
1142
  }
1131
- const { loadedPlugins: y, hasPremium: D } = await H(E);
1132
- y.push(
1133
- await pt({
1143
+ const { loadedPlugins: E, hasPremium: D } = await H(g);
1144
+ E.push(
1145
+ await wt({
1134
1146
  saveDebounceMs: n,
1135
1147
  editorId: t,
1136
1148
  targetElement: this
1137
1149
  })
1138
- ), A(l) && y.push(
1139
- await wt(n)
1150
+ ), A(l) && E.push(
1151
+ await ft(n)
1140
1152
  );
1141
1153
  const S = [
1142
1154
  ...await J(o, D),
1143
1155
  K(s || {})
1144
- ].filter((d) => !B(d));
1156
+ ].filter((m) => !_(m));
1145
1157
  let C = {
1146
1158
  ...u,
1147
1159
  ...U(t)
1148
1160
  };
1149
1161
  A(l) && (C = C.main || "");
1150
1162
  const $ = await (async () => {
1151
- let d = Y(t);
1152
- if (!d.main) {
1163
+ let m = Y(t);
1164
+ if (!m.main) {
1153
1165
  const F = A(l) ? ["main"] : Object.keys(C);
1154
- Q(d, F) || (d = await gt(t, F), C = {
1166
+ Q(m, F) || (m = await yt(t, F), C = {
1155
1167
  ...u,
1156
1168
  ...U(t)
1157
1169
  });
1158
1170
  }
1159
- A(l) && "main" in d && (d = d.main);
1171
+ A(l) && "main" in m && (m = m.main);
1160
1172
  let k = P(f);
1161
- k = T([...S].reverse(), o.ui, k);
1173
+ k = I([...S].reverse(), o.ui, k);
1162
1174
  const W = {
1163
1175
  ...k,
1164
1176
  initialData: C,
1165
- licenseKey: p,
1166
- plugins: y,
1177
+ licenseKey: d,
1178
+ plugins: E,
1167
1179
  language: o,
1168
1180
  ...S.length && {
1169
1181
  translations: S
1170
1182
  }
1171
1183
  };
1172
- return !h || !(d instanceof HTMLElement) ? w.create(d, W) : (await nt({
1173
- context: h,
1174
- element: d,
1184
+ return !p || !(m instanceof HTMLElement) ? w.create(m, W) : (await nt({
1185
+ context: p,
1186
+ element: m,
1175
1187
  creator: w,
1176
1188
  config: W
1177
1189
  })).editor;
1178
1190
  })();
1179
- return A(l) && a && ut($, a), $;
1191
+ return A(l) && a && lt($, a), $;
1180
1192
  }
1181
1193
  }
1182
1194
  function Q(r, t) {
1183
1195
  return t.every((e) => r[e]);
1184
1196
  }
1185
- async function gt(r, t) {
1197
+ async function yt(r, t) {
1186
1198
  return at(
1187
1199
  () => {
1188
1200
  const e = Y(r);
@@ -1198,7 +1210,7 @@ Missing roots: ${t.filter((i) => !e[i]).join(", ")}.`
1198
1210
  { timeOutAfter: 2e3, retryAfter: 100 }
1199
1211
  );
1200
1212
  }
1201
- class yt extends HTMLElement {
1213
+ class bt extends HTMLElement {
1202
1214
  /**
1203
1215
  * The promise that resolves when the UI part is mounted.
1204
1216
  */
@@ -1207,12 +1219,12 @@ class yt extends HTMLElement {
1207
1219
  * Mounts the UI part component.
1208
1220
  */
1209
1221
  async connectedCallback() {
1210
- await I();
1222
+ await T();
1211
1223
  const t = this.getAttribute("data-cke-editor-id") || G()[0], e = this.getAttribute("data-cke-name");
1212
- !t || !e || (this.style.display = "block", this.mountedPromise = m.the.execute(t, (i) => {
1224
+ !t || !e || (this.style.display = "block", this.mountedPromise = h.the.execute(t, (i) => {
1213
1225
  if (!this.isConnected)
1214
1226
  return;
1215
- const { ui: a } = i, n = bt(e), o = a.view[n];
1227
+ const { ui: a } = i, n = Et(e), o = a.view[n];
1216
1228
  if (!o)
1217
1229
  throw new b(`Unknown UI part name: "${e}". Supported names are "toolbar" and "menubar".`);
1218
1230
  this.appendChild(o.element);
@@ -1225,7 +1237,7 @@ class yt extends HTMLElement {
1225
1237
  this.style.display = "none", await this.mountedPromise, this.mountedPromise = null, this.innerHTML = "";
1226
1238
  }
1227
1239
  }
1228
- function bt(r) {
1240
+ function Et(r) {
1229
1241
  switch (r) {
1230
1242
  case "toolbar":
1231
1243
  return "toolbar";
@@ -1236,17 +1248,17 @@ function bt(r) {
1236
1248
  return null;
1237
1249
  }
1238
1250
  }
1239
- const Et = {
1240
- "cke5-editor": ft,
1241
- "cke5-context": mt,
1242
- "cke5-ui-part": yt,
1243
- "cke5-editable": ht
1251
+ const kt = {
1252
+ "cke5-editor": gt,
1253
+ "cke5-context": ht,
1254
+ "cke5-ui-part": bt,
1255
+ "cke5-editable": pt
1244
1256
  };
1245
- function kt() {
1246
- for (const [r, t] of Object.entries(Et))
1257
+ function vt() {
1258
+ for (const [r, t] of Object.entries(kt))
1247
1259
  window.customElements.get(r) || window.customElements.define(r, t);
1248
1260
  }
1249
- function Ot(r) {
1261
+ function Dt(r) {
1250
1262
  return O(r), {
1251
1263
  unmount() {
1252
1264
  }
@@ -1309,70 +1321,70 @@ function tt() {
1309
1321
  }
1310
1322
  };
1311
1323
  }
1312
- function Dt(r, t) {
1324
+ function St(r, t) {
1313
1325
  const e = r.getAttribute("data-cke-editor-id"), i = r.getAttribute("data-cke-root-name") ?? "main";
1314
1326
  let a = !1, n = tt(), o = null;
1315
1327
  const c = (s) => {
1316
- if (!(s instanceof g) || s.detail.editorId !== e)
1328
+ if (!(s instanceof y) || s.detail.editorId !== e)
1317
1329
  return;
1318
1330
  const l = s.detail.roots[i];
1319
1331
  l !== void 0 && n.shouldNotify(l) && t.invokeMethodAsync("OnChangeEditableData", o, l);
1320
1332
  };
1321
1333
  return (async () => {
1322
- const s = await m.the.waitFor(e);
1334
+ const s = await h.the.waitFor(e);
1323
1335
  o = DotNet.createJSObjectReference(s), n = Z(s, {
1324
1336
  getCurrentValue: () => s.getData({ rootName: i }) ?? "",
1325
1337
  applyValue: (l) => s.setData({ [i]: l }),
1326
- isEqual: (l, p) => l === p
1338
+ isEqual: (l, d) => l === d
1327
1339
  });
1328
- })(), document.body.addEventListener(g.EVENT_NAME, c), O(r), {
1340
+ })(), document.body.addEventListener(y.EVENT_NAME, c), O(r), {
1329
1341
  /**
1330
1342
  * Cleans up all event listeners when the Blazor component is disposed.
1331
1343
  */
1332
1344
  unmount() {
1333
- a || (document.body.removeEventListener(g.EVENT_NAME, c), n.unmount(), o && (DotNet.disposeJSObjectReference(o), o = null), a = !0);
1345
+ a || (document.body.removeEventListener(y.EVENT_NAME, c), n.unmount(), o && (DotNet.disposeJSObjectReference(o), o = null), a = !0);
1334
1346
  },
1335
1347
  /**
1336
1348
  * Updates this editable root's data from Blazor.
1337
1349
  * If the editor is focused, the update is deferred until blur to avoid interrupting the user.
1338
1350
  */
1339
1351
  setValue: async (s) => {
1340
- a || (await m.the.waitFor(e), n.setValue(s));
1352
+ a || (await h.the.waitFor(e), n.setValue(s));
1341
1353
  }
1342
1354
  };
1343
1355
  }
1344
- function St(r, t) {
1356
+ function xt(r, t) {
1345
1357
  const e = r.getAttribute("data-cke-editor-id");
1346
1358
  let i = !1, a = null, n = tt(), o = null;
1347
1359
  const c = (s) => {
1348
- !(s instanceof g) || s.detail.editorId !== e || n.shouldNotify(s.detail.roots) && t.invokeMethodAsync("OnChangeEditorData", o, s.detail.roots);
1360
+ !(s instanceof y) || s.detail.editorId !== e || n.shouldNotify(s.detail.roots) && t.invokeMethodAsync("OnChangeEditorData", o, s.detail.roots);
1349
1361
  };
1350
1362
  return (async () => {
1351
- const s = await m.the.waitFor(e);
1363
+ const s = await h.the.waitFor(e);
1352
1364
  o = globalThis.DotNet.createJSObjectReference(s), n = Z(s, {
1353
- getCurrentValue: () => j(s),
1354
- applyValue: (p) => s.setData(p),
1365
+ getCurrentValue: () => B(s),
1366
+ applyValue: (d) => s.setData(d),
1355
1367
  isEqual: rt
1356
1368
  });
1357
- const l = (p, E, f) => {
1369
+ const l = (d, g, f) => {
1358
1370
  const w = f ? "OnEditorFocus" : "OnEditorBlur";
1359
1371
  t.invokeMethodAsync(w, o);
1360
1372
  };
1361
1373
  s.ui.focusTracker.on("change:isFocused", l), t.invokeMethodAsync("OnEditorReady", o), a = () => {
1362
1374
  s.ui.focusTracker.off("change:isFocused", l);
1363
1375
  };
1364
- })(), document.body.addEventListener(g.EVENT_NAME, c), kt(), O(r), {
1376
+ })(), document.body.addEventListener(y.EVENT_NAME, c), vt(), O(r), {
1365
1377
  /**
1366
1378
  * Updates the editor data from Blazor. If the editor is focused, the update is deferred until blur to avoid interrupting the user.
1367
1379
  */
1368
1380
  setValue: async (s) => {
1369
- i || (await m.the.waitFor(e), n.setValue(s));
1381
+ i || (await h.the.waitFor(e), n.setValue(s));
1370
1382
  },
1371
1383
  /**
1372
1384
  * Cleans up all event listeners when the Blazor component is disposed.
1373
1385
  */
1374
1386
  unmount() {
1375
- i || (document.body.removeEventListener(g.EVENT_NAME, c), n.unmount(), a?.(), o && (globalThis.DotNet.disposeJSObjectReference(o), o = null), i = !0);
1387
+ i || (document.body.removeEventListener(y.EVENT_NAME, c), n.unmount(), a?.(), o && (globalThis.DotNet.disposeJSObjectReference(o), o = null), i = !0);
1376
1388
  },
1377
1389
  /**
1378
1390
  * Installs the custom image upload adapter that delegates uploads to Blazor.
@@ -1382,12 +1394,12 @@ function St(r, t) {
1382
1394
  attachImageUploadAdapter: async () => {
1383
1395
  if (i)
1384
1396
  return;
1385
- const s = await m.the.waitFor(e);
1386
- vt(s, t);
1397
+ const s = await h.the.waitFor(e);
1398
+ Ct(s, t);
1387
1399
  }
1388
1400
  };
1389
1401
  }
1390
- function vt(r, t) {
1402
+ function Ct(r, t) {
1391
1403
  if (!r.plugins.has("FileRepository"))
1392
1404
  return;
1393
1405
  const e = r.plugins.get("FileRepository");
@@ -1398,7 +1410,7 @@ function vt(r, t) {
1398
1410
  const n = await i.file;
1399
1411
  if (a)
1400
1412
  throw new Error("Upload aborted.");
1401
- const o = await Ct(n), c = await t.invokeMethodAsync("OnEditorImageUpload", {
1413
+ const o = await At(n), c = await t.invokeMethodAsync("OnEditorImageUpload", {
1402
1414
  fileName: n.name,
1403
1415
  mimeType: n.type,
1404
1416
  payload: o
@@ -1415,7 +1427,7 @@ function vt(r, t) {
1415
1427
  };
1416
1428
  };
1417
1429
  }
1418
- function Ct(r) {
1430
+ function At(r) {
1419
1431
  return new Promise((t, e) => {
1420
1432
  const i = new FileReader();
1421
1433
  i.onload = () => {
@@ -1424,7 +1436,7 @@ function Ct(r) {
1424
1436
  }, i.onerror = () => e(i.error), i.readAsDataURL(r);
1425
1437
  });
1426
1438
  }
1427
- function xt(r) {
1439
+ function Nt(r) {
1428
1440
  return O(r), {
1429
1441
  unmount() {
1430
1442
  }
@@ -1432,17 +1444,17 @@ function xt(r) {
1432
1444
  }
1433
1445
  export {
1434
1446
  b as CKEditor5BlazorError,
1435
- g as CKEditor5ChangeDataEvent,
1447
+ y as CKEditor5ChangeDataEvent,
1436
1448
  v as ContextsRegistry,
1437
1449
  R as CustomEditorPluginsRegistry,
1438
- ht as EditableComponentElement,
1439
- ft as EditorComponentElement,
1440
- m as EditorsRegistry,
1441
- yt as UIPartComponentElement,
1442
- Ot as createContextBlazorInterop,
1443
- Dt as createEditableBlazorInterop,
1444
- St as createEditorBlazorInterop,
1445
- xt as createUIPartBlazorInterop,
1446
- kt as ensureEditorElementsRegistered
1450
+ pt as EditableComponentElement,
1451
+ gt as EditorComponentElement,
1452
+ h as EditorsRegistry,
1453
+ bt as UIPartComponentElement,
1454
+ Dt as createContextBlazorInterop,
1455
+ St as createEditableBlazorInterop,
1456
+ xt as createEditorBlazorInterop,
1457
+ Nt as createUIPartBlazorInterop,
1458
+ vt as ensureEditorElementsRegistered
1447
1459
  };
1448
1460
  //# sourceMappingURL=index.mjs.map