mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 02:19:52 +02: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:
committed by
Ian Storm Taylor
parent
bf9b03e634
commit
0f5d95e98e
@@ -436,8 +436,10 @@ class ElementInterface {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
getDecorations(stack) {
|
getDecorations(stack) {
|
||||||
const decorations = stack.find('decorateNode', this)
|
const allDecorations = stack
|
||||||
const list = Decoration.createList(decorations || [])
|
.map('decorateNode', this)
|
||||||
|
.map(decorations => Decoration.createList(decorations))
|
||||||
|
const list = List(allDecorations).flatten(true)
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user