Merge branch 'master' into fix-install

This commit is contained in:
Kim Gardner
2018-04-02 13:37:12 -04:00
committed by GitHub
8 changed files with 67 additions and 16 deletions
@@ -35,12 +35,9 @@ class ExtendableTabPanelContainer extends React.Component {
createPluginTabFactory = (props = this.props) => el => {
return (
<ExtendableTab
tabId={el.type.talkPluginName}
key={el.type.talkPluginName}
>
<ExtendableTab tabId={el.key} key={el.key}>
{React.cloneElement(el, {
active: props.activeTab === el.type.talkPluginName,
active: props.activeTab === el.key,
})}
</ExtendableTab>
);
@@ -59,7 +56,7 @@ class ExtendableTabPanelContainer extends React.Component {
createPluginTabPane(el) {
return (
<TabPane tabId={el.type.talkPluginName} key={el.type.talkPluginName}>
<TabPane tabId={el.key} key={el.key}>
{el}
</TabPane>
);
+1
View File
@@ -136,6 +136,7 @@ export function t(key, ...replacements) {
replacements.forEach((str, i) => {
translation = translation.replace(new RegExp(`\\{${i}\\}`, 'g'), str);
});
return translation;
} else {
console.warn(`${lang}.${key} and en.${key} language key not set`);
+21 -2
View File
@@ -173,11 +173,30 @@ class PluginsService {
);
}
/**
* This adds a consistent keying for the slot elements.
* It uses the plugin name as the key. If the same plugin inserts
* multiple elements it will append `.${noOfOccurence}` to the
* key starting with the second element.
*/
const getKey = (() => {
const map = {};
return component => {
if (map[component.talkPluginName] === undefined) {
map[component.talkPluginName] = 0;
} else {
map[component.talkPluginName]++;
}
const i = map[component.talkPluginName];
return `${component.talkPluginName}${i > 0 ? `.${i}` : ''}`;
};
})();
return (size > 0 ? slots.slice(0, size) : slots)
.map((component, i) => ({
.map(component => ({
component,
disabled: isDisabled(component),
key: i,
key: getKey(component),
}))
.filter(o => !o.disabled)
.map(({ component, key }) =>