"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const Slate = require("slate");
const HtmlDeserializer = require("../html/HtmlDeserializer.cjs");
const withPaste = (editor) => {
  const { insertData } = editor;
  const htmlDeserializer = new HtmlDeserializer.HtmlDeserializer(editor.createDefaultElement, []);
  editor.htmlDeserializer = htmlDeserializer;
  editor.insertData = (data) => {
    if (data.getData("application/x-slate-fragment")) {
      return insertData(data);
    }
    const html = data.getData("text/html");
    if (!html) {
      return insertData(data);
    }
    const document = new DOMParser().parseFromString(html, "text/html");
    const nodes = Array.from(document.body.childNodes);
    const result = htmlDeserializer.deserializeBlocks(nodes, {});
    Slate.Transforms.insertFragment(editor, result);
  };
};
exports.withPaste = withPaste;
//# sourceMappingURL=withPaste.cjs.map
