A mapping represents a pipeline of zero or more StepMaps. It has special provisions for losslessly handling mapping positions through a series of steps in which some steps are inverted versions of earlier steps.
Ports Mapping from prosemirror-transform/src/map.ts.
Summary
Functions
Add a step map to the end of this mapping. If mirrors is given,
it should be the index of the step map that is the mirror image of this one.
Add all the step maps in a given mapping to this one (preserving mirroring information).
Append the inverse of the given mapping to this one.
Finds the offset of the step map that mirrors the map at the given offset.
Create an inverted version of this mapping.
Map a position through this mapping.
Map a position through this mapping, returning a MapResult.
Create a new empty Mapping.
Create a new Mapping with the given maps.
Create a mapping that maps only through a part of this one.
Types
@type t() :: %ProsemirrorEx.Transform.Mapping{ from: non_neg_integer(), maps: [ProsemirrorEx.Transform.StepMap.t()], mirror: [non_neg_integer()] | nil, to: non_neg_integer() }
Functions
Add a step map to the end of this mapping. If mirrors is given,
it should be the index of the step map that is the mirror image of this one.
Add all the step maps in a given mapping to this one (preserving mirroring information).
Append the inverse of the given mapping to this one.
Finds the offset of the step map that mirrors the map at the given offset.
Create an inverted version of this mapping.
Map a position through this mapping.
Map a position through this mapping, returning a MapResult.
Create a new empty Mapping.
Create a new Mapping with the given maps.
Create a mapping that maps only through a part of this one.