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

DecorationSet

A collection of decorations, organized in such a way that the drawing algorithm can efficiently use and compare them. This is a persistent data structure—it is not modified, updates create a new value.

class DecorationSet implements DecorationSource {
private addInner;
private findInner;
private removeInner;
 
add(doc: Node, decorations: Decoration[]): DecorationSet;
find(
start?: number,
end?: number,
predicate?: (spec: any) => boolean,
): Decoration[];
forChild(offset: number, node: Node): DecorationSet | DecorationGroup;
map(
mapping: Mapping,
doc: Node,
options?: {
onRemove?: (decorationSpec: any) => void;
}
,
): DecorationSet;
remove(decorations: Decoration[]): DecorationSet;
 
static empty: DecorationSet;
 
static create(doc: Node, decorations: Decoration[]): DecorationSet;
}

§Implements

§Properties

§
addInner
[src]
§
findInner
[src]
§
removeInner
[src]

§Methods

§
add(doc: Node, decorations: Decoration[]): DecorationSet
[src]

Add the given array of decorations to the ones in the set, producing a new set. Consumes the decorations array. Needs access to the current document to create the appropriate tree structure.

§
find(start?: number, end?: number, predicate?: (spec: any) => boolean): Decoration[]
[src]

Find all decorations in this set which touch the given range (including decorations that start or end directly at the boundaries) and match the given predicate on their spec. When start and end are omitted, all decorations in the set are considered. When predicate isn't given, all decorations are assumed to match.

§
forChild(offset: number, node: Node): DecorationSet | DecorationGroup
[src]
§
map(mapping: Mapping, doc: Node, options?: {
onRemove?: (decorationSpec: any) => void;
}
): DecorationSet
[src]

Map the set of decorations in response to a change in the document.

§
remove(decorations: Decoration[]): DecorationSet
[src]

Create a new set that contains the decorations in this set, minus the ones in the given array.

§Static Properties

§

The empty set of decorations.

§Static Methods

§
create(doc: Node, decorations: Decoration[]): DecorationSet
[src]

Create a set of decorations, using the structure of the given document. This will consume (modify) the decorations array, so you must make a copy if you want need to preserve that.