diff --git a/client/coral-embed-stream/src/tabs/stream/components/Comment.js b/client/coral-embed-stream/src/tabs/stream/components/Comment.js index c0abb7d92..f0dcc1017 100644 --- a/client/coral-embed-stream/src/tabs/stream/components/Comment.js +++ b/client/coral-embed-stream/src/tabs/stream/components/Comment.js @@ -604,7 +604,7 @@ export default class Comment extends React.Component { defaultComponent={CommentContent} {...slotProps} queryData={queryData} - singleSlot + slotSize={1} /> )} diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 516e23e50..6287358bb 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -38,7 +38,7 @@ class Slot extends React.Component { 'inline', 'className', 'reduxState', - 'singleSlot', + 'slotSize', 'defaultComponent_', 'queryData', 'childFactory', @@ -47,7 +47,7 @@ class Slot extends React.Component { } getChildren(props = this.props) { - const { singleSlot = false } = props; + const { slotSize = 0 } = props; const { plugins } = this.context; return plugins.getSlotElements( @@ -55,7 +55,7 @@ class Slot extends React.Component { props.reduxState, this.getSlotProps(props), props.queryData, - { singleSlot } + { slotSize } ); } @@ -113,9 +113,9 @@ Slot.propTypes = { defaultComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), /** - * When true, only the first plugin will take the slot. + * Specifies the number of children that can fill the slot. */ - singleSlot: PropTypes.bool, + slotSize: PropTypes.number, /** * You may specify the component to use as the root wrapper. diff --git a/client/coral-framework/services/plugins.js b/client/coral-framework/services/plugins.js index 03e3177e0..21605e684 100644 --- a/client/coral-framework/services/plugins.js +++ b/client/coral-framework/services/plugins.js @@ -94,19 +94,12 @@ class PluginsService { }; } - getSlotElement(slot, reduxState, props = {}, queryData = {}, options = {}) { - return this.getSlotElements(slot, reduxState, props, queryData, { - ...options, - singleSlot: true, - }); - } - /** * Returns React Elements for given slot. */ getSlotElements(slot, reduxState, props = {}, queryData = {}, options = {}) { const pluginConfig = get(reduxState, 'config.plugin_config') || emptyConfig; - const { singleSlot = false } = options; + const { slotSize = 0 } = options; const isDisabled = component => { if ( @@ -143,7 +136,7 @@ class PluginsService { .map(o => o.module.slots[slot]) ); - return (singleSlot ? slots.slice(0, 1) : slots) + return (slotSize > 0 ? slots.slice(0, slotSize) : slots) .map((component, i) => ({ component, disabled: isDisabled(component),