From: Alexander Ebert Date: Fri, 6 Nov 2020 18:21:07 +0000 (+0100) Subject: Moved the interfaces for a cleaner integration X-Git-Tag: 5.4.0_Alpha_1~579^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d54ae29d3e42bad847d5ed5dcdfbdef0edee4d7b;p=GitHub%2FWoltLab%2FWCF.git Moved the interfaces for a cleaner integration --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js index 8d851abdf3..c31620e95a 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js @@ -87,9 +87,8 @@ define(["require", "exports", "tslib", "../../Event/Handler", "../../Language"], 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(); diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/DragAndDrop.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/DragAndDrop.ts index c9de86f700..e3f2e586ee 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/DragAndDrop.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/DragAndDrop.ts @@ -9,16 +9,7 @@ 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; diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.ts index 555abc4616..343b3d7188 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.ts @@ -109,9 +109,8 @@ function drop(event: DragEvent): void { 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 @@ -154,7 +153,7 @@ function dragLeave() { 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); }); @@ -202,3 +201,12 @@ export interface RedactorEditorLike { $editor: HTMLElement[]; $element: HTMLElement[]; } + +export interface OnDropPayload { + file: File; +} + +export interface OnGlobalDropPayload { + cancelDrop: boolean; + event: DragEvent; +}