"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

var TitaRichEditor = /*#__PURE__*/function () {
  function TitaRichEditor(_ref) {
    var view = _ref.view,
        controllers = _ref.controllers,
        dispatcher = _ref.dispatcher;

    _classCallCheck(this, TitaRichEditor);

    this.view = view;
    this.controllers = controllers;
    this.eventDispatcher = dispatcher;
    this.on = dispatcher.on.bind(dispatcher);
    this.off = dispatcher.off.bind(dispatcher);
    this.emit = dispatcher.emit.bind(dispatcher);
  }

  _createClass(TitaRichEditor, [{
    key: "state",
    get: function get() {
      return this.view.state;
    }
  }, {
    key: "destroy",
    value: function destroy() {
      this.eventDispatcher.destroy();
      this.view.destroy();
      this.controllers = [];
    }
  }]);

  return TitaRichEditor;
}();

exports["default"] = TitaRichEditor;