UNPKG

@atlaskit/editor-plugin-card

Version:

Card plugin for @atlaskit/editor-core

16 lines 601 B
import { useEffect } from 'react'; import { useSmartLinkEvents } from '@atlaskit/smart-card'; import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals'; import { registerSmartCardEvents } from '../pm-plugins/actions'; export const EditorSmartCardEvents = ({ editorView }) => { const events = useSmartLinkEvents(); useEffect(() => { if (!events || expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) { return; } editorView.dispatch(registerSmartCardEvents(events)(editorView.state.tr)); }, [events, editorView]); return null; };