import { EditorView } from 'prosemirror-view';
import { uploadImageFiles } from '../ImageUploadPlaceholderPlugin.js';

// https://prosemirror.net/examples/upload/
export default function handleEditorDrop(view, event) {
  var dataTransfer = event.dataTransfer;
  if (!dataTransfer) {
    return false;
  }
  var files = dataTransfer.files;
  if (!(files !== null && files !== void 0 && files.length)) {
    return false;
  }
  var filesList = Array.from(files);
  var coords = {
    x: event.clientX,
    y: event.clientY
  };
  if (uploadImageFiles(view, filesList, coords)) {
    event.preventDefault();
    return true;
  }
  return false;
}