UNPKG

@atlaskit/editor-plugin-card

Version:

Card plugin for @atlaskit/editor-core

21 lines (20 loc) 831 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EditorSmartCardEvents = void 0; var _react = require("react"); var _smartCard = require("@atlaskit/smart-card"); var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals"); var _actions = require("../pm-plugins/actions"); var EditorSmartCardEvents = exports.EditorSmartCardEvents = function EditorSmartCardEvents(_ref) { var editorView = _ref.editorView; var events = (0, _smartCard.useSmartLinkEvents)(); (0, _react.useEffect)(function () { if (!events || (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) { return; } editorView.dispatch((0, _actions.registerSmartCardEvents)(events)(editorView.state.tr)); }, [events, editorView]); return null; };