---
title: "Selection"
---
# Selection

Defined in: [src/core/selection/selection.ts:49](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L49)

## Implements

- [`ISelect`](../interfaces/types.ISelect.html)

### Constructor

**new Selection**(`jodit`): `Selection`

Defined in: [src/core/selection/selection.ts:50](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L50)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `jodit` | [`IJodit`](../interfaces/types.IJodit.html) |

#### Returns

`Selection`

### jodit

`readonly` **jodit**: [`IJodit`](../interfaces/types.IJodit.html)

Defined in: [src/core/selection/selection.ts:50](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L50)

#### Get Signature

**get** **sel**(): [`Selection`](https://developer.mozilla.org/docs/Web/API/Selection) \| `null`

Defined in: [src/core/selection/selection.ts:96](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L96)

Return current selection object

##### Returns

[`Selection`](https://developer.mozilla.org/docs/Web/API/Selection) \| `null`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`sel`](../interfaces/types.ISelect.html#sel)

***

#### Get Signature

**get** **range**(): [`Range`](https://developer.mozilla.org/docs/Web/API/Range)

Defined in: [src/core/selection/selection.ts:110](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L110)

Return first selected range or create new

##### Returns

[`Range`](https://developer.mozilla.org/docs/Web/API/Range)

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`range`](../interfaces/types.ISelect.html#range)

***

#### Get Signature

**get** **isInsideArea**(): `boolean`

Defined in: [src/core/selection/selection.ts:119](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L119)

Checks if the selected text is currently inside the editor

##### Returns

`boolean`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`isInsideArea`](../interfaces/types.ISelect.html#isinsidearea)

***

#### Get Signature

**get** **hasMarkers**(): `boolean`

Defined in: [src/core/selection/selection.ts:230](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L230)

Check if editor has selection markers

##### Returns

`boolean`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`hasMarkers`](../interfaces/types.ISelect.html#hasmarkers)

***

#### Get Signature

**get** **markers**(): [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)[]

Defined in: [src/core/selection/selection.ts:237](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L237)

Check if editor has selection markers

##### Returns

[`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)[]

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`markers`](../interfaces/types.ISelect.html#markers)

***

#### Get Signature

**get** **html**(): `string`

Defined in: [src/core/selection/selection.ts:1308](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1308)

Return current selected HTML

##### Example

```javascript
const editor = Jodit.make();
console.log(editor.s.html); // html
console.log(Jodit.modules.Helpers.stripTags(editor.s.html)); // plain text
```

##### Returns

`string`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`html`](../interfaces/types.ISelect.html#html)

### createRange()

**createRange**(`select?`): [`Range`](https://developer.mozilla.org/docs/Web/API/Range)

Defined in: [src/core/selection/selection.ts:142](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L142)

Return current selection object

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `select` | `boolean` | `false` | Immediately add in selection |

#### Returns

[`Range`](https://developer.mozilla.org/docs/Web/API/Range)

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`createRange`](../interfaces/types.ISelect.html#createrange)

***

### remove()

**remove**(): `void`

Defined in: [src/core/selection/selection.ts:155](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L155)

Remove all selected content

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`remove`](../interfaces/types.ISelect.html#remove)

***

### clear()

**clear**(): `void`

Defined in: [src/core/selection/selection.ts:175](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L175)

Clear all selection

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`clear`](../interfaces/types.ISelect.html#clear)

***

### removeNode()

**removeNode**(`node`): `void`

Defined in: [src/core/selection/selection.ts:184](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L184)

Remove node element from editor

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `node` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) |

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`removeNode`](../interfaces/types.ISelect.html#removenode)

***

### insertCursorAtPoint()

**insertCursorAtPoint**(`x`, `y`): `boolean`

Defined in: [src/core/selection/selection.ts:202](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L202)

Insert the cursor to any point x, y

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `x` | `number` | Coordinate by horizontal |
| `y` | `number` | Coordinate by vertical |

#### Returns

`boolean`

false - Something went wrong

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`insertCursorAtPoint`](../interfaces/types.ISelect.html#insertcursoratpoint)

***

### removeMarkers()

**removeMarkers**(): `void`

Defined in: [src/core/selection/selection.ts:244](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L244)

Remove all markers

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`removeMarkers`](../interfaces/types.ISelect.html#removemarkers)

***

### marker()

**marker**(`atStart?`, `range?`): [`HTMLSpanElement`](https://developer.mozilla.org/docs/Web/API/HTMLSpanElement)

Defined in: [src/core/selection/selection.ts:251](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L251)

Create marker element

#### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `atStart` | `boolean` | `false` |
| `range?` | [`Range`](https://developer.mozilla.org/docs/Web/API/Range) | `undefined` |

#### Returns

[`HTMLSpanElement`](https://developer.mozilla.org/docs/Web/API/HTMLSpanElement)

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`marker`](../interfaces/types.ISelect.html#marker)

***

### restore()

**restore**(): `void`

Defined in: [src/core/selection/selection.ts:298](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L298)

Restores user selections using marker invisible elements in the DOM.

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`restore`](../interfaces/types.ISelect.html#restore)

***

### fakes()

**fakes**(): \[\] \| \[[`Node`](https://developer.mozilla.org/docs/Web/API/Node)\] \| \[[`Node`](https://developer.mozilla.org/docs/Web/API/Node), [`Node`](https://developer.mozilla.org/docs/Web/API/Node)\]

Defined in: [src/core/selection/selection.ts:370](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L370)

Inserts invisible fake nodes on the boundaries of the current selection
and returns the first pair as a restoration handle for all ranges. Unlike [Select.save](plugins_select.select.html#save) the selection stays valid while
the DOM around it is being modified. Restore it later with [Select.restoreFakes](plugins_select.select.html#restorefakes).

#### Returns

\[\] \| \[[`Node`](https://developer.mozilla.org/docs/Web/API/Node)\] \| \[[`Node`](https://developer.mozilla.org/docs/Web/API/Node), [`Node`](https://developer.mozilla.org/docs/Web/API/Node)\]

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`fakes`](../interfaces/types.ISelect.html#fakes)

***

### restoreFakes()

**restoreFakes**(`fakes`): `void`

Defined in: [src/core/selection/selection.ts:402](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L402)

Restore all ranges associated with the returned fake pair.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `fakes` | \[\] \| \[[`Node`](https://developer.mozilla.org/docs/Web/API/Node)\] \| \[[`Node`](https://developer.mozilla.org/docs/Web/API/Node), [`Node`](https://developer.mozilla.org/docs/Web/API/Node)\] |

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`restoreFakes`](../interfaces/types.ISelect.html#restorefakes)

***

### save()

**save**(`silent?`): [`MarkerInfo`](../interfaces/types.MarkerInfo.html)[]

Defined in: [src/core/selection/selection.ts:445](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L445)

Saves selections using marker invisible elements in the DOM.

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `silent` | `boolean` | `false` | Do not change current range |

#### Returns

[`MarkerInfo`](../interfaces/types.MarkerInfo.html)[]

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`save`](../interfaces/types.ISelect.html#save)

***

### focus()

**focus**(`options?`): `boolean`

Defined in: [src/core/selection/selection.ts:539](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L539)

Set focus in editor

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `options` | `FocusOptions` |

#### Returns

`boolean`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`focus`](../interfaces/types.ISelect.html#focus)

***

### isCollapsed()

**isCollapsed**(): `boolean`

Defined in: [src/core/selection/selection.ts:585](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L585)

Checks whether the current selection is something or just set the cursor is

#### Returns

`boolean`

true Selection does't have content

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`isCollapsed`](../interfaces/types.ISelect.html#iscollapsed)

***

### isFocused()

**isFocused**(): `boolean`

Defined in: [src/core/selection/selection.ts:600](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L600)

Checks whether the editor currently in focus

#### Returns

`boolean`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`isFocused`](../interfaces/types.ISelect.html#isfocused)

***

### current()

**current**(`checkChild?`): [`Nullable`](../modules/types.html#nullable)\<[`Node`](https://developer.mozilla.org/docs/Web/API/Node)\>

Defined in: [src/core/selection/selection.ts:611](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L611)

Returns the current element under the cursor inside editor

#### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `checkChild` | `boolean` | `true` |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<[`Node`](https://developer.mozilla.org/docs/Web/API/Node)\>

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`current`](../interfaces/types.ISelect.html#current)

***

### insertNode()

**insertNode**(`node`, `insertCursorAfter?`, `fireChange?`): `void`

Defined in: [src/core/selection/selection.ts:667](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L667)

Insert element in editor

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `node` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) | `undefined` | Node for insert |
| `insertCursorAfter` | `boolean` | `true` | After insert, cursor will move after element |
| `fireChange` | `boolean` | `true` | After insert, editor fire change event. You can prevent this behavior |

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`insertNode`](../interfaces/types.ISelect.html#insertnode)

***

### insertHTML()

**insertHTML**(`html`, `insertCursorAfter?`): `void`

Defined in: [src/core/selection/selection.ts:775](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L775)

Inserts in the current cursor position some HTML snippet

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `html` | `string` \| `number` \| [`Node`](https://developer.mozilla.org/docs/Web/API/Node) | `undefined` | HTML The text to be inserted into the document |
| `insertCursorAfter` | `boolean` | `true` | After insert, cursor will move after element |

#### Returns

`void`

#### Example

```javascript
parent.s.insertHTML('<img src="image.png"/>');
```

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`insertHTML`](../interfaces/types.ISelect.html#inserthtml)

***

### insertImage()

**insertImage**(`url`, `styles?`, `defaultWidth?`): `void`

Defined in: [src/core/selection/selection.ts:823](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L823)

Insert image in editor

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `url` | `string` \| [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement) | `undefined` | URL for image, or HTMLImageElement |
| `styles` | [`Nullable`](../modules/types.html#nullable)\<[`IDictionary`](../modules/types.html#idictionary)\<`string`\>\> | `null` | If specified, it will be applied <code>$(image).css(styles)</code> |
| `defaultWidth` | [`Nullable`](../modules/types.html#nullable)\<`string` \| `number`\> | `null` | If specified, it will be applied <code>css('width', defaultWidth)</code> |

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`insertImage`](../interfaces/types.ISelect.html#insertimage)

***

### eachSelection()

**eachSelection**(`callback`): `void`

Defined in: [src/core/selection/selection.ts:892](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L892)

Call callback for all selection node

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `callback` | (`current`) => `void` |

#### Returns

`void`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`eachSelection`](../interfaces/types.ISelect.html#eachselection)

***

### cursorInTheEdge()

**cursorInTheEdge**(`start`, `parentBlock`, `fake?`): [`Nullable`](../modules/types.html#nullable)\<`boolean`\>

Defined in: [src/core/selection/selection.ts:1024](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1024)

Checks if the cursor is at the end(start) block

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `start` | `boolean` | `undefined` | true - check whether the cursor is at the start block |
| `parentBlock` | [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement) | `undefined` | Find in this |
| `fake` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) \| `null` | `null` | Node for cursor position |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<`boolean`\>

true - the cursor is at the end(start) block, null - cursor somewhere outside

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`cursorInTheEdge`](../interfaces/types.ISelect.html#cursorintheedge)

***

### cursorOnTheLeft()

**cursorOnTheLeft**(`parentBlock`, `fake?`): [`Nullable`](../modules/types.html#nullable)\<`boolean`\>

Defined in: [src/core/selection/selection.ts:1096](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1096)

Wrapper for cursorInTheEdge

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `parentBlock` | [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement) |
| `fake?` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) \| `null` |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<`boolean`\>

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`cursorOnTheLeft`](../interfaces/types.ISelect.html#cursorontheleft)

***

### cursorOnTheRight()

**cursorOnTheRight**(`parentBlock`, `fake?`): [`Nullable`](../modules/types.html#nullable)\<`boolean`\>

Defined in: [src/core/selection/selection.ts:1106](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1106)

Wrapper for cursorInTheEdge

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `parentBlock` | [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement) |
| `fake?` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) \| `null` |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<`boolean`\>

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`cursorOnTheRight`](../interfaces/types.ISelect.html#cursorontheright)

***

### setCursorAfter()

**setCursorAfter**(`node`): [`Nullable`](../modules/types.html#nullable)\<[`Text`](https://developer.mozilla.org/docs/Web/API/Text)\>

Defined in: [src/core/selection/selection.ts:1118](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1118)

Set cursor after the node

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `node` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<[`Text`](https://developer.mozilla.org/docs/Web/API/Text)\>

fake invisible textnode. After insert it can be removed

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`setCursorAfter`](../interfaces/types.ISelect.html#setcursorafter)

***

### setCursorBefore()

**setCursorBefore**(`node`): [`Nullable`](../modules/types.html#nullable)\<[`Text`](https://developer.mozilla.org/docs/Web/API/Text)\>

Defined in: [src/core/selection/selection.ts:1127](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1127)

Set cursor before the node

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `node` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<[`Text`](https://developer.mozilla.org/docs/Web/API/Text)\>

fake invisible textnode. After insert it can be removed

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`setCursorBefore`](../interfaces/types.ISelect.html#setcursorbefore)

***

### setCursorIn()

**setCursorIn**(`node`, `inStart?`): [`Node`](https://developer.mozilla.org/docs/Web/API/Node)

Defined in: [src/core/selection/selection.ts:1173](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1173)

Set cursor in the node

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `node` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) | `undefined` | Node element |
| `inStart` | `boolean` | `false` | set cursor in start of element |

#### Returns

[`Node`](https://developer.mozilla.org/docs/Web/API/Node)

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`setCursorIn`](../interfaces/types.ISelect.html#setcursorin)

***

### selectRange()

**selectRange**(`range`, `focus?`): `this`

Defined in: [src/core/selection/selection.ts:1231](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1231)

Set range selection

#### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `range` | [`Range`](https://developer.mozilla.org/docs/Web/API/Range) | `undefined` |
| `focus` | `boolean` | `true` |

#### Returns

`this`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`selectRange`](../interfaces/types.ISelect.html#selectrange)

***

### select()

**select**(`node`, `inward?`): `this`

Defined in: [src/core/selection/selection.ts:1273](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1273)

Select node

#### Parameters

| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| `node` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) \| [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement) \| [`HTMLTableCellElement`](https://developer.mozilla.org/docs/Web/API/HTMLTableCellElement) \| [`HTMLTableElement`](https://developer.mozilla.org/docs/Web/API/HTMLTableElement) | `undefined` | Node element |
| `inward` | `boolean` | `false` | select all inside |

#### Returns

`this`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`select`](../interfaces/types.ISelect.html#select)

***

### wrapInTagGen()

**wrapInTagGen**(`fakes?`): [`Generator`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Generator)\<[`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement), `undefined`\>

Defined in: [src/core/selection/selection.ts:1508](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1508)

Wrap all selected fragments inside Tag or apply some callback

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `fakes?` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node)[] |

#### Returns

[`Generator`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Generator)\<[`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement), `undefined`\>

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`wrapInTagGen`](../interfaces/types.ISelect.html#wrapintaggen)

***

### wrapInTag()

**wrapInTag**(`tagOrCallback`): [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)[]

Defined in: [src/core/selection/selection.ts:1580](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1580)

Wrap all selected fragments inside Tag or apply some callback

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `tagOrCallback` | [`HTMLTagNames`](../modules/types.html#htmltagnames) \| ((`font`) => `any`) |

#### Returns

[`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)[]

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`wrapInTag`](../interfaces/types.ISelect.html#wrapintag)

***

### commitStyle()

**commitStyle**(`options`): `void`

Defined in: [src/core/selection/selection.ts:1634](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1634)

Apply some css rules for all selections. It method wraps selections in nodeName tag.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `options` | [`IStyleOptions`](../interfaces/types.IStyleOptions.html) |

#### Returns

`void`

#### Example

```js
const editor = Jodit.make('#editor');
editor.value = 'test';
editor.execCommand('selectall');

editor.s.commitStyle({
  style: {color: 'red'}
}) // will wrap `text` in `span` and add style `color:red`
editor.s.commitStyle({
  style: {color: 'red'}
}) // will remove `color:red` from `span`
```

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`commitStyle`](../interfaces/types.ISelect.html#commitstyle)

***

### splitSelection()

**splitSelection**(`currentBox`, `edge?`): [`Nullable`](../modules/types.html#nullable)\<[`Element`](https://developer.mozilla.org/docs/Web/API/Element)\>

Defined in: [src/core/selection/selection.ts:1645](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1645)

Split selection on two parts: left and right

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `currentBox` | [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement) |
| `edge?` | [`Node`](https://developer.mozilla.org/docs/Web/API/Node) |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<[`Element`](https://developer.mozilla.org/docs/Web/API/Element)\>

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`splitSelection`](../interfaces/types.ISelect.html#splitselection)

***

### expandSelection()

**expandSelection**(): `this`

Defined in: [src/core/selection/selection.ts:1765](https://github.com/xdan/jodit/blob/main/src/core/selection/selection.ts#L1765)

Expands the non-collapsed selection outward: boundaries positioned on the
edge of their parents are moved out of them (e.g. `<p><b>|test|</b></p>`
becomes `<p>|<b>test</b>|</p>`)

#### Returns

`this`

#### Implementation of

[`ISelect`](../interfaces/types.ISelect.html).[`expandSelection`](../interfaces/types.ISelect.html#expandselection)
