2016-07-12 21:08:40 -07:00
# `Transform`
```js
import { Transform } from 'slate'
```
A transform allows you to define a series of changes you'd like to make to the current [`Document` ](./document.md ) or [`Selection` ](./selection.md ) in a [`State` ](./state.md ).
All changes are performed through `Transform` objects, so that a history of changes can be preserved for use in undo/redo operations, and to make collaborative editing possible.
Transform methods can either operate on the [`Document` ](./document.md ), the [`Selection` ](./selection.md ), or both at once.
2016-07-18 16:57:15 -07:00
- [Methods ](#methods )
- [`apply` ](#apply )
2016-07-24 17:59:26 -07:00
- [Current State Transforms ](#current-state-transforms )
2016-07-12 21:08:40 -07:00
- [`deleteBackward` ](#deletebackward )
- [`deleteForward` ](#deleteforward )
- [`delete` ](#delete )
2016-08-01 18:26:27 -07:00
- [`insertBlock` ](#insertblock )
2016-07-12 21:08:40 -07:00
- [`insertFragment` ](#insertfragment )
2016-08-01 18:26:27 -07:00
- [`insertInline` ](#insertinline )
2016-07-12 21:08:40 -07:00
- [`insertText` ](#inserttext )
2016-07-19 00:30:30 +05:30
- [`addMark` ](#addmark )
2016-07-12 21:08:40 -07:00
- [`setBlock` ](#setblock )
- [`setInline` ](#setinline )
- [`splitBlock` ](#splitblock )
- [`splitInline` ](#splitinline )
2016-07-19 00:30:30 +05:30
- [`removeMark` ](#removemark )
2016-07-21 11:59:21 -07:00
- [`toggleMark` ](#togglemark )
2016-07-12 21:08:40 -07:00
- [`unwrapBlock` ](#unwrapblock )
- [`unwrapInline` ](#unwrapinline )
- [`wrapBlock` ](#wrapblock )
- [`wrapInline` ](#wrapinline )
2016-08-09 18:11:21 +02:00
- [`wrapText` ](#wraptext )
2016-07-12 21:08:40 -07:00
- [Selection Transforms ](#selection-transforms )
- [`blur` ](#blur )
2016-07-12 21:14:21 -07:00
- [`collapseTo{Edge}Of` ](#collapsetoedgeof )
- [`collapseTo{Edge}Of{Direction}Block` ](#collapsetoedgeofdirectionblock )
- [`collapseTo{Edge}Of{Direction}Text` ](#collapsetoedgeofdirectiontext )
- [`collapseTo{Edge}` ](#collapsetoedge )
2016-07-12 21:08:40 -07:00
- [`extendTo{Edge}Of` ](#extendtoedgeof )
2016-07-12 21:14:21 -07:00
- [`extend{Direction}` ](#extenddirection )
2016-07-12 21:08:40 -07:00
- [`focus` ](#focus )
- [`moveToOffsets` ](#movetooffsets )
- [`moveToRangeOf` ](#movetorangeof )
- [`moveTo` ](#moveto )
2016-07-12 21:14:21 -07:00
- [`move{Direction}` ](#movedirection )
2016-07-24 17:59:26 -07:00
- [Node Transforms ](#node-transforms )
2016-09-13 11:49:59 -07:00
- [`addMarkByKey` ](#addmarkbykey )
- [`insertNodeByKey` ](#insertnodebykey )
- [`insertTextByKey` ](#inserttextbykey )
- [`moveNodeByKey` ](#movenodebykey )
- [`removeMarkByKey` ](#removemarkbykey )
- [`removeNodeByKey` ](#removenodebykey )
- [`removeTextByKey` ](#removetextbykey )
- [`setMarkByKey` ](#setmarkbykey )
- [`setNodeByKey` ](#setnodebykey )
- [`splitNodeByKey` ](#splitnodebykey )
2016-07-12 21:08:40 -07:00
- [Document Transforms ](#document-transforms )
- [`deleteAtRange` ](#deleteatrange )
- [`deleteBackwardAtRange` ](#deletebackwardatrange )
- [`deleteForwardAtRange` ](#deleteforwardatrange )
2016-08-01 18:26:27 -07:00
- [`insertBlockAtRange` ](#insertblockatrange )
2016-07-12 21:08:40 -07:00
- [`insertFragmentAtRange` ](#insertfragmentatrange )
2016-08-01 18:26:27 -07:00
- [`insertInlineAtRange` ](#insertinlineatrange )
2016-07-12 21:08:40 -07:00
- [`insertTextAtRange` ](#inserttextatrange )
2016-07-19 00:30:30 +05:30
- [`addMarkAtRange` ](#addmarkatrange )
2016-07-12 21:08:40 -07:00
- [`setBlockAtRange` ](#setblockatrange )
- [`setInlineAtRange` ](#setinlineatrange )
- [`splitBlockAtRange` ](#splitblockatrange )
- [`splitInlineAtRange` ](#splitinlineatrange )
2016-07-21 11:59:21 -07:00
- [`removeMarkAtRange` ](#removemarkatrange )
- [`toggleMarkAtRange` ](#togglemarkatrange )
2016-07-12 21:08:40 -07:00
- [`unwrapBlockAtRange` ](#unwrapblockatrange )
- [`unwrapInlineAtRange` ](#unwrapinlineatrange )
- [`wrapBlockAtRange` ](#wrapblockatrange )
- [`wrapInlineAtRange` ](#wrapinlineatrange )
2016-08-09 18:11:21 +02:00
- [`wrapTextAtRange` ](#wraptextatrange )
2016-07-18 16:57:15 -07:00
- [History Transforms ](#history-transforms )
- [`redo` ](#redo )
- [`undo` ](#undo )
2016-07-12 21:08:40 -07:00
2016-07-18 16:57:15 -07:00
## Methods
2016-07-12 21:08:40 -07:00
2016-07-18 16:57:15 -07:00
### `apply`
`apply(options: Object) => State`
2016-07-12 21:08:40 -07:00
2016-07-18 16:57:15 -07:00
Applies all of the current transform steps, returning the newly transformed [`State` ](./state.md ). An `options` object is optional, containing values of:
2016-07-12 21:08:40 -07:00
2016-10-04 21:19:31 +02:00
- `save: Boolean` — override the editor's built-in logic of whether to create a new snapshot in the history, that can be reverted to later.
2016-07-12 21:08:40 -07:00
2016-07-24 17:59:26 -07:00
## Current State Transforms
2016-07-12 21:08:40 -07:00
### `deleteBackward`
`deleteBackward(n: Number) => Transform`
Delete backward `n` characters at the current cursor. If the selection is expanded, this method is equivalent to a regular [`delete()` ](#delete ). `n` defaults to `1` .
### `deleteForward`
`deleteForward(n: Number) => Transform`
Delete forward `n` characters at the current cursor. If the selection is expanded, this method is equivalent to a regular [`delete()` ](#delete ). `n` defaults to `1` .
### `delete`
`delete() => Transform`
Delete everything in the current selection.
2016-08-01 18:53:05 -07:00
### `insertBlock`
2016-08-25 22:55:03 -04:00
`insertBlock(block: Block) => Transform` < br />
`insertBlock(properties: Object) => Transform` < br />
2016-08-01 18:53:05 -07:00
`insertBlock(type: String) => Transform`
Insert a new block at the same level as the current block, splitting the current block to make room if it is non-empty. If the selection is expanded, it will be deleted first.
2016-07-12 21:08:40 -07:00
### `insertFragment`
`insertFragment(fragment: Document) => Transform`
2016-08-07 13:13:06 -07:00
Insert a [`fragment` ](./document.md ) at the current selection. If the selection is expanded, it will be deleted first.
2016-07-12 21:08:40 -07:00
2016-08-01 18:53:05 -07:00
### `insertInline`
2016-08-25 22:55:03 -04:00
`insertInline(inline: Inline) => Transform` < br />
2016-08-01 18:53:05 -07:00
`insertInline(properties: Object) => Transform`
Insert a new inline at the current cursor position, splitting the text to make room if it is non-empty. If the selection is expanded, it will be deleted first.
2016-07-12 21:08:40 -07:00
### `insertText`
`insertText(text: String) => Transform`
Insert a string of `text` at the current selection. If the selection is expanded, it will be deleted first.
2016-07-19 00:30:30 +05:30
### `addMark`
2016-08-25 22:55:03 -04:00
`addMark(mark: Mark) => Transform` < br />
`addMark(properties: Object) => Transform` < br />
2016-07-19 00:30:30 +05:30
`addMark(type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-21 11:59:21 -07:00
Add a [`mark` ](./mark.md ) to the characters in the current selection. For convenience, you can pass a `type` string or `properties` object to implicitly create a [`Mark` ](./mark.md ) of that type.
2016-07-12 21:08:40 -07:00
### `setBlock`
2016-08-25 22:55:03 -04:00
`setBlock(properties: Object) => Transform` < br />
2016-07-12 21:08:40 -07:00
`setBlock(type: String) => Transform`
Set the `properties` of the [`Block` ](./block.md ) in the current selection. For convenience, you can pass a `type` string to set the blocks's type only.
### `setInline`
2016-08-25 22:55:03 -04:00
`setInline(properties: Object) => Transform` < br />
2016-07-12 21:08:40 -07:00
`setInline(type: String) => Transform`
Set the `properties` of the [`Inline` ](./inline.md ) nodes in the current selection. For convenience, you can pass a `type` string to set the inline's type only.
### `splitBlock`
`splitBlock(depth: Number) => Transform`
Split the [`Block` ](./block.md ) in the current selection by `depth` levels. If the selection is expanded, it will be deleted first. `depth` defaults to `1` .
### `splitInline`
`splitInline(depth: Number) => Transform`
Split the [`Inline` ](./inline.md ) node in the current selection by `depth` levels. If the selection is expanded, it will be deleted first. `depth` defaults to `Infinity` .
2016-07-19 00:30:30 +05:30
### `removeMark`
2016-08-25 22:55:03 -04:00
`removeMark(mark: Mark) => Transform` < br />
`removeMark(properties: Object) => Transform` < br />
2016-07-19 00:30:30 +05:30
`removeMark(type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-21 11:59:21 -07:00
Remove a [`mark` ](./mark.md ) from the characters in the current selection. For convenience, you can pass a `type` string or `properties` object to implicitly create a [`Mark` ](./mark.md ) of that type.
### `toggleMark`
2016-08-25 22:55:03 -04:00
`toggleMark(mark: Mark) => Transform` < br />
`toggleMark(properties: Object) => Transform` < br />
2016-07-21 11:59:21 -07:00
`toggleMark(type: String) => Transform`
Add or remove a [`mark` ](./mark.md ) from the characters in the current selection, depending on it already exists on any or not. For convenience, you can pass a `type` string or `properties` object to implicitly create a [`Mark` ](./mark.md ) of that type.
2016-07-12 21:08:40 -07:00
### `unwrapBlock`
`unwrapBlock([type: String], [data: Data]) => Transform`
Unwrap all [`Block` ](./block.md ) nodes in the current selection that match a `type` and/or `data` .
### `unwrapInline`
`unwrapInline([type: String], [data: Data]) => Transform`
Unwrap all [`Inline` ](./inline.md ) nodes in the current selection that match a `type` and/or `data` .
### `wrapBlock`
`wrapBlock(type: String, [data: Data]) => Transform`
Wrap the [`Block` ](./block.md ) nodes in the current selection with a new [`Block` ](./block.md ) node of `type` , with optional `data` .
### `wrapInline`
`wrapInline(type: String, [data: Data]) => Transform`
Wrap the [`Inline` ](./inline.md ) nodes in the current selection with a new [`Inline` ](./inline.md ) node of `type` , with optional `data` .
2016-08-09 18:11:21 +02:00
### `wrapText`
2016-08-09 09:32:46 -07:00
`wrapText(prefix: String, [suffix: String]) => Transform`
2016-08-09 18:11:21 +02:00
2016-08-09 09:32:46 -07:00
Surround the text in the current selection with `prefix` and `suffix` strings. If the `suffix` is ommitted, the `prefix` will be used instead.
2016-08-09 18:11:21 +02:00
2016-07-12 21:08:40 -07:00
## Selection Transforms
### `blur`
`blur() => Transform`
Blur the current selection.
2016-07-12 21:14:21 -07:00
### `collapseTo{Edge}`
`collapseTo{Edge}() => Transform`
Collapse the current selection to its `{Edge}` . Where `{Edge}` is either `Anchor` , `Focus` , `Start` or `End` .
### `collapseTo{Edge}Of`
`collapseTo{Edge}Of(node: Node) => Transform`
Collapse the current selection to the `{Edge}` of `node` . Where `{Edge}` is either `Start` or `End` .
### `collapseTo{Edge}Of{Direction}Block`
`collapseTo{Edge}Of{Direction}Block() => Transform`
Collapse the current selection to the `{Edge}` of the next [`Block` ](./block.md ) node in `{Direction}` . Where `{Edge}` is either `{Start}` or `{End}` and `{Direction}` is either `Next` or `Previous` .
### `collapseTo{Edge}Of{Direction}Text`
`collapseTo{Edge}Of{Direction}Text() => Transform`
Collapse the current selection to the `{Edge}` of the next [`Text` ](./text.md ) node in `{Direction}` . Where `{Edge}` is either `{Start}` or `{End}` and `{Direction}` is either `Next` or `Previous` .
2016-07-12 21:08:40 -07:00
### `extend{Direction}`
`extend{Direction}(n: Number) => Transform`
Extend the current selection's points `n` characters in `{Direction}` . Where `{Direction}` is either `Backward` or `Forward` .
### `extendTo{Edge}Of`
`extendTo{Edge}Of(node: Node) => Transform`
Extend the current selection to the `{Edge}` of a `node` . Where `{Edge}` is either `Start` or `End` .
### `focus`
`focus() => Transform`
Focus the current selection.
### `move{Direction}`
`move{Direction}(n: Number) => Transform`
Move the current selection's points `n` characters in `{Direction}` . Where `{Direction}` is either `Backward` or `Forward` .
### `moveToOffsets`
`moveToOffsets(anchorOffset: Number, focusOffset: Number) => Transform`
Move the current selection's offsets to a new `anchorOffset` and `focusOffset` .
### `moveToRangeOf`
`moveToRangeOf(node: Node) => Transform`
Move the current selection's anchor point to the start of a `node` and its focus point to the end of the `node` .
### `moveTo`
2016-07-20 14:50:55 -07:00
`moveTo(properties: Selection || Object) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-20 14:50:55 -07:00
Move the current selection to a selection with merged `properties` . The `properties` can either be a [`Selection` ](./selection.md ) object or a plain Javascript object of selection properties.
2016-07-12 21:08:40 -07:00
2016-07-24 17:59:26 -07:00
## Node Transforms
2016-09-13 11:49:59 -07:00
### `addMarkByKey`
`addMarkByKey(key: String, offset: Number, length: Number, mark: Mark) => Transform`
Add a `mark` to `length` characters starting at an `offset` in a [`Node` ](./node.md ) by its `key` .
### `insertNodeByKey`
`insertNodeByKey(key: String, index: Number, node: Node) => Transform`
Insert a `node` at `index` inside a parent [`Node` ](./node.md ) by its `key` .
### `insertTextByKey`
`insertTextByKey(key: String, offset: Number, text: String, [marks: Set]) => Transform`
Insert `text` at an `offset` in a [`Node` ](./node.md ) with optional `marks` .
### `moveNodeByKey`
`moveNodeByKey(key: String, newKey: String, newIndex: Number) => Transform`
Move a [`Node` ](./node.md ) by its `key` to a new parent node with its `newKey` and at a `newIndex` .
### `removeMarkByKey`
`removeMarkByKey(key: String, offset: Number, length: Number, mark: Mark) => Transform`
Remove a `mark` from `length` characters starting at an `offset` in a [`Node` ](./node.md ) by its `key` .
2016-07-24 18:57:09 -07:00
### `removeNodeByKey`
`removeNodeByKey(key: String) => Transform`
Remove a [`Node` ](./node.md ) from the document by its `key` .
2016-09-13 11:49:59 -07:00
### `removeTextByKey`
`removeTextByKey(key: String, offset: Number, length: Number) => Transform`
Remove `length` characters of text starting at an `offset` in a [`Node` ](./node.md ) by its `key` .
### `setMarkByKey`
`setMarkByKey(key: String, offset: Number, length: Number, mark: Mark, properties: Object) => Transform`
Set a dictionary of `properties` on a [`mark` ](./mark.md ) on a [`Node` ](./node.md ) by its `key` .
2016-07-24 17:59:26 -07:00
### `setNodeByKey`
2016-08-25 22:55:03 -04:00
`setNodeByKey(key: String, properties: Object) => Transform` < br />
2016-07-24 17:59:26 -07:00
`setNodeByKey(key: String, type: String) => Transform`
2016-07-24 18:57:09 -07:00
Set a dictionary of `properties` on a [`Node` ](./node.md ) by its `key` . For convenience, you can pass a `type` string or `properties` object.
2016-07-24 17:59:26 -07:00
2016-09-13 11:49:59 -07:00
### `splitNodeByKey`
`splitNodeByKey(key: String, offset: Number) => Transform`
Split a node by its `key` at an `offset` .
2016-07-12 21:08:40 -07:00
## Document Transforms
### `deleteBackwardAtRange`
`deleteBackwardAtRange(range: Selection, n: Number) => Transform`
Delete backward `n` characters at a `range` . If the `range` is expanded, this method is equivalent to a regular [`delete()` ](#delete ). `n` defaults to `1` .
### `deleteForwardAtRange`
`deleteForwardAtRange(range: Selection, n: Number) => Transform`
Delete forward `n` characters at a `range` . If the `range` is expanded, this method is equivalent to a regular [`delete()` ](#delete ). `n` defaults to `1` .
### `deleteAtRange`
`deleteAtRange(range: Selection, ) => Transform`
Delete everything in a `range` .
2016-08-01 18:53:05 -07:00
### `insertBlockAtRange`
2016-08-25 22:55:03 -04:00
`insertBlockAtRange(range: Selection, block: Block) => Transform` < br />
`insertBlockAtRange(range: Selection, properties: Object) => Transform` < br />
2016-08-01 18:53:05 -07:00
`insertBlockAtRange(range: Selection, type: String) => Transform`
Insert a new block at the same level as the leaf block at a `range` , splitting the current block to make room if it is non-empty. If the selection is expanded, it will be deleted first.
2016-07-12 21:08:40 -07:00
### `insertFragmentAtRange`
`insertFragmentAtRange(range: Selection, fragment: Document) => Transform`
2016-08-07 13:13:06 -07:00
Insert a [`fragment` ](./document.md ) at a `range` . If the selection is expanded, it will be deleted first.
2016-07-12 21:08:40 -07:00
2016-08-01 18:53:05 -07:00
### `insertInlineAtRange`
2016-08-25 22:55:03 -04:00
`insertInlineAtRange(range: Selection, inline: Inline) => Transform` < br />
2016-08-01 18:53:05 -07:00
`insertInlineAtRange(range: Selection, properties: Object) => Transform`
Insert a new inline at a `range` , splitting the text to make room if it is non-empty. If the selection is expanded, it will be deleted first.
2016-07-12 21:08:40 -07:00
### `insertTextAtRange`
`insertTextAtRange(range: Selection, text: String) => Transform`
Insert a string of `text` at a `range` . If the selection is expanded, it will be deleted first.
2016-07-19 00:30:30 +05:30
### `addMarkAtRange`
2016-08-25 22:55:03 -04:00
`addMarkAtRange(range: Selection, mark: Mark) => Transform` < br />
`addMarkAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-21 11:59:21 -07:00
`addMarkAtRange(range: Selection, type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-21 11:59:21 -07:00
Add a [`mark` ](./mark.md ) to the characters in a `range` . For convenience, you can pass a `type` string or `properties` object to implicitly create a [`Mark` ](./mark.md ) of that type.
2016-07-12 21:08:40 -07:00
### `setBlockAtRange`
2016-08-25 22:55:03 -04:00
`setBlockAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-12 21:08:40 -07:00
`setBlock(range: Selection, type: String) => Transform`
Set the `properties` of the [`Block` ](./block.md ) in a `range` . For convenience, you can pass a `type` string to set the blocks's type only.
### `setInlineAtRange`
2016-08-25 22:55:03 -04:00
`setInlineAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-12 21:08:40 -07:00
`setInline(range: Selection, type: String) => Transform`
Set the `properties` of the [`Inline` ](./inline.md ) nodes in a `range` . For convenience, you can pass a `type` string to set the inline's type only.
### `splitBlockAtRange`
`splitBlockAtRange(range: Selection, depth: Number) => Transform`
Split the [`Block` ](./block.md ) in a `range` by `depth` levels. If the selection is expanded, it will be deleted first. `depth` defaults to `1` .
### `splitInlineAtRange`
`splitInlineAtRange(range: Selection, depth: Number) => Transform`
Split the [`Inline` ](./inline.md ) node in a `range` by `depth` levels. If the selection is expanded, it will be deleted first. `depth` defaults to `Infinity` .
2016-07-19 00:30:30 +05:30
### `removeMarkAtRange`
2016-08-25 22:55:03 -04:00
`removeMarkAtRange(range: Selection, mark: Mark) => Transform` < br />
`removeMarkAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-21 11:59:21 -07:00
`removeMarkAtRange(range: Selection, type: String) => Transform`
Remove a [`mark` ](./mark.md ) from the characters in a `range` . For convenience, you can pass a `type` string or `properties` object to implicitly create a [`Mark` ](./mark.md ) of that type.
### `toggleMarkAtRange`
2016-08-25 22:55:03 -04:00
`toggleMarkAtRange(range: Selection, mark: Mark) => Transform` < br />
`toggleMarkAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-21 11:59:21 -07:00
`toggleMarkAtRange(range: Selection, type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-21 11:59:21 -07:00
Add or remove a [`mark` ](./mark.md ) from the characters in a `range` , depending on whether any of them already have the mark. For convenience, you can pass a `type` string or `properties` object to implicitly create a [`Mark` ](./mark.md ) of that type.
2016-07-12 21:08:40 -07:00
### `unwrapBlockAtRange`
2016-08-25 22:55:03 -04:00
`unwrapBlockAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-28 16:35:47 -07:00
`unwrapBlockAtRange(range: Selection, type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-28 16:24:24 -07:00
Unwrap all [`Block` ](./block.md ) nodes in a `range` that match `properties` . For convenience, you can pass a `type` string or `properties` object.
2016-07-12 21:08:40 -07:00
### `unwrapInlineAtRange`
2016-08-25 22:55:03 -04:00
`unwrapInlineAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-28 16:35:47 -07:00
`unwrapInlineAtRange(range: Selection, type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-28 16:24:24 -07:00
Unwrap all [`Inline` ](./inline.md ) nodes in a `range` that match `properties` . For convenience, you can pass a `type` string or `properties` object.
2016-07-12 21:08:40 -07:00
### `wrapBlockAtRange`
2016-08-25 22:55:03 -04:00
`wrapBlockAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-28 16:35:47 -07:00
`wrapBlockAtRange(range: Selection, type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-28 16:24:24 -07:00
Wrap the [`Block` ](./block.md ) nodes in a `range` with a new [`Block` ](./block.md ) node with `properties` . For convenience, you can pass a `type` string or `properties` object.
2016-07-12 21:08:40 -07:00
### `wrapInlineAtRange`
2016-08-25 22:55:03 -04:00
`wrapInlineAtRange(range: Selection, properties: Object) => Transform` < br />
2016-07-28 16:35:47 -07:00
`wrapInlineAtRange(range: Selection, type: String) => Transform`
2016-07-12 21:08:40 -07:00
2016-07-28 16:24:24 -07:00
Wrap the [`Inline` ](./inline.md ) nodes in a `range` with a new [`Inline` ](./inline.md ) node with `properties` . For convenience, you can pass a `type` string or `properties` object.
2016-07-12 21:08:40 -07:00
2016-08-09 18:11:21 +02:00
### `wrapTextAtRange`
2016-08-09 09:32:46 -07:00
`wrapTextAtRange(range: Selection, prefix: String, [suffix: String]) => Transform`
2016-08-09 18:11:21 +02:00
2016-08-09 09:32:46 -07:00
Surround the text in a `range` with `prefix` and `suffix` strings. If the `suffix` is ommitted, the `prefix` will be used instead.
2016-07-12 21:08:40 -07:00
2016-09-13 11:49:59 -07:00
2016-07-18 16:57:15 -07:00
## History Transforms
### `redo`
2016-09-13 12:38:14 -07:00
`redo() => Transform`
2016-07-18 16:57:15 -07:00
Move forward one step in the history.
### `undo`
2016-09-13 12:38:14 -07:00
`undo() => Transform`
2016-07-18 16:57:15 -07:00
Move backward one step in the history.