| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 | 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", {
      className: i.iconTextClass,
      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$injectBraftEdi = props.injectBraftEditorProps,
      injectBraftEditorProps = _props$injectBraftEdi === void 0 ? {} : _props$injectBraftEdi,
      _props$appendToolBtn = props.appendToolBtn,
      appendToolBtn = _props$appendToolBtn === void 0 ? null : _props$appendToolBtn,
      _props$appendInnderBa = props.appendInnderBar,
      appendInnderBar = _props$appendInnderBa === void 0 ? null : _props$appendInnderBa;
  if (toolAlign === 'inner') {
    return React.createElement(BarftEditorPage, Object.assign({
      value: value,
      onChange: onChange,
      controls: [],
      FloatControls: function FloatControls(_ref) {
        var editorState = _ref.editorState,
            setEditorState = _ref.setEditorState;
        return React.createElement(ControlsToolBar, Object.assign({
          editorState: editorState,
          setEditorState: setEditorState,
          toolList: toolList
        }, injectControlsToolBar));
      }
    }, injectBraftEditorProps));
  }
  if (toolAlign === 'both') {
    return React.createElement("div", null, React.createElement(BarftEditorPage, Object.assign({
      value: value,
      onChange: onChange,
      controls: [],
      FloatControls: function FloatControls() {
        return appendInnderBar;
      }
    }, injectBraftEditorProps)), React.createElement("div", {
      style: toolBarContainerStyle
    }, React.createElement("div", {
      className: styles.bottomToolBarWrapper
    }, React.createElement(ControlsToolBar, Object.assign({
      editorState: value,
      setEditorState: onChange,
      toolList: toolList
    }, injectControlsToolBar))), appendToolBtn));
  }
  return React.createElement("div", null, React.createElement(BarftEditorPage, Object.assign({
    value: value,
    onChange: onChange,
    controls: []
  }, injectBraftEditorProps)), 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
 |