import { Transforms } from "slate";
import { HtmlDeserializer } from "../html/HtmlDeserializer.js";
const withPaste = (editor) => {
  const { insertData } = editor;
  const htmlDeserializer = new 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, {});
    Transforms.insertFragment(editor, result);
  };
};
export { withPaste };
//# sourceMappingURL=withPaste.js.map
