1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 18:39:51 +02:00

Clarify semantics of return from deserialize (#2665)

This can trip folks up who are using compile-to-JS languages (ClojureScript in my case), where return semantics may be different.
This commit is contained in:
Tom Locke
2019-03-26 14:29:41 +00:00
committed by Ian Storm Taylor
parent edbafa6fcb
commit 2380aa094f

View File

@@ -81,7 +81,7 @@ Each rule must define two properties:
`rule.deserialize(el: Element, next: Function) => Object || Void`
The `deserialize` function receives a DOM element and should return a plain JavaScript object representing the deserialized value, or nothing if the rule in question doesn't know how to deserialize the object, in which case the next rule in the stack will be attempted.
The `deserialize` function receives a DOM element and should return a plain JavaScript object representing the deserialized value, or nothing if the rule in question doesn't know how to deserialize the object, in which case the next rule in the stack will be attempted. Returning `null` will halt the rule chain and add nothing. To delegate to the next rule, the return value must be `undefined`.
The object should be one of: