mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 19:22:35 +02:00
Remove transform "unwrapInlineByKey" done by another PR
This commit is contained in:
@@ -57,7 +57,6 @@ Transform methods can either operate on the [`Document`](./document.md), the [`S
|
|||||||
- [`setMarkByKey`](#setmarkbykey)
|
- [`setMarkByKey`](#setmarkbykey)
|
||||||
- [`setNodeByKey`](#setnodebykey)
|
- [`setNodeByKey`](#setnodebykey)
|
||||||
- [`splitNodeByKey`](#splitnodebykey)
|
- [`splitNodeByKey`](#splitnodebykey)
|
||||||
- [`unwrapInlineByKey`](#unwrapinlinebykey)
|
|
||||||
- [Document Transforms](#document-transforms)
|
- [Document Transforms](#document-transforms)
|
||||||
- [`deleteAtRange`](#deleteatrange)
|
- [`deleteAtRange`](#deleteatrange)
|
||||||
- [`deleteBackwardAtRange`](#deletebackwardatrange)
|
- [`deleteBackwardAtRange`](#deletebackwardatrange)
|
||||||
@@ -318,12 +317,6 @@ Set a dictionary of `properties` on a [`Node`](./node.md) by its `key`. For conv
|
|||||||
|
|
||||||
Split a node by its `key` at an `offset`.
|
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.
|
|
||||||
|
|
||||||
## Document Transforms
|
## Document Transforms
|
||||||
|
|
||||||
### `deleteBackwardAtRange`
|
### `deleteBackwardAtRange`
|
||||||
|
@@ -241,21 +241,3 @@ export function splitNodeByKey(transform, key, offset) {
|
|||||||
|
|
||||||
return transform.splitNodeOperation(path, offset)
|
return transform.splitNodeOperation(path, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Unwrap content from an inline parent with `properties`.
|
|
||||||
*
|
|
||||||
* @param {Transform} transform
|
|
||||||
* @param {String} key
|
|
||||||
* @param {Object or String} properties
|
|
||||||
* @return {Transform}
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function unwrapInlineByKey(transform, key, properties) {
|
|
||||||
const { state } = transform
|
|
||||||
const { document, selection } = state
|
|
||||||
const node = document.assertDescendant(key)
|
|
||||||
const range = selection.moveToRangeOf(node)
|
|
||||||
|
|
||||||
return transform.unwrapInline(range, properties)
|
|
||||||
}
|
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
import assert from 'assert'
|
|
||||||
|
|
||||||
export default function (state) {
|
|
||||||
const { document, selection } = state
|
|
||||||
const inline = document.assertPath([0, 1])
|
|
||||||
|
|
||||||
const next = state
|
|
||||||
.transform()
|
|
||||||
.unwrapInlineByKey(inline.key, 'hashtag')
|
|
||||||
.apply()
|
|
||||||
|
|
||||||
return next
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
nodes:
|
|
||||||
- kind: block
|
|
||||||
type: paragraph
|
|
||||||
nodes:
|
|
||||||
- kind: text
|
|
||||||
text: w
|
|
||||||
- kind: inline
|
|
||||||
type: hashtag
|
|
||||||
nodes:
|
|
||||||
- kind: text
|
|
||||||
text: or
|
|
||||||
- kind: text
|
|
||||||
text: d
|
|
@@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
nodes:
|
|
||||||
- kind: block
|
|
||||||
type: paragraph
|
|
||||||
nodes:
|
|
||||||
- kind: text
|
|
||||||
text: word
|
|
Reference in New Issue
Block a user