@ckeditor/ckeditor5-ai 49.0.1 → 49.1.0-alpha.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 (208) hide show
  1. package/dist/aiactions/aiactions.d.ts +2 -2
  2. package/dist/aiballoon/ui/aiballoonview.d.ts +1 -1
  3. package/dist/aichat/aichatballoon.d.ts +1 -1
  4. package/dist/aichat/aichatcontroller.d.ts +2 -2
  5. package/dist/aichat/ui/aichatfeedview.d.ts +24 -0
  6. package/dist/aichat/ui/feed/aichatfeedsuggestionitemactionsview.d.ts +7 -0
  7. package/dist/aichatshortcuts/aichatshortcuts.d.ts +2 -2
  8. package/dist/aicore/aiconnector.d.ts +2 -2
  9. package/dist/aicore/aiediting.d.ts +8 -4
  10. package/dist/aicore/aieditorconfig.d.ts +225 -0
  11. package/dist/aicore/aigateway.d.ts +8 -3
  12. package/dist/aicore/model/aicontext.d.ts +2 -2
  13. package/dist/aicore/pipeline/airesponseapplier.d.ts +1 -0
  14. package/dist/aicore/ui/aiscrollfillerview.d.ts +37 -0
  15. package/dist/aicore/ui/suggestioncontainer/aisuggestionbodyview.d.ts +6 -1
  16. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartstateview.d.ts +7 -0
  17. package/dist/aicore/utils/autoadvancedelay.d.ts +13 -0
  18. package/dist/aicore/utils/getallowedcustomelements.d.ts +16 -0
  19. package/dist/aicore/utils/geteditorconfig.d.ts +10 -76
  20. package/dist/aicore/utils/getoperationsfordocumentsuggestions.d.ts +4 -4
  21. package/dist/aicore/utils/getrootinfo.d.ts +2 -19
  22. package/dist/aicore/utils/getscrolltoptoelement.d.ts +13 -0
  23. package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +35 -0
  24. package/dist/aicore/utils/htmlparser.d.ts +3 -2
  25. package/dist/aicore/utils/replyactions.d.ts +10 -2
  26. package/dist/aicore/utils/scrollmanager.d.ts +5 -0
  27. package/dist/aireviewcore/aireviewcoreediting.d.ts +2 -2
  28. package/dist/aireviewcore/aireviewcoreui.d.ts +8 -0
  29. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +8 -0
  30. package/dist/aireviewcore/ui/aireviewcorenavigationpanelview.d.ts +1 -1
  31. package/dist/aireviewcore/ui/aireviewcoreuicheckresultsview.d.ts +22 -7
  32. package/dist/aireviewmode/aireviewmodecontroller.d.ts +4 -0
  33. package/dist/aireviewmode/ui/aireviewmodecheckresultsview.d.ts +10 -1
  34. package/dist/aireviewmode/ui/aireviewmodesummaryview.d.ts +44 -0
  35. package/dist/augmentation.d.ts +6 -0
  36. package/dist/index-editor.css +328 -166
  37. package/dist/index.css +328 -166
  38. package/dist/index.d.ts +10 -4
  39. package/dist/index.js +21 -19
  40. package/dist/toolkit/applypatch.d.ts +31 -0
  41. package/dist/toolkit/computechanges.d.ts +19 -0
  42. package/dist/toolkit/computepreviews.d.ts +39 -0
  43. package/dist/toolkit/createfragmentfromrange.d.ts +24 -0
  44. package/dist/toolkit/dataidassigner.d.ts +38 -0
  45. package/dist/toolkit/documentcompare.d.ts +357 -0
  46. package/dist/{aisdk → toolkit}/documentcompareutils.d.ts +1 -1
  47. package/dist/{aisdk/documentchanges.d.ts → toolkit/documentdiffer.d.ts} +39 -21
  48. package/dist/toolkit/documentdifferutils.d.ts +15 -0
  49. package/dist/{aisdk → toolkit}/documentsnapshot.d.ts +9 -4
  50. package/dist/toolkit/elementcategory.d.ts +50 -0
  51. package/dist/toolkit/elementmatcher.d.ts +114 -0
  52. package/dist/{aisdk → toolkit}/extractselectionfromhtml.d.ts +1 -1
  53. package/dist/toolkit/proposedchange.d.ts +113 -0
  54. package/dist/toolkit/proposedchanges.d.ts +130 -0
  55. package/dist/toolkit/proposedchangescollection.d.ts +93 -0
  56. package/dist/toolkit/proposedchangescontroller.d.ts +129 -0
  57. package/dist/toolkit/proposedchangescontrollertype.d.ts +88 -0
  58. package/dist/{aisdk/documentchangesutils.d.ts → toolkit/proposedchangesutils.d.ts} +3 -3
  59. package/dist/{aisdk → toolkit}/validateoperations.d.ts +1 -1
  60. package/dist/translations/af.js +1 -1
  61. package/dist/translations/af.umd.js +1 -1
  62. package/dist/translations/ar.js +1 -1
  63. package/dist/translations/ar.umd.js +1 -1
  64. package/dist/translations/ast.js +1 -1
  65. package/dist/translations/ast.umd.js +1 -1
  66. package/dist/translations/az.js +1 -1
  67. package/dist/translations/az.umd.js +1 -1
  68. package/dist/translations/be.js +1 -1
  69. package/dist/translations/be.umd.js +1 -1
  70. package/dist/translations/bg.js +1 -1
  71. package/dist/translations/bg.umd.js +1 -1
  72. package/dist/translations/bn.js +1 -1
  73. package/dist/translations/bn.umd.js +1 -1
  74. package/dist/translations/bs.js +1 -1
  75. package/dist/translations/bs.umd.js +1 -1
  76. package/dist/translations/ca.js +1 -1
  77. package/dist/translations/ca.umd.js +1 -1
  78. package/dist/translations/cs.js +1 -1
  79. package/dist/translations/cs.umd.js +1 -1
  80. package/dist/translations/da.js +1 -1
  81. package/dist/translations/da.umd.js +1 -1
  82. package/dist/translations/de-ch.js +1 -1
  83. package/dist/translations/de-ch.umd.js +1 -1
  84. package/dist/translations/de.js +1 -1
  85. package/dist/translations/de.umd.js +1 -1
  86. package/dist/translations/el.js +1 -1
  87. package/dist/translations/el.umd.js +1 -1
  88. package/dist/translations/en-au.js +1 -1
  89. package/dist/translations/en-au.umd.js +1 -1
  90. package/dist/translations/en-gb.js +1 -1
  91. package/dist/translations/en-gb.umd.js +1 -1
  92. package/dist/translations/en.js +1 -1
  93. package/dist/translations/en.umd.js +1 -1
  94. package/dist/translations/eo.js +1 -1
  95. package/dist/translations/eo.umd.js +1 -1
  96. package/dist/translations/es-co.js +1 -1
  97. package/dist/translations/es-co.umd.js +1 -1
  98. package/dist/translations/es.js +1 -1
  99. package/dist/translations/es.umd.js +1 -1
  100. package/dist/translations/et.js +1 -1
  101. package/dist/translations/et.umd.js +1 -1
  102. package/dist/translations/eu.js +1 -1
  103. package/dist/translations/eu.umd.js +1 -1
  104. package/dist/translations/fa.js +1 -1
  105. package/dist/translations/fa.umd.js +1 -1
  106. package/dist/translations/fi.js +1 -1
  107. package/dist/translations/fi.umd.js +1 -1
  108. package/dist/translations/fr.js +1 -1
  109. package/dist/translations/fr.umd.js +1 -1
  110. package/dist/translations/gl.js +1 -1
  111. package/dist/translations/gl.umd.js +1 -1
  112. package/dist/translations/gu.js +1 -1
  113. package/dist/translations/gu.umd.js +1 -1
  114. package/dist/translations/he.js +1 -1
  115. package/dist/translations/he.umd.js +1 -1
  116. package/dist/translations/hi.js +1 -1
  117. package/dist/translations/hi.umd.js +1 -1
  118. package/dist/translations/hr.js +1 -1
  119. package/dist/translations/hr.umd.js +1 -1
  120. package/dist/translations/hu.js +1 -1
  121. package/dist/translations/hu.umd.js +1 -1
  122. package/dist/translations/hy.js +1 -1
  123. package/dist/translations/hy.umd.js +1 -1
  124. package/dist/translations/id.js +1 -1
  125. package/dist/translations/id.umd.js +1 -1
  126. package/dist/translations/it.js +1 -1
  127. package/dist/translations/it.umd.js +1 -1
  128. package/dist/translations/ja.js +1 -1
  129. package/dist/translations/ja.umd.js +1 -1
  130. package/dist/translations/jv.js +1 -1
  131. package/dist/translations/jv.umd.js +1 -1
  132. package/dist/translations/kk.js +1 -1
  133. package/dist/translations/kk.umd.js +1 -1
  134. package/dist/translations/km.js +1 -1
  135. package/dist/translations/km.umd.js +1 -1
  136. package/dist/translations/kn.js +1 -1
  137. package/dist/translations/kn.umd.js +1 -1
  138. package/dist/translations/ko.js +1 -1
  139. package/dist/translations/ko.umd.js +1 -1
  140. package/dist/translations/ku.js +1 -1
  141. package/dist/translations/ku.umd.js +1 -1
  142. package/dist/translations/lt.js +1 -1
  143. package/dist/translations/lt.umd.js +1 -1
  144. package/dist/translations/lv.js +1 -1
  145. package/dist/translations/lv.umd.js +1 -1
  146. package/dist/translations/ms.js +1 -1
  147. package/dist/translations/ms.umd.js +1 -1
  148. package/dist/translations/nb.js +1 -1
  149. package/dist/translations/nb.umd.js +1 -1
  150. package/dist/translations/ne.js +1 -1
  151. package/dist/translations/ne.umd.js +1 -1
  152. package/dist/translations/nl.js +1 -1
  153. package/dist/translations/nl.umd.js +1 -1
  154. package/dist/translations/no.js +1 -1
  155. package/dist/translations/no.umd.js +1 -1
  156. package/dist/translations/oc.js +1 -1
  157. package/dist/translations/oc.umd.js +1 -1
  158. package/dist/translations/pl.js +1 -1
  159. package/dist/translations/pl.umd.js +1 -1
  160. package/dist/translations/pt-br.js +1 -1
  161. package/dist/translations/pt-br.umd.js +1 -1
  162. package/dist/translations/pt.js +1 -1
  163. package/dist/translations/pt.umd.js +1 -1
  164. package/dist/translations/ro.js +1 -1
  165. package/dist/translations/ro.umd.js +1 -1
  166. package/dist/translations/ru.js +1 -1
  167. package/dist/translations/ru.umd.js +1 -1
  168. package/dist/translations/si.js +1 -1
  169. package/dist/translations/si.umd.js +1 -1
  170. package/dist/translations/sk.js +1 -1
  171. package/dist/translations/sk.umd.js +1 -1
  172. package/dist/translations/sl.js +1 -1
  173. package/dist/translations/sl.umd.js +1 -1
  174. package/dist/translations/sq.js +1 -1
  175. package/dist/translations/sq.umd.js +1 -1
  176. package/dist/translations/sr-latn.js +1 -1
  177. package/dist/translations/sr-latn.umd.js +1 -1
  178. package/dist/translations/sr.js +1 -1
  179. package/dist/translations/sr.umd.js +1 -1
  180. package/dist/translations/sv.js +1 -1
  181. package/dist/translations/sv.umd.js +1 -1
  182. package/dist/translations/th.js +1 -1
  183. package/dist/translations/th.umd.js +1 -1
  184. package/dist/translations/ti.js +1 -1
  185. package/dist/translations/ti.umd.js +1 -1
  186. package/dist/translations/tk.js +1 -1
  187. package/dist/translations/tk.umd.js +1 -1
  188. package/dist/translations/tr.js +1 -1
  189. package/dist/translations/tr.umd.js +1 -1
  190. package/dist/translations/tt.js +1 -1
  191. package/dist/translations/tt.umd.js +1 -1
  192. package/dist/translations/ug.js +1 -1
  193. package/dist/translations/ug.umd.js +1 -1
  194. package/dist/translations/uk.js +1 -1
  195. package/dist/translations/uk.umd.js +1 -1
  196. package/dist/translations/ur.js +1 -1
  197. package/dist/translations/ur.umd.js +1 -1
  198. package/dist/translations/uz.js +1 -1
  199. package/dist/translations/uz.umd.js +1 -1
  200. package/dist/translations/vi.js +1 -1
  201. package/dist/translations/vi.umd.js +1 -1
  202. package/dist/translations/zh-cn.js +1 -1
  203. package/dist/translations/zh-cn.umd.js +1 -1
  204. package/dist/translations/zh.js +1 -1
  205. package/dist/translations/zh.umd.js +1 -1
  206. package/package.json +32 -30
  207. package/dist/aisdk/dataidassigner.d.ts +0 -20
  208. package/dist/aisdk/documentcompare.d.ts +0 -171
@@ -6,26 +6,13 @@
6
6
  * @module ai/aicore/utils/geteditorconfig
7
7
  */
8
8
  import { type Editor } from "@ckeditor/ckeditor5-core";
9
- import { type AlignmentConfig } from "@ckeditor/ckeditor5-alignment";
10
- import { type CodeBlockConfig } from "@ckeditor/ckeditor5-code-block";
11
- import { type FontSizeConfig, type FontFamilyConfig, type FontColorConfig } from "@ckeditor/ckeditor5-font";
12
- import { type FootnotesConfig } from "@ckeditor/ckeditor5-footnotes";
13
- import { type HeadingConfig } from "@ckeditor/ckeditor5-heading";
14
- import { type HighlightConfig } from "@ckeditor/ckeditor5-highlight";
15
- import { type ImageConfig } from "@ckeditor/ckeditor5-image";
16
- import { type IndentBlockConfig } from "@ckeditor/ckeditor5-indent";
17
- import { type TextPartLanguageOption } from "@ckeditor/ckeditor5-language";
18
- import { type LineHeightConfig } from "@ckeditor/ckeditor5-line-height";
19
- import { type LinkConfig } from "@ckeditor/ckeditor5-link";
20
- import { type ListConfig } from "@ckeditor/ckeditor5-list";
21
- import { type MentionConfig } from "@ckeditor/ckeditor5-mention";
22
- import { type MergeFieldsConfig } from "@ckeditor/ckeditor5-merge-fields";
23
- import { type MultiLevelListConfig } from "@ckeditor/ckeditor5-list-multi-level";
24
- import { type StyleConfig } from "@ckeditor/ckeditor5-style";
25
- import { type TableConfig } from "@ckeditor/ckeditor5-table";
26
- import { type MediaEmbedConfig } from "@ckeditor/ckeditor5-media-embed";
27
- import { type GeneralHtmlSupportConfig } from "@ckeditor/ckeditor5-html-support";
28
- import { type AIRootInfo } from "./getrootinfo.js";
9
+ import { type AIEditorConfigSnapshot } from "../aieditorconfig.js";
10
+ /**
11
+ * Recursively replaces every regular expression in a plain-data structure with its `String( regExp )` form, leaving all
12
+ * other values untouched. Regular expressions serialize to `{}` (`JSON.stringify( /^a$/ ) === '{}'`), so without this
13
+ * the pattern would be lost on its way to the AI agent. Arrays and plain objects are recreated, never mutated.
14
+ */
15
+ export declare function stringifyRegExps<T>(value: T): T;
29
16
  /**
30
17
  * Builds a compact, serializable snapshot of the editor's feature capabilities for the AI agent.
31
18
  *
@@ -42,8 +29,8 @@ import { type AIRootInfo } from "./getrootinfo.js";
42
29
  * sizes or table properties) lets the agent keep its edits within what the editor can represent.
43
30
  *
44
31
  * On top of the features, the snapshot describes the root it was gathered for in
45
- * {@link ~AIEditorConfig#rootType `rootType`} — what that root can hold and what surrounds it. A snapshot is
46
- * therefore specific to one root, which matters for editors with more than one.
32
+ * {@link module:ai/aicore/aieditorconfig~AIEditorConfigSnapshot `rootType`} — what that root can hold and what
33
+ * surrounds it. A snapshot is therefore specific to one root, which matters for editors with more than one.
47
34
  *
48
35
  * The live editor configuration is never mutated.
49
36
  *
@@ -51,57 +38,4 @@ import { type AIRootInfo } from "./getrootinfo.js";
51
38
  * @param rootName The name of the root the snapshot is gathered for.
52
39
  * @returns The editor's feature capabilities snapshot.
53
40
  */
54
- export declare function getEditorConfig(editor: Editor, rootName?: string): AIEditorConfig;
55
- export type AIEditorConfig = AIEditorConfigFeatureConfigs & AIEditorConfigPresenceFlags & {
56
- editorVersion: string;
57
- };
58
- export type AIEditorConfigFeatureConfigs = {
59
- /**
60
- * A snapshot of the root the document relates to. See
61
- * {@link module:ai/aicore/utils/getrootinfo~getRootInfo `getRootInfo()`}.
62
- */
63
- rootType: AIRootInfo;
64
- alignment?: AlignmentConfig;
65
- codeBlock?: CodeBlockConfig;
66
- fontBackgroundColor?: FontColorConfig;
67
- fontColor?: FontColorConfig;
68
- fontFamily?: FontFamilyConfig;
69
- fontSize?: FontSizeConfig;
70
- footnotes?: FootnotesConfig;
71
- htmlSupport?: GeneralHtmlSupportConfig;
72
- heading?: HeadingConfig;
73
- highlight?: HighlightConfig;
74
- image?: ImageConfig;
75
- indentBlock?: IndentBlockConfig;
76
- lineHeight?: LineHeightConfig;
77
- link?: LinkConfig;
78
- list?: ListConfig;
79
- listMultiLevel?: MultiLevelListConfig;
80
- mediaEmbed?: MediaEmbedConfig;
81
- mention?: MentionConfig;
82
- mergeFields?: MergeFieldsConfig;
83
- style?: StyleConfig;
84
- table?: TableConfig;
85
- textPartLanguage?: Array<TextPartLanguageOption>;
86
- };
87
- export type AIEditorConfigPresenceFlags = {
88
- blockQuote?: object;
89
- bold?: object;
90
- bookmark?: object;
91
- code?: object;
92
- horizontalLine?: object;
93
- htmlEmbed?: object;
94
- italic?: object;
95
- math?: object;
96
- pageBreak?: object;
97
- paragraph?: object;
98
- restrictedEditing?: object;
99
- shiftEnter?: object;
100
- strikethrough?: object;
101
- subscript?: object;
102
- superscript?: object;
103
- tableOfContents?: object;
104
- title?: object;
105
- todoList?: object;
106
- underline?: object;
107
- };
41
+ export declare function getEditorConfig(editor: Editor, rootName?: string): AIEditorConfigSnapshot;
@@ -5,16 +5,16 @@
5
5
  /**
6
6
  * @module ai/aicore/utils/getoperationsfordocumentsuggestions
7
7
  */
8
- import { type DocumentChanges, type DocumentChangesOptions } from "../../aisdk/documentchanges.js";
8
+ import { type DocumentDiffer, type DocumentDifferOptions } from "../../toolkit/documentdiffer.js";
9
9
  import { type Operation } from "@ckeditor/ckeditor5-engine";
10
10
  import type { DocumentSuggestions } from "./builddocumentsuggestionsmap.js";
11
11
  /**
12
12
  * Returns operations that need to be applied to the editor documents to apply the AI reply.
13
13
  * The result is a `Map` keyed by `documentId`, each entry holding the operations for that document.
14
14
  */
15
- export declare function getOperationsForDocumentSuggestions({ documentSuggestions, transform, documentChanges, documentChangesOptions }: {
15
+ export declare function getOperationsForDocumentSuggestions({ documentSuggestions, transform, documentDiffer, documentDifferOptions }: {
16
16
  documentSuggestions: Map<string, DocumentSuggestions>;
17
17
  transform: boolean;
18
- documentChanges: DocumentChanges;
19
- documentChangesOptions: DocumentChangesOptions;
18
+ documentDiffer: DocumentDiffer;
19
+ documentDifferOptions: DocumentDifferOptions;
20
20
  }): Map<string, Array<Operation>>;
@@ -6,6 +6,7 @@
6
6
  * @module ai/aicore/utils/getrootinfo
7
7
  */
8
8
  import { type Editor } from "@ckeditor/ckeditor5-core";
9
+ import { type AIRootInfo } from "../aieditorconfig.js";
9
10
  /**
10
11
  * Builds a snapshot of a single editor root for the AI agent.
11
12
  *
@@ -13,7 +14,7 @@ import { type Editor } from "@ckeditor/ckeditor5-core";
13
14
  * shape of that root: an inline root cannot take block content at all, and a root hosted by a semantic element
14
15
  * (a `<h1>` title, a `<span>` label) implies a different tone and length than a full-page `<div>`.
15
16
  *
16
- * Unlike the {@link module:ai/aicore/utils/geteditorconfig~getEditorConfig feature configuration snapshot}, this one
17
+ * Unlike the {@link module:ai/aicore/aieditorconfig~AIEditorConfig#get feature configuration snapshot}, this one
17
18
  * must not be cached for the editor's lifetime: it is per root, and roots come and go at runtime (for example through
18
19
  * `MultiRootEditor#addRoot()` / `#detachRoot()`).
19
20
  *
@@ -25,21 +26,3 @@ import { type Editor } from "@ckeditor/ckeditor5-core";
25
26
  * @returns The root snapshot.
26
27
  */
27
28
  export declare function getRootInfo(editor: Editor, rootName: string): AIRootInfo;
28
- /**
29
- * The {@link ~getRootInfo root snapshot}.
30
- */
31
- export interface AIRootInfo {
32
- /**
33
- * Whether the root is an inline root, that is, whether it rejects block content and behaves like a single
34
- * paragraph. Content of such a root must stay inline-only.
35
- */
36
- isInline: boolean;
37
- /**
38
- * The tag name of the element hosting the root, for example `div` for a regular rich-text area or `h1` for a
39
- * title mounted on a heading.
40
- *
41
- * This element surrounds the root - it is not part of the root's content and cannot be edited. It must not be
42
- * reproduced in content produced for this root.
43
- */
44
- hostElement: string;
45
- }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * Returns the scroll position at which `container` shows `element` at its top, with the element's `scroll-margin-top`
7
+ * kept above it. It is the place `element.scrollIntoView( { block: 'start' } )` would bring the element to, without
8
+ * scrolling the ancestors of the container or the viewport.
9
+ *
10
+ * The theme sets the margin, so every element of a list lands in the same place. When the margin equals the padding
11
+ * above the first element, the first element is already in place and the container does not have to scroll.
12
+ */
13
+ export declare function getScrollTopToElement(container: HTMLElement, element: HTMLElement): number;
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { type Editor } from "@ckeditor/ckeditor5-core";
9
9
  import { Document } from "./htmlparser.js";
10
+ import { type Operation, type ModelDocumentFragment } from "@ckeditor/ckeditor5-engine";
10
11
  import { type AIReplyChangeGroup, type AIReplyChangeGroupState, type AIReplyChangeGroupOutdatedReason } from "../model/aireply.js";
11
12
  export declare function getSuggestionPartsFromReply({ changeGroups, documentContextContent, showDiff, trimUnchanged }: {
12
13
  showDiff: boolean;
@@ -18,6 +19,40 @@ export declare function passThroughEditorDataPipeline(editor: Editor, before: Do
18
19
  content: Document;
19
20
  hasChanges: boolean;
20
21
  };
22
+ /**
23
+ * Turns the content a change starts from into what a preview of that change shows: the operations applied to it, cut
24
+ * back to what reads around them, and rendered as content the UI can display.
25
+ *
26
+ * The operations are the caller's, because there are two ways to reach them and they are not the same. HTML content is
27
+ * diffed with `getDiff()`, while content already in the model is diffed with `getDiffForFragments()` - serializing to
28
+ * reach the former loses what a caption or a table row cannot say on its own, and drops the `data-id`s the comparison
29
+ * matches elements by.
30
+ *
31
+ * The fragment is written to, so it must be the caller's own copy.
32
+ *
33
+ * @param editor The editor the preview is shown in.
34
+ * @param fragment The content to show the change in. Modified in place.
35
+ * @param operations What makes the change, as the caller computed it.
36
+ * @param options.showDiff Whether the change is shown as a diff rather than as the proposed content alone.
37
+ * @param options.trimUnchanged Whether the content is cut back to the change and what reads around it.
38
+ */
39
+ export declare function renderPreview(editor: Editor, fragment: ModelDocumentFragment, operations: Array<Operation>, { showDiff, trimUnchanged }: {
40
+ showDiff: boolean;
41
+ trimUnchanged?: boolean;
42
+ }): Document;
43
+ /**
44
+ * Drops from the content every custom element the editor is not configured to keep - so a preview shows only what an
45
+ * apply could actually put in the document.
46
+ */
47
+ export declare function removeUnsupportedElements(editor: Editor, content: Document): Document;
48
+ /**
49
+ * Applies the operations to the fragment, without marking anything as changed.
50
+ */
51
+ export declare function applyOperations(operations: Array<Operation>, fragment: ModelDocumentFragment, editor: Editor): void;
52
+ /**
53
+ * Applies the operations to the fragment and marks the changes.
54
+ */
55
+ export declare function applyOperationsAndDiffMarkers(operations: Array<Operation>, fragment: ModelDocumentFragment, editor: Editor): void;
21
56
  export type AISuggestionContentPartDefinition = {
22
57
  type: "modified" | "new" | "removed" | "context";
23
58
  index: number;
@@ -15,8 +15,9 @@ export declare function parse(html: string, options?: Parameters<typeof parseDoc
15
15
  export declare function serialize(document: Document | AnyNode, options?: Parameters<typeof render>[1]): string;
16
16
  export declare function findByAttribute(name: string, value: string | null, nodes: Array<AnyNode> | ParentNode): ReturnType<typeof findOne>;
17
17
  export declare function findAllByAttribute(name: string, value: string | null, nodes: Array<AnyNode> | ParentNode): ReturnType<typeof findAll>;
18
- export declare function isUnsupportedTag(name: string): boolean;
19
- export declare function findAllUnsupported(root: ParentNode): Array<Element>;
18
+ export declare function isUnsupportedTag(name: string, allowedElements?: ReadonlyArray<string>): boolean;
19
+ export declare function findAllUnsupported(root: ParentNode, allowedElements?: ReadonlyArray<string>): Array<Element>;
20
+ export declare function findAllScriptsAndStyles(root: ParentNode): Array<Element>;
20
21
  export declare function isMarkerBoundaryElement(node: AnyNode): boolean;
21
22
  export declare function findAllComments(document: Document): Array<Comment>;
22
23
  export declare function getAttribute(node: AnyNode | null, name: string): string | null;
@@ -4,10 +4,18 @@
4
4
  */
5
5
  /**
6
6
  * @module ai/aicore/utils/replyactions
7
+ * @publicApi
7
8
  */
8
9
  /**
9
- * The actions that can be performed on an AI suggestion, used as the default set wherever
10
- * `ai.availableReplyActions` is not configured.
10
+ * The actions that can be performed on an AI suggestion: applying it to the document (`'applySuggestion'`) and inserting
11
+ * it as a track changes suggestion (`'insertSuggestion'`).
12
+ *
13
+ * Used as the default set of available actions, for example where
14
+ * {@link module:ai/aiconfig~AIConfig#availableReplyActions `config.ai.availableReplyActions`} is not configured, or in the
15
+ * view created by {@link module:ai/toolkit/proposedchanges~ProposedChanges#createView}.
11
16
  */
12
17
  export declare const AI_REPLY_ACTIONS: readonly ["applySuggestion", "insertSuggestion"];
18
+ /**
19
+ * The name of an action that can be performed on an AI suggestion. See {@link ~AI_REPLY_ACTIONS}.
20
+ */
13
21
  export type AISuggestionActionName = typeof AI_REPLY_ACTIONS[number];
@@ -18,6 +18,11 @@ export declare class ScrollManager {
18
18
  smooth?: boolean;
19
19
  }): void;
20
20
  /**
21
+ * Pauses the auto-scrolling, as if the user scrolled away from the bottom. It stays paused until the user scrolls back to
22
+ * the bottom, or until {@link #start} is called again.
23
+ */
24
+ pause(): void;
25
+ /**
21
26
  * Stops the auto-scrolling.
22
27
  */
23
28
  stop(): void;
@@ -8,7 +8,7 @@
8
8
  import { InsertOperation, MarkerOperation, ModelDocumentFragment, ModelPosition, ModelRange, type Operation } from "@ckeditor/ckeditor5-engine";
9
9
  import { type Emitter, ShadowRootRegistry } from "@ckeditor/ckeditor5-utils";
10
10
  import { ContextPlugin, Editor, type Context, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
11
- import { DocumentChanges } from "../aisdk/documentchanges.js";
11
+ import { DocumentDiffer } from "../toolkit/documentdiffer.js";
12
12
  import { type AIReviewCheckResultChange } from "./model/aireviewcheckresultchange.js";
13
13
  import { AIEditing } from "../aicore/aiediting.js";
14
14
  import { type AIEditorRoot } from "../aicore/model/aieditorroot.js";
@@ -19,7 +19,7 @@ export declare class AIReviewCoreEditing extends ContextPlugin {
19
19
  /**
20
20
  * @inheritDoc
21
21
  */
22
- static get requires(): PluginDependenciesOf<[DocumentChanges, AIEditing]>;
22
+ static get requires(): PluginDependenciesOf<[DocumentDiffer, AIEditing]>;
23
23
  /**
24
24
  * @inheritDoc
25
25
  */
@@ -69,6 +69,10 @@ export declare abstract class AIReviewCoreUI extends ContextPlugin {
69
69
  * Updates the review progress bar with the number of reviewed (accepted, rejected, outdated) changes out of the total.
70
70
  */
71
71
  updateProgress(reviewed: number, total: number): void;
72
+ /**
73
+ * Updates the summary of the user's decisions, shown once every change is decided (AI Review only).
74
+ */
75
+ updateSummary(accepted: number, dismissed: number): void;
72
76
  showReviewCompletedView(): void;
73
77
  showActionsWhenResultIsReady(): void;
74
78
  showNoChangesView(): void;
@@ -95,6 +99,10 @@ export declare abstract class AIReviewCoreUI extends ContextPlugin {
95
99
  */
96
100
  scrollResultsToChange(changeId: string): void;
97
101
  /**
102
+ * Scrolls the results list back to its very top.
103
+ */
104
+ scrollResultsToTop(): void;
105
+ /**
98
106
  * Shows the leave-confirmation dialog. Calls `onExit` if the user confirms leaving, or `onStay` once the
99
107
  * dialog is dismissed any other way (the stay button, the close button, or the <kbd>Esc</kbd> key).
100
108
  *
@@ -127,6 +127,14 @@ export declare abstract class AIReviewCheckRun extends AIReviewCheckRunBase {
127
127
  */
128
128
  get pendingChangesCount(): number;
129
129
  /**
130
+ * The number of changes the user accepted, which the review summary reports.
131
+ */
132
+ get acceptedChangesCount(): number;
133
+ /**
134
+ * The number of changes the user rejected (dismissed), which the review summary reports.
135
+ */
136
+ get rejectedChangesCount(): number;
137
+ /**
130
138
  * The number of changes that are no longer pending (accepted, rejected, outdated).
131
139
  */
132
140
  get reviewedChangesCount(): number;
@@ -121,7 +121,7 @@ export declare class AIReviewCoreNavigationPanelView extends BalloonPanelView {
121
121
  */
122
122
  updateChangePosition(position: AIReviewCoreNavigationPosition): void;
123
123
  /**
124
- * Follows the status of the change on display, which another user can resolve at any time.
124
+ * Follows the status of the change on display as it gets accepted, rejected or outdated.
125
125
  */
126
126
  updateChangeState(id: string, status: AIReviewCheckResultChange["status"]): void;
127
127
  /**
@@ -6,17 +6,12 @@
6
6
  * @module ai/aireviewcore/ui/aireviewcoreuicheckresultsview
7
7
  */
8
8
  import { type Locale } from "@ckeditor/ckeditor5-utils";
9
- import { ListItemView, ViewCollection } from "@ckeditor/ckeditor5-ui";
9
+ import { ListItemView, type ViewCollection } from "@ckeditor/ckeditor5-ui";
10
10
  import { type AIReviewCheckResultChange } from "../model/aireviewcheckresultchange.js";
11
- import { AIDisclaimerView } from "../../aicore/ui/aidisclaimerview.js";
12
11
  export type AIReviewCoreUICheckResultsViewContents = {
13
12
  generalErrorText: string;
14
13
  };
15
14
  export declare class AIReviewCoreUICheckResultsView extends ListItemView {
16
- /**
17
- * The disclaimer view shown below the results.
18
- */
19
- reviewDisclaimer: AIDisclaimerView;
20
15
  /**
21
16
  * The title of the current check results.
22
17
  *
@@ -85,10 +80,30 @@ export declare class AIReviewCoreUICheckResultsView extends ListItemView {
85
80
  */
86
81
  resetActiveResults(): void;
87
82
  /**
88
- * Scrolls the results so the one showing `id` starts at the top of the list.
83
+ * Updates the summary of the user's decisions. No-op by default, only AI Review shows such a summary.
84
+ *
85
+ * @param accepted The number of accepted changes.
86
+ * @param dismissed The number of dismissed changes.
87
+ */
88
+ updateSummary(accepted: number, dismissed: number): void;
89
+ /**
90
+ * Scrolls the results so the one showing `id` starts at the top of the list, with the result's `scroll-margin-top`
91
+ * kept above it.
92
+ *
93
+ * The list is given the space to scroll the last results to its top as well,
94
+ * see {@link module:ai/aicore/ui/aiscrollfillerview~AIScrollFillerView}.
89
95
  */
90
96
  scrollToResult(id: string): void;
91
97
  /**
98
+ * Scrolls the results back to the very top of the list, where the review summary is shown once every change
99
+ * is decided.
100
+ *
101
+ * The filler added by {@link #scrollToResult} is taken away once the list is at the top. Taking it away earlier would
102
+ * shrink the scrollable area under the scroll, making the list jump. When the scroll is interrupted before it reaches
103
+ * the top, the filler is kept.
104
+ */
105
+ scrollToTop(): void;
106
+ /**
92
107
  * Returns the rendered element of the result showing `id`, the one {@link #scrollToResult} brings into view.
93
108
  */
94
109
  getResultElement(id: string): HTMLElement | null;
@@ -24,4 +24,8 @@ export declare class AIReviewModeController extends AIReviewCoreController {
24
24
  * @inheritDoc
25
25
  */
26
26
  override init(): void;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ override destroy(): void;
27
31
  }
@@ -5,8 +5,9 @@
5
5
  /**
6
6
  * @module ai/aireviewmode/ui/aireviewmodecheckresultsview
7
7
  */
8
- import { AIReviewCoreUICheckResultsView } from "../../aireviewcore/ui/aireviewcoreuicheckresultsview.js";
8
+ import { AIReviewCoreUICheckResultsView, type AIReviewCoreUICheckResultsViewContents } from "../../aireviewcore/ui/aireviewcoreuicheckresultsview.js";
9
9
  import { type AIReviewCheckResultChange } from "../../aireviewcore/model/aireviewcheckresultchange.js";
10
+ import { type Locale } from "@ckeditor/ckeditor5-utils";
10
11
  /**
11
12
  * The AI Review results panel.
12
13
  *
@@ -14,6 +15,10 @@ import { type AIReviewCheckResultChange } from "../../aireviewcore/model/airevie
14
15
  * class renders. Only AI Review does this; AI Translate keeps the base rendering.
15
16
  */
16
17
  export declare class AIReviewModeCheckResultsView extends AIReviewCoreUICheckResultsView {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ constructor(locale: Locale, contents: AIReviewCoreUICheckResultsViewContents);
17
22
  /**
18
23
  * @inheritDoc
19
24
  */
@@ -21,6 +26,10 @@ export declare class AIReviewModeCheckResultsView extends AIReviewCoreUICheckRes
21
26
  /**
22
27
  * @inheritDoc
23
28
  */
29
+ override updateSummary(accepted: number, dismissed: number): void;
30
+ /**
31
+ * @inheritDoc
32
+ */
24
33
  override addResult(result: AIReviewCheckResultChange, isAcceptButtonVisible: boolean, isSuggestButtonVisible: boolean): void;
25
34
  /**
26
35
  * @inheritDoc
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module ai/aireviewmode/ui/aireviewmodesummaryview
7
+ */
8
+ import { View } from "@ckeditor/ckeditor5-ui";
9
+ import { type Locale } from "@ckeditor/ckeditor5-utils";
10
+ /**
11
+ * The summary shown at the top of the AI Review results once every change is decided.
12
+ *
13
+ * It reports how many changes were accepted and how many were dismissed, and points the user to the button that applies
14
+ * those decisions.
15
+ */
16
+ export declare class AIReviewModeSummaryView extends View<HTMLDivElement> {
17
+ /**
18
+ * The number of accepted changes.
19
+ *
20
+ * @observable
21
+ */
22
+ acceptedCount: number;
23
+ /**
24
+ * The number of dismissed changes.
25
+ *
26
+ * @observable
27
+ */
28
+ dismissedCount: number;
29
+ /**
30
+ * Whether the summary is visible.
31
+ *
32
+ * @observable
33
+ */
34
+ isVisible: boolean;
35
+ /**
36
+ * @param locale The locale instance.
37
+ * @param finishButtonLabel The label of the button that finishes the review, mentioned in the hint.
38
+ */
39
+ constructor(locale: Locale, finishButtonLabel: string);
40
+ /**
41
+ * Updates the counts of accepted and dismissed changes the summary reports.
42
+ */
43
+ setCounts(accepted: number, dismissed: number): void;
44
+ }
@@ -17,6 +17,7 @@ import type { AICore } from "./aicore/aicore.js";
17
17
  import type { AIChat } from "./aichat/aichat.js";
18
18
  import type { AIChatController } from "./aichat/aichatcontroller.js";
19
19
  import type { AIEditing } from "./aicore/aiediting.js";
20
+ import type { AIEditorConfig } from "./aicore/aieditorconfig.js";
20
21
  import type { AIChatUI } from "./aichat/aichatui.js";
21
22
  import type { AIActions } from "./aiactions/aiactions.js";
22
23
  import type { AIBalloon } from "./aiballoon/aiballoon.js";
@@ -35,6 +36,8 @@ import type { AIReviewGateway } from "./aireviewmode/aireviewgateway.js";
35
36
  import type { AITranslateGateway } from "./aitranslate/aitranslategateway.js";
36
37
  import type { AIGateway } from "./aicore/aigateway.js";
37
38
  import type { AIDocumentProcessingGateway } from "./aidocumentprocessing/aidocumentprocessinggateway.js";
39
+ import type { DocumentCompare } from "./toolkit/documentcompare.js";
40
+ import type { ProposedChanges } from "./toolkit/proposedchanges.js";
38
41
  declare module "@ckeditor/ckeditor5-core" {
39
42
  interface EditorConfig {
40
43
  /**
@@ -57,12 +60,15 @@ declare module "@ckeditor/ckeditor5-core" {
57
60
  [AIChatBalloon.pluginName]: AIChatBalloon;
58
61
  [AIChatController.pluginName]: AIChatController;
59
62
  [AIEditing.pluginName]: AIEditing;
63
+ [AIEditorConfig.pluginName]: AIEditorConfig;
60
64
  [AIChatUI.pluginName]: AIChatUI;
61
65
  [AIActions.pluginName]: AIActions;
62
66
  [AIBalloon.pluginName]: AIBalloon;
63
67
  [AIReviewCoreEditing.pluginName]: AIReviewCoreEditing;
64
68
  [AIGateway.pluginName]: AIGateway;
65
69
  [AIDocumentProcessingGateway.pluginName]: AIDocumentProcessingGateway;
70
+ [DocumentCompare.pluginName]: DocumentCompare;
71
+ [ProposedChanges.pluginName]: ProposedChanges;
66
72
  [AIReviewMode.pluginName]: AIReviewMode;
67
73
  [AIReviewModeController.pluginName]: AIReviewModeController;
68
74
  [AIReviewModeUI.pluginName]: AIReviewModeUI;