Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

NodeType

Node types are objects allocated once per Schema and used to tag Node instances. They contain information about the node type, such as its name and what kind of node it represents.

class NodeType {
contentMatch: ContentMatch;
inlineContent: boolean;
isBlock: boolean;
get isInline(): boolean;
isText: boolean;
get isTextblock(): boolean;
get isLeaf(): boolean;
get isAtom(): boolean;
markSet: readonly MarkType[] | null;
readonly name: string;
readonly schema: Schema;
readonly spec: NodeSpec;
get whitespace(): "pre" | "normal";
 
allowedMarks(marks: readonly Mark[]): readonly Mark[];
allowsMarks(marks: readonly Mark[]): boolean;
allowsMarkType(markType: MarkType): boolean;
compatibleContent(other: NodeType): boolean;
create(
attrs?: Attrs | null,
content?:
| Node
| readonly Node[]
| null
,
marks?: readonly Mark[],
): Node;
createAndFill(
attrs?: Attrs | null,
content?:
| Node
| readonly Node[]
| null
,
marks?: readonly Mark[],
): Node | null;
createChecked(
attrs?: Attrs | null,
content?:
| Node
| readonly Node[]
| null
,
marks?: readonly Mark[],
): Node;
hasRequiredAttrs(): boolean;
validContent(content: Fragment): boolean;
}

§Properties

§
contentMatch: ContentMatch
[src]

The starting match of the node type's content expression.

§
inlineContent: boolean
[src]

True if this node type has inline content.

§
isBlock: boolean
[src]

True if this is a block type

§
isInline: boolean readonly
[src]

True if this is an inline type.

§
isText: boolean
[src]

True if this is the text node type.

§
isTextblock: boolean readonly
[src]

True if this is a textblock type, a block that contains inline content.

§
isLeaf: boolean readonly
[src]

True for node types that allow no content.

§
isAtom: boolean readonly
[src]

True when this node is an atom, i.e. when it does not have directly editable content.

§
markSet: readonly MarkType[] | null
[src]

The set of marks allowed in this node. null means all marks are allowed.

§
name: string
[src]

The name the node type has in this schema.

§
schema: Schema
[src]

A link back to the Schema the node type belongs to.

§

The spec that this type is based on

§
whitespace: "pre" | "normal" readonly
[src]

The node type's whitespace option.

§Methods

§
allowedMarks(marks: readonly Mark[]): readonly Mark[]
[src]

Removes the marks that are not allowed in this node from the given set.

§
allowsMarks(marks: readonly Mark[]): boolean
[src]

Test whether the given set of marks are allowed in this node.

§
allowsMarkType(markType: MarkType): boolean
[src]

Check whether the given mark type is allowed in this node.

§
compatibleContent(other: NodeType): boolean
[src]

Indicates whether this node allows some of the same content as the given node type.

§
create(attrs?: Attrs | null, content?: Fragment | Node | readonly Node[] | null, marks?: readonly Mark[]): Node
[src]

Create a Node of this type. The given attributes are checked and defaulted (you can pass null to use the type's defaults entirely, if no required attributes exist). content may be a Fragment, a node, an array of nodes, or null. Similarly marks may be null to default to the empty set of marks.

§
createAndFill(attrs?: Attrs | null, content?: Fragment | Node | readonly Node[] | null, marks?: readonly Mark[]): Node | null
[src]

Like create, but see if it is necessary to add nodes to the start or end of the given fragment to make it fit the node. If no fitting wrapping can be found, return null. Note that, due to the fact that required nodes can always be created, this will always succeed if you pass null or Fragment.empty as content.

§
createChecked(attrs?: Attrs | null, content?: Fragment | Node | readonly Node[] | null, marks?: readonly Mark[]): Node
[src]

Like create, but check the given content against the node type's content restrictions, and throw an error if it doesn't match.

§
hasRequiredAttrs(): boolean
[src]

Tells you whether this node type has any required attributes.

§
validContent(content: Fragment): boolean
[src]

Returns true if the given fragment is valid content for this node type.