ckeditor5-livewire 1.3.0 → 1.3.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.
- package/dist/hooks/editable.d.ts.map +1 -1
- package/dist/hooks/hook.d.ts +14 -0
- package/dist/hooks/hook.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +145 -121
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/editable.ts +20 -5
- package/src/hooks/hook.ts +26 -0
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,17 @@ class P {
|
|
|
6
6
|
* The current state of the hook.
|
|
7
7
|
*/
|
|
8
8
|
state = "mounting";
|
|
9
|
+
/**
|
|
10
|
+
* Callbacks to run before the hook is destroyed.
|
|
11
|
+
*/
|
|
12
|
+
_beforeDestroyCallbacks = [];
|
|
13
|
+
/**
|
|
14
|
+
* Registers a callback to be called before the hook is destroyed.
|
|
15
|
+
* Callbacks are called in LIFO order (last registered, first called).
|
|
16
|
+
*/
|
|
17
|
+
onBeforeDestroy(t) {
|
|
18
|
+
this._beforeDestroyCallbacks.push(t);
|
|
19
|
+
}
|
|
9
20
|
/**
|
|
10
21
|
* The canonical snapshot of the Livewire component.
|
|
11
22
|
*/
|
|
@@ -30,15 +41,24 @@ class P {
|
|
|
30
41
|
isBeingDestroyed() {
|
|
31
42
|
return ["destroyed", "destroying"].includes(this.state);
|
|
32
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Runs all registered before-destroy callbacks and clears the list.
|
|
46
|
+
* Called internally by makeHook before destroyed().
|
|
47
|
+
*/
|
|
48
|
+
_runBeforeDestroyCallbacks() {
|
|
49
|
+
for (const t of this._beforeDestroyCallbacks.reverse())
|
|
50
|
+
t();
|
|
51
|
+
this._beforeDestroyCallbacks = [];
|
|
52
|
+
}
|
|
33
53
|
}
|
|
34
|
-
function
|
|
54
|
+
function U(i, t) {
|
|
35
55
|
const e = /* @__PURE__ */ new Map();
|
|
36
56
|
window.Livewire?.hook("component.init", async ({ component: r, cleanup: n }) => {
|
|
37
57
|
if (r.name !== i)
|
|
38
58
|
return;
|
|
39
59
|
const a = new t(r);
|
|
40
60
|
e.set(r.id, a), n(async () => {
|
|
41
|
-
a.state = "destroying", await a.destroyed(), a.state = "destroyed", e.delete(r.id);
|
|
61
|
+
a.state = "destroying", a._runBeforeDestroyCallbacks(), await a.destroyed(), a.state = "destroyed", e.delete(r.id);
|
|
42
62
|
}), await a.mounted(), a.state = "mounted";
|
|
43
63
|
}), window.Livewire?.hook("commit", async ({ component: r, succeed: n }) => {
|
|
44
64
|
r.name === i && n(() => {
|
|
@@ -75,11 +95,11 @@ class L {
|
|
|
75
95
|
*/
|
|
76
96
|
execute(t, e, r) {
|
|
77
97
|
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((
|
|
98
|
+
return a ? (r?.(a), Promise.reject(a)) : n ? Promise.resolve(e(n)) : new Promise((o, s) => {
|
|
79
99
|
const c = this.getPendingCallbacks(t);
|
|
80
100
|
c.success.push(async (u) => {
|
|
81
|
-
|
|
82
|
-
}), r ? c.error.push(r) : c.error.push(
|
|
101
|
+
o(await e(u));
|
|
102
|
+
}), r ? c.error.push(r) : c.error.push(s);
|
|
83
103
|
});
|
|
84
104
|
}
|
|
85
105
|
/**
|
|
@@ -213,7 +233,7 @@ class L {
|
|
|
213
233
|
this.items.size === 1 && t !== null && this.register(null, e);
|
|
214
234
|
}
|
|
215
235
|
}
|
|
216
|
-
function
|
|
236
|
+
function x(i, t) {
|
|
217
237
|
let e = null;
|
|
218
238
|
return (...r) => {
|
|
219
239
|
e && clearTimeout(e), e = setTimeout(() => {
|
|
@@ -252,21 +272,21 @@ function Y(i, {
|
|
|
252
272
|
} = {}) {
|
|
253
273
|
return new Promise((r, n) => {
|
|
254
274
|
const a = Date.now();
|
|
255
|
-
let
|
|
256
|
-
const
|
|
257
|
-
n(
|
|
275
|
+
let o = null;
|
|
276
|
+
const s = setTimeout(() => {
|
|
277
|
+
n(o ?? new Error("Timeout"));
|
|
258
278
|
}, t), c = async () => {
|
|
259
279
|
try {
|
|
260
280
|
const u = await i();
|
|
261
|
-
clearTimeout(
|
|
281
|
+
clearTimeout(s), r(u);
|
|
262
282
|
} catch (u) {
|
|
263
|
-
|
|
283
|
+
o = u, Date.now() - a > t ? n(u) : setTimeout(c, e);
|
|
264
284
|
}
|
|
265
285
|
};
|
|
266
286
|
c();
|
|
267
287
|
});
|
|
268
288
|
}
|
|
269
|
-
const
|
|
289
|
+
const D = Symbol.for("context-editor-watchdog");
|
|
270
290
|
async function X({ element: i, context: t, creator: e, config: r }) {
|
|
271
291
|
const n = G();
|
|
272
292
|
await t.add({
|
|
@@ -276,28 +296,28 @@ async function X({ element: i, context: t, creator: e, config: r }) {
|
|
|
276
296
|
type: "editor",
|
|
277
297
|
config: r
|
|
278
298
|
});
|
|
279
|
-
const a = t.getItem(n),
|
|
299
|
+
const a = t.getItem(n), o = {
|
|
280
300
|
state: "available",
|
|
281
301
|
editorContextId: n,
|
|
282
302
|
context: t
|
|
283
303
|
};
|
|
284
|
-
a[
|
|
285
|
-
const
|
|
286
|
-
return t.destroy = async () => (
|
|
287
|
-
...
|
|
304
|
+
a[D] = o;
|
|
305
|
+
const s = t.destroy.bind(t);
|
|
306
|
+
return t.destroy = async () => (o.state = "unavailable", s()), {
|
|
307
|
+
...o,
|
|
288
308
|
editor: a
|
|
289
309
|
};
|
|
290
310
|
}
|
|
291
311
|
function J(i) {
|
|
292
|
-
return
|
|
312
|
+
return D in i ? i[D] : null;
|
|
293
313
|
}
|
|
294
314
|
function Q(i) {
|
|
295
315
|
return i.model.document.getRootNames().reduce((e, r) => (e[r] = i.getData({ rootName: r }), e), /* @__PURE__ */ Object.create({}));
|
|
296
316
|
}
|
|
297
|
-
function
|
|
317
|
+
function k(i) {
|
|
298
318
|
return ["inline", "classic", "balloon", "decoupled"].includes(i);
|
|
299
319
|
}
|
|
300
|
-
function
|
|
320
|
+
function F(i) {
|
|
301
321
|
let t = i;
|
|
302
322
|
for (; t; ) {
|
|
303
323
|
for (const e of t.attributes)
|
|
@@ -379,25 +399,25 @@ class S {
|
|
|
379
399
|
return this.plugins.has(t);
|
|
380
400
|
}
|
|
381
401
|
}
|
|
382
|
-
async function
|
|
402
|
+
async function W(i) {
|
|
383
403
|
const t = await import("ckeditor5");
|
|
384
404
|
let e = null;
|
|
385
405
|
const r = i.map(async (n) => {
|
|
386
406
|
const a = await S.the.get(n);
|
|
387
407
|
if (a)
|
|
388
408
|
return a;
|
|
389
|
-
const { [n]:
|
|
390
|
-
if (
|
|
391
|
-
return
|
|
409
|
+
const { [n]: o } = t;
|
|
410
|
+
if (o)
|
|
411
|
+
return o;
|
|
392
412
|
if (!e)
|
|
393
413
|
try {
|
|
394
414
|
e = await import("ckeditor5-premium-features");
|
|
395
415
|
} catch (c) {
|
|
396
416
|
console.error(`Failed to load premium package: ${c}`);
|
|
397
417
|
}
|
|
398
|
-
const { [n]:
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
418
|
+
const { [n]: s } = e || {};
|
|
419
|
+
if (s)
|
|
420
|
+
return s;
|
|
401
421
|
throw new Error(`Plugin "${n}" not found in base or premium packages.`);
|
|
402
422
|
});
|
|
403
423
|
return {
|
|
@@ -723,23 +743,23 @@ async function tt(i, t) {
|
|
|
723
743
|
return console.error(`Failed to load translation for ${i}/${t}:`, e), null;
|
|
724
744
|
}
|
|
725
745
|
}
|
|
726
|
-
function
|
|
746
|
+
function B(i) {
|
|
727
747
|
return O(i, (t) => ({
|
|
728
748
|
dictionary: t
|
|
729
749
|
}));
|
|
730
750
|
}
|
|
731
|
-
function
|
|
732
|
-
const t =
|
|
751
|
+
function j(i) {
|
|
752
|
+
const t = N(i);
|
|
733
753
|
return O(t, ({ element: e }) => e);
|
|
734
754
|
}
|
|
735
|
-
function
|
|
736
|
-
const t = window.Livewire.all().filter(({ name:
|
|
737
|
-
...
|
|
738
|
-
[
|
|
755
|
+
function N(i) {
|
|
756
|
+
const t = window.Livewire.all().filter(({ name: o, canonical: s }) => o === "ckeditor5-editable" && s.editorId === i).reduce((o, { canonical: s, el: c }) => ({
|
|
757
|
+
...o,
|
|
758
|
+
[s.rootName]: {
|
|
739
759
|
element: c.querySelector("[data-cke-editable-content]"),
|
|
740
|
-
content:
|
|
760
|
+
content: s.content
|
|
741
761
|
}
|
|
742
|
-
}), /* @__PURE__ */ Object.create({})), r = window.Livewire.all().find(({ name:
|
|
762
|
+
}), /* @__PURE__ */ Object.create({})), r = window.Livewire.all().find(({ name: o, canonical: s }) => o === "ckeditor5" && s.editorId === i)?.canonical.content, n = document.querySelector(`#${i}_editor `), a = t.main;
|
|
743
763
|
return a && r?.main ? {
|
|
744
764
|
...t,
|
|
745
765
|
main: {
|
|
@@ -755,7 +775,7 @@ function q(i) {
|
|
|
755
775
|
} : t;
|
|
756
776
|
}
|
|
757
777
|
function z(i) {
|
|
758
|
-
const t =
|
|
778
|
+
const t = N(i), e = O(t, ({ content: r }) => r);
|
|
759
779
|
return K(e, (r) => typeof r == "string");
|
|
760
780
|
}
|
|
761
781
|
function I(i) {
|
|
@@ -779,12 +799,12 @@ function et(i, t) {
|
|
|
779
799
|
r.setStyle("height", `${t}px`, e.view.document.getRoot());
|
|
780
800
|
});
|
|
781
801
|
}
|
|
782
|
-
const
|
|
802
|
+
const T = Symbol.for("elixir-editor-watchdog");
|
|
783
803
|
async function rt(i) {
|
|
784
804
|
const { EditorWatchdog: t } = await import("ckeditor5"), e = new t(i);
|
|
785
805
|
return e.setCreator(async (...r) => {
|
|
786
806
|
const n = await i.create(...r);
|
|
787
|
-
return n[
|
|
807
|
+
return n[T] = e, n;
|
|
788
808
|
}), {
|
|
789
809
|
watchdog: e,
|
|
790
810
|
Constructor: {
|
|
@@ -793,10 +813,10 @@ async function rt(i) {
|
|
|
793
813
|
};
|
|
794
814
|
}
|
|
795
815
|
function it(i) {
|
|
796
|
-
return
|
|
816
|
+
return T in i ? i[T] : null;
|
|
797
817
|
}
|
|
798
|
-
class
|
|
799
|
-
static the = new
|
|
818
|
+
class p extends L {
|
|
819
|
+
static the = new p();
|
|
800
820
|
}
|
|
801
821
|
class nt extends P {
|
|
802
822
|
/**
|
|
@@ -807,28 +827,28 @@ class nt extends P {
|
|
|
807
827
|
* Mounts the context component.
|
|
808
828
|
*/
|
|
809
829
|
async mounted() {
|
|
810
|
-
const { contextId: t, language: e, context: r } = this.canonical, { customTranslations: n, watchdogConfig: a, config: { plugins:
|
|
830
|
+
const { contextId: t, language: e, context: r } = this.canonical, { customTranslations: n, watchdogConfig: a, config: { plugins: o, ...s } } = r, { loadedPlugins: c, hasPremium: u } = await W(o ?? []), C = [
|
|
811
831
|
...await V(e, u),
|
|
812
|
-
|
|
832
|
+
B(n || {})
|
|
813
833
|
].filter((f) => !A(f));
|
|
814
834
|
this.contextPromise = (async () => {
|
|
815
|
-
const { ContextWatchdog: f, Context:
|
|
835
|
+
const { ContextWatchdog: f, Context: w } = await import("ckeditor5"), h = new f(w, {
|
|
816
836
|
crashNumberLimit: 10,
|
|
817
837
|
...a
|
|
818
838
|
});
|
|
819
|
-
return await
|
|
820
|
-
...
|
|
839
|
+
return await h.create({
|
|
840
|
+
...s,
|
|
821
841
|
language: e,
|
|
822
842
|
plugins: c,
|
|
823
|
-
...
|
|
824
|
-
translations:
|
|
843
|
+
...C.length && {
|
|
844
|
+
translations: C
|
|
825
845
|
}
|
|
826
|
-
}),
|
|
846
|
+
}), h.on("itemError", (...g) => {
|
|
827
847
|
console.error("Context item error:", ...g);
|
|
828
|
-
}),
|
|
848
|
+
}), h;
|
|
829
849
|
})();
|
|
830
850
|
const v = await this.contextPromise;
|
|
831
|
-
this.isBeingDestroyed() ||
|
|
851
|
+
this.isBeingDestroyed() || p.the.register(t, v);
|
|
832
852
|
}
|
|
833
853
|
/**
|
|
834
854
|
* Destroys the context component. Unmounts root from the editor.
|
|
@@ -839,7 +859,7 @@ class nt extends P {
|
|
|
839
859
|
try {
|
|
840
860
|
await (await this.contextPromise)?.destroy();
|
|
841
861
|
} finally {
|
|
842
|
-
this.contextPromise = null,
|
|
862
|
+
this.contextPromise = null, p.the.hasItem(t) && p.the.unregister(t);
|
|
843
863
|
}
|
|
844
864
|
}
|
|
845
865
|
}
|
|
@@ -863,8 +883,8 @@ class at extends P {
|
|
|
863
883
|
this.editorPromise = m.the.execute(t, (n) => {
|
|
864
884
|
if (this.isBeingDestroyed())
|
|
865
885
|
return null;
|
|
866
|
-
const { ui: a, editing:
|
|
867
|
-
if (
|
|
886
|
+
const { ui: a, editing: o, model: s } = n;
|
|
887
|
+
if (s.document.getRoot(e)) {
|
|
868
888
|
if (r !== null) {
|
|
869
889
|
const c = n.getData({ rootName: e });
|
|
870
890
|
c && c !== r && n.setData({
|
|
@@ -879,7 +899,7 @@ class at extends P {
|
|
|
879
899
|
}
|
|
880
900
|
});
|
|
881
901
|
const c = this.element.querySelector("[data-cke-editable-content]"), u = a.view.createEditable(e, c);
|
|
882
|
-
a.addEditable(u),
|
|
902
|
+
a.addEditable(u), o.view.forceRender();
|
|
883
903
|
}
|
|
884
904
|
return this.syncTypingContentPush(n), this.setupPendingReceivedContentHandlers(n), n;
|
|
885
905
|
});
|
|
@@ -891,28 +911,32 @@ class at extends P {
|
|
|
891
911
|
const { rootName: e, saveDebounceMs: r } = this.canonical, n = this.element.querySelector("input"), a = () => {
|
|
892
912
|
const s = t.getData({ rootName: e });
|
|
893
913
|
n && (n.value = s), this.$wire.set("content", s);
|
|
894
|
-
};
|
|
895
|
-
t.model.document.on("change:data",
|
|
914
|
+
}, o = x(r, a);
|
|
915
|
+
t.model.document.on("change:data", o), a(), this.onBeforeDestroy(() => {
|
|
916
|
+
t.model.document.off("change:data", o);
|
|
917
|
+
});
|
|
896
918
|
}
|
|
897
919
|
/**
|
|
898
920
|
* Sets up handlers that manage pending incoming content (clears pending
|
|
899
921
|
* content on user edits and applies pending content on blur).
|
|
900
922
|
*/
|
|
901
923
|
setupPendingReceivedContentHandlers(t) {
|
|
902
|
-
const { ui: e, model: r } = t, {
|
|
903
|
-
r.document.on("change:data", () => {
|
|
924
|
+
const { ui: e, model: r } = t, { focusTracker: n } = e, { rootName: a } = this.canonical, o = () => {
|
|
904
925
|
this.pendingContent = null;
|
|
905
|
-
}
|
|
906
|
-
!
|
|
907
|
-
[
|
|
926
|
+
}, s = () => {
|
|
927
|
+
!n.isFocused && this.pendingContent !== null && (t.setData({
|
|
928
|
+
[a]: this.pendingContent
|
|
908
929
|
}), this.pendingContent = null);
|
|
930
|
+
};
|
|
931
|
+
r.document.on("change:data", o), n.on("change:isFocused", s), this.onBeforeDestroy(() => {
|
|
932
|
+
r.document.off("change:data", o), n.off("change:isFocused", s);
|
|
909
933
|
});
|
|
910
934
|
}
|
|
911
935
|
/**
|
|
912
936
|
* Applies canonical content to the editor while respecting focus/pending state.
|
|
913
937
|
*/
|
|
914
938
|
applyCanonicalContentToEditor(t) {
|
|
915
|
-
if (!
|
|
939
|
+
if (!F(this.element))
|
|
916
940
|
return;
|
|
917
941
|
const { content: e, rootName: r } = this.canonical, { ui: n } = t;
|
|
918
942
|
if (t.getData({ rootName: r }) !== (e ?? "")) {
|
|
@@ -943,7 +967,7 @@ class at extends P {
|
|
|
943
967
|
}
|
|
944
968
|
}
|
|
945
969
|
}
|
|
946
|
-
async function
|
|
970
|
+
async function ot({
|
|
947
971
|
saveDebounceMs: i,
|
|
948
972
|
component: t
|
|
949
973
|
}) {
|
|
@@ -967,21 +991,21 @@ async function st({
|
|
|
967
991
|
* disrupting the user while editing.
|
|
968
992
|
*/
|
|
969
993
|
setupAfterCommitHandler() {
|
|
970
|
-
const { editor: n } = this, { model: a, ui: { focusTracker:
|
|
971
|
-
let
|
|
994
|
+
const { editor: n } = this, { model: a, ui: { focusTracker: o } } = n;
|
|
995
|
+
let s = null;
|
|
972
996
|
n.on("afterCommitSynced", () => {
|
|
973
|
-
if (!
|
|
997
|
+
if (!F(t.element))
|
|
974
998
|
return;
|
|
975
999
|
const { content: c } = t.canonical, u = this.getEditorRootsValues();
|
|
976
|
-
if (
|
|
977
|
-
b(c, u) || (
|
|
1000
|
+
if (o.isFocused) {
|
|
1001
|
+
b(c, u) || (s = c);
|
|
978
1002
|
return;
|
|
979
1003
|
}
|
|
980
1004
|
b(c, u) || n.setData(c);
|
|
981
1005
|
}), a.document.on("change:data", () => {
|
|
982
|
-
|
|
983
|
-
}),
|
|
984
|
-
!
|
|
1006
|
+
s = null;
|
|
1007
|
+
}), o.on("change:isFocused", () => {
|
|
1008
|
+
!o.isFocused && s !== null && (n.setData(s), s = null);
|
|
985
1009
|
});
|
|
986
1010
|
}
|
|
987
1011
|
/**
|
|
@@ -991,32 +1015,32 @@ async function st({
|
|
|
991
1015
|
Livewire.on("set-editor-content", ({ editorId: n, content: a }) => {
|
|
992
1016
|
if (n !== t.canonical.editorId)
|
|
993
1017
|
return;
|
|
994
|
-
const
|
|
995
|
-
b(
|
|
1018
|
+
const o = this.getEditorRootsValues();
|
|
1019
|
+
b(o, a) || this.editor.setData(a);
|
|
996
1020
|
});
|
|
997
1021
|
}
|
|
998
1022
|
/**
|
|
999
1023
|
* Setups the content push event for the editor.
|
|
1000
1024
|
*/
|
|
1001
1025
|
setupTypingContentPush() {
|
|
1002
|
-
const { model: n } = this.editor, { $wire: a } = t,
|
|
1003
|
-
const
|
|
1004
|
-
b(
|
|
1026
|
+
const { model: n } = this.editor, { $wire: a } = t, o = () => {
|
|
1027
|
+
const s = this.getEditorRootsValues();
|
|
1028
|
+
b(s, t.canonical.content ?? {}) || (a.set("content", s), a.dispatch("editor-content-changed", {
|
|
1005
1029
|
editorId: t.canonical.editorId,
|
|
1006
|
-
content:
|
|
1030
|
+
content: s
|
|
1007
1031
|
}));
|
|
1008
1032
|
};
|
|
1009
|
-
n.document.on("change:data",
|
|
1033
|
+
n.document.on("change:data", x(i, o)), this.editor.once("ready", o);
|
|
1010
1034
|
}
|
|
1011
1035
|
/**
|
|
1012
1036
|
* Setups the event push for the editor.
|
|
1013
1037
|
*/
|
|
1014
1038
|
setupFocusableEventPush() {
|
|
1015
|
-
const { ui: n } = this.editor, { $wire: a } = t,
|
|
1016
|
-
const
|
|
1017
|
-
a.set("focused", n.focusTracker.isFocused), b(
|
|
1039
|
+
const { ui: n } = this.editor, { $wire: a } = t, o = () => {
|
|
1040
|
+
const s = this.getEditorRootsValues();
|
|
1041
|
+
a.set("focused", n.focusTracker.isFocused), b(s, t.canonical.content ?? {}) || a.set("content", s);
|
|
1018
1042
|
};
|
|
1019
|
-
n.focusTracker.on("change:isFocused",
|
|
1043
|
+
n.focusTracker.on("change:isFocused", o);
|
|
1020
1044
|
}
|
|
1021
1045
|
/**
|
|
1022
1046
|
* Gets the current values of all editor roots.
|
|
@@ -1026,7 +1050,7 @@ async function st({
|
|
|
1026
1050
|
}
|
|
1027
1051
|
};
|
|
1028
1052
|
}
|
|
1029
|
-
async function
|
|
1053
|
+
async function st(i) {
|
|
1030
1054
|
const { Plugin: t } = await import("ckeditor5");
|
|
1031
1055
|
return class extends t {
|
|
1032
1056
|
/**
|
|
@@ -1048,7 +1072,7 @@ async function ot(i) {
|
|
|
1048
1072
|
*/
|
|
1049
1073
|
afterInit() {
|
|
1050
1074
|
const { editor: r } = this, a = r.sourceElement.id.replace(/_editor$/, "");
|
|
1051
|
-
this.input = document.getElementById(`${a}_input`), this.input && (r.model.document.on("change:data",
|
|
1075
|
+
this.input = document.getElementById(`${a}_input`), this.input && (r.model.document.on("change:data", x(i, () => this.sync())), r.once("ready", this.sync), this.form = this.input.closest("form"), this.form?.addEventListener("submit", this.sync));
|
|
1052
1076
|
}
|
|
1053
1077
|
/**
|
|
1054
1078
|
* Synchronizes the editor's content with the input field.
|
|
@@ -1120,82 +1144,82 @@ class ct extends P {
|
|
|
1120
1144
|
contextId: r,
|
|
1121
1145
|
editableHeight: n,
|
|
1122
1146
|
saveDebounceMs: a,
|
|
1123
|
-
language:
|
|
1124
|
-
watchdog:
|
|
1147
|
+
language: o,
|
|
1148
|
+
watchdog: s,
|
|
1125
1149
|
content: c
|
|
1126
1150
|
} = this.canonical, {
|
|
1127
1151
|
customTranslations: u,
|
|
1128
1152
|
editorType: d,
|
|
1129
|
-
licenseKey:
|
|
1153
|
+
licenseKey: C,
|
|
1130
1154
|
config: { plugins: v, ...f }
|
|
1131
1155
|
} = t;
|
|
1132
|
-
let
|
|
1133
|
-
const
|
|
1134
|
-
if (
|
|
1135
|
-
const l = await rt(
|
|
1136
|
-
({ Constructor:
|
|
1156
|
+
let w = await Z(d);
|
|
1157
|
+
const h = await (r ? p.the.waitFor(r) : null);
|
|
1158
|
+
if (s && !h) {
|
|
1159
|
+
const l = await rt(w);
|
|
1160
|
+
({ Constructor: w } = l), l.watchdog.on("restart", () => {
|
|
1137
1161
|
const E = l.watchdog.editor;
|
|
1138
1162
|
this.editorPromise = Promise.resolve(E), m.the.register(e, E);
|
|
1139
1163
|
});
|
|
1140
1164
|
}
|
|
1141
|
-
const { loadedPlugins: g, hasPremium:
|
|
1165
|
+
const { loadedPlugins: g, hasPremium: _ } = await W(v);
|
|
1142
1166
|
g.push(
|
|
1143
|
-
await
|
|
1167
|
+
await ot(
|
|
1144
1168
|
{
|
|
1145
1169
|
saveDebounceMs: a,
|
|
1146
1170
|
component: this
|
|
1147
1171
|
}
|
|
1148
1172
|
)
|
|
1149
|
-
),
|
|
1150
|
-
await
|
|
1173
|
+
), k(d) && g.push(
|
|
1174
|
+
await st(a)
|
|
1151
1175
|
);
|
|
1152
1176
|
const $ = [
|
|
1153
|
-
...await V(
|
|
1154
|
-
|
|
1177
|
+
...await V(o, _),
|
|
1178
|
+
B(u || {})
|
|
1155
1179
|
].filter((l) => !A(l));
|
|
1156
1180
|
let y = {
|
|
1157
1181
|
...c,
|
|
1158
1182
|
...z(e)
|
|
1159
1183
|
};
|
|
1160
|
-
|
|
1184
|
+
k(d) && (y = y.main || "");
|
|
1161
1185
|
const H = await (async () => {
|
|
1162
|
-
let l =
|
|
1186
|
+
let l = j(e);
|
|
1163
1187
|
if (!(l instanceof HTMLElement) && !("main" in l)) {
|
|
1164
1188
|
const M = d === "decoupled" ? ["main"] : Object.keys(y);
|
|
1165
|
-
|
|
1189
|
+
q(l, M) || (l = await ut(e, M), y = {
|
|
1166
1190
|
...c,
|
|
1167
1191
|
...z(e)
|
|
1168
1192
|
});
|
|
1169
1193
|
}
|
|
1170
|
-
|
|
1194
|
+
k(d) && "main" in l && (l = l.main);
|
|
1171
1195
|
const E = {
|
|
1172
1196
|
...I(f),
|
|
1173
1197
|
initialData: y,
|
|
1174
|
-
licenseKey:
|
|
1198
|
+
licenseKey: C,
|
|
1175
1199
|
plugins: g,
|
|
1176
|
-
language:
|
|
1200
|
+
language: o,
|
|
1177
1201
|
...$.length && {
|
|
1178
1202
|
translations: $
|
|
1179
1203
|
}
|
|
1180
1204
|
};
|
|
1181
|
-
return !
|
|
1182
|
-
context:
|
|
1205
|
+
return !h || !(l instanceof HTMLElement) ? w.create(l, E) : (await X({
|
|
1206
|
+
context: h,
|
|
1183
1207
|
element: l,
|
|
1184
|
-
creator:
|
|
1208
|
+
creator: w,
|
|
1185
1209
|
config: E
|
|
1186
1210
|
})).editor;
|
|
1187
1211
|
})();
|
|
1188
|
-
return
|
|
1212
|
+
return k(d) && n && et(H, n), H;
|
|
1189
1213
|
}
|
|
1190
1214
|
}
|
|
1191
|
-
function
|
|
1215
|
+
function q(i, t) {
|
|
1192
1216
|
return t.every((e) => i[e]);
|
|
1193
1217
|
}
|
|
1194
1218
|
async function ut(i, t) {
|
|
1195
1219
|
return Y(
|
|
1196
1220
|
() => {
|
|
1197
|
-
const e =
|
|
1198
|
-
if (!
|
|
1221
|
+
const e = j(i);
|
|
1222
|
+
if (!q(e, t))
|
|
1199
1223
|
throw new Error(
|
|
1200
1224
|
`It looks like not all required root elements are present yet.
|
|
1201
1225
|
* If you want to wait for them, ensure they are registered before editor initialization.
|
|
@@ -1220,12 +1244,12 @@ class lt extends P {
|
|
|
1220
1244
|
this.mountedPromise = m.the.execute(t, (r) => {
|
|
1221
1245
|
if (this.isBeingDestroyed())
|
|
1222
1246
|
return;
|
|
1223
|
-
const { ui: n } = r, a = mt(e),
|
|
1224
|
-
if (!
|
|
1247
|
+
const { ui: n } = r, a = mt(e), o = n.view[a];
|
|
1248
|
+
if (!o) {
|
|
1225
1249
|
console.error(`Unknown UI part name: "${e}". Supported names are "toolbar" and "menubar".`);
|
|
1226
1250
|
return;
|
|
1227
1251
|
}
|
|
1228
|
-
this.element.appendChild(
|
|
1252
|
+
this.element.appendChild(o.element);
|
|
1229
1253
|
});
|
|
1230
1254
|
}
|
|
1231
1255
|
/**
|
|
@@ -1251,19 +1275,19 @@ const dt = {
|
|
|
1251
1275
|
"ckeditor5-ui-part": lt,
|
|
1252
1276
|
"ckeditor5-editable": at
|
|
1253
1277
|
};
|
|
1254
|
-
function
|
|
1278
|
+
function ht() {
|
|
1255
1279
|
for (const [i, t] of Object.entries(dt))
|
|
1256
|
-
|
|
1280
|
+
U(i, t);
|
|
1257
1281
|
}
|
|
1258
|
-
|
|
1282
|
+
ht();
|
|
1259
1283
|
export {
|
|
1260
1284
|
P as ClassHook,
|
|
1261
|
-
|
|
1285
|
+
p as ContextsRegistry,
|
|
1262
1286
|
S as CustomEditorPluginsRegistry,
|
|
1263
1287
|
at as EditableComponentHook,
|
|
1264
1288
|
ct as EditorComponentHook,
|
|
1265
1289
|
m as EditorsRegistry,
|
|
1266
1290
|
lt as UIPartComponentHook,
|
|
1267
|
-
|
|
1291
|
+
U as registerLivewireComponentHook
|
|
1268
1292
|
};
|
|
1269
1293
|
//# sourceMappingURL=index.mjs.map
|