@tiptap/core 2.2.3 → 2.2.5

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.cjs CHANGED
@@ -806,8 +806,8 @@ function pasteRulesPlugin(props) {
806
806
  let dragSourceElement = null;
807
807
  let isPastedFromProseMirror = false;
808
808
  let isDroppedFromProseMirror = false;
809
- let pasteEvent = new ClipboardEvent('paste');
810
- let dropEvent = new DragEvent('drop');
809
+ let pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;
810
+ let dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;
811
811
  const plugins = rules.map(rule => {
812
812
  return new state.Plugin({
813
813
  // we register a global drag handler to track the current drag source element
@@ -874,8 +874,8 @@ function pasteRulesPlugin(props) {
874
874
  if (!handler || !tr.steps.length) {
875
875
  return;
876
876
  }
877
- dropEvent = new DragEvent('drop');
878
- pasteEvent = new ClipboardEvent('paste');
877
+ dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;
878
+ pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;
879
879
  return tr;
880
880
  },
881
881
  });