import { CATEGORIES, BLOCK_SEQUENCE } from "../../../configuration/constants";
const CanvasManager = (editor, opts = {}) => {
  // fix QMB-2471
  // Grapesjs@0.16.2 CanvasView 的 getFrameOffset 方法获取了 el.ownerDocument.defaultView.frameElement
  // 获取属性时缺少异常检查，Grapesjs 后续版本修复了该问题

  editor.Canvas.getCanvasView().getFrameOffset = function(el) {
    if (!this.frmOff || el) {
      const frame = this.frame.el;
      const winEl = el && el.ownerDocument.defaultView;
      const frEl = winEl ? winEl.frameElement : frame;
      this.frmOff = this.offset(frEl || frame);
    }
    return this.frmOff;
  };
};

export default CanvasManager;
