"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _prosemirrorCommands = require("prosemirror-commands");
var _prosemirrorDropcursor = require("prosemirror-dropcursor");
var _prosemirrorGapcursor = require("prosemirror-gapcursor");
var _prosemirrorHistory = require("prosemirror-history");
var _prosemirrorKeymap = require("prosemirror-keymap");
var _prosemirrorModel = require("prosemirror-model");
var _prosemirrorState = require("prosemirror-state");
var _ContentPlaceholderPlugin = _interopRequireDefault(require("./ContentPlaceholderPlugin"));
var _CursorPlaceholderPlugin = _interopRequireDefault(require("./CursorPlaceholderPlugin"));
var _EditorPageLayoutPlugin = _interopRequireDefault(require("./EditorPageLayoutPlugin"));
var _ImageUploadPlaceholderPlugin = _interopRequireDefault(require("./ImageUploadPlaceholderPlugin"));
var _LinkTooltipPlugin = _interopRequireDefault(require("./LinkTooltipPlugin"));
var _SelectionPlaceholderPlugin = _interopRequireDefault(require("./SelectionPlaceholderPlugin"));
var _TablePlugins = _interopRequireDefault(require("./TablePlugins"));
var _buildInputRules = _interopRequireDefault(require("./buildInputRules"));
var _createEditorKeyMap = _interopRequireDefault(require("./createEditorKeyMap"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
// Creates the default plugin for the editor.
class DefaultEditorPlugins {
  constructor(schema) {
    _defineProperty(this, "plugins", void 0);
    this.plugins = [new _ContentPlaceholderPlugin.default(), new _CursorPlaceholderPlugin.default(), new _EditorPageLayoutPlugin.default(), new _ImageUploadPlaceholderPlugin.default(), new _LinkTooltipPlugin.default(), new _SelectionPlaceholderPlugin.default(), this.setPluginKey((0, _buildInputRules.default)(schema), 'InputRules'), this.setPluginKey((0, _prosemirrorDropcursor.dropCursor)(), 'DropCursor'), this.setPluginKey((0, _prosemirrorGapcursor.gapCursor)(), 'GapCursor'), (0, _prosemirrorHistory.history)(), this.setPluginKey((0, _prosemirrorKeymap.keymap)((0, _createEditorKeyMap.default)()), 'EditorKeyMap'), this.setPluginKey((0, _prosemirrorKeymap.keymap)(_prosemirrorCommands.baseKeymap), 'BaseKeymap')].concat(_TablePlugins.default);
  }
  // [FS] IRAD-1005 2020-07-07
  // Upgrade outdated packages.
  // set plugin keys so that to avoid duplicate key error when keys are assigned automatically.
  setPluginKey(plugin, key) {
    plugin.spec.key = new _prosemirrorState.PluginKey(key + 'Plugin');
    plugin.key = plugin.spec.key.key;
    return plugin;
  }
  get() {
    return this.plugins;
  }
}
exports.default = DefaultEditorPlugins;