tinymce.dom.RangeUtils

This class contains a few utility methods for ranges.

Summary

Methods

Name Summary Defined by

compareRanges()

Compares two ranges and checks if they are equal.

RangeUtils

expand()

Returns a range expanded around the entire word the provided selection was collapsed within.

RangeUtils

getCaretRangeFromPoint()

Gets the caret range for the given x/y location.

RangeUtils

Methods

compareRanges()

compareRanges(rng1: RangeObject, rng2: RangeObject): Boolean

Compares two ranges and checks if they are equal.

Parameters

  • rng1 (RangeObject) - First range to compare.

  • rng2 (RangeObject) - First range to compare.

Return value

  • Boolean - True or false if the ranges are equal.


expand()

expand(rng: Range, options: Object): Range

Returns a range expanded around the entire word the provided selection was collapsed within.

Parameters

  • rng (Range) - The initial range to work from.

  • options (Object) - Optional options provided to the expansion. Defaults to { type: 'word' }

Return value

  • Range - Returns the expanded range.


getCaretRangeFromPoint()

getCaretRangeFromPoint(clientX: Number, clientY: Number, doc: Document): Range

Gets the caret range for the given x/y location.

Parameters

  • clientX (Number) - X coordinate for range

  • clientY (Number) - Y coordinate for range

  • doc (Document) - Document that the x and y coordinates are relative to

Return value

  • Range - Caret range