@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
61 lines (60 loc) • 2.37 kB
TypeScript
/**
* @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/aiediting
*/
import { type ModelRange, type ViewDocumentFragment, type ModelDocumentFragment } from 'ckeditor5/src/engine.js';
import { ContextPlugin } from 'ckeditor5/src/core.js';
export declare const AI_VISUAL_SELECTION_MARKER_NAME = "ai-selection";
export declare class AIEditing extends ContextPlugin {
/**
* @inheritDoc
*/
static get pluginName(): "AIEditing";
/**
* @inheritDoc
*/
static get isOfficialPlugin(): true;
/**
* @inheritDoc
*/
static get isPremiumPlugin(): true;
/**
* Gets the current session ID. If RTC plugin is available, uses its sessionId.
* Otherwise, generates a random ID for the current (non-RTC) session.
*/
get sessionId(): string;
/**
* Returns the data and version of the current document.
*/
getDocumentData(): {
content: string;
version: number;
sessionId: string;
selections: Array<{
markerName: string;
start: number;
end: number;
htmlFragment: string;
}>;
};
afterInit(): Promise<void>;
/**
* Displays a fake visual selection on given ranges.
*
* Since multiple features may want to show and hide the selection, while at the same time, only one fake selection should be shown,
* it is necessary to provide an `id` when showing fake selection. Then, when the fake selection should be hidden, `id` must be
* passed as well. This mechanism prevents a feature from mistakenly hiding a fake selection set by another feature.
*/
showFakeVisualSelection(ranges: Array<ModelRange>, id: string, lock?: boolean, force?: boolean): boolean;
/**
* Removes a fake visual selection from the document.
*
* The passed `id` should be the same as the one used when {@link module:ai/aicore/aiediting~AIEditing#showFakeVisualSelection} was
* called. This mechanism prevents a feature from mistakenly hiding a fake selection set by another feature.
*/
hideFakeVisualSelection(id: string): boolean;
modelToViewWithIds(modelFragment: ModelDocumentFragment): ViewDocumentFragment;
}