UNPKG

@atlaskit/editor-plugin-metrics

Version:

Metrics plugin for @atlaskit/editor-core

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