'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var React = require('react'); var React__default = _interopDefault(React); require('react-dom'); var styleInject_es = require('../style-inject.es-dcee06b6.js'); var defineProperty = require('../defineProperty-ba7cd53d.js'); require('../index-1143667e.js'); require('../slicedToArray-172f4624.js'); var BraftEditor = require('../BraftEditor/index.js'); require('react-dom/server'); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty._defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var ControlsToolBar = function ControlsToolBar(props) { var editorState = props.editorState, setEditorState = props.setEditorState, _props$toolList = props.toolList, toolList = _props$toolList === void 0 ? [] : _props$toolList, _props$injectIconWrap = props.injectIconWrapStyle, injectIconWrapStyle = _props$injectIconWrap === void 0 ? {} : _props$injectIconWrap, _props$injectIconStyl = props.injectIconStyle, injectIconStyle = _props$injectIconStyl === void 0 ? {} : _props$injectIconStyl, _props$injectIconText = props.injectIconTextStyle, injectIconTextStyle = _props$injectIconText === void 0 ? {} : _props$injectIconText; var IconWrapStyle = _objectSpread({ display: 'flex', alignItems: 'center', cursor: "pointer", textAlign: "center", minWidth: "42px" }, injectIconWrapStyle); var IconStyle = _objectSpread({ fontSize: "21px" }, injectIconStyle); var IconTextStyle = _objectSpread({ margin: "0 4px" }, injectIconTextStyle); if (toolList.length < 1) { return null; } return React__default.createElement(React__default.Fragment, null, toolList.map(function (i) { var innerIcon = React__default.createElement("i", { className: i.iconClass, style: IconStyle }); var innerText = i.text ? React__default.createElement("span", { style: IconTextStyle }, i.text) : null; var divWrapStyle = _objectSpread({ color: i.color }, IconWrapStyle); var wrapperDom = React__default.createElement("div", { key: "toolList_".concat(i.key), style: divWrapStyle, onClick: i.onClick }, innerIcon, innerText); if (i.render) { return i.render(i, innerIcon, innerText, divWrapStyle); } return wrapperDom; })); }; var css = ".index_bottomToolBarWrapper__3mYXO {\n display: flex;\n}\n"; var styles = { "bottomToolBarWrapper": "index_bottomToolBarWrapper__3mYXO" }; styleInject_es.styleInject(css); var QASimpleEditor = function QASimpleEditor(props) { var value = props.value, onChange = props.onChange, _props$toolAlign = props.toolAlign, toolAlign = _props$toolAlign === void 0 ? 'inner' : _props$toolAlign, _props$toolList = props.toolList, toolList = _props$toolList === void 0 ? [] : _props$toolList, _props$injectControls = props.injectControlsToolBar, injectControlsToolBar = _props$injectControls === void 0 ? {} : _props$injectControls, _props$toolBarContain = props.toolBarContainerStyle, toolBarContainerStyle = _props$toolBarContain === void 0 ? {} : _props$toolBarContain, _props$appendToolBtn = props.appendToolBtn, appendToolBtn = _props$appendToolBtn === void 0 ? null : _props$appendToolBtn; if (toolAlign === 'inner') { return React__default.createElement(BraftEditor.BarftEditorPage, { value: value, onChange: onChange, controls: [], FloatControls: function FloatControls(_ref) { var editorState = _ref.editorState, setEditorState = _ref.setEditorState; return React__default.createElement(ControlsToolBar, { editorState: editorState, setEditorState: setEditorState, toolList: toolList }); } }); } return React__default.createElement("div", null, React__default.createElement(BraftEditor.BarftEditorPage, { value: value, onChange: onChange, controls: [] }), React__default.createElement("div", { style: toolBarContainerStyle }, React__default.createElement("div", { className: styles.bottomToolBarWrapper }, React__default.createElement(ControlsToolBar, Object.assign({ editorState: value, setEditorState: onChange, toolList: toolList }, injectControlsToolBar))), appendToolBtn)); }; exports.BraftEditor = BraftEditor.default; exports.QASimpleEditor = QASimpleEditor; //# sourceMappingURL=index.js.map