@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
50 lines (49 loc) • 2.19 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/ui/controls/resources/aichatcontextresourceslistview
*/
import { type Locale } from '@ckeditor/ckeditor5-utils';
import { ListView } from '@ckeditor/ckeditor5-ui';
import { type AIContextProvider, type AIContextResourceState } from '../../../model/aichatcontext.js';
/**
* A specialized list view for displaying AI context resources.
*
* This view manages a collection of resource items for a specific AI context provider,
* handling resource selection, search highlighting, and state updates.
*/
export declare class AIChatContextResourcesListView extends ListView {
/**
* Creates a new AI context resources list view.
*
* @param locale The locale instance for internationalization
* @param source The AI context provider source for this resource list
*/
constructor(locale: Locale, source: AIContextProvider);
/**
* Sets the resources to display in the list.
* Clears existing items and creates new resource item views with proper event handling.
* When useDefaultFiltering is enabled, filters resources by query and applies highlighting.
*
* @param resources Array of resource states to display
* @param query Search query string used for filtering and text highlighting
*/
setResources(resources: Array<AIContextResourceState>, query: string): void;
/**
* Highlights text in all resource items based on the search query.
* Respects the source's useDefaultFiltering configuration.
*
* @param query The search query string to highlight in resource titles
*/
highlightText(query: string): void;
/**
* Updates the state of a specific resource in the list.
* Finds the resource item by ID and updates its context state.
*
* @param resourceId The unique identifier of the resource to update
* @param isInContext Whether the resource is currently in the context
*/
updateResourceState(resourceId: string, isInContext: boolean): void;
}