diff --git a/client/src/components/History/Content/ContentItem.vue b/client/src/components/History/Content/ContentItem.vue index 580fee7866c3..1e56b0a0d451 100644 --- a/client/src/components/History/Content/ContentItem.vue +++ b/client/src/components/History/Content/ContentItem.vue @@ -113,7 +113,7 @@ import { updateContentFields } from "components/History/model/queries"; import StatelessTags from "components/TagsMultiselect/StatelessTags"; import { useEntryPointStore } from "stores/entryPointStore"; -import { clearDrag } from "@/utils/setDrag.js"; +import { clearDrag } from "@/utils/setDrag.ts"; import CollectionDescription from "./Collection/CollectionDescription"; import { JobStateSummary } from "./Collection/JobStateSummary"; diff --git a/client/src/stores/eventStore.ts b/client/src/stores/eventStore.ts index 459ba5934916..654298a5bcd6 100644 --- a/client/src/stores/eventStore.ts +++ b/client/src/stores/eventStore.ts @@ -28,7 +28,6 @@ export const useEventStore = defineStore("eventStore", () => { return { multipleDragData, - dragData, clearDragData, getDragData, setDragData, diff --git a/client/src/utils/setDrag.js b/client/src/utils/setDrag.js deleted file mode 100644 index 0535a06af20b..000000000000 --- a/client/src/utils/setDrag.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Helper to configure datatransfer for drag & drop operations - */ -import { useEventStore } from "stores/eventStore"; - -export function setDrag(evt, data = null, multiple = false) { - const eventStore = useEventStore(); - if (data) { - evt.dataTransfer.setData("text", JSON.stringify([data])); - // data submitted through datatransfer is only available upon drop, - // in order to access the drop data immediately this event store is used. - eventStore.setDragData(data, multiple); - } - evt.dataTransfer.dropEffect = "move"; - evt.dataTransfer.effectAllowed = "move"; - const elem = document.getElementById("drag-ghost"); - evt.dataTransfer.setDragImage(elem, 0, 0); -} - -export function clearDrag() { - const eventStore = useEventStore(); - eventStore.clearDragData(); -} diff --git a/client/src/utils/setDrag.ts b/client/src/utils/setDrag.ts new file mode 100644 index 000000000000..fef754a15995 --- /dev/null +++ b/client/src/utils/setDrag.ts @@ -0,0 +1,27 @@ +/** + * Helper to configure datatransfer for drag & drop operations + */ +import { useEventStore } from "@/stores/eventStore"; + +export function setDrag(evt: DragEvent, data = null, multiple = false) { + const eventStore = useEventStore(); + if (data) { + evt.dataTransfer?.setData("text", JSON.stringify([data])); + // data submitted through datatransfer is only available upon drop, + // in order to access the drop data immediately this event store is used. + eventStore.setDragData(data, multiple); + } + if (evt.dataTransfer) { + evt.dataTransfer.dropEffect = "move"; + evt.dataTransfer.effectAllowed = "move"; + const elem = document.getElementById("drag-ghost"); + if (elem) { + evt.dataTransfer.setDragImage(elem, 0, 0); + } + } +} + +export function clearDrag() { + const eventStore = useEventStore(); + eventStore.clearDragData(); +}