uiwjs / react-codemirror

CodeMirror 6 component for React. @codemirror https://uiwjs.github.io/react-codemirror/
https://uiwjs.github.io/react-codemirror/
MIT License
1.65k stars 132 forks source link

Disable drag and drop fonctionnality #422

Open mickeldebs opened 1 year ago

mickeldebs commented 1 year ago

Is there a way to disable drag and drop? I saw that there is a dragDrop property but don't know where to put it. Also tried to add event extensions and return false on drop but nothing seems to work

jaywcjlove commented 1 year ago

https://github.com/uiwjs/react-codemirror/blob/73b518e0601409e0f113a62cad89355a5115396c/extensions/events/README.md?plain=1#L92-L131

npm install @uiw/codemirror-extensions-events --save
import * as events from '@uiw/codemirror-extensions-events';
const extension1 = events.scroll({
  scroll: (evn) => {
    console.log(evn.target.scrollTop);
  },
});
const extension2 = events.content({
  focus: (evn) => {
    console.log('focus');
  },
  blur: (evn) => {
    console.log('blur');
  },
});

@mickeld23 https://uiwjs.github.io/react-codemirror/#/extensions/events