import type { ContentModelFormatState } from 'roosterjs-content-model-types'; import type { LocalizedStrings, ReactEditorPlugin } from '../../common/index'; import type { RibbonButton } from './RibbonButton'; /** * Represents a plugin to connect format ribbon component and the editor */ export interface RibbonPlugin extends ReactEditorPlugin { /** * Register a callback to be invoked when format state of editor is changed, returns a disposer function. */ registerFormatChangedCallback: (callback: (formatState: ContentModelFormatState) => void) => () => void; /** * When user clicks on a button, call this method to let the plugin to handle this click event * @param button The button that is clicked * @param key Key of child menu item that is clicked if any * @param strings The localized string map for this button */ onButtonClick: (button: RibbonButton, key: T, strings?: LocalizedStrings) => void; /** * Enter live preview state (shadow edit) of editor if there is a non-collapsed selection * @param button The button that triggered this action * @param key Key of the hovered button sub item * @param strings The localized string map for this button */ startLivePreview: (button: RibbonButton, key: T, strings?: LocalizedStrings) => void; /** * Leave live preview state (shadow edit) of editor */ stopLivePreview: () => void; }