@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
71 lines (70 loc) • 2.35 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/aiquickactions/ui/aiquickactionsdropdowncreator
*/
import { type Editor } from 'ckeditor5/src/core.js';
import { type BodyCollection, type DropdownView } from 'ckeditor5/src/ui.js';
import { type AIQuickActionsGroupDefinition, type AIQuickActionDefinition } from '../aiquickactionsui.js';
/**
* Configuration for the dropdown button appearance.
*/
type DropdownButtonDefinition = {
/**
* Icon to display on the button.
*/
icon: string;
/**
* Label text for the button.
*/
label: string;
};
/**
* Configuration options for aiQuickActionsDropdownCreator.
*/
export interface AIQuickActionsDropdownCreatorOptions {
/**
* The CKEditor instance that will contain the dropdown.
*/
editor: Editor;
/**
* Array of AI action definitions or groups to display in the dropdown.
*/
content: Array<AIQuickActionsGroupDefinition | AIQuickActionDefinition>;
/**
* Configuration for the dropdown button (icon, label).
*/
buttonDefinition: AIQuickActionsGroupDefinition | DropdownButtonDefinition;
/**
* Body collection for managing UI elements.
*/
bodyCollection: BodyCollection;
/**
* Whether to show the search input.
*
* @default false
*/
hasSearch?: boolean;
}
/**
* Creates a dropdown factory function for AI Quick Actions.
*
* This function returns a factory that creates DropdownView instances containing AI quick actions.
* The dropdown can contain either individual actions or groups of actions, and automatically
* handles the UI interaction patterns including:
*
* Features:
* - Configurable button with icon and label
* - Panel containing AI Quick Actions view
* - Read-only state binding to editor
* - Automatic closing and focus management
* - Balloon toolbar hiding on action selection
* - Optional search functionality
*
* @param options Configuration options for the dropdown creator
* @returns Factory function that creates a DropdownView instance
*/
export declare function aiQuickActionsDropdownCreator(options: AIQuickActionsDropdownCreatorOptions): () => DropdownView;
export {};