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

Add transform "unwrapBlockByKey" and "unwrapInlineByKey" (#390)

* Add transform .unwrapInlineByKey with test and documentation

* Add transform .unwrapBlockByKey with test and documentation

* add failing test for unwrap limited to a range

* Improve creation of selection in unwrap[Inline|Block]ByKey

* Adapt unwrapInlineAtRange to take range in consideration

* Add test to unwrapInline only one in the document
This commit is contained in:
Samy Pessé
2016-10-25 21:04:12 +02:00
committed by Ian Storm Taylor
parent f1a5d6f3b4
commit f380943926
19 changed files with 223 additions and 13 deletions

View File

@@ -57,6 +57,8 @@ Transform methods can either operate on the [`Document`](./document.md), the [`S
- [`setMarkByKey`](#setmarkbykey)
- [`setNodeByKey`](#setnodebykey)
- [`splitNodeByKey`](#splitnodebykey)
- [`unwrapInlineByKey`](#unwrapinlinebykey)
- [`unwrapBlockByKey`](#unwrapblockbykey)
- [Document Transforms](#document-transforms)
- [`deleteAtRange`](#deleteatrange)
- [`deleteBackwardAtRange`](#deletebackwardatrange)
@@ -317,6 +319,17 @@ Set a dictionary of `properties` on a [`Node`](./node.md) by its `key`. For conv
Split a node by its `key` at an `offset`.
### `unwrapInlineByKey`
`unwrapInlineByKey(key: String, properties: Object) => Transform` <br/>
`unwrapInlineByKey(key: String, type: String) => Transform`
Unwrap all inner content of an [`Inline`](./inline.md) node that match `properties`. For convenience, you can pass a `type` string or `properties` object.
### `unwrapBlockByKey`
`unwrapBlockByKey(key: String, properties: Object) => Transform` <br/>
`unwrapBlockByKey(key: String, type: String) => Transform`
Unwrap all inner content of a [`Block`](./block.md) node that match `properties`. For convenience, you can pass a `type` string or `properties` object.
## Document Transforms