ckeditor5-livewire 1.7.0 → 1.8.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/bundler/vite-ckeditor5-externalize.ts +15 -4
- package/dist/bundler/vite-ckeditor5-externalize.cjs +2 -2
- package/dist/bundler/vite-ckeditor5-externalize.cjs.map +1 -1
- package/dist/bundler/vite-ckeditor5-externalize.d.ts.map +1 -1
- package/dist/bundler/vite-ckeditor5-externalize.mjs +37 -37
- package/dist/bundler/vite-ckeditor5-externalize.mjs.map +1 -1
- package/dist/hooks/context/context.d.ts.map +1 -1
- package/dist/hooks/editable.d.ts.map +1 -1
- package/dist/hooks/editor/editor.d.ts.map +1 -1
- package/dist/hooks/editor/plugins/livewire-sync.d.ts.map +1 -1
- package/dist/hooks/editor/plugins/sync-editor-with-input.d.ts.map +1 -1
- package/dist/hooks/editor/utils/load-editor-translations.d.ts.map +1 -1
- package/dist/hooks/hook.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +883 -1328
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
- package/src/hooks/context/context.ts +1 -0
- package/src/hooks/editable.ts +2 -1
- package/src/hooks/editor/editor.test.ts +9 -9
- package/src/hooks/editor/editor.ts +2 -0
- package/src/hooks/editor/plugins/livewire-sync.ts +2 -0
- package/src/hooks/editor/plugins/sync-editor-with-input.ts +1 -0
- package/src/hooks/editor/utils/load-editor-plugins.ts +2 -2
- package/src/hooks/editor/utils/load-editor-translations.ts +16 -12
- package/src/hooks/hook.ts +1 -0
- package/src/hooks/ui-part.ts +1 -1
|
@@ -21,15 +21,26 @@ export function viteCKEditorExternalize(): Plugin {
|
|
|
21
21
|
'ckeditor5-livewire',
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
config.build.rollupOptions ??= {};
|
|
26
|
-
config.build.rollupOptions.external = [
|
|
27
|
-
...((config.build.rollupOptions.external as any[]) || []),
|
|
24
|
+
const externalize = [
|
|
28
25
|
'ckeditor5',
|
|
29
26
|
'ckeditor5-premium-features',
|
|
30
27
|
/^ckeditor5\/.*/,
|
|
31
28
|
/^ckeditor5-premium-features\/.*/,
|
|
32
29
|
];
|
|
30
|
+
|
|
31
|
+
config.build ??= {};
|
|
32
|
+
config.build.rollupOptions ??= {};
|
|
33
|
+
config.build.rollupOptions.external = [
|
|
34
|
+
...((config.build.rollupOptions.external as any[]) || []),
|
|
35
|
+
...externalize,
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
config.build.rolldownOptions ??= {};
|
|
39
|
+
config.build.rolldownOptions.external ??= [];
|
|
40
|
+
config.build.rolldownOptions.external = [
|
|
41
|
+
...((config.build.rolldownOptions.external as any[]) || []),
|
|
42
|
+
...externalize,
|
|
43
|
+
];
|
|
33
44
|
},
|
|
34
45
|
configResolved: (resolvedConfig) => {
|
|
35
46
|
(resolvedConfig.plugins as any).push({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=vite-ckeditor5-externalize.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(){return{name:`ckeditor5-externalize`,enforce:`pre`,config:e=>{if(e.optimizeDeps?.exclude&&!Array.isArray(e.optimizeDeps.exclude))throw Error(`ckeditor5-externalize: config.optimizeDeps.exclude is not an array`);if(e.build?.rollupOptions?.external&&!Array.isArray(e.build.rollupOptions.external))throw Error(`ckeditor5-externalize: config.build.rollupOptions.external is not an array`);e.optimizeDeps??={},e.optimizeDeps.exclude=[...e.optimizeDeps.exclude||[],`ckeditor5`,`ckeditor5-premium-features`,`ckeditor5-livewire`];let t=[`ckeditor5`,`ckeditor5-premium-features`,/^ckeditor5\/.*/,/^ckeditor5-premium-features\/.*/];e.build??={},e.build.rollupOptions??={},e.build.rollupOptions.external=[...e.build.rollupOptions.external||[],...t],e.build.rolldownOptions??={},e.build.rolldownOptions.external??=[],e.build.rolldownOptions.external=[...e.build.rolldownOptions.external||[],...t]},configResolved:e=>{e.plugins.push({name:`remove-id-prefix`,transform:e=>typeof e==`string`?e.replace(/\/@id\/ckeditor5/g,`ckeditor5`):null})},resolveId:e=>e===`ckeditor5`||e===`ckeditor5-premium-features`||e.startsWith(`ckeditor5/`)||e.startsWith(`ckeditor5-premium-features/`)?{id:e,external:!0}:null}}exports.viteCKEditorExternalize=e;
|
|
2
|
+
//# sourceMappingURL=vite-ckeditor5-externalize.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-ckeditor5-externalize.cjs","sources":["../../bundler/vite-ckeditor5-externalize.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nexport function viteCKEditorExternalize(): Plugin {\n return {\n name: 'ckeditor5-externalize',\n enforce: 'pre',\n config: (config) => {\n if (config.optimizeDeps?.exclude && !Array.isArray(config.optimizeDeps.exclude)) {\n throw new Error('ckeditor5-externalize: config.optimizeDeps.exclude is not an array');\n }\n\n if (config.build?.rollupOptions?.external && !Array.isArray(config.build.rollupOptions.external)) {\n throw new Error('ckeditor5-externalize: config.build.rollupOptions.external is not an array');\n }\n\n config.optimizeDeps ??= {};\n config.optimizeDeps.exclude = [\n ...((config.optimizeDeps.exclude as string[]) || []),\n 'ckeditor5',\n 'ckeditor5-premium-features',\n 'ckeditor5-livewire',\n ];\n\n config.build ??= {};\n config.build.rollupOptions ??= {};\n config.build.rollupOptions.external = [\n ...((config.build.rollupOptions.external as any[]) || []),\n
|
|
1
|
+
{"version":3,"file":"vite-ckeditor5-externalize.cjs","names":[],"sources":["../../bundler/vite-ckeditor5-externalize.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nexport function viteCKEditorExternalize(): Plugin {\n return {\n name: 'ckeditor5-externalize',\n enforce: 'pre',\n config: (config) => {\n if (config.optimizeDeps?.exclude && !Array.isArray(config.optimizeDeps.exclude)) {\n throw new Error('ckeditor5-externalize: config.optimizeDeps.exclude is not an array');\n }\n\n if (config.build?.rollupOptions?.external && !Array.isArray(config.build.rollupOptions.external)) {\n throw new Error('ckeditor5-externalize: config.build.rollupOptions.external is not an array');\n }\n\n config.optimizeDeps ??= {};\n config.optimizeDeps.exclude = [\n ...((config.optimizeDeps.exclude as string[]) || []),\n 'ckeditor5',\n 'ckeditor5-premium-features',\n 'ckeditor5-livewire',\n ];\n\n const externalize = [\n 'ckeditor5',\n 'ckeditor5-premium-features',\n /^ckeditor5\\/.*/,\n /^ckeditor5-premium-features\\/.*/,\n ];\n\n config.build ??= {};\n config.build.rollupOptions ??= {};\n config.build.rollupOptions.external = [\n ...((config.build.rollupOptions.external as any[]) || []),\n ...externalize,\n ];\n\n config.build.rolldownOptions ??= {};\n config.build.rolldownOptions.external ??= [];\n config.build.rolldownOptions.external = [\n ...((config.build.rolldownOptions.external as any[]) || []),\n ...externalize,\n ];\n },\n configResolved: (resolvedConfig) => {\n (resolvedConfig.plugins as any).push({\n name: 'remove-id-prefix',\n transform: (code: string) => {\n if (typeof code === 'string') {\n return code.replace(/\\/@id\\/ckeditor5/g, 'ckeditor5');\n }\n return null;\n },\n });\n },\n resolveId: (id) => {\n if (\n id === 'ckeditor5'\n || id === 'ckeditor5-premium-features'\n || id.startsWith('ckeditor5/')\n || id.startsWith('ckeditor5-premium-features/')\n ) {\n return {\n id,\n external: true,\n };\n }\n return null;\n },\n };\n}\n"],"mappings":"mEAEA,SAAgB,GAAkC,CAChD,MAAO,CACL,KAAM,wBACN,QAAS,MACT,OAAS,GAAW,CAClB,GAAI,EAAO,cAAc,SAAW,CAAC,MAAM,QAAQ,EAAO,aAAa,QAAQ,CAC7E,MAAU,MAAM,qEAAqE,CAGvF,GAAI,EAAO,OAAO,eAAe,UAAY,CAAC,MAAM,QAAQ,EAAO,MAAM,cAAc,SAAS,CAC9F,MAAU,MAAM,6EAA6E,CAG/F,EAAO,eAAiB,EAAE,CAC1B,EAAO,aAAa,QAAU,CAC5B,GAAK,EAAO,aAAa,SAAwB,EAAE,CACnD,YACA,6BACA,qBACD,CAED,IAAM,EAAc,CAClB,YACA,6BACA,iBACA,kCACD,CAED,EAAO,QAAU,EAAE,CACnB,EAAO,MAAM,gBAAkB,EAAE,CACjC,EAAO,MAAM,cAAc,SAAW,CACpC,GAAK,EAAO,MAAM,cAAc,UAAsB,EAAE,CACxD,GAAG,EACJ,CAED,EAAO,MAAM,kBAAoB,EAAE,CACnC,EAAO,MAAM,gBAAgB,WAAa,EAAE,CAC5C,EAAO,MAAM,gBAAgB,SAAW,CACtC,GAAK,EAAO,MAAM,gBAAgB,UAAsB,EAAE,CAC1D,GAAG,EACJ,EAEH,eAAiB,GAAmB,CACjC,EAAe,QAAgB,KAAK,CACnC,KAAM,mBACN,UAAY,GACN,OAAO,GAAS,SACX,EAAK,QAAQ,oBAAqB,YAAY,CAEhD,KAEV,CAAC,EAEJ,UAAY,GAER,IAAO,aACJ,IAAO,8BACP,EAAG,WAAW,aAAa,EAC3B,EAAG,WAAW,8BAA8B,CAExC,CACL,KACA,SAAU,GACX,CAEI,KAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-ckeditor5-externalize.d.ts","sourceRoot":"","sources":["../../bundler/vite-ckeditor5-externalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,wBAAgB,uBAAuB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-ckeditor5-externalize.d.ts","sourceRoot":"","sources":["../../bundler/vite-ckeditor5-externalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,wBAAgB,uBAAuB,IAAI,MAAM,CAoEhD"}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
//#region bundler/vite-ckeditor5-externalize.ts
|
|
2
|
+
function e() {
|
|
3
|
+
return {
|
|
4
|
+
name: "ckeditor5-externalize",
|
|
5
|
+
enforce: "pre",
|
|
6
|
+
config: (e) => {
|
|
7
|
+
if (e.optimizeDeps?.exclude && !Array.isArray(e.optimizeDeps.exclude)) throw Error("ckeditor5-externalize: config.optimizeDeps.exclude is not an array");
|
|
8
|
+
if (e.build?.rollupOptions?.external && !Array.isArray(e.build.rollupOptions.external)) throw Error("ckeditor5-externalize: config.build.rollupOptions.external is not an array");
|
|
9
|
+
e.optimizeDeps ??= {}, e.optimizeDeps.exclude = [
|
|
10
|
+
...e.optimizeDeps.exclude || [],
|
|
11
|
+
"ckeditor5",
|
|
12
|
+
"ckeditor5-premium-features",
|
|
13
|
+
"ckeditor5-livewire"
|
|
14
|
+
];
|
|
15
|
+
let t = [
|
|
16
|
+
"ckeditor5",
|
|
17
|
+
"ckeditor5-premium-features",
|
|
18
|
+
/^ckeditor5\/.*/,
|
|
19
|
+
/^ckeditor5-premium-features\/.*/
|
|
20
|
+
];
|
|
21
|
+
e.build ??= {}, e.build.rollupOptions ??= {}, e.build.rollupOptions.external = [...e.build.rollupOptions.external || [], ...t], e.build.rolldownOptions ??= {}, e.build.rolldownOptions.external ??= [], e.build.rolldownOptions.external = [...e.build.rolldownOptions.external || [], ...t];
|
|
22
|
+
},
|
|
23
|
+
configResolved: (e) => {
|
|
24
|
+
e.plugins.push({
|
|
25
|
+
name: "remove-id-prefix",
|
|
26
|
+
transform: (e) => typeof e == "string" ? e.replace(/\/@id\/ckeditor5/g, "ckeditor5") : null
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
resolveId: (e) => e === "ckeditor5" || e === "ckeditor5-premium-features" || e.startsWith("ckeditor5/") || e.startsWith("ckeditor5-premium-features/") ? {
|
|
30
|
+
id: e,
|
|
31
|
+
external: !0
|
|
32
|
+
} : null
|
|
33
|
+
};
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=vite-ckeditor5-externalize.mjs.map
|
|
35
|
+
//#endregion
|
|
36
|
+
export { e as viteCKEditorExternalize };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=vite-ckeditor5-externalize.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-ckeditor5-externalize.mjs","sources":["../../bundler/vite-ckeditor5-externalize.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nexport function viteCKEditorExternalize(): Plugin {\n return {\n name: 'ckeditor5-externalize',\n enforce: 'pre',\n config: (config) => {\n if (config.optimizeDeps?.exclude && !Array.isArray(config.optimizeDeps.exclude)) {\n throw new Error('ckeditor5-externalize: config.optimizeDeps.exclude is not an array');\n }\n\n if (config.build?.rollupOptions?.external && !Array.isArray(config.build.rollupOptions.external)) {\n throw new Error('ckeditor5-externalize: config.build.rollupOptions.external is not an array');\n }\n\n config.optimizeDeps ??= {};\n config.optimizeDeps.exclude = [\n ...((config.optimizeDeps.exclude as string[]) || []),\n 'ckeditor5',\n 'ckeditor5-premium-features',\n 'ckeditor5-livewire',\n ];\n\n config.build ??= {};\n config.build.rollupOptions ??= {};\n config.build.rollupOptions.external = [\n ...((config.build.rollupOptions.external as any[]) || []),\n
|
|
1
|
+
{"version":3,"file":"vite-ckeditor5-externalize.mjs","names":[],"sources":["../../bundler/vite-ckeditor5-externalize.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nexport function viteCKEditorExternalize(): Plugin {\n return {\n name: 'ckeditor5-externalize',\n enforce: 'pre',\n config: (config) => {\n if (config.optimizeDeps?.exclude && !Array.isArray(config.optimizeDeps.exclude)) {\n throw new Error('ckeditor5-externalize: config.optimizeDeps.exclude is not an array');\n }\n\n if (config.build?.rollupOptions?.external && !Array.isArray(config.build.rollupOptions.external)) {\n throw new Error('ckeditor5-externalize: config.build.rollupOptions.external is not an array');\n }\n\n config.optimizeDeps ??= {};\n config.optimizeDeps.exclude = [\n ...((config.optimizeDeps.exclude as string[]) || []),\n 'ckeditor5',\n 'ckeditor5-premium-features',\n 'ckeditor5-livewire',\n ];\n\n const externalize = [\n 'ckeditor5',\n 'ckeditor5-premium-features',\n /^ckeditor5\\/.*/,\n /^ckeditor5-premium-features\\/.*/,\n ];\n\n config.build ??= {};\n config.build.rollupOptions ??= {};\n config.build.rollupOptions.external = [\n ...((config.build.rollupOptions.external as any[]) || []),\n ...externalize,\n ];\n\n config.build.rolldownOptions ??= {};\n config.build.rolldownOptions.external ??= [];\n config.build.rolldownOptions.external = [\n ...((config.build.rolldownOptions.external as any[]) || []),\n ...externalize,\n ];\n },\n configResolved: (resolvedConfig) => {\n (resolvedConfig.plugins as any).push({\n name: 'remove-id-prefix',\n transform: (code: string) => {\n if (typeof code === 'string') {\n return code.replace(/\\/@id\\/ckeditor5/g, 'ckeditor5');\n }\n return null;\n },\n });\n },\n resolveId: (id) => {\n if (\n id === 'ckeditor5'\n || id === 'ckeditor5-premium-features'\n || id.startsWith('ckeditor5/')\n || id.startsWith('ckeditor5-premium-features/')\n ) {\n return {\n id,\n external: true,\n };\n }\n return null;\n },\n };\n}\n"],"mappings":";AAEA,SAAgB,IAAkC;AAChD,QAAO;EACL,MAAM;EACN,SAAS;EACT,SAAS,MAAW;AAClB,OAAI,EAAO,cAAc,WAAW,CAAC,MAAM,QAAQ,EAAO,aAAa,QAAQ,CAC7E,OAAU,MAAM,qEAAqE;AAGvF,OAAI,EAAO,OAAO,eAAe,YAAY,CAAC,MAAM,QAAQ,EAAO,MAAM,cAAc,SAAS,CAC9F,OAAU,MAAM,6EAA6E;AAI/F,GADA,EAAO,iBAAiB,EAAE,EAC1B,EAAO,aAAa,UAAU;IAC5B,GAAK,EAAO,aAAa,WAAwB,EAAE;IACnD;IACA;IACA;IACD;GAED,IAAM,IAAc;IAClB;IACA;IACA;IACA;IACD;AAWD,GATA,EAAO,UAAU,EAAE,EACnB,EAAO,MAAM,kBAAkB,EAAE,EACjC,EAAO,MAAM,cAAc,WAAW,CACpC,GAAK,EAAO,MAAM,cAAc,YAAsB,EAAE,EACxD,GAAG,EACJ,EAED,EAAO,MAAM,oBAAoB,EAAE,EACnC,EAAO,MAAM,gBAAgB,aAAa,EAAE,EAC5C,EAAO,MAAM,gBAAgB,WAAW,CACtC,GAAK,EAAO,MAAM,gBAAgB,YAAsB,EAAE,EAC1D,GAAG,EACJ;;EAEH,iBAAiB,MAAmB;AACjC,KAAe,QAAgB,KAAK;IACnC,MAAM;IACN,YAAY,MACN,OAAO,KAAS,WACX,EAAK,QAAQ,qBAAqB,YAAY,GAEhD;IAEV,CAAC;;EAEJ,YAAY,MAER,MAAO,eACJ,MAAO,gCACP,EAAG,WAAW,aAAa,IAC3B,EAAG,WAAW,8BAA8B,GAExC;GACL;GACA,UAAU;GACX,GAEI;EAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/hooks/context/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAW7C;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS,CAAC,QAAQ,CAAC;IAC3D;;OAEG;IACH,OAAO,CAAC,cAAc,CAAkD;IAExE;;OAEG;IACY,OAAO;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/hooks/context/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAW7C;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS,CAAC,QAAQ,CAAC;IAC3D;;OAEG;IACH,OAAO,CAAC,cAAc,CAAkD;IAExE;;OAEG;IACY,OAAO;IAqDtB;;OAEG;IACY,SAAS;CAoBzB;AAED;;GAEG;AACH,KAAK,QAAQ,GAAG;IACd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../src/hooks/editable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,SAAS,CAAC,QAAQ,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgD;IAErE;;OAEG;IACH,OAAO,CAAC,cAAc,CAAuB;IAE7C;;OAEG;IACM,OAAO;IAgDhB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAwB7B;;;OAGG;IACH,OAAO,CAAC,mCAAmC;IA4B3C;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAsBrC;;OAEG;IACY,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMjD;;OAEG;IACY,SAAS;
|
|
1
|
+
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../src/hooks/editable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,SAAS,CAAC,QAAQ,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgD;IAErE;;OAEG;IACH,OAAO,CAAC,cAAc,CAAuB;IAE7C;;OAEG;IACM,OAAO;IAgDhB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAwB7B;;;OAGG;IACH,OAAO,CAAC,mCAAmC;IA4B3C;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAsBrC;;OAEG;IACY,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMjD;;OAEG;IACY,SAAS;CAqBzB;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/editor/editor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKxE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAuBpC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,QAAQ,CAAC;IAC1D;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgC;IAErD;;OAEG;IACY,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/editor/editor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKxE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAuBpC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,QAAQ,CAAC;IAC1D;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgC;IAErD;;OAEG;IACY,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+BvC;;;OAGG;IACY,SAAS;IAkCxB;;OAEG;IACY,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMjD;;OAEG;YACW,YAAY;CA8I3B;AA4CD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC;IAErB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"livewire-sync.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/editor/plugins/livewire-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAKrD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,EACE,cAAc,EACd,SAAS,GACV,EAAE,KAAK,GACP,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"livewire-sync.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/editor/plugins/livewire-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAKrD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,EACE,cAAc,EACd,SAAS,GACV,EAAE,KAAK,GACP,OAAO,CAAC,iBAAiB,CAAC,CA+J5B;AAUD;;GAEG;AACH,KAAK,KAAK,GAAG;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,mBAAmB,CAAC;CAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-editor-with-input.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/editor/plugins/sync-editor-with-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAIlE;;GAEG;AACH,wBAAsB,+BAA+B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"sync-editor-with-input.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/editor/plugins/sync-editor-with-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAIlE;;GAEG;AACH,wBAAsB,+BAA+B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuExG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-editor-translations.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/editor/utils/load-editor-translations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;CAAE,EAC1C,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,YAAY,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"load-editor-translations.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/editor/utils/load-editor-translations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;CAAE,EAC1C,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,YAAY,EAAE,CAAC,CAiBzB"}
|
package/dist/hooks/hook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/hooks/hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYtE;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,iBAAiB;IAdhD;;OAEG;IACH,KAAK,EAAE,cAAc,CAAc;IAEnC;;OAEG;IACH,OAAO,CAAC,uBAAuB,CAAyB;;IAGtD;;OAEG;IACO,iBAAiB,EAAE,iBAAiB;IAGhD;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAI3C;;OAEG;IACH,IAAI,SAAS,IAAI,CAAC,CAEjB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,CAEhB;IAED;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC;IAExC;;OAEG;IACH,iBAAiB,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC;IAExC;;;OAGG;IACH,0BAA0B,IAAI,IAAI;CAOnC;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC;AAEjF;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,KAAI,SAAS,EAAE,iBAAiB,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;CAAE,
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/hooks/hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYtE;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,iBAAiB;IAdhD;;OAEG;IACH,KAAK,EAAE,cAAc,CAAc;IAEnC;;OAEG;IACH,OAAO,CAAC,uBAAuB,CAAyB;;IAGtD;;OAEG;IACO,iBAAiB,EAAE,iBAAiB;IAGhD;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAI3C;;OAEG;IACH,IAAI,SAAS,IAAI,CAAC,CAEjB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,IAAI,CAEhB;IAED;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC;IAExC;;OAEG;IACH,iBAAiB,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC;IAExC;;;OAGG;IACH,0BAA0B,IAAI,IAAI;CAOnC;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC;AAEjF;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,KAAI,SAAS,EAAE,iBAAiB,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;CAAE,QA2CvH"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var tt=Object.create;var F=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var at=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of rt(t))!nt.call(n,a)&&a!==e&&F(n,a,{get:()=>t[a],enumerable:!(i=et(t,a))||i.enumerable});return n};var r=(n,t,e)=>(e=n!=null?tt(it(n)):{},at(t||!n||!n.__esModule?F(e,"default",{value:n,enumerable:!0}):e,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class v{constructor(t){this.livewireComponent=t}state="mounting";_beforeDestroyCallbacks=[];onBeforeDestroy(t){this._beforeDestroyCallbacks.push(t)}get canonical(){return this.livewireComponent.canonical}get element(){return this.livewireComponent.el}get $wire(){return this.livewireComponent.$wire}isBeingDestroyed(){return["destroyed","destroying"].includes(this.state)}_runBeforeDestroyCallbacks(){for(const t of this._beforeDestroyCallbacks.reverse())t();this._beforeDestroyCallbacks=[]}}function B(n,t){const e=new Map;window.Livewire?.hook("component.init",async({component:i,cleanup:a})=>{if(i.name!==n)return;const o=new t(i);e.set(i.id,o),a(async()=>{o.state="destroying",o._runBeforeDestroyCallbacks(),await o.destroyed(),o.state="destroyed",e.delete(i.id)}),await o.mounted(),o.state="mounted"}),window.Livewire?.hook("commit",async({component:i,succeed:a})=>{i.name===n&&a(()=>{const o=e.get(i.id);o?.state==="mounted"&&o?.afterCommitSynced?.()})})}class N{items=new Map;initializationErrors=new Map;pendingCallbacks=new Map;watchers=new Set;execute(t,e,i){const a=this.items.get(t),o=this.initializationErrors.get(t);return o?(i?.(o),Promise.reject(o)):a?Promise.resolve(e(a)):new Promise((s,c)=>{const u=this.getPendingCallbacks(t);u.success.push(async l=>{s(await e(l))}),i?u.error.push(i):u.error.push(c)})}register(t,e){if(this.items.has(t))throw new Error(`Item with ID "${t}" is already registered.`);this.resetErrors(t),this.items.set(t,e);const i=this.pendingCallbacks.get(t);i&&(i.success.forEach(a=>a(e)),this.pendingCallbacks.delete(t)),this.registerAsDefault(t,e),this.notifyWatchers()}error(t,e){this.items.delete(t),this.initializationErrors.set(t,e);const i=this.pendingCallbacks.get(t);i&&(i.error.forEach(a=>a(e)),this.pendingCallbacks.delete(t)),this.initializationErrors.size===1&&!this.items.size&&this.error(null,e),this.notifyWatchers()}resetErrors(t){const{initializationErrors:e}=this;e.has(null)&&e.get(null)===e.get(t)&&e.delete(null),e.delete(t)}unregister(t){if(!this.items.has(t))throw new Error(`Item with ID "${t}" is not registered.`);t&&this.items.get(null)===this.items.get(t)&&this.unregister(null),this.items.delete(t),this.pendingCallbacks.delete(t),this.notifyWatchers()}getItems(){return Array.from(this.items.values())}hasItem(t){return this.items.has(t)}waitFor(t){return new Promise((e,i)=>{this.execute(t,e,i)})}async destroyAll(){const t=Array.from(new Set(this.items.values())).map(e=>e.destroy());this.items.clear(),this.pendingCallbacks.clear(),await Promise.all(t),this.notifyWatchers()}watch(t){return this.watchers.add(t),t(new Map(this.items),new Map(this.initializationErrors)),this.unwatch.bind(this,t)}unwatch(t){this.watchers.delete(t)}notifyWatchers(){this.watchers.forEach(t=>t(new Map(this.items),new Map(this.initializationErrors)))}getPendingCallbacks(t){let e=this.pendingCallbacks.get(t);return e||(e={success:[],error:[]},this.pendingCallbacks.set(t,e)),e}registerAsDefault(t,e){this.items.size===1&&t!==null&&this.register(null,e)}}function R(n,t){let e=null;return(...i)=>{e&&clearTimeout(e),e=setTimeout(()=>{t(...i)},n)}}function ot(n,t){const e=Object.entries(n).filter(([i,a])=>t(a,i));return Object.fromEntries(e)}function j(n){return Object.keys(n).length===0&&n.constructor===Object}function M(n,t){const e=Object.entries(n).map(([i,a])=>[i,t(a,i)]);return Object.fromEntries(e)}function k(n,t){if(n===t)return!0;const e=Object.keys(n),i=Object.keys(t);if(e.length!==i.length)return!1;for(const a of e)if(n[a]!==t[a]||!Object.prototype.hasOwnProperty.call(t,a))return!1;return!0}function st(){return Math.random().toString(36).substring(2)}function ct(n,{timeOutAfter:t=500,retryAfter:e=100}={}){return new Promise((i,a)=>{const o=Date.now();let s=null;const c=setTimeout(()=>{a(s??new Error("Timeout"))},t),u=async()=>{try{const l=await n();clearTimeout(c),i(l)}catch(l){s=l,Date.now()-o>t?a(l):setTimeout(u,e)}};u()})}const S=Symbol.for("context-editor-watchdog");async function ut({element:n,context:t,creator:e,config:i}){const a=st();await t.add({creator:(u,l)=>e.create(u,l),id:a,sourceElementOrData:n,type:"editor",config:i});const o=t.getItem(a),s={state:"available",editorContextId:a,context:t};o[S]=s;const c=t.destroy.bind(t);return t.destroy=async()=>(s.state="unavailable",c()),{...s,editor:o}}function lt(n){return S in n?n[S]:null}function dt(n){return n.model.document.getRootNames().reduce((e,i)=>(e[i]=n.getData({rootName:i}),e),Object.create({}))}function P(n){return["inline","classic","balloon","decoupled"].includes(n)}function q(n){let t=n;for(;t;){for(const e of t.attributes)if(e.name.startsWith("wire:model"))return!0;t=t.parentElement}return!1}async function mt(n){const t=await import("ckeditor5"),i={inline:t.InlineEditor,balloon:t.BalloonEditor,classic:t.ClassicEditor,decoupled:t.DecoupledEditor,multiroot:t.MultiRootEditor}[n];if(!i)throw new Error(`Unsupported editor type: ${n}`);return i}class I{static the=new I;plugins=new Map;constructor(){}register(t,e){if(this.plugins.has(t))throw new Error(`Plugin with name "${t}" is already registered.`);return this.plugins.set(t,e),this.unregister.bind(this,t)}unregister(t){if(!this.plugins.has(t))throw new Error(`Plugin with name "${t}" is not registered.`);this.plugins.delete(t)}unregisterAll(){this.plugins.clear()}async get(t){return this.plugins.get(t)?.()}has(t){return this.plugins.has(t)}}async function _(n){const t=await import("ckeditor5");let e=null;const i=n.map(async a=>{const o=await I.the.get(a);if(o)return o;const{[a]:s}=t;if(s)return s;if(!e)try{e=await import("ckeditor5-premium-features")}catch(u){console.error(`Failed to load premium package: ${u}`)}const{[a]:c}=e||{};if(c)return c;throw new Error(`Plugin "${a}" not found in base or premium packages.`)});return{loadedPlugins:await Promise.all(i),hasPremium:!!e}}async function U(n,t){const e=[n.ui,n.content];return await Promise.all([V("ckeditor5",e),t&&V("ckeditor5-premium-features",e)].filter(a=>!!a)).then(a=>a.flat())}async function V(n,t){return await Promise.all(t.filter(e=>e!=="en").map(async e=>{const i=await pt(n,e);return i?.default??i}).filter(Boolean))}async function pt(n,t){try{if(n==="ckeditor5")switch(t){case"af":return await import("ckeditor5/translations/af.js");case"ar":return await import("ckeditor5/translations/ar.js");case"ast":return await import("ckeditor5/translations/ast.js");case"az":return await import("ckeditor5/translations/az.js");case"bg":return await import("ckeditor5/translations/bg.js");case"bn":return await import("ckeditor5/translations/bn.js");case"bs":return await import("ckeditor5/translations/bs.js");case"ca":return await import("ckeditor5/translations/ca.js");case"cs":return await import("ckeditor5/translations/cs.js");case"da":return await import("ckeditor5/translations/da.js");case"de":return await import("ckeditor5/translations/de.js");case"de-ch":return await import("ckeditor5/translations/de-ch.js");case"el":return await import("ckeditor5/translations/el.js");case"en":return await import("ckeditor5/translations/en.js");case"en-au":return await import("ckeditor5/translations/en-au.js");case"en-gb":return await import("ckeditor5/translations/en-gb.js");case"eo":return await import("ckeditor5/translations/eo.js");case"es":return await import("ckeditor5/translations/es.js");case"es-co":return await import("ckeditor5/translations/es-co.js");case"et":return await import("ckeditor5/translations/et.js");case"eu":return await import("ckeditor5/translations/eu.js");case"fa":return await import("ckeditor5/translations/fa.js");case"fi":return await import("ckeditor5/translations/fi.js");case"fr":return await import("ckeditor5/translations/fr.js");case"gl":return await import("ckeditor5/translations/gl.js");case"gu":return await import("ckeditor5/translations/gu.js");case"he":return await import("ckeditor5/translations/he.js");case"hi":return await import("ckeditor5/translations/hi.js");case"hr":return await import("ckeditor5/translations/hr.js");case"hu":return await import("ckeditor5/translations/hu.js");case"hy":return await import("ckeditor5/translations/hy.js");case"id":return await import("ckeditor5/translations/id.js");case"it":return await import("ckeditor5/translations/it.js");case"ja":return await import("ckeditor5/translations/ja.js");case"jv":return await import("ckeditor5/translations/jv.js");case"kk":return await import("ckeditor5/translations/kk.js");case"km":return await import("ckeditor5/translations/km.js");case"kn":return await import("ckeditor5/translations/kn.js");case"ko":return await import("ckeditor5/translations/ko.js");case"ku":return await import("ckeditor5/translations/ku.js");case"lt":return await import("ckeditor5/translations/lt.js");case"lv":return await import("ckeditor5/translations/lv.js");case"ms":return await import("ckeditor5/translations/ms.js");case"nb":return await import("ckeditor5/translations/nb.js");case"ne":return await import("ckeditor5/translations/ne.js");case"nl":return await import("ckeditor5/translations/nl.js");case"no":return await import("ckeditor5/translations/no.js");case"oc":return await import("ckeditor5/translations/oc.js");case"pl":return await import("ckeditor5/translations/pl.js");case"pt":return await import("ckeditor5/translations/pt.js");case"pt-br":return await import("ckeditor5/translations/pt-br.js");case"ro":return await import("ckeditor5/translations/ro.js");case"ru":return await import("ckeditor5/translations/ru.js");case"si":return await import("ckeditor5/translations/si.js");case"sk":return await import("ckeditor5/translations/sk.js");case"sl":return await import("ckeditor5/translations/sl.js");case"sq":return await import("ckeditor5/translations/sq.js");case"sr":return await import("ckeditor5/translations/sr.js");case"sr-latn":return await import("ckeditor5/translations/sr-latn.js");case"sv":return await import("ckeditor5/translations/sv.js");case"th":return await import("ckeditor5/translations/th.js");case"tk":return await import("ckeditor5/translations/tk.js");case"tr":return await import("ckeditor5/translations/tr.js");case"tt":return await import("ckeditor5/translations/tt.js");case"ug":return await import("ckeditor5/translations/ug.js");case"uk":return await import("ckeditor5/translations/uk.js");case"ur":return await import("ckeditor5/translations/ur.js");case"uz":return await import("ckeditor5/translations/uz.js");case"vi":return await import("ckeditor5/translations/vi.js");case"zh":return await import("ckeditor5/translations/zh.js");case"zh-cn":return await import("ckeditor5/translations/zh-cn.js");default:return console.warn(`Language ${t} not found in ckeditor5 translations`),null}else switch(t){case"af":return await import("ckeditor5-premium-features/translations/af.js");case"ar":return await import("ckeditor5-premium-features/translations/ar.js");case"ast":return await import("ckeditor5-premium-features/translations/ast.js");case"az":return await import("ckeditor5-premium-features/translations/az.js");case"bg":return await import("ckeditor5-premium-features/translations/bg.js");case"bn":return await import("ckeditor5-premium-features/translations/bn.js");case"bs":return await import("ckeditor5-premium-features/translations/bs.js");case"ca":return await import("ckeditor5-premium-features/translations/ca.js");case"cs":return await import("ckeditor5-premium-features/translations/cs.js");case"da":return await import("ckeditor5-premium-features/translations/da.js");case"de":return await import("ckeditor5-premium-features/translations/de.js");case"de-ch":return await import("ckeditor5-premium-features/translations/de-ch.js");case"el":return await import("ckeditor5-premium-features/translations/el.js");case"en":return await import("ckeditor5-premium-features/translations/en.js");case"en-au":return await import("ckeditor5-premium-features/translations/en-au.js");case"en-gb":return await import("ckeditor5-premium-features/translations/en-gb.js");case"eo":return await import("ckeditor5-premium-features/translations/eo.js");case"es":return await import("ckeditor5-premium-features/translations/es.js");case"es-co":return await import("ckeditor5-premium-features/translations/es-co.js");case"et":return await import("ckeditor5-premium-features/translations/et.js");case"eu":return await import("ckeditor5-premium-features/translations/eu.js");case"fa":return await import("ckeditor5-premium-features/translations/fa.js");case"fi":return await import("ckeditor5-premium-features/translations/fi.js");case"fr":return await import("ckeditor5-premium-features/translations/fr.js");case"gl":return await import("ckeditor5-premium-features/translations/gl.js");case"gu":return await import("ckeditor5-premium-features/translations/gu.js");case"he":return await import("ckeditor5-premium-features/translations/he.js");case"hi":return await import("ckeditor5-premium-features/translations/hi.js");case"hr":return await import("ckeditor5-premium-features/translations/hr.js");case"hu":return await import("ckeditor5-premium-features/translations/hu.js");case"hy":return await import("ckeditor5-premium-features/translations/hy.js");case"id":return await import("ckeditor5-premium-features/translations/id.js");case"it":return await import("ckeditor5-premium-features/translations/it.js");case"ja":return await import("ckeditor5-premium-features/translations/ja.js");case"jv":return await import("ckeditor5-premium-features/translations/jv.js");case"kk":return await import("ckeditor5-premium-features/translations/kk.js");case"km":return await import("ckeditor5-premium-features/translations/km.js");case"kn":return await import("ckeditor5-premium-features/translations/kn.js");case"ko":return await import("ckeditor5-premium-features/translations/ko.js");case"ku":return await import("ckeditor5-premium-features/translations/ku.js");case"lt":return await import("ckeditor5-premium-features/translations/lt.js");case"lv":return await import("ckeditor5-premium-features/translations/lv.js");case"ms":return await import("ckeditor5-premium-features/translations/ms.js");case"nb":return await import("ckeditor5-premium-features/translations/nb.js");case"ne":return await import("ckeditor5-premium-features/translations/ne.js");case"nl":return await import("ckeditor5-premium-features/translations/nl.js");case"no":return await import("ckeditor5-premium-features/translations/no.js");case"oc":return await import("ckeditor5-premium-features/translations/oc.js");case"pl":return await import("ckeditor5-premium-features/translations/pl.js");case"pt":return await import("ckeditor5-premium-features/translations/pt.js");case"pt-br":return await import("ckeditor5-premium-features/translations/pt-br.js");case"ro":return await import("ckeditor5-premium-features/translations/ro.js");case"ru":return await import("ckeditor5-premium-features/translations/ru.js");case"si":return await import("ckeditor5-premium-features/translations/si.js");case"sk":return await import("ckeditor5-premium-features/translations/sk.js");case"sl":return await import("ckeditor5-premium-features/translations/sl.js");case"sq":return await import("ckeditor5-premium-features/translations/sq.js");case"sr":return await import("ckeditor5-premium-features/translations/sr.js");case"sr-latn":return await import("ckeditor5-premium-features/translations/sr-latn.js");case"sv":return await import("ckeditor5-premium-features/translations/sv.js");case"th":return await import("ckeditor5-premium-features/translations/th.js");case"tk":return await import("ckeditor5-premium-features/translations/tk.js");case"tr":return await import("ckeditor5-premium-features/translations/tr.js");case"tt":return await import("ckeditor5-premium-features/translations/tt.js");case"ug":return await import("ckeditor5-premium-features/translations/ug.js");case"uk":return await import("ckeditor5-premium-features/translations/uk.js");case"ur":return await import("ckeditor5-premium-features/translations/ur.js");case"uz":return await import("ckeditor5-premium-features/translations/uz.js");case"vi":return await import("ckeditor5-premium-features/translations/vi.js");case"zh":return await import("ckeditor5-premium-features/translations/zh.js");case"zh-cn":return await import("ckeditor5-premium-features/translations/zh-cn.js");default:return console.warn(`Language ${t} not found in premium translations`),await import("ckeditor5-premium-features/translations/en.js")}}catch(e){return console.error(`Failed to load translation for ${n}/${t}:`,e),null}}function K(n){return M(n,t=>({dictionary:t}))}function G(n){const t=Y(n);return M(t,({element:e})=>e)}function Y(n){const t=window.Livewire.all().filter(({name:s,canonical:c})=>s==="ckeditor5-editable"&&c.editorId===n).reduce((s,{canonical:c,el:u})=>({...s,[c.rootName]:{element:u.querySelector("[data-cke-editable-content]"),content:c.content}}),Object.create({})),i=window.Livewire.all().find(({name:s,canonical:c})=>s==="ckeditor5"&&c.editorId===n)?.canonical.content,a=document.querySelector(`#${n}_editor `),o=t.main;return o&&i?.main?{...t,main:{...o,content:o.content||i.main}}:a?{...t,main:{element:a,content:i?.main||null}}:t}function W(n){const t=Y(n),e=M(t,({content:i})=>i);return ot(e,i=>typeof i=="string")}function T(n){if(!n||typeof n!="object")return n;if(Array.isArray(n))return n.map(i=>T(i));const t=n;if(t.$element&&typeof t.$element=="string"){const i=document.querySelector(t.$element);return i||console.warn(`Element not found for selector: ${t.$element}`),i||null}const e=Object.create(null);for(const[i,a]of Object.entries(n))e[i]=T(a);return e}function D(n,t,e){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(o=>D(n,t,o));const i=e;if(i.$translation&&typeof i.$translation=="string"){const o=i.$translation,s=ht(n,o,t);return s===void 0&&console.warn(`Translation not found for key: ${o}`),s!==void 0?s:null}const a=Object.create(null);for(const[o,s]of Object.entries(e))a[o]=D(n,t,s);return a}function ht(n,t,e){for(const i of n){const a=i[e];if(a?.dictionary&&t in a.dictionary)return a.dictionary[t]}}function wt(n,t){const{editing:e}=n;e.view.change(i=>{i.setStyle("height",`${t}px`,e.view.document.getRoot())})}const H=Symbol.for("elixir-editor-watchdog");async function ft(n){const{EditorWatchdog:t}=await import("ckeditor5"),e=new t(n);return e.setCreator(async(...i)=>{const a=await n.create(...i);return a[H]=e,a}),{watchdog:e,Constructor:{create:async(...i)=>(await e.create(...i),e.editor)}}}function gt(n){return H in n?n[H]:null}class f extends N{static the=new f}class yt extends v{contextPromise=null;async mounted(){const{contextId:t,language:e,context:i}=this.canonical,{customTranslations:a,watchdogConfig:o,config:{plugins:s,...c}}=i,{loadedPlugins:u,hasPremium:l}=await _(s??[]),E=[...await U(e,l),K(a||{})].filter(b=>!j(b));this.contextPromise=(async()=>{const{ContextWatchdog:b,Context:g}=await import("ckeditor5"),h=new b(g,{crashNumberLimit:10,...o});let w=T(c);return w=D([...E].reverse(),e.ui,w),await h.create({...w,language:e,plugins:u,...E.length&&{translations:E}}),h.on("itemError",(...O)=>{console.error("Context item error:",...O)}),h})();const x=await this.contextPromise;this.isBeingDestroyed()||f.the.register(t,x)}async destroyed(){const{contextId:t}=this.canonical;this.element.style.display="none";try{await(await this.contextPromise)?.destroy()}finally{this.contextPromise=null,f.the.hasItem(t)&&f.the.unregister(t)}}}class m extends N{static the=new m}class X extends v{editorPromise=null;pendingContent=null;mounted(){const{editorId:t,rootName:e,content:i}=this.canonical;this.editorPromise=m.the.execute(t,a=>{if(this.isBeingDestroyed())return null;const{ui:o,editing:s,model:c}=a;if(c.document.getRoot(e)){if(i!==null){const u=a.getData({rootName:e});u&&u!==i&&a.setData({[e]:i})}}else{a.addRoot(e,{isUndoable:!1,...i!==null&&{data:i}});const u=this.element.querySelector("[data-cke-editable-content]"),l=o.view.createEditable(e,u);o.addEditable(l),s.view.forceRender()}return this.syncTypingContentPush(a),this.setupPendingReceivedContentHandlers(a),a})}syncTypingContentPush(t){const{rootName:e,saveDebounceMs:i}=this.canonical,a=this.element.querySelector("input"),o=()=>{const c=t.getData({rootName:e});a&&(a.value=c),this.$wire.set("content",c)},s=R(i,o);t.model.document.on("change:data",s),o(),this.onBeforeDestroy(()=>{t.model.document.off("change:data",s)})}setupPendingReceivedContentHandlers(t){const{ui:e,model:i}=t,{focusTracker:a}=e,{rootName:o}=this.canonical,s=()=>{this.pendingContent=null},c=()=>{!a.isFocused&&this.pendingContent!==null&&(t.setData({[o]:this.pendingContent}),this.pendingContent=null)};i.document.on("change:data",s),a.on("change:isFocused",c),this.onBeforeDestroy(()=>{i.document.off("change:data",s),a.off("change:isFocused",c)})}applyCanonicalContentToEditor(t){if(!q(this.element))return;const{content:e,rootName:i}=this.canonical,{ui:a}=t;if(t.getData({rootName:i})!==(e??"")){if(a.focusTracker.isFocused){this.pendingContent=e??"";return}t.setData({[i]:e??""})}}async afterCommitSynced(){const t=await this.editorPromise;this.applyCanonicalContentToEditor(t)}async destroyed(){const{rootName:t}=this.canonical;this.element.style.display="none";const e=await this.editorPromise;if(this.editorPromise=null,e&&e.state!=="destroyed"){const i=e.model.document.getRoot(t);i&&"detachEditable"in e&&(e.detachEditable(i),e.detachRoot(t,!1))}}}async function Et({saveDebounceMs:n,component:t}){const{Plugin:e}=await import("ckeditor5");return class extends e{static get pluginName(){return"LivewireSync"}init(){this.setupTypingContentPush(),this.setupFocusableEventPush(),this.setupAfterCommitHandler(),this.setupSetEditorContentHandler(),this.setupReadyDispatch()}setupAfterCommitHandler(){const{editor:a}=this,{model:o,ui:{focusTracker:s}}=a;let c=null;a.on("afterCommitSynced",()=>{if(!q(t.element))return;const{content:u}=t.canonical,l=this.getEditorRootsValues();if(s.isFocused){k(u,l)||(c=u);return}k(u,l)||a.setData(u)}),o.document.on("change:data",()=>{c=null}),s.on("change:isFocused",()=>{!s.isFocused&&c!==null&&(a.setData(c),c=null)})}setupReadyDispatch(){const{$wire:a}=t;this.editor.once("ready",()=>{a.dispatch("editor-ready",{editorId:t.canonical.editorId})})}setupSetEditorContentHandler(){Livewire.on("set-editor-content",({editorId:a,content:o})=>{if(a!==t.canonical.editorId)return;const s=this.getEditorRootsValues();k(s,o)||this.editor.setData(o)})}setupTypingContentPush(){const{model:a}=this.editor,{$wire:o}=t,s=()=>{const c=this.getEditorRootsValues();k(c,t.canonical.content??{})||(o.set("content",c),o.dispatch("editor-content-changed",{editorId:t.canonical.editorId,content:c}))};a.document.on("change:data",R(n,s)),this.editor.once("ready",s)}setupFocusableEventPush(){const{ui:a}=this.editor,{$wire:o}=t,s=()=>{const c=this.getEditorRootsValues();o.set("focused",a.focusTracker.isFocused),k(c,t.canonical.content??{})||o.set("content",c)};a.focusTracker.on("change:isFocused",s)}getEditorRootsValues(){return dt(this.editor)}}}async function bt(n){const{Plugin:t}=await import("ckeditor5");return class extends t{input=null;form=null;static get pluginName(){return"SyncEditorWithInput"}afterInit(){const{editor:i}=this,o=i.sourceElement.id.replace(/_editor$/,"");this.input=document.getElementById(`${o}_input`),this.input&&(i.model.document.on("change:data",R(n,()=>this.sync())),i.once("ready",this.sync),this.form=this.input.closest("form"),this.form?.addEventListener("submit",this.sync))}sync=()=>{if(this.input){const i=this.editor.getData();this.input.value=i,this.input.dispatchEvent(new Event("input",{bubbles:!0}))}};destroy(){this.form&&this.form.removeEventListener("submit",this.sync),this.input=null,this.form=null}}}class J extends v{editorPromise=null;async mounted(){const{editorId:t}=this.canonical;m.the.resetErrors(t);try{this.editorPromise=this.createEditor();const e=await this.editorPromise;this.isBeingDestroyed()||(m.the.register(t,e),e.once("destroy",()=>{m.the.hasItem(t)&&m.the.unregister(t)}))}catch(e){console.error(`Error initializing CKEditor5 instance with ID "${t}":`,e),this.editorPromise=null,m.the.error(t,e)}}async destroyed(){this.element.style.display="none";try{const t=await this.editorPromise;if(!t)return;const e=lt(t),i=gt(t);e?e.state!=="unavailable"&&await e.context.remove(e.editorContextId):i?await i.destroy():await t.destroy()}finally{this.editorPromise=null}}async afterCommitSynced(){(await this.editorPromise)?.fire("afterCommitSynced")}async createEditor(){const{preset:t,editorId:e,contextId:i,editableHeight:a,saveDebounceMs:o,language:s,watchdog:c,content:u}=this.canonical,{customTranslations:l,editorType:p,licenseKey:E,config:{plugins:x,...b}}=t;let g=await mt(p);const h=await(i?f.the.waitFor(i):null);if(c&&!h){const d=await ft(g);({Constructor:g}=d),d.watchdog.on("restart",()=>{const y=d.watchdog.editor;this.editorPromise=Promise.resolve(y),m.the.register(e,y)})}const{loadedPlugins:w,hasPremium:O}=await _(x);w.push(await Et({saveDebounceMs:o,component:this})),P(p)&&w.push(await bt(o));const $=[...await U(s,O),K(l||{})].filter(d=>!j(d));let C={...u,...W(e)};P(p)&&(C=C.main||"");const z=await(async()=>{let d=G(e);if(!(d instanceof HTMLElement)&&!("main"in d)){const A=p==="decoupled"?["main"]:Object.keys(C);Q(d,A)||(d=await Ct(e,A),C={...u,...W(e)})}P(p)&&"main"in d&&(d=d.main);let y=T(b);y=D([...$].reverse(),s.ui,y);const L={...y,initialData:C,licenseKey:E,plugins:w,language:s,...$.length&&{translations:$}};return!h||!(d instanceof HTMLElement)?g.create(d,L):(await ut({context:h,element:d,creator:g,config:L})).editor})();return P(p)&&a&&wt(z,a),z}}function Q(n,t){return t.every(e=>n[e])}async function Ct(n,t){return ct(()=>{const e=G(n);if(!Q(e,t))throw new Error(`It looks like not all required root elements are present yet.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{state=`mounting`;_beforeDestroyCallbacks=[];constructor(e){this.livewireComponent=e}onBeforeDestroy(e){this._beforeDestroyCallbacks.push(e)}get canonical(){return this.livewireComponent.canonical}get element(){return this.livewireComponent.el}get $wire(){return this.livewireComponent.$wire}isBeingDestroyed(){return[`destroyed`,`destroying`].includes(this.state)}_runBeforeDestroyCallbacks(){for(let e of this._beforeDestroyCallbacks.reverse())e();this._beforeDestroyCallbacks=[]}};function t(e,t){let n=new Map;window.Livewire?.hook(`component.init`,async({component:r,cleanup:i})=>{if(r.name!==e)return;let a=new t(r);n.set(r.id,a),i(async()=>{a.state=`destroying`,a._runBeforeDestroyCallbacks(),await a.destroyed(),a.state=`destroyed`,n.delete(r.id)}),await a.mounted(),a.state=`mounted`}),window.Livewire?.hook(`commit`,async({component:t,succeed:r})=>{t.name===e&&r(()=>{let e=n.get(t.id);e?.state===`mounted`&&e?.afterCommitSynced?.()})})}var n=class{items=new Map;initializationErrors=new Map;pendingCallbacks=new Map;watchers=new Set;execute(e,t,n){let r=this.items.get(e),i=this.initializationErrors.get(e);return i?(n?.(i),Promise.reject(i)):r?Promise.resolve(t(r)):new Promise((r,i)=>{let a=this.getPendingCallbacks(e);a.success.push(async e=>{r(await t(e))}),n?a.error.push(n):a.error.push(i)})}register(e,t){if(this.items.has(e))throw Error(`Item with ID "${e}" is already registered.`);this.resetErrors(e),this.items.set(e,t);let n=this.pendingCallbacks.get(e);n&&(n.success.forEach(e=>e(t)),this.pendingCallbacks.delete(e)),this.registerAsDefault(e,t),this.notifyWatchers()}error(e,t){this.items.delete(e),this.initializationErrors.set(e,t);let n=this.pendingCallbacks.get(e);n&&(n.error.forEach(e=>e(t)),this.pendingCallbacks.delete(e)),this.initializationErrors.size===1&&!this.items.size&&this.error(null,t),this.notifyWatchers()}resetErrors(e){let{initializationErrors:t}=this;t.has(null)&&t.get(null)===t.get(e)&&t.delete(null),t.delete(e)}unregister(e){if(!this.items.has(e))throw Error(`Item with ID "${e}" is not registered.`);e&&this.items.get(null)===this.items.get(e)&&this.unregister(null),this.items.delete(e),this.pendingCallbacks.delete(e),this.notifyWatchers()}getItems(){return Array.from(this.items.values())}hasItem(e){return this.items.has(e)}waitFor(e){return new Promise((t,n)=>{this.execute(e,t,n)})}async destroyAll(){let e=Array.from(new Set(this.items.values())).map(e=>e.destroy());this.items.clear(),this.pendingCallbacks.clear(),await Promise.all(e),this.notifyWatchers()}watch(e){return this.watchers.add(e),e(new Map(this.items),new Map(this.initializationErrors)),this.unwatch.bind(this,e)}unwatch(e){this.watchers.delete(e)}notifyWatchers(){this.watchers.forEach(e=>e(new Map(this.items),new Map(this.initializationErrors)))}getPendingCallbacks(e){let t=this.pendingCallbacks.get(e);return t||(t={success:[],error:[]},this.pendingCallbacks.set(e,t)),t}registerAsDefault(e,t){this.items.size===1&&e!==null&&this.register(null,t)}};function r(e,t){let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{t(...r)},e)}}function i(e,t){let n=Object.entries(e).filter(([e,n])=>t(n,e));return Object.fromEntries(n)}function a(e){return Object.keys(e).length===0&&e.constructor===Object}function o(e,t){let n=Object.entries(e).map(([e,n])=>[e,t(n,e)]);return Object.fromEntries(n)}function s(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r]||!Object.prototype.hasOwnProperty.call(t,r))return!1;return!0}function c(){return Math.random().toString(36).substring(2)}function l(e,{timeOutAfter:t=500,retryAfter:n=100}={}){return new Promise((r,i)=>{let a=Date.now(),o=null,s=setTimeout(()=>{i(o??Error(`Timeout`))},t),c=async()=>{try{let t=await e();clearTimeout(s),r(t)}catch(e){o=e,Date.now()-a>t?i(e):setTimeout(c,n)}};c()})}var u=Symbol.for(`context-editor-watchdog`);async function d({element:e,context:t,creator:n,config:r}){let i=c();await t.add({creator:(e,t)=>n.create(e,t),id:i,sourceElementOrData:e,type:`editor`,config:r});let a=t.getItem(i),o={state:`available`,editorContextId:i,context:t};a[u]=o;let s=t.destroy.bind(t);return t.destroy=async()=>(o.state=`unavailable`,s()),{...o,editor:a}}function f(e){return u in e?e[u]:null}function p(e){return e.model.document.getRootNames().reduce((t,n)=>(t[n]=e.getData({rootName:n}),t),Object.create({}))}function m(e){return[`inline`,`classic`,`balloon`,`decoupled`].includes(e)}function h(e){let t=e;for(;t;){for(let e of t.attributes)if(e.name.startsWith(`wire:model`))return!0;t=t.parentElement}return!1}async function g(e){let t=await import(`ckeditor5`),n={inline:t.InlineEditor,balloon:t.BalloonEditor,classic:t.ClassicEditor,decoupled:t.DecoupledEditor,multiroot:t.MultiRootEditor}[e];if(!n)throw Error(`Unsupported editor type: ${e}`);return n}var _=class e{static the=new e;plugins=new Map;constructor(){}register(e,t){if(this.plugins.has(e))throw Error(`Plugin with name "${e}" is already registered.`);return this.plugins.set(e,t),this.unregister.bind(this,e)}unregister(e){if(!this.plugins.has(e))throw Error(`Plugin with name "${e}" is not registered.`);this.plugins.delete(e)}unregisterAll(){this.plugins.clear()}async get(e){return this.plugins.get(e)?.()}has(e){return this.plugins.has(e)}};async function v(e){let t=await import(`ckeditor5`),n=null,r=e.map(async e=>{let r=await _.the.get(e);if(r)return r;let{[e]:i}=t;if(i)return i;if(!n)try{n=await import(`ckeditor5-premium-features`)}catch(e){console.error(`Failed to load premium package: ${e}`)}let{[e]:a}=n||{};if(a)return a;throw Error(`Plugin "${e}" not found in base or premium packages.`)});return{loadedPlugins:await Promise.all(r),hasPremium:!!n}}async function y(e,t){let n=[e.ui,e.content],r=[b(`ckeditor5`,n)];return t&&r.push(b(`ckeditor5-premium-features`,n)),await Promise.all(r).then(e=>e.flat())}async function b(e,t){return await Promise.all(t.filter(e=>e!==`en`).map(async t=>{let n=await x(e,t);return n?.default??n}).filter(Boolean))}async function x(e,t){try{if(e===`ckeditor5`)switch(t){case`af`:return await import(`ckeditor5/translations/af.js`);case`ar`:return await import(`ckeditor5/translations/ar.js`);case`ast`:return await import(`ckeditor5/translations/ast.js`);case`az`:return await import(`ckeditor5/translations/az.js`);case`bg`:return await import(`ckeditor5/translations/bg.js`);case`bn`:return await import(`ckeditor5/translations/bn.js`);case`bs`:return await import(`ckeditor5/translations/bs.js`);case`ca`:return await import(`ckeditor5/translations/ca.js`);case`cs`:return await import(`ckeditor5/translations/cs.js`);case`da`:return await import(`ckeditor5/translations/da.js`);case`de`:return await import(`ckeditor5/translations/de.js`);case`de-ch`:return await import(`ckeditor5/translations/de-ch.js`);case`el`:return await import(`ckeditor5/translations/el.js`);case`en`:return await import(`ckeditor5/translations/en.js`);case`en-au`:return await import(`ckeditor5/translations/en-au.js`);case`en-gb`:return await import(`ckeditor5/translations/en-gb.js`);case`eo`:return await import(`ckeditor5/translations/eo.js`);case`es`:return await import(`ckeditor5/translations/es.js`);case`es-co`:return await import(`ckeditor5/translations/es-co.js`);case`et`:return await import(`ckeditor5/translations/et.js`);case`eu`:return await import(`ckeditor5/translations/eu.js`);case`fa`:return await import(`ckeditor5/translations/fa.js`);case`fi`:return await import(`ckeditor5/translations/fi.js`);case`fr`:return await import(`ckeditor5/translations/fr.js`);case`gl`:return await import(`ckeditor5/translations/gl.js`);case`gu`:return await import(`ckeditor5/translations/gu.js`);case`he`:return await import(`ckeditor5/translations/he.js`);case`hi`:return await import(`ckeditor5/translations/hi.js`);case`hr`:return await import(`ckeditor5/translations/hr.js`);case`hu`:return await import(`ckeditor5/translations/hu.js`);case`hy`:return await import(`ckeditor5/translations/hy.js`);case`id`:return await import(`ckeditor5/translations/id.js`);case`it`:return await import(`ckeditor5/translations/it.js`);case`ja`:return await import(`ckeditor5/translations/ja.js`);case`jv`:return await import(`ckeditor5/translations/jv.js`);case`kk`:return await import(`ckeditor5/translations/kk.js`);case`km`:return await import(`ckeditor5/translations/km.js`);case`kn`:return await import(`ckeditor5/translations/kn.js`);case`ko`:return await import(`ckeditor5/translations/ko.js`);case`ku`:return await import(`ckeditor5/translations/ku.js`);case`lt`:return await import(`ckeditor5/translations/lt.js`);case`lv`:return await import(`ckeditor5/translations/lv.js`);case`ms`:return await import(`ckeditor5/translations/ms.js`);case`nb`:return await import(`ckeditor5/translations/nb.js`);case`ne`:return await import(`ckeditor5/translations/ne.js`);case`nl`:return await import(`ckeditor5/translations/nl.js`);case`no`:return await import(`ckeditor5/translations/no.js`);case`oc`:return await import(`ckeditor5/translations/oc.js`);case`pl`:return await import(`ckeditor5/translations/pl.js`);case`pt`:return await import(`ckeditor5/translations/pt.js`);case`pt-br`:return await import(`ckeditor5/translations/pt-br.js`);case`ro`:return await import(`ckeditor5/translations/ro.js`);case`ru`:return await import(`ckeditor5/translations/ru.js`);case`si`:return await import(`ckeditor5/translations/si.js`);case`sk`:return await import(`ckeditor5/translations/sk.js`);case`sl`:return await import(`ckeditor5/translations/sl.js`);case`sq`:return await import(`ckeditor5/translations/sq.js`);case`sr`:return await import(`ckeditor5/translations/sr.js`);case`sr-latn`:return await import(`ckeditor5/translations/sr-latn.js`);case`sv`:return await import(`ckeditor5/translations/sv.js`);case`th`:return await import(`ckeditor5/translations/th.js`);case`tk`:return await import(`ckeditor5/translations/tk.js`);case`tr`:return await import(`ckeditor5/translations/tr.js`);case`tt`:return await import(`ckeditor5/translations/tt.js`);case`ug`:return await import(`ckeditor5/translations/ug.js`);case`uk`:return await import(`ckeditor5/translations/uk.js`);case`ur`:return await import(`ckeditor5/translations/ur.js`);case`uz`:return await import(`ckeditor5/translations/uz.js`);case`vi`:return await import(`ckeditor5/translations/vi.js`);case`zh`:return await import(`ckeditor5/translations/zh.js`);case`zh-cn`:return await import(`ckeditor5/translations/zh-cn.js`);default:return console.warn(`Language ${t} not found in ckeditor5 translations`),null}else switch(t){case`af`:return await import(`ckeditor5-premium-features/translations/af.js`);case`ar`:return await import(`ckeditor5-premium-features/translations/ar.js`);case`ast`:return await import(`ckeditor5-premium-features/translations/ast.js`);case`az`:return await import(`ckeditor5-premium-features/translations/az.js`);case`bg`:return await import(`ckeditor5-premium-features/translations/bg.js`);case`bn`:return await import(`ckeditor5-premium-features/translations/bn.js`);case`bs`:return await import(`ckeditor5-premium-features/translations/bs.js`);case`ca`:return await import(`ckeditor5-premium-features/translations/ca.js`);case`cs`:return await import(`ckeditor5-premium-features/translations/cs.js`);case`da`:return await import(`ckeditor5-premium-features/translations/da.js`);case`de`:return await import(`ckeditor5-premium-features/translations/de.js`);case`de-ch`:return await import(`ckeditor5-premium-features/translations/de-ch.js`);case`el`:return await import(`ckeditor5-premium-features/translations/el.js`);case`en`:return await import(`ckeditor5-premium-features/translations/en.js`);case`en-au`:return await import(`ckeditor5-premium-features/translations/en-au.js`);case`en-gb`:return await import(`ckeditor5-premium-features/translations/en-gb.js`);case`eo`:return await import(`ckeditor5-premium-features/translations/eo.js`);case`es`:return await import(`ckeditor5-premium-features/translations/es.js`);case`es-co`:return await import(`ckeditor5-premium-features/translations/es-co.js`);case`et`:return await import(`ckeditor5-premium-features/translations/et.js`);case`eu`:return await import(`ckeditor5-premium-features/translations/eu.js`);case`fa`:return await import(`ckeditor5-premium-features/translations/fa.js`);case`fi`:return await import(`ckeditor5-premium-features/translations/fi.js`);case`fr`:return await import(`ckeditor5-premium-features/translations/fr.js`);case`gl`:return await import(`ckeditor5-premium-features/translations/gl.js`);case`gu`:return await import(`ckeditor5-premium-features/translations/gu.js`);case`he`:return await import(`ckeditor5-premium-features/translations/he.js`);case`hi`:return await import(`ckeditor5-premium-features/translations/hi.js`);case`hr`:return await import(`ckeditor5-premium-features/translations/hr.js`);case`hu`:return await import(`ckeditor5-premium-features/translations/hu.js`);case`hy`:return await import(`ckeditor5-premium-features/translations/hy.js`);case`id`:return await import(`ckeditor5-premium-features/translations/id.js`);case`it`:return await import(`ckeditor5-premium-features/translations/it.js`);case`ja`:return await import(`ckeditor5-premium-features/translations/ja.js`);case`jv`:return await import(`ckeditor5-premium-features/translations/jv.js`);case`kk`:return await import(`ckeditor5-premium-features/translations/kk.js`);case`km`:return await import(`ckeditor5-premium-features/translations/km.js`);case`kn`:return await import(`ckeditor5-premium-features/translations/kn.js`);case`ko`:return await import(`ckeditor5-premium-features/translations/ko.js`);case`ku`:return await import(`ckeditor5-premium-features/translations/ku.js`);case`lt`:return await import(`ckeditor5-premium-features/translations/lt.js`);case`lv`:return await import(`ckeditor5-premium-features/translations/lv.js`);case`ms`:return await import(`ckeditor5-premium-features/translations/ms.js`);case`nb`:return await import(`ckeditor5-premium-features/translations/nb.js`);case`ne`:return await import(`ckeditor5-premium-features/translations/ne.js`);case`nl`:return await import(`ckeditor5-premium-features/translations/nl.js`);case`no`:return await import(`ckeditor5-premium-features/translations/no.js`);case`oc`:return await import(`ckeditor5-premium-features/translations/oc.js`);case`pl`:return await import(`ckeditor5-premium-features/translations/pl.js`);case`pt`:return await import(`ckeditor5-premium-features/translations/pt.js`);case`pt-br`:return await import(`ckeditor5-premium-features/translations/pt-br.js`);case`ro`:return await import(`ckeditor5-premium-features/translations/ro.js`);case`ru`:return await import(`ckeditor5-premium-features/translations/ru.js`);case`si`:return await import(`ckeditor5-premium-features/translations/si.js`);case`sk`:return await import(`ckeditor5-premium-features/translations/sk.js`);case`sl`:return await import(`ckeditor5-premium-features/translations/sl.js`);case`sq`:return await import(`ckeditor5-premium-features/translations/sq.js`);case`sr`:return await import(`ckeditor5-premium-features/translations/sr.js`);case`sr-latn`:return await import(`ckeditor5-premium-features/translations/sr-latn.js`);case`sv`:return await import(`ckeditor5-premium-features/translations/sv.js`);case`th`:return await import(`ckeditor5-premium-features/translations/th.js`);case`tk`:return await import(`ckeditor5-premium-features/translations/tk.js`);case`tr`:return await import(`ckeditor5-premium-features/translations/tr.js`);case`tt`:return await import(`ckeditor5-premium-features/translations/tt.js`);case`ug`:return await import(`ckeditor5-premium-features/translations/ug.js`);case`uk`:return await import(`ckeditor5-premium-features/translations/uk.js`);case`ur`:return await import(`ckeditor5-premium-features/translations/ur.js`);case`uz`:return await import(`ckeditor5-premium-features/translations/uz.js`);case`vi`:return await import(`ckeditor5-premium-features/translations/vi.js`);case`zh`:return await import(`ckeditor5-premium-features/translations/zh.js`);case`zh-cn`:return await import(`ckeditor5-premium-features/translations/zh-cn.js`);default:return console.warn(`Language ${t} not found in premium translations`),await import(`ckeditor5-premium-features/translations/en.js`)}}catch(n){return console.error(`Failed to load translation for ${e}/${t}:`,n),null}}function S(e){return o(e,e=>({dictionary:e}))}function C(e){return o(w(e),({element:e})=>e)}function w(e){let t=window.Livewire.all().filter(({name:t,canonical:n})=>t===`ckeditor5-editable`&&n.editorId===e).reduce((e,{canonical:t,el:n})=>({...e,[t.rootName]:{element:n.querySelector(`[data-cke-editable-content]`),content:t.content}}),Object.create({})),n=window.Livewire.all().find(({name:t,canonical:n})=>t===`ckeditor5`&&n.editorId===e)?.canonical.content,r=document.querySelector(`#${e}_editor `),i=t.main;return i&&n?.main?{...t,main:{...i,content:i.content||n.main}}:r?{...t,main:{element:r,content:n?.main||null}}:t}function T(e){return i(o(w(e),({content:e})=>e),e=>typeof e==`string`)}function E(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>E(e));let t=e;if(t.$element&&typeof t.$element==`string`){let e=document.querySelector(t.$element);return e||console.warn(`Element not found for selector: ${t.$element}`),e||null}let n=Object.create(null);for(let[t,r]of Object.entries(e))n[t]=E(r);return n}function D(e,t,n){if(!n||typeof n!=`object`)return n;if(Array.isArray(n))return n.map(n=>D(e,t,n));let r=n;if(r.$translation&&typeof r.$translation==`string`){let n=r.$translation,i=O(e,n,t);return i===void 0&&console.warn(`Translation not found for key: ${n}`),i===void 0?null:i}let i=Object.create(null);for(let[r,a]of Object.entries(n))i[r]=D(e,t,a);return i}function O(e,t,n){for(let r of e){let e=r[n];if(e?.dictionary&&t in e.dictionary)return e.dictionary[t]}}function k(e,t){let{editing:n}=e;n.view.change(e=>{e.setStyle(`height`,`${t}px`,n.view.document.getRoot())})}var A=Symbol.for(`elixir-editor-watchdog`);async function j(e){let{EditorWatchdog:t}=await import(`ckeditor5`),n=new t(e);return n.setCreator(async(...t)=>{let r=await e.create(...t);return r[A]=n,r}),{watchdog:n,Constructor:{create:async(...e)=>(await n.create(...e),n.editor)}}}function M(e){return A in e?e[A]:null}var N=class e extends n{static the=new e},P=class extends e{contextPromise=null;async mounted(){let{contextId:e,language:t,context:n}=this.canonical,{customTranslations:r,watchdogConfig:i,config:{plugins:o,...s}}=n,{loadedPlugins:c,hasPremium:l}=await v(o??[]),u=[...await y(t,l),S(r||{})].filter(e=>!a(e));this.contextPromise=(async()=>{let{ContextWatchdog:e,Context:n}=await import(`ckeditor5`),r=new e(n,{crashNumberLimit:10,...i}),a=E(s);return a=D([...u].reverse(),t.ui,a),await r.create({...a,language:t,plugins:c,...u.length&&{translations:u}}),r.on(`itemError`,(...e)=>{console.error(`Context item error:`,...e)}),r})();let d=await this.contextPromise;this.isBeingDestroyed()||N.the.register(e,d)}async destroyed(){let{contextId:e}=this.canonical;this.element.style.display=`none`;try{await(await this.contextPromise)?.destroy()}finally{this.contextPromise=null,N.the.hasItem(e)&&N.the.unregister(e)}}},F=class e extends n{static the=new e},I=class extends e{editorPromise=null;pendingContent=null;mounted(){let{editorId:e,rootName:t,content:n}=this.canonical;this.editorPromise=F.the.execute(e,e=>{if(this.isBeingDestroyed())return null;let{ui:r,editing:i,model:a}=e;if(a.document.getRoot(t)){if(n!==null){let r=e.getData({rootName:t});r&&r!==n&&e.setData({[t]:n})}}else{e.addRoot(t,{isUndoable:!1,...n!==null&&{data:n}});let a=this.element.querySelector(`[data-cke-editable-content]`),o=r.view.createEditable(t,a);r.addEditable(o),i.view.forceRender()}return this.syncTypingContentPush(e),this.setupPendingReceivedContentHandlers(e),e})}syncTypingContentPush(e){let{rootName:t,saveDebounceMs:n}=this.canonical,i=this.element.querySelector(`input`),a=()=>{let n=e.getData({rootName:t});i&&(i.value=n),this.$wire.set(`content`,n)},o=r(n,a);e.model.document.on(`change:data`,o),a(),this.onBeforeDestroy(()=>{e.model.document.off(`change:data`,o)})}setupPendingReceivedContentHandlers(e){let{ui:t,model:n}=e,{focusTracker:r}=t,{rootName:i}=this.canonical,a=()=>{this.pendingContent=null},o=()=>{!r.isFocused&&this.pendingContent!==null&&(e.setData({[i]:this.pendingContent}),this.pendingContent=null)};n.document.on(`change:data`,a),r.on(`change:isFocused`,o),this.onBeforeDestroy(()=>{n.document.off(`change:data`,a),r.off(`change:isFocused`,o)})}applyCanonicalContentToEditor(e){if(!h(this.element))return;let{content:t,rootName:n}=this.canonical,{ui:r}=e;if(e.getData({rootName:n})!==(t??``)){if(r.focusTracker.isFocused){this.pendingContent=t??``;return}e.setData({[n]:t??``})}}async afterCommitSynced(){let e=await this.editorPromise;this.applyCanonicalContentToEditor(e)}async destroyed(){let{rootName:e}=this.canonical;this.element.style.display=`none`;let t=await this.editorPromise;if(this.editorPromise=null,t&&t.state!==`destroyed`){let n=t.model.document.getRoot(e);n&&`detachEditable`in t&&(t.detachEditable(n),t.detachRoot(e,!1))}}};async function L({saveDebounceMs:e,component:t}){let{Plugin:n}=await import(`ckeditor5`);return class extends n{static get pluginName(){return`LivewireSync`}init(){this.setupTypingContentPush(),this.setupFocusableEventPush(),this.setupAfterCommitHandler(),this.setupSetEditorContentHandler(),this.setupReadyDispatch()}setupAfterCommitHandler(){let{editor:e}=this,{model:n,ui:{focusTracker:r}}=e,i=null;e.on(`afterCommitSynced`,()=>{if(!h(t.element))return;let{content:n}=t.canonical,a=this.getEditorRootsValues();if(r.isFocused){s(n,a)||(i=n);return}s(n,a)||e.setData(n)}),n.document.on(`change:data`,()=>{i=null}),r.on(`change:isFocused`,()=>{!r.isFocused&&i!==null&&(e.setData(i),i=null)})}setupReadyDispatch(){let{$wire:e}=t;this.editor.once(`ready`,()=>{e.dispatch(`editor-ready`,{editorId:t.canonical.editorId})})}setupSetEditorContentHandler(){Livewire.on(`set-editor-content`,({editorId:e,content:n})=>{e===t.canonical.editorId&&(s(this.getEditorRootsValues(),n)||this.editor.setData(n))})}setupTypingContentPush(){let{model:n}=this.editor,{$wire:i}=t,a=()=>{let e=this.getEditorRootsValues();s(e,t.canonical.content??{})||(i.set(`content`,e),i.dispatch(`editor-content-changed`,{editorId:t.canonical.editorId,content:e}))};n.document.on(`change:data`,r(e,a)),this.editor.once(`ready`,a)}setupFocusableEventPush(){let{ui:e}=this.editor,{$wire:n}=t;e.focusTracker.on(`change:isFocused`,()=>{let r=this.getEditorRootsValues();n.set(`focused`,e.focusTracker.isFocused),s(r,t.canonical.content??{})||n.set(`content`,r)})}getEditorRootsValues(){return p(this.editor)}}}async function R(e){let{Plugin:t}=await import(`ckeditor5`);return class extends t{input=null;form=null;static get pluginName(){return`SyncEditorWithInput`}afterInit(){let{editor:t}=this,n=t.sourceElement.id.replace(/_editor$/,``);this.input=document.getElementById(`${n}_input`),this.input&&(t.model.document.on(`change:data`,r(e,()=>this.sync())),t.once(`ready`,this.sync),this.form=this.input.closest(`form`),this.form?.addEventListener(`submit`,this.sync))}sync=()=>{if(this.input){let e=this.editor.getData();this.input.value=e,this.input.dispatchEvent(new Event(`input`,{bubbles:!0}))}};destroy(){this.form&&this.form.removeEventListener(`submit`,this.sync),this.input=null,this.form=null}}}var z=class extends e{editorPromise=null;async mounted(){let{editorId:e}=this.canonical;F.the.resetErrors(e);try{this.editorPromise=this.createEditor();let t=await this.editorPromise;this.isBeingDestroyed()||(F.the.register(e,t),t.once(`destroy`,()=>{F.the.hasItem(e)&&F.the.unregister(e)}))}catch(t){console.error(`Error initializing CKEditor5 instance with ID "${e}":`,t),this.editorPromise=null,F.the.error(e,t)}}async destroyed(){this.element.style.display=`none`;try{let e=await this.editorPromise;if(!e)return;let t=f(e),n=M(e);t?t.state!==`unavailable`&&await t.context.remove(t.editorContextId):n?await n.destroy():await e.destroy()}finally{this.editorPromise=null}}async afterCommitSynced(){(await this.editorPromise)?.fire(`afterCommitSynced`)}async createEditor(){let{preset:e,editorId:t,contextId:n,editableHeight:r,saveDebounceMs:i,language:o,watchdog:s,content:c}=this.canonical,{customTranslations:l,editorType:u,licenseKey:f,config:{plugins:p,...h}}=e,_=await g(u),b=await(n?N.the.waitFor(n):null);if(s&&!b){let e=await j(_);({Constructor:_}=e),e.watchdog.on(`restart`,()=>{let n=e.watchdog.editor;this.editorPromise=Promise.resolve(n),F.the.register(t,n)})}let{loadedPlugins:x,hasPremium:w}=await v(p);x.push(await L({saveDebounceMs:i,component:this})),m(u)&&x.push(await R(i));let O=[...await y(o,w),S(l||{})].filter(e=>!a(e)),A={...c,...T(t)};m(u)&&(A=A.main||``);let M=await(async()=>{let e=C(t);if(!(e instanceof HTMLElement)&&!(`main`in e)){let n=u===`decoupled`?[`main`]:Object.keys(A);B(e,n)||(e=await V(t,n),A={...c,...T(t)})}m(u)&&`main`in e&&(e=e.main);let n=E(h);n=D([...O].reverse(),o.ui,n);let r={...n,initialData:A,licenseKey:f,plugins:x,language:o,...O.length&&{translations:O}};return!b||!(e instanceof HTMLElement)?_.create(e,r):(await d({context:b,element:e,creator:_,config:r})).editor})();return m(u)&&r&&k(M,r),M}};function B(e,t){return t.every(t=>e[t])}async function V(e,t){return l(()=>{let n=C(e);if(!B(n,t))throw Error(`It looks like not all required root elements are present yet.
|
|
2
2
|
* If you want to wait for them, ensure they are registered before editor initialization.
|
|
3
3
|
* If you want lazy initialize roots, consider removing root values from the \`initialData\` config and assign initial data in editable components.
|
|
4
|
-
Missing roots: ${t.filter(
|
|
5
|
-
//# sourceMappingURL=index.cjs.map
|
|
4
|
+
Missing roots: ${t.filter(e=>!n[e]).join(`, `)}.`);return n},{timeOutAfter:2e3,retryAfter:100})}var H=class extends e{mountedPromise=null;async mounted(){let{editorId:e,name:t}=this.canonical;this.mountedPromise=F.the.execute(e,e=>{if(this.isBeingDestroyed())return;let{ui:n}=e,r=U(t),i=n.view[r];if(!i){console.error(`Unknown UI part name: "${t}". Supported names are "toolbar" and "menubar".`);return}this.element.appendChild(i.element)})}async destroyed(){this.element.style.display=`none`,await this.mountedPromise,this.mountedPromise=null,this.element.innerHTML=``}};function U(e){switch(e){case`toolbar`:return`toolbar`;case`menubar`:return`menuBarView`;default:return null}}var W={ckeditor5:z,"ckeditor5-context":P,"ckeditor5-ui-part":H,"ckeditor5-editable":I};function G(){for(let[e,n]of Object.entries(W))t(e,n)}G(),exports.ClassHook=e,exports.ContextsRegistry=N,exports.CustomEditorPluginsRegistry=_,exports.EditableComponentHook=I,exports.EditorComponentHook=z,exports.EditorsRegistry=F,exports.UIPartComponentHook=H,exports.registerLivewireComponentHook=t;
|
|
5
|
+
//# sourceMappingURL=index.cjs.map
|