@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
100 lines (99 loc) • 3.07 kB
TypeScript
/**
* @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/aichat/aichatballoon
*/
import { type Editor, Plugin } from '@ckeditor/ckeditor5-core';
import { AIBalloon, type AIBalloonConfig } from '../aiballoon/aiballoon.js';
import { type AISuggestionContentPartDefinition } from '../aicore/utils/getsuggestionpartsfromreply.js';
import { type AIContentRenderingStrategy } from '../aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.js';
import { type AIReplyChangeGroupState } from '../aicore/model/aireply.js';
import { Dialog } from '@ckeditor/ckeditor5-ui';
/**
* The plugin responsible for the AI Balloon dialog in the Chat UI.
*
* * It depends on the API of the `AIBalloon` plugin.
* * It uses the `AIChatBalloonView` to display the suggestion part in the `AIBalloon`.
*/
export declare class AIChatBalloon extends Plugin {
/**
* @inheritDoc
*/
static get requires(): readonly [typeof Dialog, typeof AIBalloon];
/**
* @inheritDoc
*/
static get pluginName(): "AIChatBalloon";
/**
* @inheritDoc
*/
static get isOfficialPlugin(): true;
/**
* @inheritDoc
*/
static get isPremiumPlugin(): true;
/**
* Observable property that indicates whether the suggestion display mode is "show changes".
*/
showDiff: boolean;
/**
* @inheritDoc
*/
constructor(editor: Editor);
/**
* Opens the AI Balloon dialog.
*/
open(config: Omit<AIChatBalloonConfig, 'class' | 'id' | 'mainView'>): void;
/**
* Closes the AI Balloon dialog.
*/
close(): void;
/**
* Updates the content of the suggestion part displayed in the balloon.
*/
updateContent(options: {
part: AISuggestionContentPartDefinition;
renderingStrategy: AIContentRenderingStrategy;
abortSignal?: AbortSignal;
keepErrors?: boolean;
}): Promise<void>;
/**
* Sets the state of the suggestion part displayed in the balloon (accepted, rejected, pending, etc.).
*/
setState(state: AIReplyChangeGroupState): void;
}
type AIChatBalloonConfig = AIBalloonConfig & {
areActionsDisabled: boolean;
showRotator: boolean;
};
/**
* Event fired when user toggles the suggestion display mode.
*/
export type AIChatBalloonToggleSuggestionDisplayModeEvent = {
name: 'toggleSuggestionDisplayMode';
args: [];
};
/**
* Event fired when user clicks the apply button to apply a suggestion.
*/
export type AIChatBalloonApplySuggestionEvent = {
name: 'applySuggestion';
args: [];
};
/**
* Event fired when user clicks the suggest button to insert a suggestion.
*/
export type AIChatBalloonInsertSuggestionEvent = {
name: 'insertSuggestion';
args: [];
};
/**
* Event fired when user clicks the reject button to reject a suggestion.
*/
export type AIChatBalloonRejectSuggestionEvent = {
name: 'rejectSuggestion';
args: [];
};
export {};