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

NodeSpec

A description of a node type, used when defining a schema.

interface NodeSpec {
[key: string]: any;
atom?: boolean;
attrs?: {
[name: string]: AttributeSpec;
}
;
code?: boolean;
content?: string;
defining?: boolean;
definingAsContext?: boolean;
definingForContent?: boolean;
draggable?: boolean;
group?: string;
inline?: boolean;
isolating?: boolean;
leafText?: (node: Node) => string;
linebreakReplacement?: boolean;
marks?: string;
parseDOM?: readonly TagParseRule[];
selectable?: boolean;
toDebugString?: (node: Node) => string;
toDOM?: (node: Node) => DOMOutputSpec;
whitespace?: "pre" | "normal";
}

§Index Signatures

§
[key: string]: any

§Properties

§
atom?: boolean
[src]

Can be set to true to indicate that, though this isn't a leaf node, it doesn't have directly editable content and should be treated as a single unit in the view.

§
attrs?: {
[name: string]: AttributeSpec;
}
[src]

The attributes that nodes of this type get.

§
code?: boolean
[src]

Can be used to indicate that this node contains code, which causes some commands to behave differently.

§
content?: string
[src]

The content expression for this node, as described in the schema guide. When not given, the node does not allow any content.

§
defining?: boolean
[src]

When enabled, enables both definingAsContext and definingForContent.

§
definingAsContext?: boolean
[src]

Determines whether this node is considered an important parent node during replace operations (such as paste). Non-defining (the default) nodes get dropped when their entire content is replaced, whereas defining nodes persist and wrap the inserted content.

§
definingForContent?: boolean
[src]

In inserted content the defining parents of the content are preserved when possible. Typically, non-default-paragraph textblock types, and possibly list items, are marked as defining.

§
draggable?: boolean
[src]

Determines whether nodes of this type can be dragged without being selected. Defaults to false.

§
group?: string
[src]

The group or space-separated groups to which this node belongs, which can be referred to in the content expressions for the schema.

§
inline?: boolean
[src]

Should be set to true for inline nodes. (Implied for text nodes.)

§
isolating?: boolean
[src]

When enabled (default is false), the sides of nodes of this type count as boundaries that regular editing operations, like backspacing or lifting, won't cross. An example of a node that should probably have this enabled is a table cell.

§
leafText?: (node: Node) => string
[src]

Defines the default way a leaf node of this type should be serialized to a string (as used by Node.textBetween and Node.textContent).

§
linebreakReplacement?: boolean
[src]

A single inline node in a schema can be set to be a linebreak equivalent. When converting between block types that support the node and block types that don't but have whitespace set to "pre", setBlockType will convert between newline characters to or from linebreak nodes as appropriate.

§
marks?: string
[src]

The marks that are allowed inside of this node. May be a space-separated string referring to mark names or groups, "_" to explicitly allow all marks, or "" to disallow marks. When not given, nodes with inline content default to allowing all marks, other nodes default to not allowing marks.

§
parseDOM?: readonly TagParseRule[]
[src]

Associates DOM parser information with this node, which can be used by DOMParser.fromSchema to automatically derive a parser. The node field in the rules is implied (the name of this node will be filled in automatically). If you supply your own parser, you do not need to also specify parsing rules in your schema.

§
selectable?: boolean
[src]

Controls whether nodes of this type can be selected as a node selection. Defaults to true for non-text nodes.

§
toDebugString?: (node: Node) => string
[src]

Defines the default way a node of this type should be serialized to a string representation for debugging (e.g. in error messages).

§
toDOM?: (node: Node) => DOMOutputSpec
[src]

Defines the default way a node of this type should be serialized to DOM/HTML (as used by DOMSerializer.fromSchema). Should return a DOM node or an array structure that describes one, with an optional number zero (“hole”) in it to indicate where the node's content should be inserted.

For text nodes, the default is to create a text DOM node. Though
it is possible to create a serializer where text is rendered
differently, this is not supported inside the editor, so you
shouldn't override that in your text node spec.
§
whitespace?: "pre" | "normal"
[src]

Controls way whitespace in this a node is parsed. The default is "normal", which causes the DOM parser to collapse whitespace in normal mode, and normalize it (replacing newlines and such with spaces) otherwise. "pre" causes the parser to preserve spaces inside the node. When this option isn't given, but code is true, whitespace will default to "pre". Note that this option doesn't influence the way the node is rendered—that should be handled by toDOM and/or styling.