@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
38 lines (37 loc) • 1.34 kB
TypeScript
import { Mark as PMMark, MarkSpec, NodeSpec, Schema } from '../prosemirror';
export interface Doc {
version: 1;
type: 'doc';
content: Node[];
}
export interface Node {
type: string;
attrs?: any;
content?: Node[];
marks?: Mark[];
text?: string;
}
export interface Mark {
type: string;
attrs?: any;
}
export interface MarkSimple {
type: {
name: string;
};
attrs?: any;
}
export declare const markOrder: string[];
export declare const isSubSupType: (type: string) => type is "sub" | "sup";
export declare const getMarksByOrder: (marks: PMMark[]) => PMMark[];
export declare const isSameMark: (mark: PMMark | null, otherMark: PMMark | null) => boolean;
export declare const getValidDocument: (doc: Doc, schema?: Schema<NodeSpec, MarkSpec>) => Doc | null;
export declare const getValidContent: (content: Node[], schema?: Schema<NodeSpec, MarkSpec>) => Node[];
/**
* Sanitize unknown node tree
*
* @see https://product-fabric.atlassian.net/wiki/spaces/E/pages/11174043/Document+structure#Documentstructure-ImplementationdetailsforHCNGwebrenderer
*/
export declare const getValidUnknownNode: (node: Node) => Node;
export declare const getValidNode: (originalNode: Node, schema?: Schema<NodeSpec, MarkSpec>) => Node;
export declare const getValidMark: (mark: Mark) => Mark | null;