import OrderedMap from 'orderedmap'; /** A mark is a piece of information that can be attached to a node, such as it being emphasized, in code font, or a link. It has a type and optionally a set of attributes that provide further information (such as the target of the link). Marks are created through a `Schema`, which controls which types exist and which attributes they have. */ declare class Mark { /** The type of this mark. */ readonly type: MarkType; /** The attributes associated with this mark. */ readonly attrs: Attrs; /** Given a set of marks, create a new set which contains this one as well, in the right position. If this mark is already in the set, the set itself is returned. If any marks that are set to be [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present, those are replaced by this one. */ addToSet(set: readonly Mark[]): readonly Mark[]; /** Remove this mark from the given set, returning a new set. If this mark is not in the set, the set itself is returned. */ removeFromSet(set: readonly Mark[]): readonly Mark[]; /** Test whether this mark is in the given set of marks. */ isInSet(set: readonly Mark[]): boolean; /** Test whether this mark has the same type and attributes as another mark. */ eq(other: Mark): boolean; /** Convert this mark to a JSON-serializeable representation. */ toJSON(): any; /** Deserialize a mark from JSON. */ static fromJSON(schema: Schema, json: any): Mark; /** Test whether two sets of marks are identical. */ static sameSet(a: readonly Mark[], b: readonly Mark[]): boolean; /** Create a properly sorted mark set from null, a single mark, or an unsorted array of marks. */ static setFrom(marks?: Mark | readonly Mark[] | null): readonly Mark[]; /** The empty set of marks. */ static none: readonly Mark[]; } /** A description of a DOM structure. Can be either a DOM element, a `{dom, contentDOM}` object, or an array. An array describes a DOM element. The first value in the array should be a string—the name of the DOM element, optionally prefixed by a namespace URL and a space. If the second element is plain object, it is interpreted as a set of attributes for the element. Any elements after that (including the 2nd if it's not an attribute object) are interpreted as children of the DOM elements, and must either be valid `DOMOutputSpec` values, strings (for text nodes), or the number zero. The number zero (pronounced “hole”) is used to indicate the place where a node's child nodes should be inserted. If it occurs in an output spec, it should be the only child element in its parent node. */ type DOMOutputSpec = HTMLElement | { dom: HTMLElement; contentDOM?: HTMLElement; } | readonly [string, ...any[]]; /** A DOM serializer knows how to convert ProseMirror nodes and marks of various types to DOM nodes. */ declare class DOMSerializer { /** The node serialization functions. */ readonly nodes: { [node: string]: (node: Node) => DOMOutputSpec; }; /** The mark serialization functions. */ readonly marks: { [mark: string]: (mark: Mark, inline: boolean) => DOMOutputSpec; }; /** Create a serializer. `nodes` should map node names to functions that take a node and return a description of the corresponding DOM. `marks` does the same for mark names, but also gets an argument that tells it whether the mark's content is block or inline content (for typical use, it'll always be inline). A mark serializer may be `null` to indicate that marks of that type should not be serialized. */ constructor( /** The node serialization functions. */ nodes: { [node: string]: (node: Node) => DOMOutputSpec; }, /** The mark serialization functions. */ marks: { [mark: string]: (mark: Mark, inline: boolean) => DOMOutputSpec; }); /** Serialize the content of this fragment to a DOM fragment. When not in the browser, the `document` option, containing a DOM document, should be passed so that the serializer can create nodes. */ serializeFragment(fragment: Fragment, options?: { document?: Document; }, target?: HTMLElement | DocumentFragment): DocumentFragment | HTMLElement; /** Serialize this node to a DOM node. This can be useful when you need to serialize a part of a document, as opposed to the whole document. To serialize a whole document, use [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on its [content](https://prosemirror.net/docs/ref/#model.Node.content). */ serializeNode(node: Node, options?: { document?: Document; }): HTMLElement | Text; /** Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If the spec has a hole (zero) in it, `contentDOM` will point at the node with the hole. */ static renderSpec(doc: Document, structure: DOMOutputSpec, xmlNS?: string | null): { dom: HTMLElement; contentDOM?: HTMLElement; }; /** Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM) properties in a schema's node and mark specs. */ static fromSchema(schema: Schema): DOMSerializer; /** Gather the serializers in a schema's node specs into an object. This can be useful as a base to build a custom serializer from. */ static nodesFromSchema(schema: Schema): { [node: string]: (node: Node) => DOMOutputSpec; }; /** Gather the serializers in a schema's mark specs into an object. */ static marksFromSchema(schema: Schema): { [mark: string]: (mark: Mark, inline: boolean) => DOMOutputSpec; }; } /** You can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more information about it. Objects of this class represent such a resolved position, providing various pieces of context information, and some helper methods. Throughout this interface, methods that take an optional `depth` parameter will interpret undefined as `this.depth` and negative numbers as `this.depth + value`. */ declare class ResolvedPos { /** The position that was resolved. */ readonly pos: number; /** The offset this position has into its parent node. */ readonly parentOffset: number; /** The number of levels the parent node is from the root. If this position points directly into the root node, it is 0. If it points into a top-level paragraph, 1, and so on. */ depth: number; /** The parent node that the position points into. Note that even if a position points into a text node, that node is not considered the parent—text nodes are ‘flat’ in this model, and have no content. */ get parent(): Node; /** The root node in which the position was resolved. */ get doc(): Node; /** The ancestor node at the given level. `p.node(p.depth)` is the same as `p.parent`. */ node(depth?: number | null): Node; /** The index into the ancestor at the given level. If this points at the 3rd node in the 2nd paragraph on the top level, for example, `p.index(0)` is 1 and `p.index(1)` is 2. */ index(depth?: number | null): number; /** The index pointing after this position into the ancestor at the given level. */ indexAfter(depth?: number | null): number; /** The (absolute) position at the start of the node at the given level. */ start(depth?: number | null): number; /** The (absolute) position at the end of the node at the given level. */ end(depth?: number | null): number; /** The (absolute) position directly before the wrapping node at the given level, or, when `depth` is `this.depth + 1`, the original position. */ before(depth?: number | null): number; /** The (absolute) position directly after the wrapping node at the given level, or the original position when `depth` is `this.depth + 1`. */ after(depth?: number | null): number; /** When this position points into a text node, this returns the distance between the position and the start of the text node. Will be zero for positions that point between nodes. */ get textOffset(): number; /** Get the node directly after the position, if any. If the position points into a text node, only the part of that node after the position is returned. */ get nodeAfter(): Node | null; /** Get the node directly before the position, if any. If the position points into a text node, only the part of that node before the position is returned. */ get nodeBefore(): Node | null; /** Get the position at the given index in the parent node at the given depth (which defaults to `this.depth`). */ posAtIndex(index: number, depth?: number | null): number; /** Get the marks at this position, factoring in the surrounding marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the position is at the start of a non-empty node, the marks of the node after it (if any) are returned. */ marks(): readonly Mark[]; /** Get the marks after the current position, if any, except those that are non-inclusive and not present at position `$end`. This is mostly useful for getting the set of marks to preserve after a deletion. Will return `null` if this position is at the end of its parent node or its parent node isn't a textblock (in which case no marks should be preserved). */ marksAcross($end: ResolvedPos): readonly Mark[] | null; /** The depth up to which this position and the given (non-resolved) position share the same parent nodes. */ sharedDepth(pos: number): number; /** Returns a range based on the place where this position and the given position diverge around block content. If both point into the same textblock, for example, a range around that textblock will be returned. If they point into different blocks, the range around those blocks in their shared ancestor is returned. You can pass in an optional predicate that will be called with a parent node to see if a range into that parent is acceptable. */ blockRange(other?: ResolvedPos, pred?: (node: Node) => boolean): NodeRange | null; /** Query whether the given position shares the same parent node. */ sameParent(other: ResolvedPos): boolean; /** Return the greater of this and the given position. */ max(other: ResolvedPos): ResolvedPos; /** Return the smaller of this and the given position. */ min(other: ResolvedPos): ResolvedPos; } /** Represents a flat range of content, i.e. one that starts and ends in the same node. */ declare class NodeRange { /** A resolved position along the start of the content. May have a `depth` greater than this object's `depth` property, since these are the positions that were used to compute the range, not re-resolved positions directly at its boundaries. */ readonly $from: ResolvedPos; /** A position along the end of the content. See caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from). */ readonly $to: ResolvedPos; /** The depth of the node that this range points into. */ readonly depth: number; /** Construct a node range. `$from` and `$to` should point into the same node until at least the given `depth`, since a node range denotes an adjacent set of nodes in a single parent node. */ constructor( /** A resolved position along the start of the content. May have a `depth` greater than this object's `depth` property, since these are the positions that were used to compute the range, not re-resolved positions directly at its boundaries. */ $from: ResolvedPos, /** A position along the end of the content. See caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from). */ $to: ResolvedPos, /** The depth of the node that this range points into. */ depth: number); /** The position at the start of the range. */ get start(): number; /** The position at the end of the range. */ get end(): number; /** The parent node that the range points into. */ get parent(): Node; /** The start index of the range in the parent node. */ get startIndex(): number; /** The end index of the range in the parent node. */ get endIndex(): number; } /** Error type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when given an invalid replacement. */ declare class ReplaceError extends Error { } /** A slice represents a piece cut out of a larger document. It stores not only a fragment, but also the depth up to which nodes on both side are ‘open’ (cut through). */ declare class Slice { /** The slice's content. */ readonly content: Fragment; /** The open depth at the start of the fragment. */ readonly openStart: number; /** The open depth at the end. */ readonly openEnd: number; /** Create a slice. When specifying a non-zero open depth, you must make sure that there are nodes of at least that depth at the appropriate side of the fragment—i.e. if the fragment is an empty paragraph node, `openStart` and `openEnd` can't be greater than 1. It is not necessary for the content of open nodes to conform to the schema's content constraints, though it should be a valid start/end/middle for such a node, depending on which sides are open. */ constructor( /** The slice's content. */ content: Fragment, /** The open depth at the start of the fragment. */ openStart: number, /** The open depth at the end. */ openEnd: number); /** The size this slice would add when inserted into a document. */ get size(): number; /** Tests whether this slice is equal to another slice. */ eq(other: Slice): boolean; /** Convert a slice to a JSON-serializable representation. */ toJSON(): any; /** Deserialize a slice from its JSON representation. */ static fromJSON(schema: Schema, json: any): Slice; /** Create a slice from a fragment by taking the maximum possible open value on both side of the fragment. */ static maxOpen(fragment: Fragment, openIsolating?: boolean): Slice; /** The empty slice. */ static empty: Slice; } type DOMNode = InstanceType; /** These are the options recognized by the [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse) and [`parseSlice`](https://prosemirror.net/docs/ref/#model.DOMParser.parseSlice) methods. */ interface ParseOptions { /** By default, whitespace is collapsed as per HTML's rules. Pass `true` to preserve whitespace, but normalize newlines to spaces or, if available, [line break replacements](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement), and `"full"` to preserve whitespace entirely. */ preserveWhitespace?: boolean | "full"; /** When given, the parser will, beside parsing the content, record the document positions of the given DOM positions. It will do so by writing to the objects, adding a `pos` property that holds the document position. DOM positions that are not in the parsed content will not be written to. */ findPositions?: { node: DOMNode; offset: number; pos?: number; }[]; /** The child node index to start parsing from. */ from?: number; /** The child node index to stop parsing at. */ to?: number; /** By default, the content is parsed into the schema's default [top node type](https://prosemirror.net/docs/ref/#model.Schema.topNodeType). You can pass this option to use the type and attributes from a different node as the top container. */ topNode?: Node; /** Provide the starting content match that content parsed into the top node is matched against. */ topMatch?: ContentMatch; /** A set of additional nodes to count as [context](https://prosemirror.net/docs/ref/#model.GenericParseRule.context) when parsing, above the given [top node](https://prosemirror.net/docs/ref/#model.ParseOptions.topNode). */ context?: ResolvedPos; } /** Fields that may be present in both [tag](https://prosemirror.net/docs/ref/#model.TagParseRule) and [style](https://prosemirror.net/docs/ref/#model.StyleParseRule) parse rules. */ interface GenericParseRule { /** Can be used to change the order in which the parse rules in a schema are tried. Those with higher priority come first. Rules without a priority are counted as having priority 50. This property is only meaningful in a schema—when directly constructing a parser, the order of the rule array is used. */ priority?: number; /** By default, when a rule matches an element or style, no further rules get a chance to match it. By setting this to `false`, you indicate that even when this rule matches, other rules that come after it should also run. */ consuming?: boolean; /** When given, restricts this rule to only match when the current context—the parent nodes into which the content is being parsed—matches this expression. Should contain one or more node names or node group names followed by single or double slashes. For example `"paragraph/"` means the rule only matches when the parent node is a paragraph, `"blockquote/paragraph/"` restricts it to be in a paragraph that is inside a blockquote, and `"section//"` matches any position inside a section—a double slash matches any sequence of ancestor nodes. To allow multiple different contexts, they can be separated by a pipe (`|`) character, as in `"blockquote/|list_item/"`. */ context?: string; /** The name of the mark type to wrap the matched content in. */ mark?: string; /** When true, ignore content that matches this rule. Any ``, `