@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
62 lines (61 loc) • 2.46 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/aichatresourcelistitemview
*/
import { type Locale } from '@ckeditor/ckeditor5-utils';
import { ListItemView } from '@ckeditor/ckeditor5-ui';
import { type AIContextResourceState } from '../../../../aichat/model/aichatcontext.js';
/**
* A view representing a single resource item in the AI chat context resource list.
* Displays resource information with appropriate icons and handles selection state.
*/
export declare class AIChatResourceListItemView extends ListItemView {
/**
* The context resource state this view represents.
* Contains the resource data including ID, label, type, and context status.
*/
resource: AIContextResourceState;
/**
* Whether the resource is currently in the context.
* This property is observable and automatically updates the view's appearance.
*
* @observable
*/
isInContext: boolean;
/**
* Creates a new AI context resource list item view.
*
* @param locale The locale instance for internationalization
* @param resource The context resource state to represent
*/
constructor(locale: Locale, resource: AIContextResourceState);
/**
* Renders the view and its child components.
*/
render(): void;
/**
* Gets the appropriate icon for a resource based on its type and context state.
* Returns a checkmark icon if the resource is in context, otherwise returns
* a type-specific icon (document, link, file, or default outline).
*
* @param resource The context resource state
* @returns The appropriate icon string for the resource
*/
getResourceIcon(resource: AIContextResourceState): string;
/**
* Highlights text in the resource title based on the provided search query.
* This method should only be called when highlighting is enabled for the source.
*
* @param query The search query string to highlight, or empty string to clear highlighting
*/
highlightText(query: string): void;
/**
* Updates the resource state and refreshes the icon accordingly.
*
* @param isInContext Whether the resource is currently in the context
*/
updateResourceState(isInContext: boolean): void;
}