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

ReplaceStep

Replace a part of the document with a slice of new content.

class ReplaceStep extends Step {
constructor(
from: number,
to: number,
slice: Slice,
structure?: boolean,
);
readonly from: number;
readonly slice: Slice;
readonly to: number;
 
apply(doc: Node): StepResult;
getMap(): StepMap;
invert(doc: Node): ReplaceStep;
map(mapping: Mappable): ReplaceStep | null;
merge(other: Step): ReplaceStep | null;
toJSON(): any;
}

§Extends

§Constructors

§
new ReplaceStep(from: number, to: number, slice: Slice, structure?: boolean)
[src]

The given slice should fit the 'gap' between from and to—the depths must line up, and the surrounding nodes must be able to be joined with the open sides of the slice. When structure is true, the step will fail if the content between from and to is not just a sequence of closing and then opening tokens (this is to guard against rebased replace steps overwriting something they weren't supposed to).

§Properties

§
from: number
[src]

The start position of the replaced range.

§
slice: Slice
[src]

The slice to insert.

§
to: number
[src]

The end position of the replaced range.

§Methods

§
apply(doc: Node): StepResult
[src]
§
getMap(): StepMap
[src]
§
invert(doc: Node): ReplaceStep
[src]
§
map(mapping: Mappable): ReplaceStep | null
[src]
§
merge(other: Step): ReplaceStep | null
[src]
§
toJSON(): any
[src]