You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2026-04-24 19:55:13 +02:00
15 lines
446 B
TypeScript
15 lines
446 B
TypeScript
import { EditorView } from '@codemirror/view';
|
|
import { PasteFileCallback } from '../../types';
|
|
import getFileFromPasteEvent from '../../utils/getFileFromPasteEvent';
|
|
|
|
const handlePasteEvent = (event: ClipboardEvent|DragEvent, _view: EditorView, onPaste: PasteFileCallback) => {
|
|
const fileToPaste = getFileFromPasteEvent(event);
|
|
|
|
if (fileToPaste) {
|
|
event.preventDefault();
|
|
void onPaste(fileToPaste);
|
|
}
|
|
};
|
|
|
|
export default handlePasteEvent;
|