UNPKG

@atlaskit/editor-plugin-card

Version:

Card plugin for @atlaskit/editor-core

15 lines 654 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 var EditorSmartCardEvents = function EditorSmartCardEvents(_ref) { var editorView = _ref.editorView; var events = useSmartLinkEvents(); useEffect(function () { if (!events || expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) { return; } editorView.dispatch(registerSmartCardEvents(events)(editorView.state.tr)); }, [events, editorView]); return null; };