ckeditor5-blazor 1.4.0 → 1.6.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.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +38 -38
- package/dist/index.mjs.map +1 -1
- package/dist/interop/create-editable-blazor-interop.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/interop/create-editable-blazor-interop.test.ts +21 -0
- package/src/interop/create-editable-blazor-interop.ts +2 -1
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 _ {
|
|
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
|
|
202
|
+
function B(r) {
|
|
203
203
|
return Object.keys(r).length === 0 && r.constructor === Object;
|
|
204
204
|
}
|
|
205
205
|
function V(r, t) {
|
|
@@ -301,13 +301,13 @@ 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
|
|
304
|
+
function H(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) {
|
|
308
308
|
return ["inline", "classic", "balloon", "decoupled"].includes(r);
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
310
|
+
async function q(r) {
|
|
311
311
|
const t = await import("ckeditor5"), i = {
|
|
312
312
|
inline: t.InlineEditor,
|
|
313
313
|
balloon: t.BalloonEditor,
|
|
@@ -379,7 +379,7 @@ class R {
|
|
|
379
379
|
return this.plugins.has(t);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
async function
|
|
382
|
+
async function J(r) {
|
|
383
383
|
const t = await import("ckeditor5");
|
|
384
384
|
let e = null;
|
|
385
385
|
const i = r.map(async (a) => {
|
|
@@ -417,17 +417,17 @@ async function H(r) {
|
|
|
417
417
|
function st(r) {
|
|
418
418
|
return typeof r == "object" && r !== null && "$import" in r;
|
|
419
419
|
}
|
|
420
|
-
async function
|
|
420
|
+
async function K(r, t) {
|
|
421
421
|
const e = [r.ui, r.content];
|
|
422
422
|
return await Promise.all(
|
|
423
423
|
[
|
|
424
|
-
|
|
424
|
+
U("ckeditor5", e),
|
|
425
425
|
/* v8 ignore next -- @preserve */
|
|
426
|
-
t &&
|
|
426
|
+
t && U("ckeditor5-premium-features", e)
|
|
427
427
|
].filter((a) => !!a)
|
|
428
428
|
).then((a) => a.flat());
|
|
429
429
|
}
|
|
430
|
-
async function
|
|
430
|
+
async function U(r, t) {
|
|
431
431
|
return await Promise.all(
|
|
432
432
|
t.filter((e) => e !== "en").map(async (e) => {
|
|
433
433
|
const i = await ct(r, e);
|
|
@@ -735,19 +735,19 @@ async function ct(r, t) {
|
|
|
735
735
|
return console.error(`Failed to load translation for ${r}/${t}:`, e), null;
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function G(r) {
|
|
739
739
|
return V(r, (t) => ({
|
|
740
740
|
dictionary: t
|
|
741
741
|
}));
|
|
742
742
|
}
|
|
743
|
-
function
|
|
743
|
+
function $() {
|
|
744
744
|
return Array.from(document.querySelectorAll("cke5-editor")).map((r) => r.getAttribute("data-cke-editor-id")).filter((r) => r !== null);
|
|
745
745
|
}
|
|
746
746
|
function Y(r) {
|
|
747
747
|
const t = X(r);
|
|
748
748
|
return V(t, ({ element: e }) => e);
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function j(r) {
|
|
751
751
|
const t = X(r), e = V(t, ({ content: i }) => i);
|
|
752
752
|
return et(e, (i) => typeof i == "string");
|
|
753
753
|
}
|
|
@@ -835,7 +835,7 @@ async function dt(r) {
|
|
|
835
835
|
function mt(r) {
|
|
836
836
|
return N in r ? r[N] : null;
|
|
837
837
|
}
|
|
838
|
-
class v extends
|
|
838
|
+
class v extends _ {
|
|
839
839
|
static the = new v();
|
|
840
840
|
}
|
|
841
841
|
class ht extends HTMLElement {
|
|
@@ -857,10 +857,10 @@ class ht extends HTMLElement {
|
|
|
857
857
|
* Initializes the context component.
|
|
858
858
|
*/
|
|
859
859
|
async initializeContext() {
|
|
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
|
|
861
|
-
...await
|
|
862
|
-
|
|
863
|
-
].filter((f) => !
|
|
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 J(o ?? []), d = [
|
|
861
|
+
...await K(e, s),
|
|
862
|
+
G(a || {})
|
|
863
|
+
].filter((f) => !B(f));
|
|
864
864
|
this.contextPromise = (async () => {
|
|
865
865
|
const { ContextWatchdog: f, Context: w } = await import("ckeditor5"), p = new f(w, {
|
|
866
866
|
crashNumberLimit: 10,
|
|
@@ -895,7 +895,7 @@ class ht extends HTMLElement {
|
|
|
895
895
|
}
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
|
-
class h extends
|
|
898
|
+
class h extends _ {
|
|
899
899
|
static the = new h();
|
|
900
900
|
}
|
|
901
901
|
class pt extends HTMLElement {
|
|
@@ -927,7 +927,7 @@ class pt extends HTMLElement {
|
|
|
927
927
|
* Initializes the editable instance.
|
|
928
928
|
*/
|
|
929
929
|
async initializeEditable() {
|
|
930
|
-
this.hasAttribute("data-cke-editor-id") || this.setAttribute("data-cke-editor-id",
|
|
930
|
+
this.hasAttribute("data-cke-editor-id") || this.setAttribute("data-cke-editor-id", $()[0]);
|
|
931
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);
|
|
932
932
|
if (!t || !e)
|
|
933
933
|
throw new b("Editor ID or Root Name is missing.");
|
|
@@ -1018,7 +1018,7 @@ async function wt({
|
|
|
1018
1018
|
new y({
|
|
1019
1019
|
editorId: t,
|
|
1020
1020
|
editor: n,
|
|
1021
|
-
roots:
|
|
1021
|
+
roots: H(n)
|
|
1022
1022
|
})
|
|
1023
1023
|
);
|
|
1024
1024
|
};
|
|
@@ -1087,7 +1087,7 @@ class gt extends HTMLElement {
|
|
|
1087
1087
|
* Mounts the editor component.
|
|
1088
1088
|
*/
|
|
1089
1089
|
async connectedCallback() {
|
|
1090
|
-
await T(), this.interactiveWait = M(this),
|
|
1090
|
+
await T(), this.interactiveWait = M(this), q("classic"), await this.interactiveWait.promise, await this.initializeEditor();
|
|
1091
1091
|
}
|
|
1092
1092
|
/**
|
|
1093
1093
|
* Initializes the editor instance.
|
|
@@ -1131,7 +1131,7 @@ class gt extends HTMLElement {
|
|
|
1131
1131
|
licenseKey: d,
|
|
1132
1132
|
config: { plugins: g, ...f }
|
|
1133
1133
|
} = e;
|
|
1134
|
-
let w = await
|
|
1134
|
+
let w = await q(l);
|
|
1135
1135
|
const p = await (i ? v.the.waitFor(i) : null);
|
|
1136
1136
|
if (c && !p) {
|
|
1137
1137
|
const m = await dt(w);
|
|
@@ -1140,7 +1140,7 @@ class gt extends HTMLElement {
|
|
|
1140
1140
|
this.editorPromise = Promise.resolve(k), h.the.register(t, k);
|
|
1141
1141
|
});
|
|
1142
1142
|
}
|
|
1143
|
-
const { loadedPlugins: E, hasPremium: D } = await
|
|
1143
|
+
const { loadedPlugins: E, hasPremium: D } = await J(g);
|
|
1144
1144
|
E.push(
|
|
1145
1145
|
await wt({
|
|
1146
1146
|
saveDebounceMs: n,
|
|
@@ -1151,27 +1151,27 @@ class gt extends HTMLElement {
|
|
|
1151
1151
|
await ft(n)
|
|
1152
1152
|
);
|
|
1153
1153
|
const S = [
|
|
1154
|
-
...await
|
|
1155
|
-
|
|
1156
|
-
].filter((m) => !
|
|
1154
|
+
...await K(o, D),
|
|
1155
|
+
G(s || {})
|
|
1156
|
+
].filter((m) => !B(m));
|
|
1157
1157
|
let C = {
|
|
1158
1158
|
...u,
|
|
1159
|
-
...
|
|
1159
|
+
...j(t)
|
|
1160
1160
|
};
|
|
1161
1161
|
A(l) && (C = C.main || "");
|
|
1162
|
-
const
|
|
1162
|
+
const W = await (async () => {
|
|
1163
1163
|
let m = Y(t);
|
|
1164
1164
|
if (!m.main) {
|
|
1165
|
-
const
|
|
1166
|
-
Q(m,
|
|
1165
|
+
const L = A(l) ? ["main"] : Object.keys(C);
|
|
1166
|
+
Q(m, L) || (m = await yt(t, L), C = {
|
|
1167
1167
|
...u,
|
|
1168
|
-
...
|
|
1168
|
+
...j(t)
|
|
1169
1169
|
});
|
|
1170
1170
|
}
|
|
1171
1171
|
A(l) && "main" in m && (m = m.main);
|
|
1172
1172
|
let k = P(f);
|
|
1173
1173
|
k = I([...S].reverse(), o.ui, k);
|
|
1174
|
-
const
|
|
1174
|
+
const F = {
|
|
1175
1175
|
...k,
|
|
1176
1176
|
initialData: C,
|
|
1177
1177
|
licenseKey: d,
|
|
@@ -1181,14 +1181,14 @@ class gt extends HTMLElement {
|
|
|
1181
1181
|
translations: S
|
|
1182
1182
|
}
|
|
1183
1183
|
};
|
|
1184
|
-
return !p || !(m instanceof HTMLElement) ? w.create(m,
|
|
1184
|
+
return !p || !(m instanceof HTMLElement) ? w.create(m, F) : (await nt({
|
|
1185
1185
|
context: p,
|
|
1186
1186
|
element: m,
|
|
1187
1187
|
creator: w,
|
|
1188
|
-
config:
|
|
1188
|
+
config: F
|
|
1189
1189
|
})).editor;
|
|
1190
1190
|
})();
|
|
1191
|
-
return A(l) && a && lt(
|
|
1191
|
+
return A(l) && a && lt(W, a), W;
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
1194
|
function Q(r, t) {
|
|
@@ -1220,7 +1220,7 @@ class bt extends HTMLElement {
|
|
|
1220
1220
|
*/
|
|
1221
1221
|
async connectedCallback() {
|
|
1222
1222
|
await T();
|
|
1223
|
-
const t = this.getAttribute("data-cke-editor-id") ||
|
|
1223
|
+
const t = this.getAttribute("data-cke-editor-id") || $()[0], e = this.getAttribute("data-cke-name");
|
|
1224
1224
|
!t || !e || (this.style.display = "block", this.mountedPromise = h.the.execute(t, (i) => {
|
|
1225
1225
|
if (!this.isConnected)
|
|
1226
1226
|
return;
|
|
@@ -1322,7 +1322,7 @@ function tt() {
|
|
|
1322
1322
|
};
|
|
1323
1323
|
}
|
|
1324
1324
|
function St(r, t) {
|
|
1325
|
-
const e = r.getAttribute("data-cke-editor-id"), i = r.getAttribute("data-cke-root-name") ?? "main";
|
|
1325
|
+
const e = r.getAttribute("data-cke-editor-id") ?? $()[0], i = r.getAttribute("data-cke-root-name") ?? "main";
|
|
1326
1326
|
let a = !1, n = tt(), o = null;
|
|
1327
1327
|
const c = (s) => {
|
|
1328
1328
|
if (!(s instanceof y) || s.detail.editorId !== e)
|
|
@@ -1362,7 +1362,7 @@ function xt(r, t) {
|
|
|
1362
1362
|
return (async () => {
|
|
1363
1363
|
const s = await h.the.waitFor(e);
|
|
1364
1364
|
o = globalThis.DotNet.createJSObjectReference(s), n = Z(s, {
|
|
1365
|
-
getCurrentValue: () =>
|
|
1365
|
+
getCurrentValue: () => H(s),
|
|
1366
1366
|
applyValue: (d) => s.setData(d),
|
|
1367
1367
|
isEqual: rt
|
|
1368
1368
|
});
|