import type { CustomReplacement, EditorPlugin, IEditor, PluginEvent } from 'roosterjs-editor-types'; /** * Wrapper for CustomReplaceContentEditFeature that provides an API for updating the * content edit feature */ export default class CustomReplacePlugin implements EditorPlugin { private longestReplacementLength; private editor; private replacements; private replacementEndCharacters; /** * Create instance of CustomReplace plugin * @param replacements Replacement rules. If not passed, a default replacement rule set will be applied */ constructor(replacements?: CustomReplacement[]); /** * Set the replacements that this plugin is looking for. * @param newReplacements new set of replacements for this plugin */ updateReplacements(newReplacements: CustomReplacement[]): void; /** * Get a friendly name of this plugin */ getName(): string; /** * Initialize this plugin * @param editor The editor instance */ initialize(editor: IEditor): void; /** * Dispose this plugin */ dispose(): void; /** * Handle events triggered from editor * @param event PluginEvent object */ onPluginEvent(event: PluginEvent): void; private getMatchingReplacement; }