@znuny/ckeditor5-autocomplete-plugin
Version:
A plugin for CKEditor 5 that provides an extendable autocomplete functionality with predefined mention and HTML replacement logic.
85 lines (84 loc) • 4.15 kB
TypeScript
/**
* @copyright Copyright (c) 2024, Znuny GmbH.
*
* @license GNU GPL version 3
*
* This software comes with ABSOLUTELY NO WARRANTY. For details, see
* the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
*/
import type { CompletionGroupConfiguration } from './CompletionGroupConfiguration';
/**
* Available configuration options for the Autocomplete plugin.
*/
export interface AutocompletePluginConfiguration {
/**
* Array of completion groups to group completions for the same marker (prefix) characters together.
*/
completionGroups: Array<CompletionGroupConfiguration>;
/**
* Custom key codes to overwrite the default selection commit keys (enter, tab).
*/
commitKeyCodes?: Array<number>;
/**
* Specify how many overall completion elements of all groups will be shown (maximum) in the selection dropdown list. Defaults to 10.
*
* This is a second limit, that will applied after the completion group specific limit. (Especially useful for completion sets out of different groups.)
*
* To show all available (matching) elements in the selection ui, set this to -1.
*/
overallSelectionDropdownLimit?: number;
/**
* Enable whether the matching completion elements of multiple completion groups should be joined in the selection ui (dropdown),
* if the completion group markers are equal (or multiple ones are matching when using non distinct markers) or the completionGroup's markerMatchingCallback returns true.
*
* If this is disabled, just (and only) the first matching completion group will be used to create the matching options for the completion ui.
*
* Defaults to true.
*/
combineResultOfCompletionGroupsWithSameMarker?: boolean;
/**
* Enable whether the autocompletion logic will be applied when the current selection (cursor) position is above an already fulfilled completion replacement.
* This works only for mention elements. HTML replacements cannot be considered.
* Since offering completions on already completed strings is counterintuitive, it's recommended to leave this option disabled.
*
* Defaults to false.
*/
allowAutocompletionAboveFulfilledCompletionReplacements?: boolean;
/**
* Overwrite the type for all mention HTML elements. (only in mention mode)
*
* Only valid html element tag names allowed!
*
* By default, a mention element will be of type `span`.
*/
overwriteMentionCompletionElementTagName?: string;
/**
* Overwrite css variable --ck-color-mention-background in :root scope, that is responsible for the selection ui element background color.
*/
overwriteCSSMentionBackgroundColor?: string;
/**
* Overwrite css variable --ck-color-mention-text in :root scope, that is responsible for the selection ui element text color.
*/
overwriteCSSMentionTextColor?: string;
/**
* Overwrite css variable --ck-color-mention-selection-background in :root scope, that is responsible for the selection ui element background color.
*/
overwriteCSSSelectionBackgroundColor?: string;
/**
* Overwrite css variable --ck-color-mention-selection-background-selected in :root scope, that is responsible for the background color of the currently selected selection ui element.
*/
overwriteCSSSelectionBackgroundColorSelected?: string;
/**
* Overwrite css variable --ck-color-mention-selection-text in :root scope, that is responsible for the selection ui element text color.
*/
overwriteCSSSelectionTextColor?: string;
/**
* Overwrite css variable --ck-color-mention-selection-text-selected in :root scope, that is responsible for the text color of the currently selected selection ui element.
*/
overwriteCSSSelectionTextColorSelected?: string;
/**
* Overwrite css variable --ck-mention-list-max-height in :root scope, that is responsible for the selection ui max height.
*/
overwriteCSSSelectionListMaxHeight?: string;
}