UNPKG

communication-react-19

Version:

React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)

29 lines 1.22 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { ContextMenuPluginBase } from 'roosterjs-content-model-plugins'; /** * Represents a plugin that adds a context menu to the rich text editor. */ export class ContextMenuPlugin extends ContextMenuPluginBase { constructor(onRender, onDismiss) { super({ /** * Renders the context menu in the specified container with the provided items. * @param container - The container element where the context menu should be rendered. * @param items - The items to be displayed in the context menu. * @param onDismiss - Callback function to be called when the context menu is dismissed. It will call `dismiss` method. */ render: (container, items, onDismissCallback) => { const filteredItems = items.filter((item) => item !== null); onRender(container, filteredItems, onDismissCallback); }, /** * Dismisses the context menu. */ dismiss: () => { onDismiss(); } }); } } //# sourceMappingURL=ContextMenuPlugin.js.map