"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.inlineEditor = exports.createSlateEditor = exports.baseEditor = void 0;
var _slate = require("slate");
var _slateHistory = require("slate-history");
var _slateReact = require("slate-react");
var _slugid = require("slugid");
var _plugins = _interopRequireDefault(require("./plugins"));
const baseEditor = exports.baseEditor = _plugins.default.reduce((editor, pluginItem) => {
  const withPlugin = pluginItem.editorPlugin;
  if (withPlugin) {
    return withPlugin(editor);
  }
  editor._id = (0, _slugid.nice)();
  return editor;
}, (0, _slateHistory.withHistory)((0, _slateReact.withReact)((0, _slate.createEditor)())));
const inlineEditor = () => {
  const editor = _plugins.default.reduce((editor, pluginItem) => {
    const withPlugin = pluginItem.editorPlugin;
    if (withPlugin) {
      return withPlugin(editor);
    }
    return editor;
  }, (0, _slateHistory.withHistory)((0, _slateReact.withReact)((0, _slate.createEditor)())));
  editor._id = (0, _slugid.nice)();
  return editor;
};
exports.inlineEditor = inlineEditor;
const createSlateEditor = () => {
  const editor = _plugins.default.reduce((editor, pluginItem) => {
    const withPlugin = pluginItem.editorPlugin;
    if (withPlugin) {
      return withPlugin(editor);
    }
    return editor;
  }, (0, _slateHistory.withHistory)((0, _slateReact.withReact)((0, _slate.createEditor)())));
  editor._id = (0, _slugid.nice)();
  return editor;
};
exports.createSlateEditor = createSlateEditor;