UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

47 lines (46 loc) 1.51 kB
/** * @license Copyright (c) 2003-2025, 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/documentrange */ import { DocumentPosition } from './documentposition.js'; import { Document } from './htmlparser.js'; /** * Represents a range in a htmlparser's Document limited by two * {@link module:ai/aicore/utils/documentposition~DocumentPosition} instances. */ export declare class DocumentRange { readonly start: DocumentPosition; readonly end: DocumentPosition; constructor(start: DocumentPosition, end: DocumentPosition); isEqual(otherRange: DocumentRange): boolean; /** * Nudges {@link #start} and {@link #end} positions to the word boundary so that the range does not split * a word. * * See {@link module:ai/aicore/utils/documentposition~DocumentPosition#getNudgedToWordBoundary} for more details. */ getNudgedToWordBoundary(): DocumentRange; /** * Returns a document with the content of this range. The content is extracted from the original document, * preserving the original structure. * * For instance, for the following document and range: * * ```html * <p>fo[o</p> * <p>bar <b>ba]z</b></p> * <p>qux</p> * ``` * * the resulting document will be * * ```html * <p>o</p> * <p>bar <b>ba</b></p> * ``` */ getContent(): Document; }