Show: Inherited Protected Private Deprecated

# CKEDITOR.plugins.ae_selectionregion Class

Defined in: `src/core/selection-region.js:13`

SelectionRegion utility class which provides metadata about the selection. The metadata may be the start and end rectangles, caret region, etc. This class is not intended to be used standalone. Its functions will be merged into each editor instance, so the developer may use them directly via the editor, without making an instance of this class.

## Constructor

### `CKEDITOR.plugins.ae_selectionregion`

()

Defined in `src/core/selection-region.js:13`

## Index

### Methods

- createSelectionFromPoint
- createSelectionFromRange
- getCaretRegion
- getClientRectsRegion
- getSelectionData
- getSelectionDirection
- getSelectionRegion
- init
- isSelectionEmpty

## Methods

### `createSelectionFromPoint`

(

- `x`
- `y`

)

Defined in `src/core/selection-region.js:27`

Creates selection from two points in page coordinates.

#### Parameters:

- `x` Number

  X point in page coordinates.

- `y` Number

  Y point in page coordinates.

### `createSelectionFromRange`

(

- `startX`
- `startY`
- `endX`
- `endY`

)

Defined in `src/core/selection-region.js:38`

Creates selection from range. A range consists from two points in page coordinates.

#### Parameters:

- `startX` Number

  X coordinate of the first point.

- `startY` Number

  Y coordinate of the first point.

- `endX` Number

  X coordinate of the second point.

- `endY` Number

  Y coordinate of the second point.

### `getCaretRegion`

() Object

Defined in `src/core/selection-region.js:103`

Returns the region of the current position of the caret. The points are in page coordinates.

#### Returns:

Object:

Returns object with the following properties:

- bottom
- left
- right
- top

### `getClientRectsRegion`

() Object

Defined in `src/core/selection-region.js:211`

Returns object with data about the client rectangles of the selection, normalized across browses. All offsets below are in page coordinates.

#### Returns:

Object:

Returns object with the following data:

- bottom - bottom offset of all client rectangles
- left - left offset of all client rectangles
- right - right offset of all client rectangles
- top - top offset of all client rectangles
- startRect - An Object, which contains the following information:
  - bottom - bottom offset
  - height - the height of the rectangle
  - left - left offset of the selection
  - right - right offset of the selection
  - top - top offset of the selection
  - width - the width of the rectangle
- endRect - An Object, which contains the following information:
  - bottom - bottom offset
  - height - the height of the rectangle
  - left - left offset of the selection
  - right - right offset of the selection
  - top - top offset of the selection
  - width - the width of the rectangle

If there is no native selection, the objects will be filled with 0.

### `getSelectionData`

() Object | Null

Defined in `src/core/selection-region.js:147`

Returns data for the current selection.

#### Returns:

Object | Null:

Returns an object with the following data:

- element - The currently selected element, if any
- text - The selected text
- region - The data, returned from getSelectionRegion

### `getSelectionDirection`

() Number

Defined in `src/core/selection-region.js:335`

Retrieves the direction of the selection. The direction is from top to bottom or from bottom to top. For IE < 9 it is not possible, so the direction for these browsers will be always CKEDITOR.SELECTION_TOP_TO_BOTTOM.

#### Returns:

Number:

Returns a number which represents selection direction. It might be one of these:

- CKEDITOR.SELECTION_TOP_TO_BOTTOM;
- CKEDITOR.SELECTION_BOTTOM_TO_TOP;

### `getSelectionRegion`

() Object

Defined in `src/core/selection-region.js:173`

Returns the region of the current selection.

#### Returns:

Object:

Returns object which is being returned from getClientRectsRegion with three more properties:

- direction - the direction of the selection. Can be one of these:
  1. CKEDITOR.SELECTION_TOP_TO_BOTTOM
  2. CKEDITOR.SELECTION_BOTTOM_TO_TOP
- height - The height of the selection region
- width - The width of the selection region

### `init`

(

- `editor`

)
protected

Defined in `src/core/selection-region.js:369`

Initializer lifecycle implementation for the SelectionRegion plugin.

#### Parameters:

- `editor` Object

  The current CKEditor instance.

### `isSelectionEmpty`

() Boolean

Defined in `src/core/selection-region.js:196`

Returns true if the current selection is empty, false otherwise.

#### Returns:

Boolean:

Returns true if the current selection is empty, false otherwise.