@atlaskit/editor-plugin-selection-extension
Version:
editor-plugin-selection-extension plugin for @atlaskit/editor-core
15 lines (13 loc) • 603 B
JavaScript
import { createContext, useContext } from 'react';
/*
* Common context passed down to selection extension components
*/
const SelectionExtensionComponentContext = /*#__PURE__*/createContext(undefined);
export const SelectionExtensionComponentContextProvider = SelectionExtensionComponentContext.Provider;
export const useSelectionExtensionComponentContext = () => {
const context = useContext(SelectionExtensionComponentContext);
if (!context) {
throw new Error('useSelectionExtensionComponentContext must be used within SelectionExtensionComponentContextProvider');
}
return context;
};