/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module ai/aicore/utils/getsuggestionpartsfromreply */ import { type Editor } from "@ckeditor/ckeditor5-core"; import { Document } from "./htmlparser.js"; import { type Operation, type ModelDocumentFragment } from "@ckeditor/ckeditor5-engine"; import { type AIReplyChangeGroup, type AIReplyChangeGroupState, type AIReplyChangeGroupOutdatedReason } from "../model/aireply.js"; export declare function getSuggestionPartsFromReply({ changeGroups, documentContextContent, showDiff, trimUnchanged }: { showDiff: boolean; changeGroups: Array; documentContextContent: Map; trimUnchanged?: boolean; }): Array; export declare function passThroughEditorDataPipeline(editor: Editor, before: Document, after: Document, showDiff: boolean, trimUnchanged?: boolean): { content: Document; hasChanges: boolean; }; /** * Turns the content a change starts from into what a preview of that change shows: the operations applied to it, cut * back to what reads around them, and rendered as content the UI can display. * * The operations are the caller's, because there are two ways to reach them and they are not the same. HTML content is * diffed with `getDiff()`, while content already in the model is diffed with `getDiffForFragments()` - serializing to * reach the former loses what a caption or a table row cannot say on its own, and drops the `data-id`s the comparison * matches elements by. * * The fragment is written to, so it must be the caller's own copy. * * @param editor The editor the preview is shown in. * @param fragment The content to show the change in. Modified in place. * @param operations What makes the change, as the caller computed it. * @param options.showDiff Whether the change is shown as a diff rather than as the proposed content alone. * @param options.trimUnchanged Whether the content is cut back to the change and what reads around it. */ export declare function renderPreview(editor: Editor, fragment: ModelDocumentFragment, operations: Array, options: { showDiff: boolean; trimUnchanged?: boolean; }): Document; /** * Drops from the content every custom element the editor is not configured to keep - so a preview shows only what an * apply could actually put in the document. */ export declare function removeUnsupportedElements(editor: Editor, content: Document): Document; /** * Applies the operations to the fragment, without marking anything as changed. */ export declare function applyOperations(operations: Array, fragment: ModelDocumentFragment, editor: Editor): void; /** * Applies the operations to the fragment and marks the changes. */ export declare function applyOperationsAndDiffMarkers(operations: Array, fragment: ModelDocumentFragment, editor: Editor): void; export type AISuggestionContentPartDefinition = { type: "modified" | "new" | "removed" | "context"; index: number; state: AIReplyChangeGroupState; outdatedReason?: AIReplyChangeGroupOutdatedReason; content: Document; hasChanges: boolean; wrapperTag?: string; };