mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-24 01:02:31 +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
|
||||
* syntax. A custom transform is a JavaScript function that takes a Transform
|
||||
* 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()
|
||||
* ```
|
||||
* Call a `fn` as if it was a core transform. This is a convenience method to
|
||||
* make using non-core transforms easier to read and chain.
|
||||
*
|
||||
* @param {Transform} transform
|
||||
* @param {Function} fn
|
||||
* @param {Mixed} ...args
|
||||
*/
|
||||
|
||||
export default function call(transform, fn, ...args) {
|
||||
fn(transform, ...args)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user