UNPKG

@atlaskit/editor-plugin-undo-redo

Version:

Undo redo plugin for @atlaskit/editor-core

30 lines (29 loc) • 1.37 kB
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics/api'; import type { ACTION } from '@atlaskit/editor-common/analytics/types/enums'; import type { HigherOrderCommand, Command } from '@atlaskit/editor-common/types/command'; import type { Node } from '@atlaskit/editor-prosemirror/model'; import { InputSource } from './enums'; type AttachInputMeta = (inputSource: InputSource) => HigherOrderCommand; export declare const attachInputMeta: AttachInputMeta; type NodeHistory = { after: Node; before: Node; }; type NodeWithDifferingAttributes = { attributes: string[]; type: string; }; /** * Analyzes changes between two ProseMirror document nodes. * * @param params - Object containing before and after node states * @param params.before - The document node before changes * @param params.after - The document node after changes * @returns Object containing change analysis results with hasChanged boolean and affectedNodes array */ export declare function getChanges({ before, after }: NodeHistory): { affectedNodes: NodeWithDifferingAttributes[] | undefined; hasChanged: boolean; }; export declare const attachInputMetaWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputSource: InputSource, action: ACTION.UNDO_PERFORMED | ACTION.REDO_PERFORMED) => (command: Command) => Command; export {};