UNPKG

@atlaskit/editor-plugin-paste

Version:

Paste plugin for @atlaskit/editor-core

31 lines 1.35 kB
import { MoveAnalyticPluginTypes } from './actions'; import { createCommand, getPluginState } from './plugin-factory'; import { pluginKey } from './plugin-key'; export const updateContentMoved = (nextState, nextAction) => createCommand(state => { const { contentMoved } = getPluginState(state); const data = { currentActions: [...contentMoved.currentActions, nextAction], size: (nextState === null || nextState === void 0 ? void 0 : nextState.size) || contentMoved.size, nodeName: nextState === null || nextState === void 0 ? void 0 : nextState.nodeName, nodeDepth: nextState === null || nextState === void 0 ? void 0 : nextState.nodeDepth, nodeTypes: nextState === null || nextState === void 0 ? void 0 : nextState.nodeTypes, hasSelectedMultipleNodes: nextState === null || nextState === void 0 ? void 0 : nextState.hasSelectedMultipleNodes }; return { type: MoveAnalyticPluginTypes.UpdateMovedAction, data }; }, tr => tr.setMeta('addToHistory', false)); export const resetContentMoved = () => createCommand(() => { return { type: MoveAnalyticPluginTypes.RemoveMovedAction }; }, tr => tr.setMeta('addToHistory', false)); export const resetContentMovedTransform = () => tr => { const payload = { type: MoveAnalyticPluginTypes.RemoveMovedAction }; return tr.setMeta(pluginKey, payload); };