/** * @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/toolkit/computepreviews */ import { ModelDocumentFragment, type ModelSchema } from "@ckeditor/ckeditor5-engine"; import { type DocumentChange } from "./proposedchange.js"; /** * The two fragments one change is rendered from. */ export interface ChangePreview { /** * The changed content as it stands, in what it is shown in. */ previewBefore: ModelDocumentFragment; /** * What that becomes, in the same surroundings. */ previewAfter: ModelDocumentFragment; } /** * Builds the fragments each of the given changes is previewed from, in the order the changes come in. * * While a change keeps strictly the content it covers, a preview has that content wrapped in all necessary ancestors to make sure * the model can be properly downcasted and rendered to DOM. Also, additional context elements around the change are added, if possible. * This makes it easier to locate the change in the original document. * * At most one element before and after the changed content is added as such context. If there's none, context element for one of wrappers * can be added instead. * * Note that a modified element cannot be added as context element, as it is present in a different change. This blocks given "side" * from receiving any context at all. * * @param changes The changes to show, in document order. Only where each one sits is read. * @param schema The model's schema. */ export declare function computePreviews(changes: ReadonlyArray, schema: ModelSchema): Array;