ckeditor5-blazor 0.1.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.
Files changed (219) hide show
  1. package/dist/ckeditor5-blazor-error.d.ts +7 -0
  2. package/dist/ckeditor5-blazor-error.d.ts.map +1 -0
  3. package/dist/elements/context/context.d.ts +26 -0
  4. package/dist/elements/context/context.d.ts.map +1 -0
  5. package/dist/elements/context/contexts-registry.d.ts +9 -0
  6. package/dist/elements/context/contexts-registry.d.ts.map +1 -0
  7. package/dist/elements/context/index.d.ts +4 -0
  8. package/dist/elements/context/index.d.ts.map +1 -0
  9. package/dist/elements/context/typings.d.ts +34 -0
  10. package/dist/elements/context/typings.d.ts.map +1 -0
  11. package/dist/elements/editable.d.ts +34 -0
  12. package/dist/elements/editable.d.ts.map +1 -0
  13. package/dist/elements/editor/custom-editor-plugins.d.ts +54 -0
  14. package/dist/elements/editor/custom-editor-plugins.d.ts.map +1 -0
  15. package/dist/elements/editor/editor.d.ts +31 -0
  16. package/dist/elements/editor/editor.d.ts.map +1 -0
  17. package/dist/elements/editor/editors-registry.d.ts +9 -0
  18. package/dist/elements/editor/editors-registry.d.ts.map +1 -0
  19. package/dist/elements/editor/index.d.ts +3 -0
  20. package/dist/elements/editor/index.d.ts.map +1 -0
  21. package/dist/elements/editor/plugins/dispatch-editor-roots-change-event.d.ts +23 -0
  22. package/dist/elements/editor/plugins/dispatch-editor-roots-change-event.d.ts.map +1 -0
  23. package/dist/elements/editor/plugins/index.d.ts +3 -0
  24. package/dist/elements/editor/plugins/index.d.ts.map +1 -0
  25. package/dist/elements/editor/plugins/sync-editor-with-input.d.ts +6 -0
  26. package/dist/elements/editor/plugins/sync-editor-with-input.d.ts.map +1 -0
  27. package/dist/elements/editor/typings.d.ts +99 -0
  28. package/dist/elements/editor/typings.d.ts.map +1 -0
  29. package/dist/elements/editor/utils/create-editor-in-context.d.ts +44 -0
  30. package/dist/elements/editor/utils/create-editor-in-context.d.ts.map +1 -0
  31. package/dist/elements/editor/utils/get-editor-roots-values.d.ts +9 -0
  32. package/dist/elements/editor/utils/get-editor-roots-values.d.ts.map +1 -0
  33. package/dist/elements/editor/utils/index.d.ts +14 -0
  34. package/dist/elements/editor/utils/index.d.ts.map +1 -0
  35. package/dist/elements/editor/utils/is-single-root-editor.d.ts +9 -0
  36. package/dist/elements/editor/utils/is-single-root-editor.d.ts.map +1 -0
  37. package/dist/elements/editor/utils/load-editor-constructor.d.ts +9 -0
  38. package/dist/elements/editor/utils/load-editor-constructor.d.ts.map +1 -0
  39. package/dist/elements/editor/utils/load-editor-plugins.d.ts +20 -0
  40. package/dist/elements/editor/utils/load-editor-plugins.d.ts.map +1 -0
  41. package/dist/elements/editor/utils/load-editor-translations.d.ts +14 -0
  42. package/dist/elements/editor/utils/load-editor-translations.d.ts.map +1 -0
  43. package/dist/elements/editor/utils/normalize-custom-translations.d.ts +11 -0
  44. package/dist/elements/editor/utils/normalize-custom-translations.d.ts.map +1 -0
  45. package/dist/elements/editor/utils/query-all-editor-ids.d.ts +5 -0
  46. package/dist/elements/editor/utils/query-all-editor-ids.d.ts.map +1 -0
  47. package/dist/elements/editor/utils/query-editor-editables.d.ts +25 -0
  48. package/dist/elements/editor/utils/query-editor-editables.d.ts.map +1 -0
  49. package/dist/elements/editor/utils/resolve-editor-config-elements-references.d.ts +9 -0
  50. package/dist/elements/editor/utils/resolve-editor-config-elements-references.d.ts.map +1 -0
  51. package/dist/elements/editor/utils/resolve-editor-config-translations.d.ts +25 -0
  52. package/dist/elements/editor/utils/resolve-editor-config-translations.d.ts.map +1 -0
  53. package/dist/elements/editor/utils/set-editor-editable-height.d.ts +9 -0
  54. package/dist/elements/editor/utils/set-editor-editable-height.d.ts.map +1 -0
  55. package/dist/elements/editor/utils/wrap-with-watchdog.d.ts +24 -0
  56. package/dist/elements/editor/utils/wrap-with-watchdog.d.ts.map +1 -0
  57. package/dist/elements/ensure-editor-elements-registered.d.ts +5 -0
  58. package/dist/elements/ensure-editor-elements-registered.d.ts.map +1 -0
  59. package/dist/elements/index.d.ts +6 -0
  60. package/dist/elements/index.d.ts.map +1 -0
  61. package/dist/elements/ui-part.d.ts +18 -0
  62. package/dist/elements/ui-part.d.ts.map +1 -0
  63. package/dist/index.cjs +5 -0
  64. package/dist/index.cjs.map +1 -0
  65. package/dist/index.d.ts +11 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.mjs +1400 -0
  68. package/dist/index.mjs.map +1 -0
  69. package/dist/interop/create-context-blazor-interop.d.ts +10 -0
  70. package/dist/interop/create-context-blazor-interop.d.ts.map +1 -0
  71. package/dist/interop/create-editable-blazor-interop.d.ts +21 -0
  72. package/dist/interop/create-editable-blazor-interop.d.ts.map +1 -0
  73. package/dist/interop/create-editor-blazor-interop.d.ts +19 -0
  74. package/dist/interop/create-editor-blazor-interop.d.ts.map +1 -0
  75. package/dist/interop/create-ui-part-blazor-interop.d.ts +10 -0
  76. package/dist/interop/create-ui-part-blazor-interop.d.ts.map +1 -0
  77. package/dist/interop/index.d.ts +5 -0
  78. package/dist/interop/index.d.ts.map +1 -0
  79. package/dist/interop/utils/create-editor-value-sync.d.ts +63 -0
  80. package/dist/interop/utils/create-editor-value-sync.d.ts.map +1 -0
  81. package/dist/interop/utils/index.d.ts +2 -0
  82. package/dist/interop/utils/index.d.ts.map +1 -0
  83. package/dist/shared/async-registry.d.ts +136 -0
  84. package/dist/shared/async-registry.d.ts.map +1 -0
  85. package/dist/shared/camel-case.d.ts +8 -0
  86. package/dist/shared/camel-case.d.ts.map +1 -0
  87. package/dist/shared/debounce.d.ts +2 -0
  88. package/dist/shared/debounce.d.ts.map +1 -0
  89. package/dist/shared/deep-camel-case-keys.d.ts +8 -0
  90. package/dist/shared/deep-camel-case-keys.d.ts.map +1 -0
  91. package/dist/shared/filter-object-values.d.ts +9 -0
  92. package/dist/shared/filter-object-values.d.ts.map +1 -0
  93. package/dist/shared/index.d.ts +16 -0
  94. package/dist/shared/index.d.ts.map +1 -0
  95. package/dist/shared/is-empty-object.d.ts +2 -0
  96. package/dist/shared/is-empty-object.d.ts.map +1 -0
  97. package/dist/shared/is-plain-object.d.ts +8 -0
  98. package/dist/shared/is-plain-object.d.ts.map +1 -0
  99. package/dist/shared/map-object-values.d.ts +11 -0
  100. package/dist/shared/map-object-values.d.ts.map +1 -0
  101. package/dist/shared/once.d.ts +2 -0
  102. package/dist/shared/once.d.ts.map +1 -0
  103. package/dist/shared/shallow-equal.d.ts +9 -0
  104. package/dist/shared/shallow-equal.d.ts.map +1 -0
  105. package/dist/shared/timeout.d.ts +8 -0
  106. package/dist/shared/timeout.d.ts.map +1 -0
  107. package/dist/shared/uid.d.ts +7 -0
  108. package/dist/shared/uid.d.ts.map +1 -0
  109. package/dist/shared/wait-for-dom-ready.d.ts +5 -0
  110. package/dist/shared/wait-for-dom-ready.d.ts.map +1 -0
  111. package/dist/shared/wait-for-interactive-attribute.d.ts +18 -0
  112. package/dist/shared/wait-for-interactive-attribute.d.ts.map +1 -0
  113. package/dist/shared/wait-for.d.ts +20 -0
  114. package/dist/shared/wait-for.d.ts.map +1 -0
  115. package/dist/types/can-be-promise.type.d.ts +2 -0
  116. package/dist/types/can-be-promise.type.d.ts.map +1 -0
  117. package/dist/types/dot-net-interop.type.d.ts +7 -0
  118. package/dist/types/dot-net-interop.type.d.ts.map +1 -0
  119. package/dist/types/index.d.ts +4 -0
  120. package/dist/types/index.d.ts.map +1 -0
  121. package/dist/types/required-by.type.d.ts +2 -0
  122. package/dist/types/required-by.type.d.ts.map +1 -0
  123. package/package.json +49 -0
  124. package/src/ckeditor5-blazor-error.ts +9 -0
  125. package/src/elements/context/context.test.ts +323 -0
  126. package/src/elements/context/context.ts +128 -0
  127. package/src/elements/context/contexts-registry.test.ts +10 -0
  128. package/src/elements/context/contexts-registry.ts +10 -0
  129. package/src/elements/context/index.ts +3 -0
  130. package/src/elements/context/typings.ts +38 -0
  131. package/src/elements/editable.test.ts +383 -0
  132. package/src/elements/editable.ts +183 -0
  133. package/src/elements/editor/custom-editor-plugins.test.ts +103 -0
  134. package/src/elements/editor/custom-editor-plugins.ts +85 -0
  135. package/src/elements/editor/editor.test.ts +562 -0
  136. package/src/elements/editor/editor.ts +330 -0
  137. package/src/elements/editor/editors-registry.test.ts +10 -0
  138. package/src/elements/editor/editors-registry.ts +10 -0
  139. package/src/elements/editor/index.ts +2 -0
  140. package/src/elements/editor/plugins/dispatch-editor-roots-change-event.ts +76 -0
  141. package/src/elements/editor/plugins/index.ts +2 -0
  142. package/src/elements/editor/plugins/sync-editor-with-input.ts +79 -0
  143. package/src/elements/editor/typings.ts +114 -0
  144. package/src/elements/editor/utils/create-editor-in-context.ts +89 -0
  145. package/src/elements/editor/utils/get-editor-roots-values.test.ts +48 -0
  146. package/src/elements/editor/utils/get-editor-roots-values.ts +21 -0
  147. package/src/elements/editor/utils/index.ts +13 -0
  148. package/src/elements/editor/utils/is-single-root-editor.test.ts +40 -0
  149. package/src/elements/editor/utils/is-single-root-editor.ts +11 -0
  150. package/src/elements/editor/utils/load-editor-constructor.test.ts +62 -0
  151. package/src/elements/editor/utils/load-editor-constructor.ts +29 -0
  152. package/src/elements/editor/utils/load-editor-plugins.test.ts +100 -0
  153. package/src/elements/editor/utils/load-editor-plugins.ts +72 -0
  154. package/src/elements/editor/utils/load-editor-translations.ts +232 -0
  155. package/src/elements/editor/utils/normalize-custom-translations.test.ts +152 -0
  156. package/src/elements/editor/utils/normalize-custom-translations.ts +17 -0
  157. package/src/elements/editor/utils/query-all-editor-ids.ts +9 -0
  158. package/src/elements/editor/utils/query-editor-editables.ts +101 -0
  159. package/src/elements/editor/utils/resolve-editor-config-elements-references.test.ts +93 -0
  160. package/src/elements/editor/utils/resolve-editor-config-elements-references.ts +36 -0
  161. package/src/elements/editor/utils/resolve-editor-config-translations.test.ts +131 -0
  162. package/src/elements/editor/utils/resolve-editor-config-translations.ts +77 -0
  163. package/src/elements/editor/utils/set-editor-editable-height.test.ts +131 -0
  164. package/src/elements/editor/utils/set-editor-editable-height.ts +15 -0
  165. package/src/elements/editor/utils/wrap-with-watchdog.test.ts +45 -0
  166. package/src/elements/editor/utils/wrap-with-watchdog.ts +51 -0
  167. package/src/elements/ensure-editor-elements-registered.ts +24 -0
  168. package/src/elements/index.ts +14 -0
  169. package/src/elements/ui-part.test.ts +156 -0
  170. package/src/elements/ui-part.ts +84 -0
  171. package/src/index.ts +15 -0
  172. package/src/interop/create-context-blazor-interop.test.ts +30 -0
  173. package/src/interop/create-context-blazor-interop.ts +15 -0
  174. package/src/interop/create-editable-blazor-interop.test.ts +213 -0
  175. package/src/interop/create-editable-blazor-interop.ts +98 -0
  176. package/src/interop/create-editor-blazor-interop.test.ts +183 -0
  177. package/src/interop/create-editor-blazor-interop.ts +112 -0
  178. package/src/interop/create-ui-part-blazor-interop.test.ts +30 -0
  179. package/src/interop/create-ui-part-blazor-interop.ts +15 -0
  180. package/src/interop/index.ts +4 -0
  181. package/src/interop/utils/create-editor-value-sync.test.ts +302 -0
  182. package/src/interop/utils/create-editor-value-sync.ts +160 -0
  183. package/src/interop/utils/index.ts +1 -0
  184. package/src/shared/async-registry.test.ts +737 -0
  185. package/src/shared/async-registry.ts +353 -0
  186. package/src/shared/camel-case.test.ts +35 -0
  187. package/src/shared/camel-case.ts +11 -0
  188. package/src/shared/debounce.test.ts +72 -0
  189. package/src/shared/debounce.ts +16 -0
  190. package/src/shared/deep-camel-case-keys.test.ts +34 -0
  191. package/src/shared/deep-camel-case-keys.ts +26 -0
  192. package/src/shared/filter-object-values.test.ts +25 -0
  193. package/src/shared/filter-object-values.ts +17 -0
  194. package/src/shared/index.ts +15 -0
  195. package/src/shared/is-empty-object.test.ts +78 -0
  196. package/src/shared/is-empty-object.ts +3 -0
  197. package/src/shared/is-plain-object.test.ts +38 -0
  198. package/src/shared/is-plain-object.ts +15 -0
  199. package/src/shared/map-object-values.test.ts +29 -0
  200. package/src/shared/map-object-values.ts +19 -0
  201. package/src/shared/once.test.ts +116 -0
  202. package/src/shared/once.ts +12 -0
  203. package/src/shared/shallow-equal.test.ts +51 -0
  204. package/src/shared/shallow-equal.ts +30 -0
  205. package/src/shared/timeout.test.ts +65 -0
  206. package/src/shared/timeout.ts +13 -0
  207. package/src/shared/uid.test.ts +25 -0
  208. package/src/shared/uid.ts +8 -0
  209. package/src/shared/wait-for-dom-ready.test.ts +87 -0
  210. package/src/shared/wait-for-dom-ready.ts +21 -0
  211. package/src/shared/wait-for-interactive-attribute.test.ts +93 -0
  212. package/src/shared/wait-for-interactive-attribute.ts +50 -0
  213. package/src/shared/wait-for.test.ts +24 -0
  214. package/src/shared/wait-for.ts +56 -0
  215. package/src/types/can-be-promise.type.ts +1 -0
  216. package/src/types/dot-net-interop.type.ts +6 -0
  217. package/src/types/dotnet-global.d.ts +14 -0
  218. package/src/types/index.ts +3 -0
  219. package/src/types/required-by.type.ts +1 -0
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolves element references in configuration object.
3
+ * Looks for objects with { $element: "selector" } format and replaces them with actual DOM elements.
4
+ *
5
+ * @param obj - Configuration object to process
6
+ * @returns Processed configuration object with resolved element references
7
+ */
8
+ export declare function resolveEditorConfigElementReferences<T>(obj: T): T;
9
+ //# sourceMappingURL=resolve-editor-config-elements-references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-editor-config-elements-references.d.ts","sourceRoot":"","sources":["../../../../../src/elements/editor/utils/resolve-editor-config-elements-references.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA4BjE"}
@@ -0,0 +1,25 @@
1
+ import { Translations } from 'ckeditor5';
2
+ /**
3
+ * Resolves translation references in a configuration object.
4
+ *
5
+ * The configuration may contain objects with the form `{ $translation: "some.key" }`.
6
+ * These are replaced with the actual string from the provided translations map.
7
+ *
8
+ * The function will walk the provided object recursively, handling arrays and
9
+ * nested objects. Primitive values are returned as-is. If a translation key is
10
+ * not present in the map, a warning is logged and `null` is returned for that
11
+ * value.
12
+ *
13
+ * @param translations - An array of CKEditor `Translations` objects. Each translation
14
+ * pack will be searched in order for the requested key, and the
15
+ * first matching value will be returned. This mirrors the format
16
+ * returned by `loadAllEditorTranslations` and simplifies the
17
+ * caller's API.
18
+ * @param language - Language identifier to look up in the packs. Only this locale
19
+ * will be consulted, ensuring that keys from other languages are
20
+ * ignored even if they appear earlier in the array.
21
+ * @param obj - Configuration object to process
22
+ * @returns Processed configuration object with resolved translations.
23
+ */
24
+ export declare function resolveEditorConfigTranslations<T>(translations: Translations[], language: string, obj: T): T;
25
+ //# sourceMappingURL=resolve-editor-config-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-editor-config-translations.d.ts","sourceRoot":"","sources":["../../../../../src/elements/editor/utils/resolve-editor-config-translations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,EAC/C,YAAY,EAAE,YAAY,EAAE,EAC5B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,CAAC,GACL,CAAC,CA6BH"}
@@ -0,0 +1,9 @@
1
+ import { Editor } from 'ckeditor5';
2
+ /**
3
+ * Sets the height of the editable area in the CKEditor instance.
4
+ *
5
+ * @param instance - The CKEditor instance to modify.
6
+ * @param height - The height in pixels to set for the editable area.
7
+ */
8
+ export declare function setEditorEditableHeight(instance: Editor, height: number): void;
9
+ //# sourceMappingURL=set-editor-editable-height.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-editor-editable-height.d.ts","sourceRoot":"","sources":["../../../../../src/elements/editor/utils/set-editor-editable-height.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAM9E"}
@@ -0,0 +1,24 @@
1
+ import { Editor, EditorWatchdog } from 'ckeditor5';
2
+ /**
3
+ * Wraps an Editor creator with a watchdog for automatic recovery.
4
+ *
5
+ * @param Editor - The Editor creator to wrap.
6
+ * @returns The Editor creator wrapped with a watchdog.
7
+ */
8
+ export declare function wrapWithWatchdog(Editor: EditorCreator): Promise<{
9
+ watchdog: EditorWatchdog<Editor>;
10
+ Constructor: {
11
+ create: (...args: Parameters<(typeof Editor)["create"]>) => Promise<Editor>;
12
+ };
13
+ }>;
14
+ /**
15
+ * Unwraps the EditorWatchdog from the editor instance.
16
+ */
17
+ export declare function unwrapEditorWatchdog(editor: Editor): EditorWatchdog | null;
18
+ /**
19
+ * Type representing an Editor creator with a create method.
20
+ */
21
+ export type EditorCreator = {
22
+ create: (...args: any) => Promise<Editor>;
23
+ };
24
+ //# sourceMappingURL=wrap-with-watchdog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-with-watchdog.d.ts","sourceRoot":"","sources":["../../../../../src/elements/editor/utils/wrap-with-watchdog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIxD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,aAAa;;;0BAe9B,UAAU,CAAC,CAAA,OAAO,MAAM,EAAC,QAAQ,CAAC,CAAC;;GAOhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAM1E;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Registers all available Blazor component hooks.
3
+ */
4
+ export declare function ensureEditorElementsRegistered(): void;
5
+ //# sourceMappingURL=ensure-editor-elements-registered.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-editor-elements-registered.d.ts","sourceRoot":"","sources":["../../../src/elements/ensure-editor-elements-registered.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,wBAAgB,8BAA8B,SAQ7C"}
@@ -0,0 +1,6 @@
1
+ export { ContextComponentElement, type ContextConfig, type ContextCreatorConfig, ContextsRegistry, } from './context';
2
+ export { EditableComponentElement } from './editable';
3
+ export { type EditorCloudConfig, EditorComponentElement, type EditorConfig, } from './editor';
4
+ export { ensureEditorElementsRegistered } from './ensure-editor-elements-registered';
5
+ export { UIPartComponentElement } from './ui-part';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,KAAK,iBAAiB,EACtB,sBAAsB,EACtB,KAAK,YAAY,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * UI Part hook for Blazor. It allows you to create UI parts for multi-root editors.
3
+ */
4
+ export declare class UIPartComponentElement extends HTMLElement {
5
+ /**
6
+ * The promise that resolves when the UI part is mounted.
7
+ */
8
+ private mountedPromise;
9
+ /**
10
+ * Mounts the UI part component.
11
+ */
12
+ connectedCallback(): Promise<void>;
13
+ /**
14
+ * Destroys the UI part component. Unmounts UI parts from the editor.
15
+ */
16
+ disconnectedCallback(): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=ui-part.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-part.d.ts","sourceRoot":"","sources":["../../../src/elements/ui-part.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,WAAW;IACrD;;OAEG;IACH,OAAO,CAAC,cAAc,CAA8B;IAEpD;;OAEG;IACG,iBAAiB;IAgCvB;;OAEG;IACG,oBAAoB;CAW3B"}
package/dist/index.cjs ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var st=Object.create;var F=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty;var mt=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ut(t))!dt.call(i,n)&&n!==e&&F(i,n,{get:()=>t[n],enumerable:!(a=ct(t,n))||a.enumerable});return i};var r=(i,t,e)=>(e=i!=null?st(lt(i)):{},mt(t||!i||!i.__esModule?F(e,"default",{value:i,enumerable:!0}):e,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class b extends Error{constructor(t){super(t),this.name="CKEditor5BlazorError"}}class U{items=new Map;initializationErrors=new Map;pendingCallbacks=new Map;watchers=new Set;execute(t,e,a){const n=this.items.get(t),o=this.initializationErrors.get(t);return o?(a?.(o),Promise.reject(o)):n?Promise.resolve(e(n)):new Promise((s,u)=>{const l=this.getPendingCallbacks(t);l.success.push(async c=>{s(await e(c))}),a?l.error.push(a):l.error.push(u)})}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 a=this.pendingCallbacks.get(t);a&&(a.success.forEach(n=>n(e)),this.pendingCallbacks.delete(t)),this.registerAsDefault(t,e),this.notifyWatchers()}error(t,e){this.items.delete(t),this.initializationErrors.set(t,e);const a=this.pendingCallbacks.get(t);a&&(a.error.forEach(n=>n(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,e){return new Promise((a,n)=>{let o=!1,s=null;this.execute(t,u=>{o||(s!==null&&clearTimeout(s),a(u))},u=>{o||(s!==null&&clearTimeout(s),n(u))}),e&&(s=setTimeout(()=>{o=!0,n(new Error(`Timeout waiting for item with ID "${t}" to be registered.`))},e))})}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)}reset(){this.items.clear(),this.initializationErrors.clear(),this.pendingCallbacks.clear(),this.notifyWatchers()}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 M(i,t){let e=null;return(...a)=>{e&&clearTimeout(e),e=setTimeout(()=>{t(...a)},i)}}function ht(i,t){const e=Object.entries(i).filter(([a,n])=>t(n,a));return Object.fromEntries(e)}function H(i){return Object.keys(i).length===0&&i.constructor===Object}function R(i,t){const e=Object.entries(i).map(([a,n])=>[a,t(n,a)]);return Object.fromEntries(e)}function pt(i,t){if(i===t)return!0;const e=Object.keys(i),a=Object.keys(t);if(e.length!==a.length)return!1;for(const n of e)if(i[n]!==t[n]||!Object.prototype.hasOwnProperty.call(t,n))return!1;return!0}function wt(){return Math.random().toString(36).substring(2)}function ft(i,{timeOutAfter:t=500,retryAfter:e=100}={}){return new Promise((a,n)=>{const o=Date.now();let s=null;const u=setTimeout(()=>{n(s??new Error("Timeout"))},t),l=async()=>{try{const c=await i();clearTimeout(u),a(c)}catch(c){s=c,Date.now()-o>t?n(c):setTimeout(l,e)}};l()})}function D(){return new Promise(i=>{switch(document.readyState){case"loading":document.addEventListener("DOMContentLoaded",()=>i(),{once:!0});break;case"interactive":case"complete":setTimeout(i,0);break;default:console.warn("Unexpected document.readyState:",document.readyState),setTimeout(i,0)}})}function $(i){if(i.hasAttribute("data-cke-interactive"))return{promise:Promise.resolve(),disconnect:()=>{}};let t;return{promise:new Promise(a=>{t=new MutationObserver(n=>{for(const o of n)if(o.type==="attributes"&&o.attributeName==="data-cke-interactive"&&i.hasAttribute("data-cke-interactive")){t.disconnect(),a();break}}),t.observe(i,{attributes:!0})}),disconnect:()=>t?.disconnect()}}function O(i){i.setAttribute("data-cke-interactive","true")}const N=Symbol.for("context-editor-watchdog");async function gt({element:i,context:t,creator:e,config:a}){const n=wt();await t.add({creator:(l,c)=>e.create(l,c),id:n,sourceElementOrData:i,type:"editor",config:a});const o=t.getItem(n),s={state:"available",editorContextId:n,context:t};o[N]=s;const u=t.destroy.bind(t);return t.destroy=async()=>(s.state="unavailable",u()),{...s,editor:o}}function yt(i){return N in i?i[N]:null}function J(i){return Array.from(i.model.document.getRoots()).reduce((t,e)=>(e.rootName==="$graveyard"||(t[e.rootName]=i.getData({rootName:e.rootName})),t),Object.create({}))}function P(i){return["inline","classic","balloon","decoupled"].includes(i)}async function B(i){const t=await import("ckeditor5"),a={inline:t.InlineEditor,balloon:t.BalloonEditor,classic:t.ClassicEditor,decoupled:t.DecoupledEditor,multiroot:t.MultiRootEditor}[i];if(!a)throw new b(`Unsupported editor type: ${i}`);return a}class S{static the=new S;plugins=new Map;constructor(){}register(t,e){if(this.plugins.has(t))throw new b(`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 b(`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 K(i){const t=await import("ckeditor5");let e=null;const a=i.map(async n=>{const o=await S.the.get(n);if(o)return o;const{[n]:s}=t;if(s)return s;if(!e)try{e=await import("ckeditor5-premium-features")}catch(l){throw console.error(`Failed to load premium package: ${l}`),new b(`Plugin "${n}" not found in base package and failed to load premium package.`)}const{[n]:u}=e||{};if(u)return u;throw new b(`Plugin "${n}" not found in base or premium packages.`)});return{loadedPlugins:await Promise.all(a),hasPremium:!!e}}async function G(i,t){const e=[i.ui,i.content];return await Promise.all([_("ckeditor5",e),t&&_("ckeditor5-premium-features",e)].filter(n=>!!n)).then(n=>n.flat())}async function _(i,t){return await Promise.all(t.filter(e=>e!=="en").map(async e=>{const a=await bt(i,e);return a?.default??a}).filter(Boolean))}async function bt(i,t){try{if(i==="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 ${i}/${t}:`,e),null}}function Y(i){return R(i,t=>({dictionary:t}))}function X(){return Array.from(document.querySelectorAll("cke5-editor")).map(i=>i.getAttribute("data-cke-editor-id")).filter(i=>i!==null)}function Q(i){const t=Z(i);return R(t,({element:e})=>e)}function j(i){const t=Z(i),e=R(t,({content:a})=>a);return ht(e,a=>typeof a=="string")}function Z(i){const t=Array.from(document.querySelectorAll(`cke5-editable[data-cke-editor-id="${i}"]`)).reduce((s,u)=>{const l=u.getAttribute("data-cke-root-name"),c=u.getAttribute("data-cke-content");return s[l]={element:u.querySelector("[data-cke-editable-content]"),content:c},s},Object.create({})),e=document.querySelector(`cke5-editor[data-cke-editor-id="${i}"]`);if(!e)return t;const a=t.main,n=JSON.parse(e.getAttribute("data-cke-content")),o=document.querySelector(`#${i}_editor `);return a&&n?.main?{...t,main:{...a,content:a.content||n.main}}:o?{...t,main:{element:o,content:n?.main||null}}:t}function I(i){if(!i||typeof i!="object")return i;if(Array.isArray(i))return i.map(a=>I(a));const t=i;if(t.$element&&typeof t.$element=="string"){const a=document.querySelector(t.$element);return a||console.warn(`Element not found for selector: ${t.$element}`),a||null}const e=Object.create(null);for(const[a,n]of Object.entries(i))e[a]=I(n);return e}function T(i,t,e){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(o=>T(i,t,o));const a=e;if(a.$translation&&typeof a.$translation=="string"){const o=a.$translation,s=Et(i,o,t);return s===void 0&&console.warn(`Translation not found for key: ${o}`),s!==void 0?s:null}const n=Object.create(null);for(const[o,s]of Object.entries(e))n[o]=T(i,t,s);return n}function Et(i,t,e){for(const a of i){const n=a[e];if(n?.dictionary&&t in n.dictionary)return n.dictionary[t]}}function kt(i,t){const{editing:e}=i;e.view.change(a=>{a.setStyle("height",`${t}px`,e.view.document.getRoot())})}const V=Symbol.for("elixir-editor-watchdog");async function vt(i){const{EditorWatchdog:t}=await import("ckeditor5"),e=new t(i);return e.setCreator(async(...a)=>{const n=await i.create(...a);return n[V]=e,n}),{watchdog:e,Constructor:{create:async(...a)=>(await e.create(...a),e.editor)}}}function Ct(i){return V in i?i[V]:null}class k extends U{static the=new k}class At extends HTMLElement{contextPromise=null;interactiveWait;async connectedCallback(){await D(),this.interactiveWait=$(this),await this.interactiveWait.promise,await this.initializeContext()}async initializeContext(){const t=this.getAttribute("data-cke-context-id"),e=JSON.parse(this.getAttribute("data-cke-language")),a=JSON.parse(this.getAttribute("data-cke-context")),{customTranslations:n,watchdogConfig:o,config:{plugins:s,...u}}=a,{loadedPlugins:l,hasPremium:c}=await K(s??[]),w=[...await G(e,c),Y(n||{})].filter(g=>!H(g));this.contextPromise=(async()=>{const{ContextWatchdog:g,Context:f}=await import("ckeditor5"),p=new g(f,{crashNumberLimit:10,...o});let E=I(u);return E=T([...w].reverse(),e.ui,E),await p.create({...E,language:e,plugins:l,...w.length&&{translations:w}}),p.on("itemError",(...x)=>{console.error("Context item error:",...x)}),p})();const v=await this.contextPromise;this.isConnected&&k.the.register(t,v)}async disconnectedCallback(){this.interactiveWait?.disconnect();const t=this.getAttribute("data-cke-context-id");this.style.display="none";try{await(await this.contextPromise)?.destroy()}finally{this.contextPromise=null,t&&k.the.hasItem(t)&&k.the.unregister(t)}}}class h extends U{static the=new h}class tt extends HTMLElement{editorPromise=null;interactiveWait;beforeDestroyCallbacks=[];onBeforeDestroy(t){this.beforeDestroyCallbacks.push(t)}async connectedCallback(){await D(),this.interactiveWait=$(this),await this.interactiveWait.promise,await this.initializeEditable()}async initializeEditable(){this.hasAttribute("data-cke-editor-id")||this.setAttribute("data-cke-editor-id",X()[0]);const t=this.getAttribute("data-cke-editor-id"),e=this.getAttribute("data-cke-root-name"),a=this.getAttribute("data-cke-content"),n=Number.parseInt(this.getAttribute("data-cke-save-debounce-ms"),10);if(!t||!e)throw new b("Editor ID or Root Name is missing.");this.style.display="block",this.editorPromise=h.the.execute(t,async o=>{if(!this.isConnected)return null;const{ui:s,editing:u,model:l}=o,c=this.querySelector("input");if(l.document.getRoot(e)?.isAttached()){if(a!==null){const p=o.getData({rootName:e});p&&p!==a&&o.setData({[e]:a})}return o}o.addRoot(e,{isUndoable:!1,...a!==null&&{data:a}});const w=this.querySelector("[data-cke-editable-content]"),v=s.view.createEditable(e,w);s.addEditable(v),u.view.forceRender();const g=()=>{if(!l.document.getRoot(e)?.isAttached())return;const p=o.getData({rootName:e});c&&(c.value=p,c.dispatchEvent(new Event("input"))),this.dispatchEvent(new CustomEvent("change",{detail:{value:p}}))},f=M(n,g);return o.model.document.on("change:data",f),this.onBeforeDestroy(()=>o.model.document.off("change:data",f)),g(),o})}async disconnectedCallback(){this.interactiveWait?.disconnect();const t=this.getAttribute("data-cke-root-name");this.style.display="none";const e=await this.editorPromise;this.editorPromise=null;for(const a of this.beforeDestroyCallbacks)a();if(this.beforeDestroyCallbacks=[],e&&e.state!=="destroyed"&&t){const a=e.model.document.getRoot(t);if(a&&"detachEditable"in e){try{e.ui.view.editables[t]&&e.detachEditable(a)}catch(n){console.error("Unable unmount editable from root:",n)}a.isAttached()&&e.detachRoot(t,!1)}}}}async function Pt({saveDebounceMs:i,editorId:t,targetElement:e}){const{Plugin:a}=await import("ckeditor5");return class extends a{static get pluginName(){return"DispatchEditorRootsChangeEvent"}afterInit(){const{editor:o}=this,s=M(i,this.dispatch);o.model.document.on("change:data",s),o.once("ready",this.dispatch)}dispatch=()=>{const{editor:o}=this;e.dispatchEvent(new y({editorId:t,editor:o,roots:J(o)}))}}}class y extends CustomEvent{static EVENT_NAME="ckeditor5:change:data";constructor(t){super(y.EVENT_NAME,{detail:t,bubbles:!0})}}async function It(i){const{Plugin:t}=await import("ckeditor5");return class extends t{input=null;form=null;static get pluginName(){return"SyncEditorWithInput"}afterInit(){const{editor:a}=this,o=a.sourceElement.id.replace(/_editor$/,"");this.input=document.getElementById(`${o}_input`),this.input&&(a.model.document.on("change:data",M(i,()=>this.sync())),a.once("ready",this.sync),this.form=this.input.closest("form"),this.form?.addEventListener("submit",this.sync))}sync=()=>{if(this.input){const a=this.editor.getData();this.input.value=a,this.input.dispatchEvent(new Event("input",{bubbles:!0}))}};destroy(){this.form&&this.form.removeEventListener("submit",this.sync),this.input=null,this.form=null}}}class et extends HTMLElement{editorPromise=null;interactiveWait;async connectedCallback(){await D(),this.interactiveWait=$(this),B("classic"),await this.interactiveWait.promise,await this.initializeEditor()}async initializeEditor(){const t=this.getAttribute("data-cke-editor-id");h.the.resetErrors(t);try{this.style.display="block",this.editorPromise=this.createEditor();const e=await this.editorPromise;this.isConnected&&(h.the.register(t,e),e.once("destroy",()=>{h.the.hasItem(t)&&h.the.unregister(t)}))}catch(e){console.error(`Error initializing CKEditor5 instance with ID "${t}":`,e),this.editorPromise=null,h.the.error(t,e)}}async disconnectedCallback(){this.interactiveWait?.disconnect(),this.style.display="none";try{const t=await this.editorPromise;if(!t)return;const e=yt(t),a=Ct(t);e?e.state!=="unavailable"&&await e.context.remove(e.editorContextId):a?await a.destroy():await t.destroy()}finally{this.editorPromise=null}}async createEditor(){const t=this.getAttribute("data-cke-editor-id"),e=JSON.parse(this.getAttribute("data-cke-preset")),a=this.getAttribute("data-cke-context-id"),n=this.getAttribute("data-cke-editable-height")?Number.parseInt(this.getAttribute("data-cke-editable-height"),10):null,o=Number.parseInt(this.getAttribute("data-cke-save-debounce-ms"),10),s=JSON.parse(this.getAttribute("data-cke-language")),u=this.hasAttribute("data-cke-watchdog"),l=JSON.parse(this.getAttribute("data-cke-content")),{customTranslations:c,editorType:d,licenseKey:w,config:{plugins:v,...g}}=e;let f=await B(d);const p=await(a?k.the.waitFor(a):null);if(u&&!p){const m=await vt(f);({Constructor:f}=m),m.watchdog.on("restart",()=>{const C=m.watchdog.editor;this.editorPromise=Promise.resolve(C),h.the.register(t,C)})}const{loadedPlugins:E,hasPremium:x}=await K(v);E.push(await Pt({saveDebounceMs:o,editorId:t,targetElement:this})),P(d)&&E.push(await It(o));const z=[...await G(s,x),Y(c||{})].filter(m=>!H(m));let A={...l,...j(t)};P(d)&&(A=A.main||"");const W=await(async()=>{let m=Q(t);if(!m.main){const L=P(d)?["main"]:Object.keys(A);rt(m,L)||(m=await Tt(t,L),A={...l,...j(t)})}P(d)&&"main"in m&&(m=m.main);let C=I(g);C=T([...z].reverse(),s.ui,C);const q={...C,initialData:A,licenseKey:w,plugins:E,language:s,...z.length&&{translations:z}};return!p||!(m instanceof HTMLElement)?f.create(m,q):(await gt({context:p,element:m,creator:f,config:q})).editor})();return P(d)&&n&&kt(W,n),W}}function rt(i,t){return t.every(e=>i[e])}async function Tt(i,t){return ft(()=>{const e=Q(i);if(!rt(e,t))throw new Error(`It looks like not all required root elements are present yet.
2
+ * If you want to wait for them, ensure they are registered before editor initialization.
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(a=>!e[a]).join(", ")}.`);return e},{timeOutAfter:2e3,retryAfter:100})}class it extends HTMLElement{mountedPromise=null;async connectedCallback(){await D();const t=this.getAttribute("data-cke-editor-id")||X()[0],e=this.getAttribute("data-cke-name");!t||!e||(this.style.display="block",this.mountedPromise=h.the.execute(t,a=>{if(!this.isConnected)return;const{ui:n}=a,o=Dt(e),s=n.view[o];if(!s)throw new b(`Unknown UI part name: "${e}". Supported names are "toolbar" and "menubar".`);this.appendChild(s.element)}))}async disconnectedCallback(){this.style.display="none",await this.mountedPromise,this.mountedPromise=null,this.innerHTML=""}}function Dt(i){switch(i){case"toolbar":return"toolbar";case"menubar":return"menuBarView";default:return null}}const Ot={"cke5-editor":et,"cke5-context":At,"cke5-ui-part":it,"cke5-editable":tt};function at(){for(const[i,t]of Object.entries(Ot))window.customElements.get(i)||window.customElements.define(i,t)}function St(i){return O(i),{unmount(){}}}function nt(i,t){const e={pendingValue:null,lastSyncedValue:null},a=()=>{e.pendingValue=null},n=(o,s,u)=>{if(u||e.pendingValue===null)return;const l=t.getCurrentValue();t.isEqual(l,e.pendingValue)||t.applyValue(e.pendingValue),e.pendingValue=null};return i.model.document.on("change:data",a),i.ui.focusTracker.on("change:isFocused",n),{unmount(){i.model.document.off("change:data",a),i.ui.focusTracker.off("change:isFocused",n)},shouldNotify(o){return e.lastSyncedValue!==null&&t.isEqual(e.lastSyncedValue,o)?!1:(e.lastSyncedValue=o,!0)},setValue(o){if(i.ui.focusTracker.isFocused){e.pendingValue=o;return}e.lastSyncedValue!==null&&t.isEqual(e.lastSyncedValue,o)||(e.lastSyncedValue=o,t.applyValue(o))}}}function ot(){return{unmount(){},shouldNotify(i){return!1},setValue(i){}}}function xt(i,t){const e=i.getAttribute("data-cke-editor-id"),a=i.getAttribute("data-cke-root-name")??"main";let n=!1,o=ot(),s=null;const u=c=>{if(!(c instanceof y)||c.detail.editorId!==e)return;const d=c.detail.roots[a];d!==void 0&&o.shouldNotify(d)&&t.invokeMethodAsync("OnChangeEditableData",s,d)};return(async()=>{const c=await h.the.waitFor(e);s=DotNet.createJSObjectReference(c),o=nt(c,{getCurrentValue:()=>c.getData({rootName:a})??"",applyValue:d=>c.setData({[a]:d}),isEqual:(d,w)=>d===w})})(),document.body.addEventListener(y.EVENT_NAME,u),O(i),{unmount(){n||(document.body.removeEventListener(y.EVENT_NAME,u),o.unmount(),s&&(DotNet.disposeJSObjectReference(s),s=null),n=!0)},setValue:async c=>{n||(await h.the.waitFor(e),o.setValue(c))}}}function zt(i,t){const e=i.getAttribute("data-cke-editor-id");let a=!1,n=null,o=ot(),s=null;const u=c=>{!(c instanceof y)||c.detail.editorId!==e||o.shouldNotify(c.detail.roots)&&t.invokeMethodAsync("OnChangeEditorData",s,c.detail.roots)};return(async()=>{const c=await h.the.waitFor(e);s=globalThis.DotNet.createJSObjectReference(c),o=nt(c,{getCurrentValue:()=>J(c),applyValue:w=>c.setData(w),isEqual:pt});const d=(w,v,g)=>{const f=g?"OnEditorFocus":"OnEditorBlur";t.invokeMethodAsync(f,s)};c.ui.focusTracker.on("change:isFocused",d),t.invokeMethodAsync("OnEditorReady",s),n=()=>{c.ui.focusTracker.off("change:isFocused",d)}})(),document.body.addEventListener(y.EVENT_NAME,u),at(),O(i),{setValue:async c=>{a||(await h.the.waitFor(e),o.setValue(c))},unmount(){a||(document.body.removeEventListener(y.EVENT_NAME,u),o.unmount(),n?.(),s&&(globalThis.DotNet.disposeJSObjectReference(s),s=null),a=!0)}}}function Nt(i){return O(i),{unmount(){}}}exports.CKEditor5BlazorError=b;exports.CKEditor5ChangeDataEvent=y;exports.ContextsRegistry=k;exports.CustomEditorPluginsRegistry=S;exports.EditableComponentElement=tt;exports.EditorComponentElement=et;exports.EditorsRegistry=h;exports.UIPartComponentElement=it;exports.createContextBlazorInterop=St;exports.createEditableBlazorInterop=xt;exports.createEditorBlazorInterop=zt;exports.createUIPartBlazorInterop=Nt;exports.ensureEditorElementsRegistered=at;
5
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/ckeditor5-blazor-error.ts","../src/shared/async-registry.ts","../src/shared/debounce.ts","../src/shared/filter-object-values.ts","../src/shared/is-empty-object.ts","../src/shared/map-object-values.ts","../src/shared/shallow-equal.ts","../src/shared/uid.ts","../src/shared/wait-for.ts","../src/shared/wait-for-dom-ready.ts","../src/shared/wait-for-interactive-attribute.ts","../src/elements/editor/utils/create-editor-in-context.ts","../src/elements/editor/utils/get-editor-roots-values.ts","../src/elements/editor/utils/is-single-root-editor.ts","../src/elements/editor/utils/load-editor-constructor.ts","../src/elements/editor/custom-editor-plugins.ts","../src/elements/editor/utils/load-editor-plugins.ts","../src/elements/editor/utils/load-editor-translations.ts","../src/elements/editor/utils/normalize-custom-translations.ts","../src/elements/editor/utils/query-all-editor-ids.ts","../src/elements/editor/utils/query-editor-editables.ts","../src/elements/editor/utils/resolve-editor-config-elements-references.ts","../src/elements/editor/utils/resolve-editor-config-translations.ts","../src/elements/editor/utils/set-editor-editable-height.ts","../src/elements/editor/utils/wrap-with-watchdog.ts","../src/elements/context/contexts-registry.ts","../src/elements/context/context.ts","../src/elements/editor/editors-registry.ts","../src/elements/editable.ts","../src/elements/editor/plugins/dispatch-editor-roots-change-event.ts","../src/elements/editor/plugins/sync-editor-with-input.ts","../src/elements/editor/editor.ts","../src/elements/ui-part.ts","../src/elements/ensure-editor-elements-registered.ts","../src/interop/create-context-blazor-interop.ts","../src/interop/utils/create-editor-value-sync.ts","../src/interop/create-editable-blazor-interop.ts","../src/interop/create-editor-blazor-interop.ts","../src/interop/create-ui-part-blazor-interop.ts"],"sourcesContent":["/**\n * Custom error class for CKEditor5 Blazor-related errors.\n */\nexport class CKEditor5BlazorError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CKEditor5BlazorError';\n }\n}\n","/**\n * Generic async registry for objects with an async destroy method.\n * Provides a way to register, unregister, and execute callbacks on objects by ID.\n */\nexport class AsyncRegistry<T extends Destructible> {\n /**\n * Map of registered items.\n */\n private readonly items = new Map<RegistryId | null, T>();\n\n /**\n * Map of initialization errors for items that failed to register.\n */\n private readonly initializationErrors = new Map<RegistryId | null, any>();\n\n /**\n * Map of pending callbacks waiting for items to be registered or fail.\n */\n private readonly pendingCallbacks = new Map<RegistryId | null, PendingCallbacks<T>>();\n\n /**\n * Set of watchers that observe changes to the registry.\n */\n private readonly watchers = new Set<RegistryWatcher<T>>();\n\n /**\n * Executes a function on an item.\n * If the item is not yet registered, it will wait for it to be registered.\n *\n * @param id The ID of the item.\n * @param onSuccess The function to execute.\n * @param onError Optional error callback.\n * @returns A promise that resolves with the result of the function.\n */\n execute<R, E extends T = T>(\n id: RegistryId | null,\n onSuccess: (item: E) => R,\n onError?: (error: any) => void,\n ): Promise<Awaited<R>> {\n const item = this.items.get(id);\n const error = this.initializationErrors.get(id);\n\n // If error exists and callback provided, invoke it immediately.\n if (error) {\n onError?.(error);\n return Promise.reject(error);\n }\n\n // If item exists, invoke callback immediately (synchronously via Promise.resolve).\n if (item) {\n return Promise.resolve(onSuccess(item as E));\n }\n\n // Item not ready yet - queue the callbacks.\n return new Promise((resolve, reject) => {\n const pending = this.getPendingCallbacks(id);\n\n pending.success.push(async (item: T) => {\n resolve(await onSuccess(item as E));\n });\n\n if (onError) {\n pending.error.push(onError);\n }\n else {\n pending.error.push(reject);\n }\n });\n }\n\n /**\n * Registers an item.\n *\n * @param id The ID of the item.\n * @param item The item instance.\n */\n register(id: RegistryId | null, item: T): void {\n if (this.items.has(id)) {\n throw new Error(`Item with ID \"${id}\" is already registered.`);\n }\n\n this.resetErrors(id);\n this.items.set(id, item);\n\n // Execute all pending callbacks for this item (synchronously).\n const pending = this.pendingCallbacks.get(id);\n\n if (pending) {\n pending.success.forEach(callback => callback(item));\n this.pendingCallbacks.delete(id);\n }\n\n // Register the first item as the default item (null ID).\n this.registerAsDefault(id, item);\n this.notifyWatchers();\n }\n\n /**\n * Registers an error for an item.\n *\n * @param id The ID of the item.\n * @param error The error to register.\n */\n error(id: RegistryId | null, error: any): void {\n this.items.delete(id);\n this.initializationErrors.set(id, error);\n\n // Execute all pending error callbacks for this item.\n const pending = this.pendingCallbacks.get(id);\n\n if (pending) {\n pending.error.forEach(callback => callback(error));\n this.pendingCallbacks.delete(id);\n }\n\n // Set as default error if this is the first error and no items exist.\n if (this.initializationErrors.size === 1 && !this.items.size) {\n this.error(null, error);\n }\n\n // Notify watchers about the error state.\n this.notifyWatchers();\n }\n\n /**\n * Resets errors for an item.\n *\n * @param id The ID of the item.\n */\n resetErrors(id: RegistryId | null): void {\n const { initializationErrors } = this;\n\n // Clear default error if it's the same as the specific error.\n if (initializationErrors.has(null) && initializationErrors.get(null) === initializationErrors.get(id)) {\n initializationErrors.delete(null);\n }\n\n initializationErrors.delete(id);\n }\n\n /**\n * Un-registers an item.\n *\n * @param id The ID of the item.\n */\n unregister(id: RegistryId | null): void {\n if (!this.items.has(id)) {\n throw new Error(`Item with ID \"${id}\" is not registered.`);\n }\n\n // If unregistering the default item, clear it.\n if (id && this.items.get(null) === this.items.get(id)) {\n this.unregister(null);\n }\n\n this.items.delete(id);\n this.pendingCallbacks.delete(id);\n\n this.notifyWatchers();\n }\n\n /**\n * Gets all registered items.\n *\n * @returns An array of all registered items.\n */\n getItems(): T[] {\n return Array.from(this.items.values());\n }\n\n /**\n * Checks if an item with the given ID is registered.\n *\n * @param id The ID of the item.\n * @returns `true` if the item is registered, `false` otherwise.\n */\n hasItem(id: RegistryId | null): boolean {\n return this.items.has(id);\n }\n\n /**\n * Gets a promise that resolves with the item instance for the given ID.\n * If the item is not registered yet, it will wait for it to be registered.\n *\n * @param id The ID of the item.\n * @param timeout Optional timeout in milliseconds.\n * @returns A promise that resolves with the item instance.\n */\n waitFor<E extends T = T>(id: RegistryId | null, timeout?: number): Promise<E> {\n return new Promise<E>((resolve, reject) => {\n let exceedTimeout = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n void this.execute(\n id,\n (value: E) => {\n if (exceedTimeout) {\n return;\n }\n\n if (timer !== null) {\n clearTimeout(timer!);\n }\n\n (resolve as (value: E) => void)(value);\n },\n (error: any) => {\n if (exceedTimeout) {\n return;\n }\n\n if (timer !== null) {\n clearTimeout(timer!);\n }\n\n reject(error);\n },\n );\n\n if (timeout) {\n timer = setTimeout(() => {\n exceedTimeout = true;\n reject(new Error(`Timeout waiting for item with ID \"${id}\" to be registered.`));\n }, timeout);\n }\n });\n }\n\n /**\n * Destroys all registered items and clears the registry.\n * This will call the `destroy` method on each item.\n */\n async destroyAll() {\n const promises = (\n Array\n .from(new Set(this.items.values()))\n .map(item => item.destroy())\n );\n\n this.items.clear();\n this.pendingCallbacks.clear();\n\n await Promise.all(promises);\n\n this.notifyWatchers();\n }\n\n /**\n * Registers a watcher that will be called whenever the registry changes.\n *\n * @param watcher The watcher function to register.\n * @returns A function to unregister the watcher.\n */\n watch(watcher: RegistryWatcher<T>): () => void {\n this.watchers.add(watcher);\n\n // Call the watcher immediately with the current state.\n watcher(\n new Map(this.items),\n new Map(this.initializationErrors),\n );\n\n return this.unwatch.bind(this, watcher);\n }\n\n /**\n * Un-registers a watcher.\n *\n * @param watcher The watcher function to unregister.\n */\n unwatch(watcher: RegistryWatcher<T>): void {\n this.watchers.delete(watcher);\n }\n\n /**\n * Resets the registry by clearing all items, errors, and pending callbacks.\n */\n reset(): void {\n this.items.clear();\n this.initializationErrors.clear();\n this.pendingCallbacks.clear();\n this.notifyWatchers();\n }\n\n /**\n * Notifies all watchers about changes to the registry.\n */\n private notifyWatchers(): void {\n this.watchers.forEach(\n watcher => watcher(\n new Map(this.items),\n new Map(this.initializationErrors),\n ),\n );\n }\n\n /**\n * Gets or creates pending callbacks for a specific ID.\n *\n * @param id The ID of the item.\n * @returns The pending callbacks structure.\n */\n private getPendingCallbacks(id: RegistryId | null): PendingCallbacks<T> {\n let pending = this.pendingCallbacks.get(id);\n\n if (!pending) {\n pending = { success: [], error: [] };\n this.pendingCallbacks.set(id, pending);\n }\n\n return pending;\n }\n\n /**\n * Registers an item as the default (null ID) item if it's the first one.\n *\n * @param id The ID of the item being registered.\n * @param item The item instance.\n */\n private registerAsDefault(id: RegistryId | null, item: T): void {\n if (this.items.size === 1 && id !== null) {\n this.register(null, item);\n }\n }\n}\n\n/**\n * Interface for objects that can be destroyed.\n */\nexport type Destructible = {\n destroy: () => Promise<any>;\n};\n\n/**\n * Identifier of the registry item.\n */\ntype RegistryId = string;\n\n/**\n * Structure holding pending success and error callbacks for an item.\n */\ntype PendingCallbacks<T> = {\n success: Array<(item: T) => void>;\n error: Array<(error: Error) => void>;\n};\n\n/**\n * Callback type for watching registry changes.\n */\ntype RegistryWatcher<T> = (\n items: Map<RegistryId | null, T>,\n errors: Map<RegistryId | null, Error>,\n) => void;\n","export function debounce<T extends (...args: any[]) => any>(\n delay: number,\n callback: T,\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n return (...args: Parameters<T>): void => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n timeoutId = setTimeout(() => {\n callback(...args);\n }, delay);\n };\n}\n","/**\n * Filters the values of an object based on a provided filter function.\n *\n * @param obj The object to filter.\n * @param filter The filter function that determines whether a value should be included.\n * @returns A new object containing only the key-value pairs that passed the filter.\n */\nexport function filterObjectValues<T>(\n obj: Record<string, T>,\n filter: (value: T, key: string) => boolean,\n): Record<string, T> {\n const filteredEntries = Object\n .entries(obj)\n .filter(([key, value]) => filter(value, key));\n\n return Object.fromEntries(filteredEntries);\n}\n","export function isEmptyObject(obj: Record<string, unknown>): boolean {\n return Object.keys(obj).length === 0 && obj.constructor === Object;\n}\n","/**\n * Maps the values of an object using a provided mapper function.\n *\n * @param obj The object whose values will be mapped.\n * @param mapper A function that takes a value and its key, and returns a new value.\n * @template T The type of the original values in the object.\n * @template U The type of the new values in the object.\n * @returns A new object with the same keys as the original, but with values transformed by\n */\nexport function mapObjectValues<T, U>(\n obj: Record<string, T>,\n mapper: (value: T, key: string) => U,\n): Record<string, U> {\n const mappedEntries = Object\n .entries(obj)\n .map(([key, value]) => [key, mapper(value, key)] as const);\n\n return Object.fromEntries(mappedEntries);\n}\n","/**\n * Performs a shallow comparison of two objects.\n *\n * @param objA - The first object to compare.\n * @param objB - The second object to compare.\n * @returns True if the objects are shallowly equal, false otherwise.\n */\nexport function shallowEqual<T extends Record<string, unknown>>(\n objA: T,\n objB: T,\n): boolean {\n if (objA === objB) {\n return true;\n }\n\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n for (const key of keysA) {\n if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {\n return false;\n }\n }\n\n return true;\n}\n","/**\n * Generates a unique identifier string\n *\n * @returns Random string that can be used as unique identifier\n */\nexport function uid() {\n return Math.random().toString(36).substring(2);\n}\n","import type { CanBePromise } from '../types';\n\n/**\n * Waits for the provided callback to succeed. The callback is executed multiple times until it succeeds or the timeout is reached.\n * It's executed immediately and then with a delay defined by the `retry` option.\n *\n * @param callback The callback to execute.\n * @param config Configuration for the function.\n * @param config.timeOutAfter The maximum time to wait for the callback to succeed, in milliseconds. Default is 500ms.\n * @param config.retryAfter The time to wait between retries, in milliseconds. Default is 100ms.\n * @returns A promise that resolves when the callback succeeds.\n */\nexport function waitFor<R>(\n callback: () => CanBePromise<R>,\n {\n timeOutAfter = 500,\n retryAfter = 100,\n }: WaitForConfig = {},\n): Promise<R> {\n return new Promise<R>((resolve, reject) => {\n const startTime = Date.now();\n let lastError: Error | null = null;\n\n const timeoutTimerId = setTimeout(() => {\n reject(lastError ?? new Error('Timeout'));\n }, timeOutAfter);\n\n const tick = async () => {\n try {\n const result = await callback();\n clearTimeout(timeoutTimerId);\n resolve(result);\n }\n catch (err: any) {\n lastError = err;\n\n if (Date.now() - startTime > timeOutAfter) {\n reject(err);\n }\n else {\n setTimeout(tick, retryAfter);\n }\n }\n };\n\n void tick();\n });\n}\n\n/**\n * Configuration for the `waitFor` function.\n */\nexport type WaitForConfig = {\n timeOutAfter?: number;\n retryAfter?: number;\n};\n","/**\n * Returns a promise that resolves when the DOM is fully loaded and ready.\n */\nexport function waitForDOMReady(): Promise<void> {\n return new Promise((resolve) => {\n switch (document.readyState) {\n case 'loading':\n document.addEventListener('DOMContentLoaded', () => resolve(), { once: true });\n break;\n\n case 'interactive':\n case 'complete':\n setTimeout(resolve, 0);\n break;\n\n default:\n console.warn('Unexpected document.readyState:', document.readyState);\n setTimeout(resolve, 0);\n }\n });\n}\n","/**\n * Waits for the 'data-cke-interactive' attribute to be added to the element.\n */\nexport function waitForInteractiveAttribute(element: HTMLElement): WaitForInteractiveResult {\n if (element.hasAttribute('data-cke-interactive')) {\n return { promise: Promise.resolve(), disconnect: () => {} };\n }\n\n let observer: MutationObserver;\n\n const promise = new Promise<void>((resolve) => {\n observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes'\n && mutation.attributeName === 'data-cke-interactive'\n && element.hasAttribute('data-cke-interactive')\n ) {\n observer.disconnect();\n resolve();\n break;\n }\n }\n });\n\n observer.observe(element, { attributes: true });\n });\n\n return {\n promise,\n disconnect: () => observer?.disconnect(),\n };\n}\n\n/**\n * Marks the given element as interactive by adding the 'data-cke-interactive' attribute.\n *\n * @param element - The HTML element to mark as interactive.\n */\nexport function markElementAsInteractive(element: HTMLElement) {\n element.setAttribute('data-cke-interactive', 'true');\n}\n\n/**\n * Result of waiting for the interactive attribute.\n */\nexport type WaitForInteractiveResult = {\n promise: Promise<void>;\n disconnect: () => void;\n};\n","import type { EditorCreator } from './wrap-with-watchdog';\nimport type { Context, ContextWatchdog, Editor, EditorConfig } from 'ckeditor5';\n\nimport { uid } from '../../../shared';\n\n/**\n * Symbol used to store the context watchdog on the editor instance.\n * Internal use only.\n */\nconst CONTEXT_EDITOR_WATCHDOG_SYMBOL = Symbol.for('context-editor-watchdog');\n\n/**\n * Creates a CKEditor 5 editor instance within a given context watchdog.\n *\n * @param params Parameters for editor creation.\n * @param params.element The DOM element or data for the editor.\n * @param params.context The context watchdog instance.\n * @param params.creator The editor creator utility.\n * @param params.config The editor configuration object.\n * @returns The created editor instance.\n */\nexport async function createEditorInContext({ element, context, creator, config }: Attrs) {\n const editorContextId = uid();\n\n await context.add({\n creator: (_element, _config) => creator.create(_element, _config),\n id: editorContextId,\n sourceElementOrData: element,\n type: 'editor',\n config,\n });\n\n const editor = context.getItem(editorContextId) as Editor;\n const contextDescriptor: EditorContextDescriptor = {\n state: 'available',\n editorContextId,\n context,\n };\n\n (editor as any)[CONTEXT_EDITOR_WATCHDOG_SYMBOL] = contextDescriptor;\n\n // Destroying of context is async. There can be situation when the destroy of the context\n // and the destroy of the editor is called in parallel. It often happens during unmounting of\n // phoenix hooks. Let's make sure that descriptor informs other components, that context is being\n // destroyed.\n const originalDestroy = context.destroy.bind(context);\n context.destroy = async () => {\n contextDescriptor.state = 'unavailable';\n return originalDestroy();\n };\n\n return {\n ...contextDescriptor,\n editor,\n };\n}\n\n/**\n * Retrieves the context watchdog from an editor instance, if available.\n *\n * @param editor The editor instance.\n * @returns The context watchdog or null if not found.\n */\nexport function unwrapEditorContext(editor: Editor): EditorContextDescriptor | null {\n if (CONTEXT_EDITOR_WATCHDOG_SYMBOL in editor) {\n return (editor as any)[CONTEXT_EDITOR_WATCHDOG_SYMBOL];\n }\n\n return null;\n}\n\n/**\n * Parameters for creating an editor in a context.\n */\ntype Attrs = {\n context: ContextWatchdog<Context>;\n creator: EditorCreator;\n element: HTMLElement;\n config: EditorConfig;\n};\n\n/**\n * Descriptor for an editor context.\n */\ntype EditorContextDescriptor = {\n state: 'available' | 'unavailable';\n editorContextId: string;\n context: ContextWatchdog<Context>;\n};\n","import type { Editor } from 'ckeditor5';\n\n/**\n * Gets values of all editor roots.\n *\n * @param editor The editor instance.\n * @returns A record where keys are root names and values are root HTML strings.\n */\nexport function getEditorRootsValues(editor: Editor): Record<string, string> {\n return Array\n .from(editor.model.document.getRoots())\n .reduce<Record<string, string>>((acc, root) => {\n if (root.rootName === '$graveyard') {\n return acc;\n }\n\n acc[root.rootName] = editor.getData({ rootName: root.rootName });\n\n return acc;\n }, Object.create({}));\n}\n","import type { EditorType } from '../typings';\n\n/**\n * Checks if the given editor type is one of the single editing-like editors.\n *\n * @param editorType - The type of the editor to check.\n * @returns `true` if the editor type is 'inline', 'classic', or 'balloon', otherwise `false`.\n */\nexport function isSingleRootEditor(editorType: EditorType): boolean {\n return ['inline', 'classic', 'balloon', 'decoupled'].includes(editorType);\n}\n","import type { EditorType } from '../typings';\n\nimport { CKEditor5BlazorError } from '../../../ckeditor5-blazor-error';\n\n/**\n * Returns the constructor for the specified CKEditor5 editor type.\n *\n * @param type - The type of the editor to load.\n * @returns A promise that resolves to the editor constructor.\n */\nexport async function loadEditorConstructor(type: EditorType) {\n const PKG = await import('ckeditor5');\n\n const editorMap = {\n inline: PKG.InlineEditor,\n balloon: PKG.BalloonEditor,\n classic: PKG.ClassicEditor,\n decoupled: PKG.DecoupledEditor,\n multiroot: PKG.MultiRootEditor,\n } as const;\n\n const EditorConstructor = editorMap[type];\n\n if (!EditorConstructor) {\n throw new CKEditor5BlazorError(`Unsupported editor type: ${type}`);\n }\n\n return EditorConstructor;\n}\n","import type { CanBePromise } from '../../types';\nimport type { PluginConstructor } from 'ckeditor5';\n\nimport { CKEditor5BlazorError } from '../../ckeditor5-blazor-error';\n\ntype PluginReader = () => CanBePromise<PluginConstructor>;\n\n/**\n * Registry for custom CKEditor plugins.\n * Allows registration and retrieval of custom plugins that can be used alongside built-in plugins.\n */\nexport class CustomEditorPluginsRegistry {\n static readonly the = new CustomEditorPluginsRegistry();\n\n /**\n * Map of registered custom plugins.\n */\n private readonly plugins = new Map<string, PluginReader>();\n\n /**\n * Private constructor to enforce singleton pattern.\n */\n private constructor() {}\n\n /**\n * Registers a custom plugin for the CKEditor.\n *\n * @param name The name of the plugin.\n * @param reader The plugin reader function that returns the plugin constructor.\n * @returns A function to unregister the plugin.\n */\n register(name: string, reader: PluginReader): () => void {\n if (this.plugins.has(name)) {\n throw new CKEditor5BlazorError(`Plugin with name \"${name}\" is already registered.`);\n }\n\n this.plugins.set(name, reader);\n\n return this.unregister.bind(this, name);\n }\n\n /**\n * Removes a custom plugin by its name.\n *\n * @param name The name of the plugin to unregister.\n * @throws Will throw an error if the plugin is not registered.\n */\n unregister(name: string): void {\n if (!this.plugins.has(name)) {\n throw new CKEditor5BlazorError(`Plugin with name \"${name}\" is not registered.`);\n }\n\n this.plugins.delete(name);\n }\n\n /**\n * Removes all custom editor plugins.\n * This is useful for cleanup in tests or when reloading plugins.\n */\n unregisterAll(): void {\n this.plugins.clear();\n }\n\n /**\n * Retrieves a custom plugin by its name.\n *\n * @param name The name of the plugin.\n * @returns The plugin constructor or undefined if not found.\n */\n async get(name: string): Promise<PluginConstructor | undefined> {\n const reader = this.plugins.get(name);\n\n return reader?.();\n }\n\n /**\n * Checks if a plugin with the given name is registered.\n *\n * @param name The name of the plugin.\n * @returns `true` if the plugin is registered, `false` otherwise.\n */\n has(name: string): boolean {\n return this.plugins.has(name);\n }\n}\n","import type { EditorPlugin } from '../typings';\nimport type { PluginConstructor } from 'ckeditor5';\n\nimport { CKEditor5BlazorError } from '../../../ckeditor5-blazor-error';\nimport { CustomEditorPluginsRegistry } from '../custom-editor-plugins';\n\n/**\n * Loads CKEditor plugins from base and premium packages.\n * First tries to load from the base 'ckeditor5' package, then falls back to 'ckeditor5-premium-features'.\n *\n * @param plugins - Array of plugin names to load\n * @returns Promise that resolves to an array of loaded Plugin instances\n * @throws Error if a plugin is not found in either package\n */\nexport async function loadEditorPlugins(plugins: EditorPlugin[]): Promise<LoadedPlugins> {\n const basePackage = await import('ckeditor5');\n let premiumPackage: Record<string, any> | null = null;\n\n const loaders = plugins.map(async (plugin) => {\n // Let's first try to load the plugin from the base package.\n // Coverage is disabled due to Vitest issues with mocking dynamic imports.\n\n // If the plugin is not found in the base package, try custom plugins.\n const customPlugin = await CustomEditorPluginsRegistry.the.get(plugin);\n\n if (customPlugin) {\n return customPlugin;\n }\n\n // If not found, try to load from the base package.\n const { [plugin]: basePkgImport } = basePackage as Record<string, unknown>;\n\n if (basePkgImport) {\n return basePkgImport as PluginConstructor;\n }\n\n // Plugin not found in base package, try premium package.\n /* v8 ignore start -- @preserve */\n if (!premiumPackage) {\n try {\n premiumPackage = await import('ckeditor5-premium-features');\n }\n catch (error) {\n console.error(`Failed to load premium package: ${error}`);\n throw new CKEditor5BlazorError(`Plugin \"${plugin}\" not found in base package and failed to load premium package.`);\n }\n }\n /* v8 ignore end */\n\n const { [plugin]: premiumPkgImport } = premiumPackage || {};\n\n if (premiumPkgImport) {\n return premiumPkgImport as PluginConstructor;\n }\n\n // Plugin not found in either package, throw an error.\n throw new CKEditor5BlazorError(`Plugin \"${plugin}\" not found in base or premium packages.`);\n });\n\n return {\n loadedPlugins: await Promise.all(loaders),\n hasPremium: !!premiumPackage,\n };\n}\n\n/**\n * Type representing the loaded plugins and whether premium features are available.\n */\ntype LoadedPlugins = {\n loadedPlugins: PluginConstructor<any>[];\n hasPremium: boolean;\n};\n","/**\n * Loads all required translations for the editor based on the language configuration.\n *\n * @param language - The language configuration object containing UI and content language codes.\n * @param language.ui - The UI language code.\n * @param language.content - The content language code.\n * @param hasPremium - Whether premium features are enabled and premium translations should be loaded.\n * @returns A promise that resolves to an array of loaded translation objects.\n */\nexport async function loadAllEditorTranslations(\n language: { ui: string; content: string; },\n hasPremium: boolean,\n) {\n const translations = [language.ui, language.content];\n const loadedTranslations = await Promise.all(\n [\n loadEditorPkgTranslations('ckeditor5', translations),\n\n /* v8 ignore next -- @preserve */\n hasPremium && loadEditorPkgTranslations('ckeditor5-premium-features', translations),\n ].filter(pkg => !!pkg),\n )\n .then(translations => translations.flat());\n\n return loadedTranslations;\n}\n\n/**\n * Loads the editor translations for the given languages.\n *\n * Make sure this function is properly compiled and bundled in self hosted environments!\n *\n * @param pkg - The package to load translations from ('ckeditor5' or 'ckeditor5-premium-features').\n * @param translations - The list of language codes to load translations for.\n * @returns A promise that resolves to an array of loaded translation packs.\n */\nasync function loadEditorPkgTranslations(\n pkg: EditorPkgName,\n translations: string[],\n) {\n return await Promise.all(\n translations\n .filter(lang => lang !== 'en') // 'en' is the default language, no need to load it.\n .map(async (lang) => {\n const pack = await loadEditorTranslation(pkg, lang);\n\n /* v8 ignore next -- @preserve */\n return pack?.default ?? pack;\n })\n .filter(Boolean),\n );\n}\n\n/**\n * Type representing the package name for CKEditor 5.\n */\ntype EditorPkgName = 'ckeditor5' | 'ckeditor5-premium-features';\n\n/**\n * Load translation for CKEditor 5\n * @param pkg - Package type: 'ckeditor5' or 'premium'\n * @param lang - Language code (e.g., 'pl', 'en', 'de')\n * @returns Translation object or null if failed\n */\nasync function loadEditorTranslation(pkg: EditorPkgName, lang: string): Promise<any> {\n try {\n /* v8 ignore next if -- @preserve */\n if (pkg === 'ckeditor5') {\n switch (lang) {\n case 'af': return await import('ckeditor5/translations/af.js');\n case 'ar': return await import('ckeditor5/translations/ar.js');\n case 'ast': return await import('ckeditor5/translations/ast.js');\n case 'az': return await import('ckeditor5/translations/az.js');\n case 'bg': return await import('ckeditor5/translations/bg.js');\n case 'bn': return await import('ckeditor5/translations/bn.js');\n case 'bs': return await import('ckeditor5/translations/bs.js');\n case 'ca': return await import('ckeditor5/translations/ca.js');\n case 'cs': return await import('ckeditor5/translations/cs.js');\n case 'da': return await import('ckeditor5/translations/da.js');\n case 'de': return await import('ckeditor5/translations/de.js');\n case 'de-ch': return await import('ckeditor5/translations/de-ch.js');\n case 'el': return await import('ckeditor5/translations/el.js');\n case 'en': return await import('ckeditor5/translations/en.js');\n case 'en-au': return await import('ckeditor5/translations/en-au.js');\n case 'en-gb': return await import('ckeditor5/translations/en-gb.js');\n case 'eo': return await import('ckeditor5/translations/eo.js');\n case 'es': return await import('ckeditor5/translations/es.js');\n case 'es-co': return await import('ckeditor5/translations/es-co.js');\n case 'et': return await import('ckeditor5/translations/et.js');\n case 'eu': return await import('ckeditor5/translations/eu.js');\n case 'fa': return await import('ckeditor5/translations/fa.js');\n case 'fi': return await import('ckeditor5/translations/fi.js');\n case 'fr': return await import('ckeditor5/translations/fr.js');\n case 'gl': return await import('ckeditor5/translations/gl.js');\n case 'gu': return await import('ckeditor5/translations/gu.js');\n case 'he': return await import('ckeditor5/translations/he.js');\n case 'hi': return await import('ckeditor5/translations/hi.js');\n case 'hr': return await import('ckeditor5/translations/hr.js');\n case 'hu': return await import('ckeditor5/translations/hu.js');\n case 'hy': return await import('ckeditor5/translations/hy.js');\n case 'id': return await import('ckeditor5/translations/id.js');\n case 'it': return await import('ckeditor5/translations/it.js');\n case 'ja': return await import('ckeditor5/translations/ja.js');\n case 'jv': return await import('ckeditor5/translations/jv.js');\n case 'kk': return await import('ckeditor5/translations/kk.js');\n case 'km': return await import('ckeditor5/translations/km.js');\n case 'kn': return await import('ckeditor5/translations/kn.js');\n case 'ko': return await import('ckeditor5/translations/ko.js');\n case 'ku': return await import('ckeditor5/translations/ku.js');\n case 'lt': return await import('ckeditor5/translations/lt.js');\n case 'lv': return await import('ckeditor5/translations/lv.js');\n case 'ms': return await import('ckeditor5/translations/ms.js');\n case 'nb': return await import('ckeditor5/translations/nb.js');\n case 'ne': return await import('ckeditor5/translations/ne.js');\n case 'nl': return await import('ckeditor5/translations/nl.js');\n case 'no': return await import('ckeditor5/translations/no.js');\n case 'oc': return await import('ckeditor5/translations/oc.js');\n case 'pl': return await import('ckeditor5/translations/pl.js');\n case 'pt': return await import('ckeditor5/translations/pt.js');\n case 'pt-br': return await import('ckeditor5/translations/pt-br.js');\n case 'ro': return await import('ckeditor5/translations/ro.js');\n case 'ru': return await import('ckeditor5/translations/ru.js');\n case 'si': return await import('ckeditor5/translations/si.js');\n case 'sk': return await import('ckeditor5/translations/sk.js');\n case 'sl': return await import('ckeditor5/translations/sl.js');\n case 'sq': return await import('ckeditor5/translations/sq.js');\n case 'sr': return await import('ckeditor5/translations/sr.js');\n case 'sr-latn': return await import('ckeditor5/translations/sr-latn.js');\n case 'sv': return await import('ckeditor5/translations/sv.js');\n case 'th': return await import('ckeditor5/translations/th.js');\n case 'tk': return await import('ckeditor5/translations/tk.js');\n case 'tr': return await import('ckeditor5/translations/tr.js');\n case 'tt': return await import('ckeditor5/translations/tt.js');\n case 'ug': return await import('ckeditor5/translations/ug.js');\n case 'uk': return await import('ckeditor5/translations/uk.js');\n case 'ur': return await import('ckeditor5/translations/ur.js');\n case 'uz': return await import('ckeditor5/translations/uz.js');\n case 'vi': return await import('ckeditor5/translations/vi.js');\n case 'zh': return await import('ckeditor5/translations/zh.js');\n case 'zh-cn': return await import('ckeditor5/translations/zh-cn.js');\n default:\n console.warn(`Language ${lang} not found in ckeditor5 translations`);\n return null;\n }\n }\n else {\n // Premium features translations\n switch (lang) {\n case 'af': return await import('ckeditor5-premium-features/translations/af.js');\n case 'ar': return await import('ckeditor5-premium-features/translations/ar.js');\n case 'ast': return await import('ckeditor5-premium-features/translations/ast.js');\n case 'az': return await import('ckeditor5-premium-features/translations/az.js');\n case 'bg': return await import('ckeditor5-premium-features/translations/bg.js');\n case 'bn': return await import('ckeditor5-premium-features/translations/bn.js');\n case 'bs': return await import('ckeditor5-premium-features/translations/bs.js');\n case 'ca': return await import('ckeditor5-premium-features/translations/ca.js');\n case 'cs': return await import('ckeditor5-premium-features/translations/cs.js');\n case 'da': return await import('ckeditor5-premium-features/translations/da.js');\n case 'de': return await import('ckeditor5-premium-features/translations/de.js');\n case 'de-ch': return await import('ckeditor5-premium-features/translations/de-ch.js');\n case 'el': return await import('ckeditor5-premium-features/translations/el.js');\n case 'en': return await import('ckeditor5-premium-features/translations/en.js');\n case 'en-au': return await import('ckeditor5-premium-features/translations/en-au.js');\n case 'en-gb': return await import('ckeditor5-premium-features/translations/en-gb.js');\n case 'eo': return await import('ckeditor5-premium-features/translations/eo.js');\n case 'es': return await import('ckeditor5-premium-features/translations/es.js');\n case 'es-co': return await import('ckeditor5-premium-features/translations/es-co.js');\n case 'et': return await import('ckeditor5-premium-features/translations/et.js');\n case 'eu': return await import('ckeditor5-premium-features/translations/eu.js');\n case 'fa': return await import('ckeditor5-premium-features/translations/fa.js');\n case 'fi': return await import('ckeditor5-premium-features/translations/fi.js');\n case 'fr': return await import('ckeditor5-premium-features/translations/fr.js');\n case 'gl': return await import('ckeditor5-premium-features/translations/gl.js');\n case 'gu': return await import('ckeditor5-premium-features/translations/gu.js');\n case 'he': return await import('ckeditor5-premium-features/translations/he.js');\n case 'hi': return await import('ckeditor5-premium-features/translations/hi.js');\n case 'hr': return await import('ckeditor5-premium-features/translations/hr.js');\n case 'hu': return await import('ckeditor5-premium-features/translations/hu.js');\n case 'hy': return await import('ckeditor5-premium-features/translations/hy.js');\n case 'id': return await import('ckeditor5-premium-features/translations/id.js');\n case 'it': return await import('ckeditor5-premium-features/translations/it.js');\n case 'ja': return await import('ckeditor5-premium-features/translations/ja.js');\n case 'jv': return await import('ckeditor5-premium-features/translations/jv.js');\n case 'kk': return await import('ckeditor5-premium-features/translations/kk.js');\n case 'km': return await import('ckeditor5-premium-features/translations/km.js');\n case 'kn': return await import('ckeditor5-premium-features/translations/kn.js');\n case 'ko': return await import('ckeditor5-premium-features/translations/ko.js');\n case 'ku': return await import('ckeditor5-premium-features/translations/ku.js');\n case 'lt': return await import('ckeditor5-premium-features/translations/lt.js');\n case 'lv': return await import('ckeditor5-premium-features/translations/lv.js');\n case 'ms': return await import('ckeditor5-premium-features/translations/ms.js');\n case 'nb': return await import('ckeditor5-premium-features/translations/nb.js');\n case 'ne': return await import('ckeditor5-premium-features/translations/ne.js');\n case 'nl': return await import('ckeditor5-premium-features/translations/nl.js');\n case 'no': return await import('ckeditor5-premium-features/translations/no.js');\n case 'oc': return await import('ckeditor5-premium-features/translations/oc.js');\n case 'pl': return await import('ckeditor5-premium-features/translations/pl.js');\n case 'pt': return await import('ckeditor5-premium-features/translations/pt.js');\n case 'pt-br': return await import('ckeditor5-premium-features/translations/pt-br.js');\n case 'ro': return await import('ckeditor5-premium-features/translations/ro.js');\n case 'ru': return await import('ckeditor5-premium-features/translations/ru.js');\n case 'si': return await import('ckeditor5-premium-features/translations/si.js');\n case 'sk': return await import('ckeditor5-premium-features/translations/sk.js');\n case 'sl': return await import('ckeditor5-premium-features/translations/sl.js');\n case 'sq': return await import('ckeditor5-premium-features/translations/sq.js');\n case 'sr': return await import('ckeditor5-premium-features/translations/sr.js');\n case 'sr-latn': return await import('ckeditor5-premium-features/translations/sr-latn.js');\n case 'sv': return await import('ckeditor5-premium-features/translations/sv.js');\n case 'th': return await import('ckeditor5-premium-features/translations/th.js');\n case 'tk': return await import('ckeditor5-premium-features/translations/tk.js');\n case 'tr': return await import('ckeditor5-premium-features/translations/tr.js');\n case 'tt': return await import('ckeditor5-premium-features/translations/tt.js');\n case 'ug': return await import('ckeditor5-premium-features/translations/ug.js');\n case 'uk': return await import('ckeditor5-premium-features/translations/uk.js');\n case 'ur': return await import('ckeditor5-premium-features/translations/ur.js');\n case 'uz': return await import('ckeditor5-premium-features/translations/uz.js');\n case 'vi': return await import('ckeditor5-premium-features/translations/vi.js');\n case 'zh': return await import('ckeditor5-premium-features/translations/zh.js');\n case 'zh-cn': return await import('ckeditor5-premium-features/translations/zh-cn.js');\n default:\n console.warn(`Language ${lang} not found in premium translations`);\n return await import('ckeditor5-premium-features/translations/en.js'); // fallback to English\n }\n }\n }\n /* v8 ignore start -- @preserve */\n catch (error) {\n console.error(`Failed to load translation for ${pkg}/${lang}:`, error);\n return null;\n }\n /* v8 ignore stop -- @preserve */\n}\n","import type { EditorCustomTranslationsDictionary } from '../typings';\nimport type { Translations } from 'ckeditor5';\n\nimport { mapObjectValues } from '../../../shared';\n\n/**\n * This function takes a custom translations object and maps it to the format expected by CKEditor5.\n * Each translation dictionary is wrapped in an object with a `dictionary` key.\n *\n * @param translations - The custom translations to normalize.\n * @returns A normalized translations object suitable for CKEditor5.\n */\nexport function normalizeCustomTranslations(translations: EditorCustomTranslationsDictionary): Translations {\n return mapObjectValues(translations, dictionary => ({\n dictionary,\n }));\n}\n","/**\n * Queries all CKEditor 5 editor IDs present in the document.\n */\nexport function queryAllEditorIds(): string[] {\n return Array\n .from(document.querySelectorAll<HTMLElement>('cke5-editor'))\n .map(element => element.getAttribute('data-cke-editor-id'))\n .filter((id): id is string => id !== null);\n}\n","import type { EditorId } from '../typings';\n\nimport { filterObjectValues, mapObjectValues } from '../../../shared';\n\n/**\n * Gets the initial root elements for the editor based on its type.\n *\n * @param editorId The editor's ID.\n * @returns The root element(s) for the editor.\n */\nexport function queryEditablesElements(editorId: EditorId) {\n const editables = queryAllEditorEditables(editorId);\n\n return mapObjectValues(editables, ({ element }) => element);\n}\n\n/**\n * Gets the initial data for the roots of the editor. If the editor is a single editing-like editor,\n * it retrieves the initial value from the element's attribute. Otherwise, it returns an object mapping\n * editable names to their initial values.\n *\n * @param editorId The editor's ID.\n * @returns The initial values for the editor's roots.\n */\nexport function queryEditablesSnapshotContent(editorId: EditorId) {\n const editables = queryAllEditorEditables(editorId);\n const values = mapObjectValues(editables, ({ content }) => content);\n\n return filterObjectValues(values, value => typeof value === 'string') as Record<string, string>;\n}\n\n/**\n * Queries all editable elements within a specific editor instance. It picks\n * initial values from actually rendered elements or from the editor container's.\n *\n * It may differ from the `initialData` used during editor creation, as it might\n * not set all roots or set different values.\n *\n * @param editorId The ID of the editor to query.\n * @returns An object mapping editable names to their corresponding elements and initial values.\n */\nfunction queryAllEditorEditables(editorId: EditorId) {\n const acc = (\n Array\n .from(document.querySelectorAll<HTMLElement>(`cke5-editable[data-cke-editor-id=\"${editorId}\"]`))\n .reduce<Record<string, EditableItem>>((acc, element) => {\n const rootName = element.getAttribute('data-cke-root-name')!;\n const content = element.getAttribute('data-cke-content');\n\n acc[rootName] = {\n element: element.querySelector<HTMLElement>('[data-cke-editable-content]')!,\n content,\n };\n\n return acc;\n }, Object.create({}))\n );\n\n const editor = document.querySelector<HTMLElement>(`cke5-editor[data-cke-editor-id=\"${editorId}\"]`);\n\n /* v8 ignore next -- @preserve */\n if (!editor) {\n return acc;\n }\n\n const currentMain = acc['main'];\n const initialRootEditableValue = JSON.parse(editor.getAttribute('data-cke-content')!);\n const contentElement = document.querySelector<HTMLElement>(`#${editorId}_editor `);\n\n // If found `main` editable, but it has no content, try to fill it from the editor container.\n if (currentMain && initialRootEditableValue?.['main']) {\n return {\n ...acc,\n main: {\n ...currentMain,\n content: currentMain.content || initialRootEditableValue['main'],\n },\n };\n }\n\n // If no `main` editable found, try to create it from the editor container.\n if (contentElement) {\n return {\n ...acc,\n main: {\n element: contentElement,\n content: initialRootEditableValue?.['main'] || null,\n },\n };\n }\n\n return acc;\n}\n\n/**\n * Type representing an editable item within an editor.\n */\nexport type EditableItem = {\n element: HTMLElement;\n content: string | null;\n};\n","/**\n * Resolves element references in configuration object.\n * Looks for objects with { $element: \"selector\" } format and replaces them with actual DOM elements.\n *\n * @param obj - Configuration object to process\n * @returns Processed configuration object with resolved element references\n */\nexport function resolveEditorConfigElementReferences<T>(obj: T): T {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => resolveEditorConfigElementReferences(item)) as T;\n }\n\n const anyObj = obj as any;\n\n if (anyObj.$element && typeof anyObj.$element === 'string') {\n const element = document.querySelector(anyObj.$element);\n\n if (!element) {\n console.warn(`Element not found for selector: ${anyObj.$element}`);\n }\n\n return (element || null) as T;\n }\n\n const result = Object.create(null);\n\n for (const [key, value] of Object.entries(obj)) {\n result[key] = resolveEditorConfigElementReferences(value);\n }\n\n return result as T;\n}\n","import type { Translations } from 'ckeditor5';\n\n/**\n * Resolves translation references in a configuration object.\n *\n * The configuration may contain objects with the form `{ $translation: \"some.key\" }`.\n * These are replaced with the actual string from the provided translations map.\n *\n * The function will walk the provided object recursively, handling arrays and\n * nested objects. Primitive values are returned as-is. If a translation key is\n * not present in the map, a warning is logged and `null` is returned for that\n * value.\n *\n * @param translations - An array of CKEditor `Translations` objects. Each translation\n * pack will be searched in order for the requested key, and the\n * first matching value will be returned. This mirrors the format\n * returned by `loadAllEditorTranslations` and simplifies the\n * caller's API.\n * @param language - Language identifier to look up in the packs. Only this locale\n * will be consulted, ensuring that keys from other languages are\n * ignored even if they appear earlier in the array.\n * @param obj - Configuration object to process\n * @returns Processed configuration object with resolved translations.\n */\nexport function resolveEditorConfigTranslations<T>(\n translations: Translations[],\n language: string,\n obj: T,\n): T {\n if (!obj || typeof obj !== 'object') {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => resolveEditorConfigTranslations(translations, language, item)) as T;\n }\n\n const anyObj = obj as any;\n\n if (anyObj.$translation && typeof anyObj.$translation === 'string') {\n const key: string = anyObj.$translation;\n const value = getTranslationValue(translations, key, language);\n\n if (value === undefined) {\n console.warn(`Translation not found for key: ${key}`);\n }\n\n return (value !== undefined ? value : null) as T;\n }\n\n const result = Object.create(null);\n\n for (const [key, value] of Object.entries(obj)) {\n result[key] = resolveEditorConfigTranslations(translations, language, value);\n }\n\n return result as T;\n}\n\n/**\n * Look up a translation value inside the provided map or array of CKEditor packs.\n */\nfunction getTranslationValue(\n translations: Translations[],\n key: string,\n language: string,\n): string | ReadonlyArray<string> | undefined {\n for (const pack of translations) {\n const langData = pack[language];\n\n if (langData?.dictionary && key in langData.dictionary) {\n return langData.dictionary[key] as string | ReadonlyArray<string>;\n }\n }\n\n return undefined;\n}\n","import type { Editor } from 'ckeditor5';\n\n/**\n * Sets the height of the editable area in the CKEditor instance.\n *\n * @param instance - The CKEditor instance to modify.\n * @param height - The height in pixels to set for the editable area.\n */\nexport function setEditorEditableHeight(instance: Editor, height: number): void {\n const { editing } = instance;\n\n editing.view.change((writer) => {\n writer.setStyle('height', `${height}px`, editing.view.document.getRoot()!);\n });\n}\n","import type { Editor, EditorWatchdog } from 'ckeditor5';\n\nconst EDITOR_WATCHDOG_SYMBOL = Symbol.for('elixir-editor-watchdog');\n\n/**\n * Wraps an Editor creator with a watchdog for automatic recovery.\n *\n * @param Editor - The Editor creator to wrap.\n * @returns The Editor creator wrapped with a watchdog.\n */\nexport async function wrapWithWatchdog(Editor: EditorCreator) {\n const { EditorWatchdog } = await import('ckeditor5');\n const watchdog = new EditorWatchdog(Editor);\n\n watchdog.setCreator(async (...args: Parameters<typeof Editor['create']>) => {\n const editor = await Editor.create(...args);\n\n (editor as any)[EDITOR_WATCHDOG_SYMBOL] = watchdog;\n\n return editor;\n });\n\n return {\n watchdog,\n Constructor: {\n create: async (...args: Parameters<typeof Editor['create']>) => {\n await watchdog.create(...args);\n\n return watchdog.editor!;\n },\n },\n };\n}\n\n/**\n * Unwraps the EditorWatchdog from the editor instance.\n */\nexport function unwrapEditorWatchdog(editor: Editor): EditorWatchdog | null {\n if (EDITOR_WATCHDOG_SYMBOL in editor) {\n return (editor as any)[EDITOR_WATCHDOG_SYMBOL] as EditorWatchdog;\n }\n\n return null;\n}\n\n/**\n * Type representing an Editor creator with a create method.\n */\nexport type EditorCreator = {\n create: (...args: any) => Promise<Editor>;\n};\n","import type { Context, ContextWatchdog } from 'ckeditor5';\n\nimport { AsyncRegistry } from '../../shared';\n\n/**\n * It provides a way to register contexts and execute callbacks on them when they are available.\n */\nexport class ContextsRegistry extends AsyncRegistry<ContextWatchdog<Context>> {\n static readonly the = new ContextsRegistry();\n}\n","import type { WaitForInteractiveResult } from '../../shared';\nimport type { EditorLanguage } from '../editor';\nimport type { ContextConfig } from './typings';\nimport type { Context, ContextWatchdog } from 'ckeditor5';\n\nimport { isEmptyObject, waitForDOMReady, waitForInteractiveAttribute } from '../../shared';\nimport {\n loadAllEditorTranslations,\n loadEditorPlugins,\n normalizeCustomTranslations,\n resolveEditorConfigElementReferences,\n resolveEditorConfigTranslations,\n} from '../editor/utils';\nimport { ContextsRegistry } from './contexts-registry';\n\n/**\n * The Blazor hook that mounts CKEditor context instances.\n */\nexport class ContextComponentElement extends HTMLElement {\n /**\n * The promise that resolves to the context instance.\n */\n private contextPromise: Promise<ContextWatchdog<Context>> | null = null;\n\n /**\n * Wait result for the interactive attribute.\n */\n private interactiveWait?: WaitForInteractiveResult;\n\n /**\n * Mounts the context component.\n */\n async connectedCallback() {\n await waitForDOMReady();\n\n // By default, components do not bootstrap from web components.\n // They bootstrap only when they receive the data-cke-interactive flag, which the interop sets.\n // This is a fallback for situations where CKEditor 5 is rendered on a non-interactive page.\n this.interactiveWait = waitForInteractiveAttribute(this);\n\n await this.interactiveWait.promise;\n await this.initializeContext();\n }\n\n /**\n * Initializes the context component.\n */\n private async initializeContext(): Promise<void> {\n const contextId = this.getAttribute('data-cke-context-id')!;\n const language = JSON.parse(this.getAttribute('data-cke-language')!) as EditorLanguage;\n const contextConfig = JSON.parse(this.getAttribute('data-cke-context')!) as ContextConfig;\n\n const { customTranslations, watchdogConfig, config: { plugins, ...config } } = contextConfig;\n const { loadedPlugins, hasPremium } = await loadEditorPlugins(plugins ?? []);\n\n // Mix custom translations with loaded translations.\n const loadedTranslations = await loadAllEditorTranslations(language, hasPremium);\n const mixedTranslations = [\n ...loadedTranslations,\n normalizeCustomTranslations(customTranslations || {}),\n ]\n .filter(translations => !isEmptyObject(translations));\n\n // Initialize context with watchdog.\n this.contextPromise = (async () => {\n const { ContextWatchdog, Context } = await import('ckeditor5');\n\n const instance = new ContextWatchdog(Context, {\n crashNumberLimit: 10,\n ...watchdogConfig,\n });\n\n // Construct parsed config. First resolve DOM element references in the provided configuration.\n let resolvedConfig = resolveEditorConfigElementReferences(config);\n\n // Then resolve translation references in the provided configuration, using the mixed translations.\n resolvedConfig = resolveEditorConfigTranslations([...mixedTranslations].reverse(), language.ui, resolvedConfig);\n\n await instance.create({\n ...resolvedConfig,\n language,\n plugins: loadedPlugins,\n ...mixedTranslations.length && {\n translations: mixedTranslations,\n },\n });\n\n instance.on('itemError', (...args) => {\n console.error('Context item error:', ...args);\n });\n\n return instance;\n })();\n\n const context = await this.contextPromise;\n\n if (this.isConnected) {\n ContextsRegistry.the.register(contextId, context);\n }\n }\n\n /**\n * Destroys the context component. Unmounts root from the editor.\n */\n async disconnectedCallback() {\n // Disconnect the observer if present.\n this.interactiveWait?.disconnect();\n\n const contextId = this.getAttribute('data-cke-context-id');\n\n // Let's hide the element during destruction to prevent flickering.\n this.style.display = 'none';\n\n // Let's wait for the mounted promise to resolve before proceeding with destruction.\n try {\n const context = await this.contextPromise;\n\n await context?.destroy();\n }\n finally {\n this.contextPromise = null;\n\n if (contextId && ContextsRegistry.the.hasItem(contextId)) {\n ContextsRegistry.the.unregister(contextId);\n }\n }\n }\n}\n","import type { Editor } from 'ckeditor5';\n\nimport { AsyncRegistry } from '../../shared/async-registry';\n\n/**\n * It provides a way to register editors and execute callbacks on them when they are available.\n */\nexport class EditorsRegistry extends AsyncRegistry<Editor> {\n static readonly the = new EditorsRegistry();\n}\n","import type { WaitForInteractiveResult } from '../shared';\nimport type { MultiRootEditor } from 'ckeditor5';\n\nimport { CKEditor5BlazorError } from '../ckeditor5-blazor-error';\nimport { debounce, waitForDOMReady, waitForInteractiveAttribute } from '../shared';\nimport { EditorsRegistry } from './editor/editors-registry';\nimport { queryAllEditorIds } from './editor/utils';\n\n/**\n * Editable hook for Blazor. It allows you to create editables for multi-root editors.\n */\nexport class EditableComponentElement extends HTMLElement {\n /**\n * The promise that resolves when the editable is mounted.\n */\n private editorPromise: Promise<MultiRootEditor | null> | null = null;\n\n /**\n * Wait result for the interactive attribute.\n */\n private interactiveWait?: WaitForInteractiveResult;\n\n /**\n * Callbacks to be invoked before the editable is destroyed.\n */\n private beforeDestroyCallbacks: Array<() => void> = [];\n\n /**\n * Registers a callback to be called before the editable is destroyed.\n */\n public onBeforeDestroy(callback: () => void): void {\n this.beforeDestroyCallbacks.push(callback);\n }\n\n /**\n * Mounts the editable component.\n */\n async connectedCallback() {\n await waitForDOMReady();\n\n this.interactiveWait = waitForInteractiveAttribute(this);\n await this.interactiveWait.promise;\n await this.initializeEditable();\n }\n\n /**\n * Initializes the editable instance.\n */\n private async initializeEditable(): Promise<void> {\n if (!this.hasAttribute('data-cke-editor-id')) {\n this.setAttribute('data-cke-editor-id', queryAllEditorIds()[0]!);\n }\n\n const editorId = this.getAttribute('data-cke-editor-id');\n const rootName = this.getAttribute('data-cke-root-name');\n const content = this.getAttribute('data-cke-content');\n const saveDebounceMs = Number.parseInt(this.getAttribute('data-cke-save-debounce-ms')!, 10);\n\n /* v8 ignore next if -- @preserve */\n if (!editorId || !rootName) {\n throw new CKEditor5BlazorError('Editor ID or Root Name is missing.');\n }\n\n // If the editor is not registered yet, we will wait for it to be registered.\n this.style.display = 'block';\n this.editorPromise = EditorsRegistry.the.execute(editorId, async (editor: MultiRootEditor) => {\n if (!this.isConnected) {\n return null;\n }\n\n const { ui, editing, model } = editor;\n\n const input = this.querySelector('input') as HTMLInputElement | null;\n const root = model.document.getRoot(rootName);\n\n if (root?.isAttached()) {\n // If the newly added root already exists, but the newly added editable has content,\n // we need to update the root data with the editable content.\n if (content !== null) {\n const data = editor.getData({ rootName });\n\n if (data && data !== content) {\n editor.setData({\n [rootName]: content,\n });\n }\n }\n\n return editor;\n }\n\n editor.addRoot(rootName, {\n isUndoable: false,\n ...content !== null && {\n data: content,\n },\n });\n\n const contentElement = this.querySelector('[data-cke-editable-content]') as HTMLElement | null;\n const editable = ui.view.createEditable(rootName, contentElement!);\n\n ui.addEditable(editable);\n editing.view.forceRender();\n\n // Sync data with socket and input element.\n const sync = () => {\n if (!model.document.getRoot(rootName)?.isAttached()) {\n return;\n }\n\n const html = editor.getData({ rootName });\n\n if (input) {\n input.value = html;\n input.dispatchEvent(new Event('input'));\n }\n\n this.dispatchEvent(new CustomEvent('change', {\n detail: {\n value: html,\n },\n }));\n };\n\n const debouncedSync = debounce(saveDebounceMs, sync);\n\n editor.model.document.on('change:data', debouncedSync);\n this.onBeforeDestroy(() => editor.model.document.off('change:data', debouncedSync));\n sync();\n\n return editor;\n });\n }\n\n /**\n * Destroys the editable component. Unmounts root from the editor.\n */\n async disconnectedCallback() {\n // Disconnect the observer if present.\n this.interactiveWait?.disconnect();\n\n const rootName = this.getAttribute('data-cke-root-name');\n\n // Let's hide the element during destruction to prevent flickering.\n this.style.display = 'none';\n\n // Let's wait for the mounted promise to resolve before proceeding with destruction.\n const editor = await this.editorPromise;\n this.editorPromise = null;\n\n // Run all registered pre-destroy callbacks and clear the queue.\n for (const callback of this.beforeDestroyCallbacks) {\n callback();\n }\n\n this.beforeDestroyCallbacks = [];\n\n // Unmount root from the editor if editor is still registered.\n if (editor && editor.state !== 'destroyed' && rootName) {\n const root = editor.model.document.getRoot(rootName);\n\n /* v8 ignore else -- @preserve */\n if (root && 'detachEditable' in editor) {\n // Detaching editables seem to be buggy when something removed DOM element of the editable (e.g. Blazor re-render) before\n // the editable is unmounted. To prevent errors in such cases, we will try to detach the editable if it exists, but ignore errors.\n try {\n if (editor.ui.view.editables[rootName]) {\n editor.detachEditable(root);\n }\n }\n catch (err) {\n // Ignore errors when detaching editable.\n /* v8 ignore next -- @preserve */\n console.error('Unable unmount editable from root:', err);\n }\n\n if (root.isAttached()) {\n editor.detachRoot(rootName, false);\n }\n }\n }\n }\n}\n","import type { Editor, PluginConstructor } from 'ckeditor5';\n\nimport { debounce } from '../../../shared';\nimport { getEditorRootsValues } from '../utils';\n\n/**\n * Creates a DispatchEditorRootsChangeEvent plugin class.\n */\nexport async function createDispatchEditorRootsChangeEventPlugin(\n {\n saveDebounceMs,\n editorId,\n targetElement,\n }: {\n saveDebounceMs: number;\n editorId: string;\n targetElement: HTMLElement;\n },\n): Promise<PluginConstructor> {\n const { Plugin } = await import('ckeditor5');\n\n return class DispatchEditorRootsChangeEvent extends Plugin {\n /**\n * The name of the plugin.\n */\n static get pluginName() {\n return 'DispatchEditorRootsChangeEvent' as const;\n }\n\n /**\n * Initializes the plugin.\n */\n public afterInit(): void {\n const { editor } = this;\n const sync = debounce(saveDebounceMs, this.dispatch);\n\n editor.model.document.on('change:data', sync);\n editor.once('ready', this.dispatch);\n }\n\n /**\n * Dispatches a custom event with all roots data.\n */\n private dispatch = (): void => {\n const { editor } = this;\n\n targetElement.dispatchEvent(\n new CKEditor5ChangeDataEvent({\n editorId,\n editor,\n roots: getEditorRootsValues(editor),\n }),\n );\n };\n };\n}\n\n/**\n * A custom event dispatched by the DispatchEditorRootsChangeEvent plugin, containing all editor roots data.\n */\nexport class CKEditor5ChangeDataEvent extends CustomEvent<CKEditor5ChangeDataEventPayload> {\n static readonly EVENT_NAME = 'ckeditor5:change:data';\n\n constructor(detail: CKEditor5ChangeDataEventPayload) {\n super(CKEditor5ChangeDataEvent.EVENT_NAME, {\n detail,\n bubbles: true,\n });\n }\n}\n\ntype CKEditor5ChangeDataEventPayload = {\n editorId: string;\n editor: Editor;\n roots: Record<string, string>;\n};\n","import type { ClassicEditor, PluginConstructor } from 'ckeditor5';\n\nimport { debounce } from '../../../shared';\n\n/**\n * Creates a SyncEditorWithInput plugin class.\n */\nexport async function createSyncEditorWithInputPlugin(saveDebounceMs: number): Promise<PluginConstructor> {\n const { Plugin } = await import('ckeditor5');\n\n return class SyncEditorWithInput extends Plugin {\n /**\n * The input element to synchronize with.\n */\n private input: HTMLInputElement | null = null;\n\n /**\n * The form element reference for cleanup.\n */\n private form: HTMLFormElement | null = null;\n\n /**\n * The name of the plugin.\n */\n static get pluginName() {\n return 'SyncEditorWithInput' as const;\n }\n\n /**\n * Initializes the plugin.\n */\n public afterInit(): void {\n const { editor } = this;\n const editorElement = (editor as ClassicEditor).sourceElement as HTMLElement;\n\n // Try to find the associated input field.\n const editorId = editorElement.id.replace(/_editor$/, '');\n\n this.input = document.getElementById(`${editorId}_input`) as HTMLInputElement | null;\n\n if (!this.input) {\n return;\n }\n\n // Setup handlers.\n editor.model.document.on('change:data', debounce(saveDebounceMs, () => this.sync()));\n editor.once('ready', this.sync);\n\n // Setup form integration.\n this.form = this.input.closest('form');\n this.form?.addEventListener('submit', this.sync);\n }\n\n /**\n * Synchronizes the editor's content with the input field.\n */\n private sync = (): void => {\n /* v8 ignore else -- @preserve */\n if (this.input) {\n const newValue = this.editor.getData();\n\n this.input.value = newValue;\n this.input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n };\n\n /**\n * Destroys the plugin.\n */\n public override destroy(): void {\n if (this.form) {\n this.form.removeEventListener('submit', this.sync);\n }\n\n this.input = null;\n this.form = null;\n }\n };\n}\n","import type { WaitForInteractiveResult } from '../../shared';\nimport type { EditorId, EditorLanguage, EditorPreset } from './typings';\nimport type { EditorCreator } from './utils';\nimport type { Editor } from 'ckeditor5';\n\nimport {\n isEmptyObject,\n waitFor,\n waitForDOMReady,\n waitForInteractiveAttribute,\n} from '../../shared';\nimport { ContextsRegistry } from '../context';\nimport { EditorsRegistry } from './editors-registry';\nimport {\n createDispatchEditorRootsChangeEventPlugin,\n createSyncEditorWithInputPlugin,\n} from './plugins';\nimport {\n createEditorInContext,\n isSingleRootEditor,\n loadAllEditorTranslations,\n loadEditorConstructor,\n loadEditorPlugins,\n normalizeCustomTranslations,\n queryEditablesElements,\n queryEditablesSnapshotContent,\n resolveEditorConfigElementReferences,\n resolveEditorConfigTranslations,\n setEditorEditableHeight,\n unwrapEditorContext,\n unwrapEditorWatchdog,\n wrapWithWatchdog,\n} from './utils';\n\n/**\n * The Blazor hook that manages the lifecycle of CKEditor5 instances.\n */\nexport class EditorComponentElement extends HTMLElement {\n /**\n * The promise that resolves to the editor instance.\n */\n private editorPromise: Promise<Editor> | null = null;\n\n /**\n * Wait result for the interactive attribute.\n */\n private interactiveWait?: WaitForInteractiveResult;\n\n /**\n * Mounts the editor component.\n */\n async connectedCallback(): Promise<void> {\n await waitForDOMReady();\n\n // By default, components do not bootstrap from web components.\n // They bootstrap only when they receive the data-cke-interactive flag, which the interop sets.\n // This is a fallback for situations where CKEditor 5 is rendered on a non-interactive page.\n this.interactiveWait = waitForInteractiveAttribute(this);\n\n // Let's start preloading the editor constructor. We are still waiting for the interactive attribute, but\n // at least we will have the constructor ready when it arrives. It makes no difference which editor type is being\n // preloaded as they are loaded from the same package, so let's just preload the classic editor constructor.\n void loadEditorConstructor('classic');\n\n await this.interactiveWait.promise;\n await this.initializeEditor();\n }\n\n /**\n * Initializes the editor instance.\n */\n private async initializeEditor(): Promise<void> {\n const editorId = this.getAttribute('data-cke-editor-id')!;\n\n EditorsRegistry.the.resetErrors(editorId);\n\n try {\n this.style.display = 'block';\n this.editorPromise = this.createEditor();\n\n const editor = await this.editorPromise;\n\n // Do not even try to broadcast about the registration of the editor\n // if hook was immediately destroyed.\n /* v8 ignore else -- @preserve */\n if (this.isConnected) {\n EditorsRegistry.the.register(editorId, editor);\n\n editor.once('destroy', () => {\n if (EditorsRegistry.the.hasItem(editorId)) {\n EditorsRegistry.the.unregister(editorId);\n }\n });\n }\n }\n catch (error: any) {\n /* v8 ignore start -- @preserve */\n console.error(`Error initializing CKEditor5 instance with ID \"${editorId}\":`, error);\n this.editorPromise = null;\n EditorsRegistry.the.error(editorId, error);\n /* v8 ignore end */\n }\n }\n\n /**\n * Destroys the editor instance when the component is destroyed.\n * This is important to prevent memory leaks and ensure that the editor is properly cleaned up.\n */\n async disconnectedCallback() {\n // Disconnect the observer if present.\n this.interactiveWait?.disconnect();\n\n // Let's hide the element during destruction to prevent flickering.\n this.style.display = 'none';\n\n // Let's wait for the mounted promise to resolve before proceeding with destruction.\n try {\n const editor = await this.editorPromise;\n\n /* v8 ignore next -- @preserve */\n if (!editor) {\n return;\n }\n\n const editorContext = unwrapEditorContext(editor);\n const watchdog = unwrapEditorWatchdog(editor);\n\n if (editorContext) {\n // If context is present, make sure it's not in unmounting phase, as it'll kill the editors.\n // If it's being destroyed, don't do anything, as the context will take care of it.\n if (editorContext.state !== 'unavailable') {\n await editorContext.context.remove(editorContext.editorContextId);\n }\n }\n else if (watchdog) {\n await watchdog.destroy();\n }\n else {\n await editor.destroy();\n }\n }\n finally {\n this.editorPromise = null;\n }\n }\n\n /**\n * Creates the CKEditor instance.\n */\n private async createEditor() {\n const editorId = this.getAttribute('data-cke-editor-id')!;\n const preset = JSON.parse(this.getAttribute('data-cke-preset')!) as EditorPreset;\n const contextId = this.getAttribute('data-cke-context-id');\n const editableHeight = this.getAttribute('data-cke-editable-height') ? Number.parseInt(this.getAttribute('data-cke-editable-height')!, 10) : null;\n const saveDebounceMs = Number.parseInt(this.getAttribute('data-cke-save-debounce-ms')!, 10);\n const language = JSON.parse(this.getAttribute('data-cke-language')!) as EditorLanguage;\n const watchdog = this.hasAttribute('data-cke-watchdog');\n const content = JSON.parse(this.getAttribute('data-cke-content')!) as Record<string, string>;\n\n const {\n customTranslations,\n editorType,\n licenseKey,\n config: { plugins, ...config },\n } = preset;\n\n // Wrap editor creator with watchdog if needed.\n let Constructor: EditorCreator = await loadEditorConstructor(editorType);\n const context = await (\n contextId\n ? ContextsRegistry.the.waitFor(contextId)\n : null\n );\n\n // Do not use editor specific watchdog if context is attached, as the context is by default protected.\n if (watchdog && !context) {\n const wrapped = await wrapWithWatchdog(Constructor);\n\n ({ Constructor } = wrapped);\n wrapped.watchdog.on('restart', () => {\n const newInstance = wrapped.watchdog.editor!;\n\n this.editorPromise = Promise.resolve(newInstance);\n\n EditorsRegistry.the.register(editorId, newInstance);\n });\n }\n\n const { loadedPlugins, hasPremium } = await loadEditorPlugins(plugins);\n\n loadedPlugins.push(\n await createDispatchEditorRootsChangeEventPlugin({\n saveDebounceMs,\n editorId,\n targetElement: this,\n }),\n );\n\n if (isSingleRootEditor(editorType)) {\n loadedPlugins.push(\n await createSyncEditorWithInputPlugin(saveDebounceMs),\n );\n }\n\n // Mix custom translations with loaded translations.\n const loadedTranslations = await loadAllEditorTranslations(language, hasPremium);\n const mixedTranslations = [\n ...loadedTranslations,\n normalizeCustomTranslations(customTranslations || {}),\n ]\n .filter(translations => !isEmptyObject(translations));\n\n // Let's query all elements, and create basic configuration.\n let initialData: string | Record<string, string> = {\n ...content,\n ...queryEditablesSnapshotContent(editorId),\n };\n\n if (isSingleRootEditor(editorType)) {\n initialData = initialData['main'] || '';\n }\n\n // Depending of the editor type, and parent lookup for nearest context or initialize it without it.\n const editor = await (async () => {\n let sourceElementOrData: HTMLElement | Record<string, HTMLElement> = queryEditablesElements(editorId);\n\n // Handle special case when user specified `initialData` of several root elements, but editable components\n // are not yet present in the DOM. In other words - editor is initialized before attaching root elements.\n if (!sourceElementOrData['main']) {\n const requiredRoots = (\n isSingleRootEditor(editorType)\n ? ['main']\n : Object.keys(initialData as Record<string, string>)\n );\n\n if (!checkIfAllRootsArePresent(sourceElementOrData, requiredRoots)) {\n sourceElementOrData = await waitForAllRootsToBePresent(editorId, requiredRoots);\n initialData = {\n ...content,\n ...queryEditablesSnapshotContent(editorId),\n };\n }\n }\n\n // If single root editor, unwrap the element from the object.\n if (isSingleRootEditor(editorType) && 'main' in sourceElementOrData) {\n sourceElementOrData = sourceElementOrData['main'];\n }\n\n // Construct parsed config. First resolve DOM element references in the provided configuration.\n let resolvedConfig = resolveEditorConfigElementReferences(config);\n\n // Then resolve translation references in the provided configuration, using the mixed translations.\n resolvedConfig = resolveEditorConfigTranslations([...mixedTranslations].reverse(), language.ui, resolvedConfig);\n\n // Construct parsed config.\n const parsedConfig = {\n ...resolvedConfig,\n initialData,\n licenseKey,\n plugins: loadedPlugins,\n language,\n ...mixedTranslations.length && {\n translations: mixedTranslations,\n },\n };\n\n if (!context || !(sourceElementOrData instanceof HTMLElement)) {\n return Constructor.create(sourceElementOrData as any, parsedConfig);\n }\n\n const result = await createEditorInContext({\n context,\n element: sourceElementOrData,\n creator: Constructor,\n config: parsedConfig,\n });\n\n return result.editor;\n })();\n\n if (isSingleRootEditor(editorType) && editableHeight) {\n setEditorEditableHeight(editor, editableHeight);\n }\n\n return editor;\n };\n}\n\n/**\n * Checks if all required root elements are present in the elements object.\n *\n * @param elements The elements object mapping root IDs to HTMLElements.\n * @param requiredRoots The list of required root IDs.\n * @returns True if all required roots are present, false otherwise.\n */\nfunction checkIfAllRootsArePresent(elements: Record<string, HTMLElement>, requiredRoots: string[]): boolean {\n return requiredRoots.every(rootId => elements[rootId]);\n}\n\n/**\n * Waits for all required root elements to be present in the DOM.\n *\n * @param editorId The editor's ID.\n * @param requiredRoots The list of required root IDs.\n * @returns A promise that resolves to the record of root elements.\n */\nasync function waitForAllRootsToBePresent(\n editorId: EditorId,\n requiredRoots: string[],\n): Promise<Record<string, HTMLElement>> {\n return waitFor(\n () => {\n const elements = queryEditablesElements(editorId) as unknown as Record<string, HTMLElement>;\n\n if (!checkIfAllRootsArePresent(elements, requiredRoots)) {\n throw new Error(\n 'It looks like not all required root elements are present yet.\\n'\n + '* If you want to wait for them, ensure they are registered before editor initialization.\\n'\n + '* If you want lazy initialize roots, consider removing root values from the `initialData` config '\n + 'and assign initial data in editable components.\\n'\n + `Missing roots: ${requiredRoots.filter(rootId => !elements[rootId]).join(', ')}.`,\n );\n }\n\n return elements;\n },\n { timeOutAfter: 2000, retryAfter: 100 },\n );\n}\n","import { CKEditor5BlazorError } from '../ckeditor5-blazor-error';\nimport { waitForDOMReady } from '../shared';\nimport { EditorsRegistry } from './editor/editors-registry';\nimport { queryAllEditorIds } from './editor/utils';\n\n/**\n * UI Part hook for Blazor. It allows you to create UI parts for multi-root editors.\n */\nexport class UIPartComponentElement extends HTMLElement {\n /**\n * The promise that resolves when the UI part is mounted.\n */\n private mountedPromise: Promise<void> | null = null;\n\n /**\n * Mounts the UI part component.\n */\n async connectedCallback() {\n await waitForDOMReady();\n\n const editorId = this.getAttribute('data-cke-editor-id') || queryAllEditorIds()[0]!;\n const name = this.getAttribute('data-cke-name');\n\n /* v8 ignore next if -- @preserve */\n if (!editorId || !name) {\n return;\n }\n\n // If the editor is not registered yet, we will wait for it to be registered.\n this.style.display = 'block';\n this.mountedPromise = EditorsRegistry.the.execute(editorId, (editor) => {\n if (!this.isConnected) {\n return;\n }\n\n const { ui } = editor;\n\n const uiViewName = mapUIPartView(name);\n const uiPart = (ui.view as any)[uiViewName!];\n\n /* v8 ignore next if -- @preserve */\n if (!uiPart) {\n throw new CKEditor5BlazorError(`Unknown UI part name: \"${name}\". Supported names are \"toolbar\" and \"menubar\".`);\n }\n\n this.appendChild(uiPart.element);\n });\n }\n\n /**\n * Destroys the UI part component. Unmounts UI parts from the editor.\n */\n async disconnectedCallback() {\n // Let's hide the element during destruction to prevent flickering.\n this.style.display = 'none';\n\n // Let's wait for the mounted promise to resolve before proceeding with destruction.\n await this.mountedPromise;\n this.mountedPromise = null;\n\n // Unmount all UI parts from the editor.\n this.innerHTML = '';\n }\n}\n\n/**\n * Maps the UI part name to the corresponding view in the editor.\n *\n * @param name The name of the UI part.\n * @returns The name of the view in the editor.\n */\nfunction mapUIPartView(name: string): string | null {\n switch (name) {\n case 'toolbar':\n return 'toolbar';\n\n case 'menubar':\n return 'menuBarView';\n\n /* v8 ignore next -- @preserve */\n default:\n return null;\n }\n}\n","import { ContextComponentElement } from './context';\nimport { EditableComponentElement } from './editable';\nimport { EditorComponentElement } from './editor';\nimport { UIPartComponentElement } from './ui-part';\n\nconst CUSTOM_ELEMENTS = {\n 'cke5-editor': EditorComponentElement,\n 'cke5-context': ContextComponentElement,\n 'cke5-ui-part': UIPartComponentElement,\n 'cke5-editable': EditableComponentElement,\n};\n\n/**\n * Registers all available Blazor component hooks.\n */\nexport function ensureEditorElementsRegistered() {\n for (const [name, CustomElement] of Object.entries(CUSTOM_ELEMENTS)) {\n if (window.customElements.get(name)) {\n continue;\n }\n\n window.customElements.define(name, CustomElement);\n }\n}\n","import { markElementAsInteractive } from '../shared';\n\n/**\n * Creates a simple interop layer for CKEditor 5 context to set the interactive attribute.\n *\n * @param element - The root HTML element of the context component, used to identify\n * the context instance and attach necessary attributes.\n */\nexport function createContextBlazorInterop(element: HTMLElement) {\n markElementAsInteractive(element);\n\n return {\n unmount() {},\n };\n}\n","import type { Editor } from 'ckeditor5';\n\n/**\n * Creates a focus-aware value synchronization layer for a CKEditor 5 instance.\n *\n * Handles the shared mechanics present in both the Editor and Editable Blazor interops:\n * - Tracking `lastSyncedValue` to prevent circular Blazor ↔ JS updates.\n * - Storing a `pendingValue` when a Blazor update arrives while the editor is focused,\n * and applying it safely once the user blurs.\n * - Registering and cleaning up the `change:data` and `change:isFocused` editor listeners.\n *\n * @param editor - The CKEditor 5 editor instance to synchronize with.\n * @param options - Callbacks and equality check specific to the consumer (editor vs editable).\n * @param options.getCurrentValue - Returns the current value of the tracked root(s) from the editor.\n * @param options.applyValue - Applies the given value to the editor (e.g. via `editor.setData`).\n * @param options.isEqual - Returns true if two values are considered equal, used to avoid redundant updates.\n * @returns An object with `setValue`, `shouldNotify`, and `unmount`.\n */\nexport function createEditorValueSync<T>(\n editor: Editor,\n options: {\n\n /**\n * Returns the current value of the tracked root(s) from the editor.\n * Called to compare against the pending value before applying it.\n */\n getCurrentValue: () => T;\n\n /**\n * Applies the given value to the editor (e.g. via `editor.setData`).\n */\n applyValue: (value: T) => void;\n\n /**\n * Returns true if two values are considered equal, used to avoid redundant\n * updates in both directions.\n */\n isEqual: (a: T, b: T) => boolean;\n },\n): EditorValueSync<T> {\n const state = {\n /** Value received from Blazor while the editor was focused, pending application on blur. */\n pendingValue: null as T | null,\n\n /** The last value sent to or received from Blazor to prevent circular updates. */\n lastSyncedValue: null as T | null,\n };\n\n /**\n * Any internal model change means the pending external value is stale — discard it.\n */\n const onChangeData = () => {\n state.pendingValue = null;\n };\n\n /**\n * When the editor loses focus, apply any value that Blazor sent while the user was typing.\n */\n const onFocusChange = (_evt: unknown, _name: unknown, isFocused: boolean) => {\n if (isFocused || state.pendingValue === null) {\n return;\n }\n\n const current = options.getCurrentValue();\n\n if (!options.isEqual(current, state.pendingValue)) {\n options.applyValue(state.pendingValue);\n }\n\n state.pendingValue = null;\n };\n\n editor.model.document.on('change:data', onChangeData);\n editor.ui.focusTracker.on('change:isFocused', onFocusChange);\n\n return {\n /**\n * Removes all editor listeners registered by this sync instance.\n * Call this when the Blazor component is disposed.\n */\n unmount() {\n editor.model.document.off('change:data', onChangeData);\n editor.ui.focusTracker.off('change:isFocused', onFocusChange);\n },\n\n /**\n * Checks whether the given value differs from the last synced value and, if so,\n * updates `lastSyncedValue` and returns `true` to signal that Blazor should be notified.\n *\n * Call this from the `CKEditor5ChangeDataEvent` handler to conditionally invoke\n * the .NET interop method.\n */\n shouldNotify(value: T): boolean {\n if (state.lastSyncedValue !== null && options.isEqual(state.lastSyncedValue, value)) {\n return false;\n }\n\n state.lastSyncedValue = value;\n return true;\n },\n\n /**\n * Pushes a new value from Blazor into the editor.\n * If the editor is currently focused, the update is deferred until blur.\n * If the value matches the last synced state, the update is skipped entirely.\n */\n setValue(value: T) {\n if (editor.ui.focusTracker.isFocused) {\n state.pendingValue = value;\n return;\n }\n\n if (state.lastSyncedValue !== null && options.isEqual(state.lastSyncedValue, value)) {\n return;\n }\n\n state.lastSyncedValue = value;\n options.applyValue(value);\n },\n };\n}\n\n/**\n * Returns a no-op {@link EditorValueSync} used as a placeholder before the real editor\n * instance is available, so callers never have to null-check `sync`.\n */\nexport function createNoopSync<T>(): EditorValueSync<T> {\n return {\n unmount() {},\n shouldNotify(_value: T): boolean { return false; },\n setValue(_value: T) {},\n };\n}\n\n/**\n * The public interface returned by {@link createEditorValueSync} and {@link createNoopSync}.\n * Typed over the value shape `T` so consumers can declare `sync` variables without\n * repeating the full return type.\n */\nexport type EditorValueSync<T> = {\n /** Removes all editor listeners registered by this sync instance. */\n unmount: () => void;\n\n /**\n * Checks whether the given value differs from the last synced value and, if so,\n * updates `lastSyncedValue` and returns `true` to signal that Blazor should be notified.\n */\n /**\n * Called by the consumer to determine if a value change should trigger a\n * notification. Returns `true` when the value differs from the last one that\n * was synced and updates internal tracking.\n */\n shouldNotify: (value: T) => boolean;\n\n /**\n * Pushes a new value from Blazor into the editor.\n * Deferred until blur when the editor is focused; skipped when value is unchanged.\n */\n setValue: (value: T) => void;\n};\n","import type { DotNetInterop } from '../types';\n\nimport { EditorsRegistry } from '../elements/editor/editors-registry';\nimport { CKEditor5ChangeDataEvent } from '../elements/editor/plugins/dispatch-editor-roots-change-event';\nimport { markElementAsInteractive } from '../shared';\nimport { createEditorValueSync, createNoopSync } from './utils/create-editor-value-sync';\n\n/**\n * Creates an interop layer to synchronize a single CKEditor 5 editable root with a Blazor component.\n *\n * @param element - The root HTML element of the editable component, used to identify\n * the editable instance and attach necessary attributes.\n * @param interop - The .NET object reference to trigger Blazor methods.\n * @returns An object containing lifecycle and synchronization methods.\n */\nexport function createEditableBlazorInterop(element: HTMLElement, interop: DotNetInterop) {\n const editorId = element.getAttribute('data-cke-editor-id');\n const rootName = element.getAttribute('data-cke-root-name') ?? 'main';\n\n let unmounted = false;\n let sync = createNoopSync<string>();\n let editorRef: unknown | null = null;\n\n /**\n * Handles data change events dispatched by the CKEditor plugin.\n * Filters by both editorId and rootName, then notifies Blazor if the root value changed.\n * The callback now includes a JS object reference to the underlying editor instance.\n */\n const onDataChange = (event: Event) => {\n if (!(event instanceof CKEditor5ChangeDataEvent) || event.detail.editorId !== editorId) {\n return;\n }\n\n const newValue = event.detail.roots[rootName];\n\n if (newValue === undefined) {\n return;\n }\n\n if (sync.shouldNotify(newValue)) {\n void interop.invokeMethodAsync('OnChangeEditableData', editorRef, newValue);\n }\n };\n\n /**\n * Initializes the focus tracker and model listeners for the editor owning this editable.\n */\n const initializeSynchronization = async () => {\n const editor = await EditorsRegistry.the.waitFor(editorId);\n editorRef = DotNet.createJSObjectReference(editor);\n\n sync = createEditorValueSync(editor, {\n getCurrentValue: () => editor.getData({ rootName }) ?? '',\n applyValue: value => editor.setData({ [rootName]: value }),\n isEqual: (a, b) => a === b,\n });\n };\n\n void initializeSynchronization();\n document.body.addEventListener(CKEditor5ChangeDataEvent.EVENT_NAME, onDataChange);\n markElementAsInteractive(element);\n\n return {\n /**\n * Cleans up all event listeners when the Blazor component is disposed.\n */\n unmount() {\n if (unmounted) {\n return;\n }\n\n document.body.removeEventListener(CKEditor5ChangeDataEvent.EVENT_NAME, onDataChange);\n sync.unmount();\n\n if (editorRef) {\n DotNet.disposeJSObjectReference(editorRef);\n editorRef = null;\n }\n\n unmounted = true;\n },\n\n /**\n * Updates this editable root's data from Blazor.\n * If the editor is focused, the update is deferred until blur to avoid interrupting the user.\n */\n setValue: async (value: string) => {\n if (unmounted) {\n return;\n }\n\n await EditorsRegistry.the.waitFor(editorId);\n\n // Ensure sync is initialized before forwarding (waitFor guarantees the editor exists)\n sync.setValue(value);\n },\n };\n}\n","import type { DotNetInterop } from '../types';\n\nimport { ensureEditorElementsRegistered } from '../elements';\nimport { EditorsRegistry } from '../elements/editor/editors-registry';\nimport { CKEditor5ChangeDataEvent } from '../elements/editor/plugins/dispatch-editor-roots-change-event';\nimport { getEditorRootsValues } from '../elements/editor/utils';\nimport { markElementAsInteractive, shallowEqual } from '../shared';\nimport { createEditorValueSync, createNoopSync } from './utils/create-editor-value-sync';\n\n/**\n * Creates an interop layer to synchronize a CKEditor 5 instance with a Blazor component.\n *\n * @param element - The root HTML element of the editor component, used to identify the editor instance and attach necessary attributes.\n * @param interop - The .NET object reference to trigger Blazor methods.\n * @returns An object containing lifecycle and synchronization methods.\n */\nexport function createEditorBlazorInterop(element: HTMLElement, interop: DotNetInterop) {\n const editorId = element.getAttribute('data-cke-editor-id');\n\n let unmounted = false;\n let unmountCKEditorListeners: VoidFunction | null = null;\n\n let sync = createNoopSync<Record<string, string>>();\n let editorRef: unknown | null = null;\n\n // Handles data change events dispatched by the CKEditor plugin.\n // Dispatches updates back to Blazor if the data has changed.\n const onDataChange = (event: Event) => {\n if (!(event instanceof CKEditor5ChangeDataEvent) || event.detail.editorId !== editorId) {\n return;\n }\n\n if (sync.shouldNotify(event.detail.roots)) {\n void interop.invokeMethodAsync('OnChangeEditorData', editorRef!, event.detail.roots);\n }\n };\n\n /**\n * Initializes the focus tracker and model listeners for the editor.\n */\n const initializeSynchronization = async () => {\n const editor = await EditorsRegistry.the.waitFor(editorId);\n\n editorRef = globalThis.DotNet.createJSObjectReference(editor);\n sync = createEditorValueSync(editor, {\n getCurrentValue: () => getEditorRootsValues(editor),\n applyValue: value => editor.setData(value),\n isEqual: shallowEqual,\n });\n\n // Notify Blazor of focus changes so it can trigger the appropriate callbacks.\n const onFocusChange = (_evt: unknown, _name: unknown, isFocused: boolean) => {\n const method = isFocused ? 'OnEditorFocus' : 'OnEditorBlur';\n\n void interop.invokeMethodAsync(method, editorRef);\n };\n\n editor.ui.focusTracker.on('change:isFocused', onFocusChange);\n\n // Notify Blazor that the editor instance is ready so the consumer can\n // retain an IJSObjectReference or perform additional JS calls directly.\n // This mirrors the `OnChangeEditorData` (which now also drives the public\n // `OnChange` event) as well as `OnEditorFocus` and `OnEditorBlur` callbacks\n // that already exist on the .NET side.\n void interop.invokeMethodAsync('OnEditorReady', editorRef);\n\n // When the Blazor component is disposed, clean up event listeners.\n unmountCKEditorListeners = () => {\n editor.ui.focusTracker.off('change:isFocused', onFocusChange);\n };\n };\n\n void initializeSynchronization();\n document.body.addEventListener(CKEditor5ChangeDataEvent.EVENT_NAME, onDataChange);\n\n ensureEditorElementsRegistered();\n markElementAsInteractive(element);\n\n return {\n /**\n * Updates the editor data from Blazor. If the editor is focused, the update is deferred until blur to avoid interrupting the user.\n */\n setValue: async (value: Record<string, string>) => {\n if (unmounted) {\n return;\n }\n\n await EditorsRegistry.the.waitFor(editorId);\n sync.setValue(value);\n },\n\n /**\n * Cleans up all event listeners when the Blazor component is disposed.\n */\n unmount() {\n if (unmounted) {\n return;\n }\n\n document.body.removeEventListener(CKEditor5ChangeDataEvent.EVENT_NAME, onDataChange);\n sync.unmount();\n unmountCKEditorListeners?.();\n\n if (editorRef) {\n globalThis.DotNet.disposeJSObjectReference(editorRef);\n editorRef = null;\n }\n\n unmounted = true;\n },\n };\n}\n","import { markElementAsInteractive } from '../shared';\n\n/**\n * Creates a simple interop layer for CKEditor 5 UI part to set the interactive attribute.\n *\n * @param element - The root HTML element of the UI part component, used to identify\n * the UI part instance and attach necessary attributes.\n */\nexport function createUIPartBlazorInterop(element: HTMLElement) {\n markElementAsInteractive(element);\n\n return {\n unmount() {},\n };\n}\n"],"names":["CKEditor5BlazorError","message","AsyncRegistry","id","onSuccess","onError","item","error","resolve","reject","pending","callback","initializationErrors","timeout","exceedTimeout","timer","value","promises","watcher","debounce","delay","timeoutId","args","filterObjectValues","obj","filter","filteredEntries","key","isEmptyObject","mapObjectValues","mapper","mappedEntries","shallowEqual","objA","objB","keysA","keysB","uid","waitFor","timeOutAfter","retryAfter","startTime","lastError","timeoutTimerId","tick","result","err","waitForDOMReady","waitForInteractiveAttribute","element","observer","mutations","mutation","markElementAsInteractive","CONTEXT_EDITOR_WATCHDOG_SYMBOL","createEditorInContext","context","creator","config","editorContextId","_element","_config","editor","contextDescriptor","originalDestroy","unwrapEditorContext","getEditorRootsValues","acc","root","isSingleRootEditor","editorType","loadEditorConstructor","type","PKG","EditorConstructor","CustomEditorPluginsRegistry","name","reader","loadEditorPlugins","plugins","basePackage","premiumPackage","loaders","plugin","customPlugin","basePkgImport","premiumPkgImport","loadAllEditorTranslations","language","hasPremium","translations","loadEditorPkgTranslations","pkg","lang","pack","loadEditorTranslation","normalizeCustomTranslations","dictionary","queryAllEditorIds","queryEditablesElements","editorId","editables","queryAllEditorEditables","queryEditablesSnapshotContent","values","content","rootName","currentMain","initialRootEditableValue","contentElement","resolveEditorConfigElementReferences","anyObj","resolveEditorConfigTranslations","getTranslationValue","langData","setEditorEditableHeight","instance","height","editing","writer","EDITOR_WATCHDOG_SYMBOL","wrapWithWatchdog","Editor","EditorWatchdog","watchdog","unwrapEditorWatchdog","ContextsRegistry","ContextComponentElement","contextId","contextConfig","customTranslations","watchdogConfig","loadedPlugins","mixedTranslations","ContextWatchdog","Context","resolvedConfig","EditorsRegistry","EditableComponentElement","saveDebounceMs","ui","model","input","data","editable","sync","html","debouncedSync","createDispatchEditorRootsChangeEventPlugin","targetElement","Plugin","CKEditor5ChangeDataEvent","detail","createSyncEditorWithInputPlugin","newValue","EditorComponentElement","editorContext","preset","editableHeight","licenseKey","Constructor","wrapped","newInstance","initialData","sourceElementOrData","requiredRoots","checkIfAllRootsArePresent","waitForAllRootsToBePresent","parsedConfig","elements","rootId","UIPartComponentElement","uiViewName","mapUIPartView","uiPart","CUSTOM_ELEMENTS","ensureEditorElementsRegistered","CustomElement","createContextBlazorInterop","createEditorValueSync","options","state","onChangeData","onFocusChange","_evt","_name","isFocused","current","createNoopSync","_value","createEditableBlazorInterop","interop","unmounted","editorRef","onDataChange","event","a","b","createEditorBlazorInterop","unmountCKEditorListeners","method","createUIPartBlazorInterop"],"mappings":"uiBAGO,MAAMA,UAA6B,KAAM,CAC9C,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,sBACd,CACF,CCJO,MAAMC,CAAsC,CAIhC,UAAY,IAKZ,yBAA2B,IA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iBAAiBhC,EAAyB,WAAY2C,CAAY,EAEhFlB,GAAA,EACA3H,EAAyBJ,CAAO,EAEzB,CAIL,SAAU,MAAOjC,GAAkC,CAC7CgL,IAIJ,MAAMvD,EAAgB,IAAI,QAAQrC,CAAQ,EAC1C6C,EAAK,SAASjI,CAAK,EACrB,EAKA,SAAU,CACJgL,IAIJ,SAAS,KAAK,oBAAoBzC,EAAyB,WAAY2C,CAAY,EACnFjD,EAAK,QAAA,EACLsD,IAAA,EAEIN,IACF,WAAW,OAAO,yBAAyBA,CAAS,EACpDA,EAAY,MAGdD,EAAY,GACd,CAAA,CAEJ,CCvGO,SAASS,GAA0BxJ,EAAsB,CAC9D,OAAAI,EAAyBJ,CAAO,EAEzB,CACL,SAAU,CAAC,CAAA,CAEf"}
@@ -0,0 +1,11 @@
1
+ export { CKEditor5BlazorError } from './ckeditor5-blazor-error';
2
+ export { ensureEditorElementsRegistered } from './elements';
3
+ export { ContextsRegistry } from './elements/context/contexts-registry';
4
+ export { EditableComponentElement } from './elements/editable';
5
+ export { EditorComponentElement } from './elements/editor';
6
+ export { CustomEditorPluginsRegistry } from './elements/editor/custom-editor-plugins';
7
+ export { EditorsRegistry } from './elements/editor/editors-registry';
8
+ export { CKEditor5ChangeDataEvent } from './elements/editor/plugins/dispatch-editor-roots-change-event';
9
+ export { UIPartComponentElement } from './elements/ui-part';
10
+ export { createContextBlazorInterop, createEditableBlazorInterop, createEditorBlazorInterop, createUIPartBlazorInterop, } from './interop';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8DAA8D,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,WAAW,CAAC"}