@tiptap/core 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -802,8 +802,8 @@ function pasteRulesPlugin(props) {
802
802
  let dragSourceElement = null;
803
803
  let isPastedFromProseMirror = false;
804
804
  let isDroppedFromProseMirror = false;
805
- let pasteEvent = new ClipboardEvent('paste');
806
- let dropEvent = new DragEvent('drop');
805
+ let pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;
806
+ let dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;
807
807
  const plugins = rules.map(rule => {
808
808
  return new Plugin({
809
809
  // we register a global drag handler to track the current drag source element
@@ -870,8 +870,8 @@ function pasteRulesPlugin(props) {
870
870
  if (!handler || !tr.steps.length) {
871
871
  return;
872
872
  }
873
- dropEvent = new DragEvent('drop');
874
- pasteEvent = new ClipboardEvent('paste');
873
+ dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;
874
+ pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;
875
875
  return tr;
876
876
  },
877
877
  });