mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-25 08:11:53 +02:00
Fixed syntax mismatch at normalize method (#1737)
`switch` operator was wrapped around `case` statements
This commit is contained in:
committed by
Ian Storm Taylor
parent
950c5a92e1
commit
d2eb362234
@@ -168,6 +168,7 @@ Will validate a node's marks. The `marks` definitions can declare a list of mark
|
||||
```js
|
||||
{
|
||||
normalize: (change, violation, context) => {
|
||||
switch (violation) {
|
||||
case 'child_object_invalid':
|
||||
change.wrapBlockByKey(context.child.key, 'paragraph')
|
||||
return
|
||||
@@ -176,6 +177,7 @@ Will validate a node's marks. The `marks` definitions can declare a list of mark
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A function that can be provided to override the default behavior in the case of a rule being invalid. By default Slate will do what it can, but since it doesn't know much about your schema, it will often remove invalid nodes. If you want to override this behavior, and "fix" the node instead of removing it, pass a custom `normalize` function.
|
||||
|
Reference in New Issue
Block a user