mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-01 05:16:10 +01:00
Merge decorations from multiple plugins (#2197)
* Merge decorations from multiple plugins Previously, `decorateNode` would search the plugin stack for the first `decorateNode` handler that returned a value. Now, it will call the `decorateNode` handler on every plugin in the stack and merge their results together. * Call List() to instantiate empty list instead of using new keyword * Fix linting errors and use Immutable's flatten() * Use boolean flatten() argument for clarity (shallow flatten)
This commit is contained in:
parent
bf9b03e634
commit
0f5d95e98e
@ -436,8 +436,10 @@ class ElementInterface {
|
||||
*/
|
||||
|
||||
getDecorations(stack) {
|
||||
const decorations = stack.find('decorateNode', this)
|
||||
const list = Decoration.createList(decorations || [])
|
||||
const allDecorations = stack
|
||||
.map('decorateNode', this)
|
||||
.map(decorations => Decoration.createList(decorations))
|
||||
const list = List(allDecorations).flatten(true)
|
||||
return list
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user