---
title: "ISelectionHandler | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ISelectionHandler/"
---

# ISelectionHandler

> Handler for performing simple operations with text selection.

## Interfaces

### ISelectionHandler

#### Properties

##### selectionChangeEvent

```ts
selectionChangeEvent: EventObject<ITextRange>;
```

Text selection change event.

###### Remarks

reports the currently selected text.

#### Methods

##### getSelectionRange()

```ts
getSelectionRange(): ITextRange;
```

Returns the currently selected text range.

###### Returns

[`ITextRange`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextRange.md#itextrange)

##### resetSelection()

```ts
resetSelection(position?): void;
```

Resets the selection of text and sets the anchor to a new position.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `position?` | [`IPositionInText`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IPositionInText.md#ipositionintext) | new position in the text. |

###### Returns

`void`

###### Remarks

if position is null then anchor is set to null.

##### setSelectionByPoints()

```ts
setSelectionByPoints(startPoint, endPoint): void;
```

Sets the selection of text by starting and ending points.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `startPoint` | [IPoint](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-model/IPoint.md) | starting point. |
| `endPoint` | [IPoint](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-model/IPoint.md) | ending point. |

###### Returns

`void`

##### setSelectionByPositions()

```ts
setSelectionByPositions(startPosition, endPosition): void;
```

Sets the selection of text by starting and ending positions.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `startPosition` | [`IPositionInText`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IPositionInText.md#ipositionintext) | starting position. |
| `endPosition` | [`IPositionInText`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IPositionInText.md#ipositionintext) | ending position. |

###### Returns

`void`

##### setSelectionByRange()

```ts
setSelectionByRange(selection): void;
```

Sets the selection of text by a range.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `selection` | [`ITextRange`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextRange.md#itextrange) | start position in text. |

###### Returns

`void`

##### setSelectionToPosition()

```ts
setSelectionToPosition(position): void;
```

Sets the selection of text to a position relative to the anchor.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `position` | [`IPositionInText`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IPositionInText.md#ipositionintext) | new position in the text. |

###### Returns

`void`
