UNPKG

@atlaskit/adf-schema

Version:

Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs

50 lines (49 loc) 1.6 kB
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model'; import { ReplaceStep, Step, StepMap, StepResult, Mappable } from '@atlaskit/editor-prosemirror/transform'; export declare const stepType = "editor-linking-meta"; export declare const invertStepType = "editor-linking-meta-invert"; export type LinkStepMetadata = { /** * Editor action performed */ action?: string; /** * Editor input method that triggered the transaction */ inputMethod?: string; /** * The applicable card action for this step * if is RESOLVE then the undo/redo steps should be considered "updates" of a link */ cardAction?: 'RESOLVE'; /** * Source UI that tiggered this step, if available/applicable */ sourceEvent?: unknown; }; /** * Custom Prosemirror Step to attach metadata about user interactions with links * Using a Step means that it will work with prosemirror-history and we get utilise when * firing events on history change */ export declare class LinkMetaStep extends Step { private pos; private metadata; private isInverted; constructor(pos: number | null, metadata: LinkStepMetadata, isInverted?: boolean); getMetadata(): LinkStepMetadata; /** * Generate new undo/redo analytics event when step is inverted */ invert(): LinkMetaStep; apply(doc: PMNode): StepResult; map(mapping: Mappable): LinkMetaStep; getMap(): StepMap; merge(): null; toJSON(): { stepType: string; from: number; to: number; }; static fromJSON(): ReplaceStep; }