UNPKG

@atlaskit/editor-plugin-metrics

Version:

Metrics plugin for @atlaskit/editor-core

20 lines 604 B
import { metricsKey } from '../../../main'; import { ActionType } from '../types'; const UI_EVENT = 'uiEvent'; const PASTE_EVENT = 'paste'; export const checkContentPastedOrMoved = tr => { var _tr$getMeta; const isContentMoved = (_tr$getMeta = tr.getMeta(metricsKey)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.contentMoved; const isContentPasted = tr.getMeta(UI_EVENT) === PASTE_EVENT; if (isContentMoved) { return { type: ActionType.MOVING_CONTENT }; } if (isContentPasted) { return { type: ActionType.PASTING_CONTENT }; } return undefined; };