/** * @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/elementcategory */ import { type ModelElement, type ModelSchema } from "@ckeditor/ckeditor5-engine"; /** * Name of the model attribute which carries the element id used by the document comparison. * * It is a temporary attribute that exists only on content processed by `DocumentDiffer`, never in the document data. */ export declare const DATA_ID_MODEL_ATTRIBUTE = "$elementId"; /** * Name of the view (HTML) attribute which is upcast to {@link ~DATA_ID_MODEL_ATTRIBUTE}. */ export declare const DATA_ID_VIEW_ATTRIBUTE = "data-id"; /** * Describes how an element behaves in a document comparison and how it can change. * * * `block` - elements like paragraphs, lists, or headings. Can be renamed. Can be created by splitting. Can be removed by merging. * Its contents can be "moved around" by splitting or merging. * * * `container` - elements like blockquote. Cannot be renamed. Can be created by wrapping. Can be removed by unwrapping. Can be * "resized" by having other elements be moved into or out of them. * * * `solid` - limit-like elements like table or image. Cannot be renamed, split or merged. Can be added by insertion and removed by * deletion. If added or removed, all their content also should be treated as added or removed. */ export type ModelElementCategory = "block" | "container" | "solid"; /** * Returns the {@link ~ModelElementCategory category} of the element, based on the schema. * * The same classification drives both the diff algorithm in `DocumentDiffer` and the content-based element matching, so * the two never disagree on what an element is. */ export declare function getElementCategory(element: ModelElement, schema: ModelSchema): ModelElementCategory; /** * Returns `true` when the element holds a `$text` child and unwrapping into the element's parent * would strand it - i.e. parent is a non-block element that doesn't accept text. * * That's the shape the diff algorithm can't compute valid operations for: an unwrap would leave * bare text in a parent that doesn't allow it, and `DocumentDiffer` doesn't synthesise a paragraph * wrap to make the result valid. * * With GHS this fires for `htmlSummary`, `htmlCaption`, `htmlFigcaption`, `htmlLegend`, `htmlLi` * when they hold text (and the native plugin that normally handles them is not loaded). */ export declare function isStructurallyBoundElement(element: ModelElement, schema: ModelSchema): boolean;