const target = event.currentTarget;
const elementId = target.dataset.elementId;
Array.from(event.dataTransfer.files).forEach((file) => {
- EventHandler.fire("com.woltlab.wcf.redactor2", `dragAndDrop_${elementId}`, {
- file,
- });
+ const eventData = { file };
+ EventHandler.fire("com.woltlab.wcf.redactor2", `dragAndDrop_${elementId}`, eventData);
});
// this will reset all drop areas
dragLeave();
import * as Core from "../Core";
import * as EventHandler from "../Event/Handler";
-import { init, RedactorEditorLike } from "./Redactor/DragAndDrop";
-
-interface OnDropPayload {
- file: File;
-}
-
-interface OnGlobalDropPayload {
- cancelDrop: boolean;
- event: DragEvent;
-}
+import { init, OnDropPayload, OnGlobalDropPayload, RedactorEditorLike } from "./Redactor/DragAndDrop";
interface DragAndDropOptions {
element: HTMLElement;
const elementId = target.dataset.elementId!;
Array.from(event.dataTransfer.files).forEach((file) => {
- EventHandler.fire("com.woltlab.wcf.redactor2", `dragAndDrop_${elementId}`, {
- file,
- });
+ const eventData: OnDropPayload = { file };
+ EventHandler.fire("com.woltlab.wcf.redactor2", `dragAndDrop_${elementId}`, eventData);
});
// this will reset all drop areas
function globalDrop(event: DragEvent): void {
const target = event.target as HTMLElement;
if (target.closest(".redactor-layer") === null) {
- const eventData = { cancelDrop: true, event: event };
+ const eventData: OnGlobalDropPayload = { cancelDrop: true, event: event };
_dragArea.forEach((data) => {
EventHandler.fire("com.woltlab.wcf.redactor2", `dragAndDrop_globalDrop_${data.editor.$element[0].id}`, eventData);
});
$editor: HTMLElement[];
$element: HTMLElement[];
}
+
+export interface OnDropPayload {
+ file: File;
+}
+
+export interface OnGlobalDropPayload {
+ cancelDrop: boolean;
+ event: DragEvent;
+}