@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
52 lines (51 loc) • 1.66 kB
TypeScript
import { Node as PMNode, Schema } from 'prosemirror-model';
import { ReplaceStep, Step, StepMap, StepResult, Mappable } from 'prosemirror-transform';
export declare const stepType = "editor-linking-meta";
export declare const invertStepType = "editor-linking-meta-invert";
export declare 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<any>;
map(mapping: Mappable): LinkMetaStep;
getMap(): StepMap;
merge(): null;
toJSON(): {
stepType: string;
from: number;
to: number;
};
static fromJSON<S extends Schema = any>(_: S, __: {
[key: string]: any;
}): ReplaceStep<any>;
}