@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
18 lines • 616 B
JavaScript
import React, { createContext, useContext, useMemo } from 'react';
const SyncBlockActionsContext = /*#__PURE__*/createContext(null);
export const useSyncBlockActions = () => {
return useContext(SyncBlockActionsContext);
};
export const SyncBlockActionsProvider = ({
children,
removeSyncBlock,
fetchSyncBlockSourceInfo
}) => {
const value = useMemo(() => ({
deleteSyncBlock: removeSyncBlock,
fetchSourceInfo: fetchSyncBlockSourceInfo
}), [removeSyncBlock, fetchSyncBlockSourceInfo]);
return /*#__PURE__*/React.createElement(SyncBlockActionsContext.Provider, {
value: value
}, children);
};