import React from 'react'; import { s as styleInject } from '../style-inject.es-1f59c1d0.js'; import { _ as _defineProperty } from '../defineProperty-18999f8e.js'; import '../index-e3cf212a.js'; import '../slicedToArray-4cd9e6d3.js'; import 'braft-editor'; import { BarftEditorPage } from '../BraftEditor/index.js'; export { default as BraftEditor } from '../BraftEditor/index.js'; import 'braft-editor/dist/index.css'; import 'braft-extensions/dist/emoticon.css'; import 'braft-extensions/dist/emoticon'; import 'braft-extensions/dist/max-length'; 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(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.createElement(React.Fragment, null, toolList.map(function (i) { var innerIcon = React.createElement("i", { className: i.iconClass, style: IconStyle }); var innerText = i.text ? React.createElement("span", { style: IconTextStyle }, i.text) : null; var divWrapStyle = _objectSpread({ color: i.color }, IconWrapStyle); var wrapperDom = React.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__DzhzC {\n display: flex;\n}\n"; var styles = { "bottomToolBarWrapper": "index_bottomToolBarWrapper__DzhzC" }; styleInject(css); var SimpleEditor = function SimpleEditor(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.createElement(BarftEditorPage, { value: value, onChange: onChange, controls: [], FloatControls: function FloatControls(_ref) { var editorState = _ref.editorState, setEditorState = _ref.setEditorState; return React.createElement(ControlsToolBar, { editorState: editorState, setEditorState: setEditorState, toolList: toolList }); } }); } return React.createElement("div", null, React.createElement(BarftEditorPage, { value: value, onChange: onChange, controls: [] }), React.createElement("div", { style: toolBarContainerStyle }, React.createElement("div", { className: styles.bottomToolBarWrapper }, React.createElement(ControlsToolBar, Object.assign({ editorState: value, setEditorState: onChange, toolList: toolList }, injectControlsToolBar))), appendToolBtn)); }; export { SimpleEditor }; //# sourceMappingURL=index.js.map