1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-03 04:02:33 +02:00

add wrapTextAtRange tests, cleanup wrapText style and backwards handling

This commit is contained in:
Ian Storm Taylor
2016-08-09 09:32:46 -07:00
parent 17f703cecb
commit 90d4eced95
33 changed files with 395 additions and 27 deletions

View File

@@ -188,9 +188,9 @@ Wrap the [`Block`](./block.md) nodes in the current selection with a new [`Block
Wrap the [`Inline`](./inline.md) nodes in the current selection with a new [`Inline`](./inline.md) node of `type`, with optional `data`.
### `wrapText`
`wrapText(before: String, after: String) => Transform`
`wrapText(prefix: String, [suffix: String]) => Transform`
Surround the text in the current selection.
Surround the text in the current selection with `prefix` and `suffix` strings. If the `suffix` is ommitted, the `prefix` will be used instead.
## Selection Transforms
@@ -378,9 +378,9 @@ Wrap the [`Block`](./block.md) nodes in a `range` with a new [`Block`](./block.m
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.
### `wrapTextAtRange`
`wrapTextAtRange(range: Selection, prefix: String, suffix: String) => Transform`
`wrapTextAtRange(range: Selection, prefix: String, [suffix: String]) => Transform`
Surround the text in a `range`.
Surround the text in a `range` with `prefix` and `suffix` strings. If the `suffix` is ommitted, the `prefix` will be used instead.
## History Transforms