UNPKG

@atlaskit/editor-plugin-card

Version:

Card plugin for @atlaskit/editor-core

24 lines 1.05 kB
import React from 'react'; import { AnalyticsContext } from '@atlaskit/analytics-next'; import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils'; import { getPluginState } from '../pm-plugins/util/state'; /** * Provides location attribute to child events */ export var EditorAnalyticsContext = function EditorAnalyticsContext(_ref) { var _getPluginState; var editorView = _ref.editorView, children = _ref.children; var editorAppearance = editorView ? (_getPluginState = getPluginState(editorView.state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.editorAppearance : undefined; var analyticsEditorAppearance = getAnalyticsEditorAppearance(editorAppearance); var analyticsData = { attributes: { location: analyticsEditorAppearance }, // Below is added for the future implementation of Linking Platform namespaced analytic context location: analyticsEditorAppearance }; return /*#__PURE__*/React.createElement(AnalyticsContext, { data: analyticsData }, children); };