@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
32 lines • 1.59 kB
JavaScript
import * as tslib_1 from "tslib";
import * as React from 'react';
import styled from 'styled-components';
// tslint:disable-next-line:variable-name
var PluginsComponentsWrapper = (_a = ["\n display: flex;\n"], _a.raw = ["\n display: flex;\n"], styled.div(_a));
var PluginSlot = (function (_super) {
tslib_1.__extends(PluginSlot, _super);
function PluginSlot() {
return _super !== null && _super.apply(this, arguments) || this;
}
PluginSlot.prototype.shouldComponentUpdate = function (nextProps) {
var _a = this.props, editorView = _a.editorView, items = _a.items, providerFactory = _a.providerFactory, eventDispatcher = _a.eventDispatcher;
return !(nextProps.editorView === editorView
&& nextProps.items === items
&& nextProps.providerFactory === providerFactory
&& nextProps.eventDispatcher === eventDispatcher);
};
PluginSlot.prototype.render = function () {
var _a = this.props, items = _a.items, editorView = _a.editorView, eventDispatcher = _a.eventDispatcher, providerFactory = _a.providerFactory, appearance = _a.appearance;
if (!items) {
return null;
}
return (React.createElement(PluginsComponentsWrapper, null, items.map(function (component, key) {
var element = component(editorView, eventDispatcher, providerFactory, appearance);
return element && React.cloneElement(element, { key: key });
})));
};
return PluginSlot;
}(React.Component));
export default PluginSlot;
var _a;
//# sourceMappingURL=index.js.map