UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

72 lines (71 loc) 2.25 kB
/** * @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/aichat/ui/controls/aichatchipsoverflowmanager */ import { View, type BodyCollection, ButtonView } from 'ckeditor5/src/ui.js'; import { type Locale, Collection } from 'ckeditor5/src/utils.js'; import { type AIChatContextItemButtonView } from './aichatcontextitembuttonview.js'; /** * Configuration interface for the chips overflow manager. */ export interface ChipsOverflowConfig { cssClasses: { showMoreButton: string; showMoreBalloon: string; overflowContainer: string; controlsButton?: string; calculationContainer?: string; }; maxVisibleRows?: number; /** * Tolerance for row detection in pixels. */ rowDetectionTolerance?: number; showMoreLabelPrefix?: string; viewportOffset?: { top: number; bottom: number; }; } /** * A reusable component for managing chips overflow with show more functionality. */ export declare class AIChatChipsOverflowManager { constructor(locale: Locale, visibleChips: Collection<AIChatContextItemButtonView>, config: ChipsOverflowConfig, bodyCollection: BodyCollection, parentView: View); /** * Sets the container element that holds the chips. */ setContainerElement(element: HTMLElement): void; /** * Gets the show more button view. */ get showMoreButtonView(): ButtonView | null; /** * Gets the overflow chips collection. */ get overflowChips(): Collection<AIChatContextItemButtonView>; /** * Reorganizes chips to handle overflow. */ reorganizeChips(): void; /** * Shows the show more balloon panel. */ showBalloonPanel(): void; /** * Hides the show more balloon panel. */ hideBalloonPanel(): void; /** * Clears all overflow chips and resets the overflow state. * This properly updates the show more button counter and hides it when no overflow items remain. */ clear(): void; /** * Destroys the overflow manager and cleans up resources. */ destroy(): void; }