UNPKG

@atlaskit/editor-plugin-analytics

Version:

Analytics plugin for @atlaskit/editor-core

18 lines 709 B
const getUndoRedoInputSource = tr => { var _tr$getMeta; // Please, do not copy or use this kind of code below return (_tr$getMeta = tr.getMeta('undoRedoPlugin$')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : null; }; export const generateUndoRedoInputSoucePayload = tr => { const undoRedoPluginInputSource = getUndoRedoInputSource(tr); return payload => { const shouldAddHistoryTriggerMethodAttribute = undoRedoPluginInputSource && ['undid', 'redid'].includes(payload.action); return !shouldAddHistoryTriggerMethodAttribute ? payload : { ...payload, attributes: { ...payload.attributes, historyTriggerMethod: undoRedoPluginInputSource } }; }; };