ckeditor5-livewire 1.2.5 → 1.2.6
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/hooks/editor/editor.d.ts.map +1 -1
- package/dist/hooks/editor/utils/query-editor-editables.d.ts +2 -3
- package/dist/hooks/editor/utils/query-editor-editables.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +138 -127
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/editable.test.ts +1 -1
- package/src/hooks/editor/editor.test.ts +29 -7
- package/src/hooks/editor/editor.ts +13 -17
- package/src/hooks/editor/utils/query-editor-editables.ts +35 -9
- package/src/hooks/ui-part.test.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class C {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.livewireComponent = t;
|
|
4
4
|
}
|
|
@@ -33,21 +33,21 @@ class v {
|
|
|
33
33
|
}
|
|
34
34
|
function U(i, t) {
|
|
35
35
|
const e = /* @__PURE__ */ new Map();
|
|
36
|
-
window.Livewire?.hook("component.init", async ({ component: r, cleanup:
|
|
36
|
+
window.Livewire?.hook("component.init", async ({ component: r, cleanup: n }) => {
|
|
37
37
|
if (r.name !== i)
|
|
38
38
|
return;
|
|
39
|
-
const
|
|
40
|
-
e.set(r.id,
|
|
41
|
-
|
|
42
|
-
}), await
|
|
43
|
-
}), window.Livewire?.hook("commit", async ({ component: r, succeed:
|
|
44
|
-
r.name === i &&
|
|
45
|
-
const
|
|
46
|
-
|
|
39
|
+
const a = new t(r);
|
|
40
|
+
e.set(r.id, a), n(async () => {
|
|
41
|
+
a.state = "destroying", await a.destroyed(), a.state = "destroyed", e.delete(r.id);
|
|
42
|
+
}), await a.mounted(), a.state = "mounted";
|
|
43
|
+
}), window.Livewire?.hook("commit", async ({ component: r, succeed: n }) => {
|
|
44
|
+
r.name === i && n(() => {
|
|
45
|
+
const a = e.get(r.id);
|
|
46
|
+
a?.state === "mounted" && a?.afterCommitSynced?.();
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
class
|
|
50
|
+
class H {
|
|
51
51
|
/**
|
|
52
52
|
* Map of registered items.
|
|
53
53
|
*/
|
|
@@ -74,8 +74,8 @@ class A {
|
|
|
74
74
|
* @returns A promise that resolves with the result of the function.
|
|
75
75
|
*/
|
|
76
76
|
execute(t, e, r) {
|
|
77
|
-
const
|
|
78
|
-
return
|
|
77
|
+
const n = this.items.get(t), a = this.initializationErrors.get(t);
|
|
78
|
+
return a ? (r?.(a), Promise.reject(a)) : n ? Promise.resolve(e(n)) : new Promise((s, o) => {
|
|
79
79
|
const c = this.getPendingCallbacks(t);
|
|
80
80
|
c.success.push(async (u) => {
|
|
81
81
|
s(await e(u));
|
|
@@ -93,7 +93,7 @@ class A {
|
|
|
93
93
|
throw new Error(`Item with ID "${t}" is already registered.`);
|
|
94
94
|
this.resetErrors(t), this.items.set(t, e);
|
|
95
95
|
const r = this.pendingCallbacks.get(t);
|
|
96
|
-
r && (r.success.forEach((
|
|
96
|
+
r && (r.success.forEach((n) => n(e)), this.pendingCallbacks.delete(t)), this.registerAsDefault(t, e), this.notifyWatchers();
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Registers an error for an item.
|
|
@@ -104,7 +104,7 @@ class A {
|
|
|
104
104
|
error(t, e) {
|
|
105
105
|
this.items.delete(t), this.initializationErrors.set(t, e);
|
|
106
106
|
const r = this.pendingCallbacks.get(t);
|
|
107
|
-
r && (r.error.forEach((
|
|
107
|
+
r && (r.error.forEach((n) => n(e)), this.pendingCallbacks.delete(t)), this.initializationErrors.size === 1 && !this.items.size && this.error(null, e), this.notifyWatchers();
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Resets errors for an item.
|
|
@@ -213,7 +213,7 @@ class A {
|
|
|
213
213
|
this.items.size === 1 && t !== null && this.register(null, e);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function D(i, t) {
|
|
217
217
|
let e = null;
|
|
218
218
|
return (...r) => {
|
|
219
219
|
e && clearTimeout(e), e = setTimeout(() => {
|
|
@@ -222,14 +222,14 @@ function O(i, t) {
|
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
function _(i, t) {
|
|
225
|
-
const e = Object.entries(i).filter(([r,
|
|
225
|
+
const e = Object.entries(i).filter(([r, n]) => t(n, r));
|
|
226
226
|
return Object.fromEntries(e);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function W(i) {
|
|
229
229
|
return Object.keys(i).length === 0 && i.constructor === Object;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
const e = Object.entries(i).map(([r,
|
|
231
|
+
function O(i, t) {
|
|
232
|
+
const e = Object.entries(i).map(([r, n]) => [r, t(n, r)]);
|
|
233
233
|
return Object.fromEntries(e);
|
|
234
234
|
}
|
|
235
235
|
function P(i, t) {
|
|
@@ -238,8 +238,8 @@ function P(i, t) {
|
|
|
238
238
|
const e = Object.keys(i), r = Object.keys(t);
|
|
239
239
|
if (e.length !== r.length)
|
|
240
240
|
return !1;
|
|
241
|
-
for (const
|
|
242
|
-
if (i[
|
|
241
|
+
for (const n of e)
|
|
242
|
+
if (i[n] !== t[n] || !Object.prototype.hasOwnProperty.call(t, n))
|
|
243
243
|
return !1;
|
|
244
244
|
return !0;
|
|
245
245
|
}
|
|
@@ -250,17 +250,17 @@ function G(i, {
|
|
|
250
250
|
timeOutAfter: t = 500,
|
|
251
251
|
retryAfter: e = 100
|
|
252
252
|
} = {}) {
|
|
253
|
-
return new Promise((r,
|
|
254
|
-
const
|
|
253
|
+
return new Promise((r, n) => {
|
|
254
|
+
const a = Date.now();
|
|
255
255
|
let s = null;
|
|
256
256
|
const o = setTimeout(() => {
|
|
257
|
-
|
|
257
|
+
n(s ?? new Error("Timeout"));
|
|
258
258
|
}, t), c = async () => {
|
|
259
259
|
try {
|
|
260
260
|
const u = await i();
|
|
261
261
|
clearTimeout(o), r(u);
|
|
262
262
|
} catch (u) {
|
|
263
|
-
s = u, Date.now() -
|
|
263
|
+
s = u, Date.now() - a > t ? n(u) : setTimeout(c, e);
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
266
|
c();
|
|
@@ -268,24 +268,24 @@ function G(i, {
|
|
|
268
268
|
}
|
|
269
269
|
const I = Symbol.for("context-editor-watchdog");
|
|
270
270
|
async function Y({ element: i, context: t, creator: e, config: r }) {
|
|
271
|
-
const
|
|
271
|
+
const n = K();
|
|
272
272
|
await t.add({
|
|
273
273
|
creator: (c, u) => e.create(c, u),
|
|
274
|
-
id:
|
|
274
|
+
id: n,
|
|
275
275
|
sourceElementOrData: i,
|
|
276
276
|
type: "editor",
|
|
277
277
|
config: r
|
|
278
278
|
});
|
|
279
|
-
const
|
|
279
|
+
const a = t.getItem(n), s = {
|
|
280
280
|
state: "available",
|
|
281
|
-
editorContextId:
|
|
281
|
+
editorContextId: n,
|
|
282
282
|
context: t
|
|
283
283
|
};
|
|
284
|
-
|
|
284
|
+
a[I] = s;
|
|
285
285
|
const o = t.destroy.bind(t);
|
|
286
286
|
return t.destroy = async () => (s.state = "unavailable", o()), {
|
|
287
287
|
...s,
|
|
288
|
-
editor:
|
|
288
|
+
editor: a
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
291
|
function X(i) {
|
|
@@ -294,7 +294,7 @@ function X(i) {
|
|
|
294
294
|
function J(i) {
|
|
295
295
|
return i.model.document.getRootNames().reduce((e, r) => (e[r] = i.getData({ rootName: r }), e), /* @__PURE__ */ Object.create({}));
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function v(i) {
|
|
298
298
|
return ["inline", "classic", "balloon", "decoupled"].includes(i);
|
|
299
299
|
}
|
|
300
300
|
function Q(i) {
|
|
@@ -319,8 +319,8 @@ async function Z(i) {
|
|
|
319
319
|
throw new Error(`Unsupported editor type: ${i}`);
|
|
320
320
|
return r;
|
|
321
321
|
}
|
|
322
|
-
class
|
|
323
|
-
static the = new
|
|
322
|
+
class S {
|
|
323
|
+
static the = new S();
|
|
324
324
|
/**
|
|
325
325
|
* Map of registered custom plugins.
|
|
326
326
|
*/
|
|
@@ -379,14 +379,14 @@ class $ {
|
|
|
379
379
|
return this.plugins.has(t);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
async function
|
|
382
|
+
async function A(i) {
|
|
383
383
|
const t = await import("ckeditor5");
|
|
384
384
|
let e = null;
|
|
385
|
-
const r = i.map(async (
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
return
|
|
389
|
-
const { [
|
|
385
|
+
const r = i.map(async (n) => {
|
|
386
|
+
const a = await S.the.get(n);
|
|
387
|
+
if (a)
|
|
388
|
+
return a;
|
|
389
|
+
const { [n]: s } = t;
|
|
390
390
|
if (s)
|
|
391
391
|
return s;
|
|
392
392
|
if (!e)
|
|
@@ -395,27 +395,27 @@ async function j(i) {
|
|
|
395
395
|
} catch (c) {
|
|
396
396
|
console.error(`Failed to load premium package: ${c}`);
|
|
397
397
|
}
|
|
398
|
-
const { [
|
|
398
|
+
const { [n]: o } = e || {};
|
|
399
399
|
if (o)
|
|
400
400
|
return o;
|
|
401
|
-
throw new Error(`Plugin "${
|
|
401
|
+
throw new Error(`Plugin "${n}" not found in base or premium packages.`);
|
|
402
402
|
});
|
|
403
403
|
return {
|
|
404
404
|
loadedPlugins: await Promise.all(r),
|
|
405
405
|
hasPremium: !!e
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
|
-
async function
|
|
408
|
+
async function V(i, t) {
|
|
409
409
|
const e = [i.ui, i.content];
|
|
410
410
|
return await Promise.all(
|
|
411
411
|
[
|
|
412
|
-
|
|
412
|
+
R("ckeditor5", e),
|
|
413
413
|
/* v8 ignore next */
|
|
414
|
-
t &&
|
|
415
|
-
].filter((
|
|
416
|
-
).then((
|
|
414
|
+
t && R("ckeditor5-premium-features", e)
|
|
415
|
+
].filter((n) => !!n)
|
|
416
|
+
).then((n) => n.flat());
|
|
417
417
|
}
|
|
418
|
-
async function
|
|
418
|
+
async function R(i, t) {
|
|
419
419
|
return await Promise.all(
|
|
420
420
|
t.filter((e) => e !== "en").map(async (e) => {
|
|
421
421
|
const r = await tt(i, e);
|
|
@@ -723,28 +723,39 @@ async function tt(i, t) {
|
|
|
723
723
|
return console.error(`Failed to load translation for ${i}/${t}:`, e), null;
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
return
|
|
726
|
+
function j(i) {
|
|
727
|
+
return O(i, (t) => ({
|
|
728
728
|
dictionary: t
|
|
729
729
|
}));
|
|
730
730
|
}
|
|
731
|
-
function
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
const e = q(i);
|
|
735
|
-
return S(e, ({ element: r }) => r);
|
|
731
|
+
function F(i) {
|
|
732
|
+
const t = q(i);
|
|
733
|
+
return O(t, ({ element: e }) => e);
|
|
736
734
|
}
|
|
737
735
|
function q(i) {
|
|
738
|
-
|
|
736
|
+
const t = window.Livewire.all().filter(({ name: s, canonical: o }) => s === "ckeditor5-editable" && o.editorId === i).reduce((s, { canonical: o, el: c }) => ({
|
|
737
|
+
...s,
|
|
738
|
+
[o.rootName]: {
|
|
739
|
+
element: c.querySelector("[data-cke-editable-content]"),
|
|
740
|
+
content: o.content
|
|
741
|
+
}
|
|
742
|
+
}), /* @__PURE__ */ Object.create({})), r = window.Livewire.all().find(({ name: s, canonical: o }) => s === "ckeditor5" && o.editorId === i)?.canonical.content, n = document.querySelector(`#${i}_editor `), a = t.main;
|
|
743
|
+
return a && r?.main ? {
|
|
739
744
|
...t,
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
content:
|
|
745
|
+
main: {
|
|
746
|
+
...a,
|
|
747
|
+
content: a.content || r.main
|
|
743
748
|
}
|
|
744
|
-
}
|
|
749
|
+
} : n ? {
|
|
750
|
+
...t,
|
|
751
|
+
main: {
|
|
752
|
+
element: n,
|
|
753
|
+
content: r?.main || null
|
|
754
|
+
}
|
|
755
|
+
} : t;
|
|
745
756
|
}
|
|
746
|
-
function
|
|
747
|
-
const t = q(i), e =
|
|
757
|
+
function L(i) {
|
|
758
|
+
const t = q(i), e = O(t, ({ content: r }) => r);
|
|
748
759
|
return _(e, (r) => typeof r == "string");
|
|
749
760
|
}
|
|
750
761
|
function T(i) {
|
|
@@ -758,8 +769,8 @@ function T(i) {
|
|
|
758
769
|
return r || console.warn(`Element not found for selector: ${t.$element}`), r || null;
|
|
759
770
|
}
|
|
760
771
|
const e = /* @__PURE__ */ Object.create(null);
|
|
761
|
-
for (const [r,
|
|
762
|
-
e[r] = T(
|
|
772
|
+
for (const [r, n] of Object.entries(i))
|
|
773
|
+
e[r] = T(n);
|
|
763
774
|
return e;
|
|
764
775
|
}
|
|
765
776
|
function et(i, t) {
|
|
@@ -768,12 +779,12 @@ function et(i, t) {
|
|
|
768
779
|
r.setStyle("height", `${t}px`, e.view.document.getRoot());
|
|
769
780
|
});
|
|
770
781
|
}
|
|
771
|
-
const
|
|
782
|
+
const x = Symbol.for("elixir-editor-watchdog");
|
|
772
783
|
async function rt(i) {
|
|
773
784
|
const { EditorWatchdog: t } = await import("ckeditor5"), e = new t(i);
|
|
774
785
|
return e.setCreator(async (...r) => {
|
|
775
|
-
const
|
|
776
|
-
return
|
|
786
|
+
const n = await i.create(...r);
|
|
787
|
+
return n[x] = e, n;
|
|
777
788
|
}), {
|
|
778
789
|
watchdog: e,
|
|
779
790
|
Constructor: {
|
|
@@ -782,12 +793,12 @@ async function rt(i) {
|
|
|
782
793
|
};
|
|
783
794
|
}
|
|
784
795
|
function it(i) {
|
|
785
|
-
return
|
|
796
|
+
return x in i ? i[x] : null;
|
|
786
797
|
}
|
|
787
|
-
class y extends
|
|
798
|
+
class y extends H {
|
|
788
799
|
static the = new y();
|
|
789
800
|
}
|
|
790
|
-
class
|
|
801
|
+
class nt extends C {
|
|
791
802
|
/**
|
|
792
803
|
* The promise that resolves to the context instance.
|
|
793
804
|
*/
|
|
@@ -796,14 +807,14 @@ class at extends v {
|
|
|
796
807
|
* Mounts the context component.
|
|
797
808
|
*/
|
|
798
809
|
async mounted() {
|
|
799
|
-
const { contextId: t, language: e, context: r } = this.canonical, { customTranslations:
|
|
800
|
-
...await
|
|
801
|
-
|
|
802
|
-
].filter((d) => !
|
|
810
|
+
const { contextId: t, language: e, context: r } = this.canonical, { customTranslations: n, watchdogConfig: a, config: { plugins: s, ...o } } = r, { loadedPlugins: c, hasPremium: u } = await A(s ?? []), h = [
|
|
811
|
+
...await V(e, u),
|
|
812
|
+
j(n || {})
|
|
813
|
+
].filter((d) => !W(d));
|
|
803
814
|
this.contextPromise = (async () => {
|
|
804
815
|
const { ContextWatchdog: d, Context: g } = await import("ckeditor5"), p = new d(g, {
|
|
805
816
|
crashNumberLimit: 10,
|
|
806
|
-
...
|
|
817
|
+
...a
|
|
807
818
|
});
|
|
808
819
|
return await p.create({
|
|
809
820
|
...o,
|
|
@@ -832,10 +843,10 @@ class at extends v {
|
|
|
832
843
|
}
|
|
833
844
|
}
|
|
834
845
|
}
|
|
835
|
-
class w extends
|
|
846
|
+
class w extends H {
|
|
836
847
|
static the = new w();
|
|
837
848
|
}
|
|
838
|
-
class
|
|
849
|
+
class at extends C {
|
|
839
850
|
/**
|
|
840
851
|
* The promise that resolves when the editable is mounted.
|
|
841
852
|
*/
|
|
@@ -844,7 +855,7 @@ class nt extends v {
|
|
|
844
855
|
* Mounts the editable component.
|
|
845
856
|
*/
|
|
846
857
|
mounted() {
|
|
847
|
-
const { editorId: t, rootName: e, content: r, saveDebounceMs:
|
|
858
|
+
const { editorId: t, rootName: e, content: r, saveDebounceMs: n } = this.canonical, a = this.element.querySelector("input");
|
|
848
859
|
this.editorPromise = w.the.execute(t, (s) => {
|
|
849
860
|
const { ui: o, editing: c, model: u } = s;
|
|
850
861
|
if (u.document.getRoot(e)) {
|
|
@@ -866,9 +877,9 @@ class nt extends v {
|
|
|
866
877
|
o.addEditable(h), c.view.forceRender();
|
|
867
878
|
const f = () => {
|
|
868
879
|
const d = s.getData({ rootName: e });
|
|
869
|
-
|
|
880
|
+
a && (a.value = d), this.$wire.set("content", d);
|
|
870
881
|
};
|
|
871
|
-
return s.model.document.on("change:data",
|
|
882
|
+
return s.model.document.on("change:data", D(n, f)), f(), s;
|
|
872
883
|
});
|
|
873
884
|
}
|
|
874
885
|
/**
|
|
@@ -915,50 +926,50 @@ async function st({
|
|
|
915
926
|
* Setups the content sync from Livewire to the editor.
|
|
916
927
|
*/
|
|
917
928
|
setupContentServerSync() {
|
|
918
|
-
const { editor:
|
|
929
|
+
const { editor: n } = this, { model: a, ui: { focusTracker: s } } = n;
|
|
919
930
|
let o = null;
|
|
920
|
-
|
|
931
|
+
n.on("afterCommitSynced", () => {
|
|
921
932
|
const { content: c } = t.canonical, u = this.getEditorRootsValues();
|
|
922
933
|
if (Q(t.element)) {
|
|
923
934
|
if (s.isFocused) {
|
|
924
935
|
P(c, u) || (o = c);
|
|
925
936
|
return;
|
|
926
937
|
}
|
|
927
|
-
P(c, u) ||
|
|
938
|
+
P(c, u) || n.setData(c);
|
|
928
939
|
}
|
|
929
940
|
}), Livewire.on("set-editor-content", ({ editorId: c, content: u }) => {
|
|
930
941
|
if (c !== t.canonical.editorId)
|
|
931
942
|
return;
|
|
932
943
|
const m = this.getEditorRootsValues();
|
|
933
|
-
P(m, u) ||
|
|
934
|
-
}),
|
|
944
|
+
P(m, u) || n.setData(u);
|
|
945
|
+
}), a.document.on("change:data", () => {
|
|
935
946
|
o = null;
|
|
936
947
|
}), s.on("change:isFocused", () => {
|
|
937
|
-
!s.isFocused && o !== null && (
|
|
948
|
+
!s.isFocused && o !== null && (n.setData(o), o = null);
|
|
938
949
|
});
|
|
939
950
|
}
|
|
940
951
|
/**
|
|
941
952
|
* Setups the content push event for the editor.
|
|
942
953
|
*/
|
|
943
954
|
setupTypingContentPush() {
|
|
944
|
-
const { model:
|
|
955
|
+
const { model: n } = this.editor, { $wire: a } = t, s = () => {
|
|
945
956
|
const o = this.getEditorRootsValues();
|
|
946
|
-
P(o, t.canonical.content ?? {}) || (
|
|
957
|
+
P(o, t.canonical.content ?? {}) || (a.set("content", o), a.dispatch("editor-content-changed", {
|
|
947
958
|
editorId: t.canonical.editorId,
|
|
948
959
|
content: o
|
|
949
960
|
}));
|
|
950
961
|
};
|
|
951
|
-
|
|
962
|
+
n.document.on("change:data", D(i, s)), this.editor.once("ready", s);
|
|
952
963
|
}
|
|
953
964
|
/**
|
|
954
965
|
* Setups the event push for the editor.
|
|
955
966
|
*/
|
|
956
967
|
setupFocusableEventPush() {
|
|
957
|
-
const { ui:
|
|
968
|
+
const { ui: n } = this.editor, { $wire: a } = t, s = () => {
|
|
958
969
|
const o = this.getEditorRootsValues();
|
|
959
|
-
|
|
970
|
+
a.set("focused", n.focusTracker.isFocused), P(o, t.canonical.content ?? {}) || a.set("content", o);
|
|
960
971
|
};
|
|
961
|
-
|
|
972
|
+
n.focusTracker.on("change:isFocused", s);
|
|
962
973
|
}
|
|
963
974
|
/**
|
|
964
975
|
* Gets the current values of all editor roots.
|
|
@@ -989,8 +1000,8 @@ async function ot(i) {
|
|
|
989
1000
|
* Initializes the plugin.
|
|
990
1001
|
*/
|
|
991
1002
|
afterInit() {
|
|
992
|
-
const { editor: r } = this,
|
|
993
|
-
this.input = document.getElementById(`${
|
|
1003
|
+
const { editor: r } = this, a = r.sourceElement.id.replace(/_editor$/, "");
|
|
1004
|
+
this.input = document.getElementById(`${a}_input`), this.input && (r.model.document.on("change:data", D(i, () => this.sync())), r.once("ready", this.sync), this.form = this.input.closest("form"), this.form?.addEventListener("submit", this.sync));
|
|
994
1005
|
}
|
|
995
1006
|
/**
|
|
996
1007
|
* Synchronizes the editor's content with the input field.
|
|
@@ -1009,7 +1020,7 @@ async function ot(i) {
|
|
|
1009
1020
|
}
|
|
1010
1021
|
};
|
|
1011
1022
|
}
|
|
1012
|
-
class ct extends
|
|
1023
|
+
class ct extends C {
|
|
1013
1024
|
/**
|
|
1014
1025
|
* The promise that resolves to the editor instance.
|
|
1015
1026
|
*/
|
|
@@ -1060,8 +1071,8 @@ class ct extends v {
|
|
|
1060
1071
|
preset: t,
|
|
1061
1072
|
editorId: e,
|
|
1062
1073
|
contextId: r,
|
|
1063
|
-
editableHeight:
|
|
1064
|
-
saveDebounceMs:
|
|
1074
|
+
editableHeight: n,
|
|
1075
|
+
saveDebounceMs: a,
|
|
1065
1076
|
language: s,
|
|
1066
1077
|
watchdog: o,
|
|
1067
1078
|
content: c
|
|
@@ -1080,44 +1091,44 @@ class ct extends v {
|
|
|
1080
1091
|
this.editorPromise = Promise.resolve(k), w.the.register(e, k);
|
|
1081
1092
|
});
|
|
1082
1093
|
}
|
|
1083
|
-
const { loadedPlugins: E, hasPremium: B } = await
|
|
1094
|
+
const { loadedPlugins: E, hasPremium: B } = await A(f);
|
|
1084
1095
|
E.push(
|
|
1085
1096
|
await st(
|
|
1086
1097
|
{
|
|
1087
|
-
saveDebounceMs:
|
|
1098
|
+
saveDebounceMs: a,
|
|
1088
1099
|
component: this
|
|
1089
1100
|
}
|
|
1090
1101
|
)
|
|
1091
|
-
),
|
|
1092
|
-
await ot(
|
|
1102
|
+
), v(m) && E.push(
|
|
1103
|
+
await ot(a)
|
|
1093
1104
|
);
|
|
1094
|
-
const
|
|
1095
|
-
...await
|
|
1096
|
-
|
|
1097
|
-
].filter((l) => !
|
|
1105
|
+
const $ = [
|
|
1106
|
+
...await V(s, B),
|
|
1107
|
+
j(u || {})
|
|
1108
|
+
].filter((l) => !W(l));
|
|
1098
1109
|
let b = {
|
|
1099
1110
|
...c,
|
|
1100
|
-
...
|
|
1111
|
+
...L(e)
|
|
1101
1112
|
};
|
|
1102
|
-
|
|
1113
|
+
v(m) && (b = b.main || "");
|
|
1103
1114
|
const M = await (async () => {
|
|
1104
|
-
let l =
|
|
1115
|
+
let l = F(e);
|
|
1105
1116
|
if (!(l instanceof HTMLElement) && !("main" in l)) {
|
|
1106
|
-
const
|
|
1107
|
-
N(l,
|
|
1117
|
+
const z = m === "decoupled" ? ["main"] : Object.keys(b);
|
|
1118
|
+
N(l, z) || (l = await ut(e, z), b = {
|
|
1108
1119
|
...c,
|
|
1109
|
-
...
|
|
1120
|
+
...L(e)
|
|
1110
1121
|
});
|
|
1111
1122
|
}
|
|
1112
|
-
|
|
1123
|
+
v(m) && "main" in l && (l = l.main);
|
|
1113
1124
|
const k = {
|
|
1114
1125
|
...T(d),
|
|
1115
1126
|
initialData: b,
|
|
1116
1127
|
licenseKey: h,
|
|
1117
1128
|
plugins: E,
|
|
1118
1129
|
language: s,
|
|
1119
|
-
|
|
1120
|
-
translations:
|
|
1130
|
+
...$.length && {
|
|
1131
|
+
translations: $
|
|
1121
1132
|
}
|
|
1122
1133
|
};
|
|
1123
1134
|
return !p || !(l instanceof HTMLElement) ? g.create(l, k) : (await Y({
|
|
@@ -1127,29 +1138,29 @@ class ct extends v {
|
|
|
1127
1138
|
config: k
|
|
1128
1139
|
})).editor;
|
|
1129
1140
|
})();
|
|
1130
|
-
return
|
|
1141
|
+
return v(m) && n && et(M, n), M;
|
|
1131
1142
|
}
|
|
1132
1143
|
}
|
|
1133
1144
|
function N(i, t) {
|
|
1134
1145
|
return t.every((e) => i[e]);
|
|
1135
1146
|
}
|
|
1136
|
-
async function ut(i, t
|
|
1137
|
-
return
|
|
1147
|
+
async function ut(i, t) {
|
|
1148
|
+
return G(
|
|
1138
1149
|
() => {
|
|
1139
|
-
const
|
|
1140
|
-
if (!N(
|
|
1150
|
+
const e = F(i);
|
|
1151
|
+
if (!N(e, t))
|
|
1141
1152
|
throw new Error(
|
|
1142
1153
|
`It looks like not all required root elements are present yet.
|
|
1143
1154
|
* If you want to wait for them, ensure they are registered before editor initialization.
|
|
1144
1155
|
* If you want lazy initialize roots, consider removing root values from the \`initialData\` config and assign initial data in editable components.
|
|
1145
|
-
Missing roots: ${
|
|
1156
|
+
Missing roots: ${t.filter((r) => !e[r]).join(", ")}.`
|
|
1146
1157
|
);
|
|
1147
|
-
return
|
|
1158
|
+
return e;
|
|
1148
1159
|
},
|
|
1149
1160
|
{ timeOutAfter: 2e3, retryAfter: 100 }
|
|
1150
|
-
)
|
|
1161
|
+
);
|
|
1151
1162
|
}
|
|
1152
|
-
class lt extends
|
|
1163
|
+
class lt extends C {
|
|
1153
1164
|
/**
|
|
1154
1165
|
* The promise that resolves when the UI part is mounted.
|
|
1155
1166
|
*/
|
|
@@ -1160,7 +1171,7 @@ class lt extends v {
|
|
|
1160
1171
|
async mounted() {
|
|
1161
1172
|
const { editorId: t, name: e } = this.canonical;
|
|
1162
1173
|
this.mountedPromise = w.the.execute(t, (r) => {
|
|
1163
|
-
const { ui:
|
|
1174
|
+
const { ui: n } = r, a = mt(e), s = n.view[a];
|
|
1164
1175
|
if (!s) {
|
|
1165
1176
|
console.error(`Unknown UI part name: "${e}". Supported names are "toolbar" and "menubar".`);
|
|
1166
1177
|
return;
|
|
@@ -1187,9 +1198,9 @@ function mt(i) {
|
|
|
1187
1198
|
}
|
|
1188
1199
|
const dt = {
|
|
1189
1200
|
ckeditor5: ct,
|
|
1190
|
-
"ckeditor5-context":
|
|
1201
|
+
"ckeditor5-context": nt,
|
|
1191
1202
|
"ckeditor5-ui-part": lt,
|
|
1192
|
-
"ckeditor5-editable":
|
|
1203
|
+
"ckeditor5-editable": at
|
|
1193
1204
|
};
|
|
1194
1205
|
function wt() {
|
|
1195
1206
|
for (const [i, t] of Object.entries(dt))
|