import {Fragment} from "./fragment" import {Slice} from "./replace" import {Mark} from "./mark" import {Node, TextNode} from "./node" import {ContentMatch} from "./content" import {ResolvedPos} from "./resolvedpos" import {Schema, Attrs, NodeType, MarkType} from "./schema" import {DOMNode} from "./dom" /// These are the options recognized by the /// [`parse`](#model.DOMParser.parse) and /// [`parseSlice`](#model.DOMParser.parseSlice) methods. export 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](#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](#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](#model.GenericParseRule.context) when parsing, above the /// given [top node](#model.ParseOptions.topNode). context?: ResolvedPos /// @internal ruleFromNode?: (node: DOMNode) => Omit | null /// @internal topOpen?: boolean } /// Fields that may be present in both [tag](#model.TagParseRule) and /// [style](#model.StyleParseRule) parse rules. export 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 ``, /// `