BlueprintRange

Type: Class

How to get BlueprintRange?

JavaScript

import BlueprintRange from 'fontoxml-blueprints/src/BlueprintRange.js'

Represents a range in a blueprint

A blueprint performs edits a vanilla range cannot respond to, examples are: edits in the order of start and end: a normal range will mirror itself, it will not mirror if the edits only took place in the blueprint.

Also, setStartBefore like functions will also not work.

Use this for using ranges in blueprints. Edits in the blueprint will affect this range.

Constructor arguments

  1. blueprint

    (Required)

    Type: Blueprint

    The blueprint in which to consider the range

Properties

collapsed

Type: Boolean

endContainer

Type: Node

Returns

endOffset

Type: Number

The offset of the end of this range

Returns

isEmpty

Type: Boolean

If true, this range is empty (there is no selection).

startContainer

Type: Node

The container of the start of this range

Returns

startOffset

Type: Number

The offset of the start of the range

Returns

Methods

cloneRange

Type: Function

Create a new range with the same boundary points.

Returns

collapse

Type: Function

Collapses the Range to one of its boundary points.

Arguments

findCommonAncestor

Type: Function

Find the common ancestor of this range, the first node under which the start and endContainer are contained

Returns

selectNode

Type: Function

Sets the Range to contain the Node and its contents.

Arguments

selectNodeContents

Type: Function

Sets the Range to contain the contents of a Node.

Arguments

setEnd

Type: Function

Sets the start position of a range to a given node and a given offset inside that node.

Arguments

setEndAfter

Type: Function

Sets the end position of this Range relative to another Node.

Arguments

setEndBefore

Type: Function

Sets the end position of this Range relative to another Node.

Arguments

setStart

Type: Function

Sets the start position of a range to a given node and a given offset inside that node.

Arguments

setStartAfter

Type: Function

Sets the start position of this Range relative to another Node.

Arguments

setStartBefore

Type: Function

Sets the start position of this Range relative to another Node.

Arguments

Static properties

createFromRange

Type: Function

Constructs a new BlueprintRange from the given Range.

Arguments

Returns