mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-24 09:13:24 +01:00
fix style
This commit is contained in:
parent
479ab24320
commit
6822e8b5ec
@ -1,31 +1,14 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to call a custom transform function using easier to read
|
* Call a `fn` as if it was a core transform. This is a convenience method to
|
||||||
* syntax. A custom transform is a JavaScript function that takes a Transform
|
* make using non-core transforms easier to read and chain.
|
||||||
* instance as the first argument. Any additional arguments passed to the `call`
|
|
||||||
* method after the Transform instance are passed to the custom transform function.
|
|
||||||
*
|
|
||||||
* These are equivalent but the second is easier to read:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* const transform = state.transform()
|
|
||||||
* myTransform(transform, 0, 1)
|
|
||||||
* return transform.insertText('hello').apply()
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* and
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* state.transform()
|
|
||||||
* .call(myTransform, 0, 1)
|
|
||||||
* .insertText('hello')
|
|
||||||
* .apply()
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @param {Transform} transform
|
* @param {Transform} transform
|
||||||
|
* @param {Function} fn
|
||||||
* @param {Mixed} ...args
|
* @param {Mixed} ...args
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default function call(transform, fn, ...args) {
|
export default function call(transform, fn, ...args) {
|
||||||
fn(transform, ...args)
|
fn(transform, ...args)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user