From 1fc3e9062bc2ae8e22494b7cf1f7336175655dd3 Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Thu, 25 Jul 2024 18:16:29 +0200 Subject: [PATCH] fix drag&drop on iOS --- dist/index.js | 22 +++++++++++++++------- src/View/Components/taskEntry.tsx | 1 + src/View/utility.ts | 4 ++++ src/ViewModel/Pages/taskViewModel.ts | 11 ++++++++--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index b032f262..0538168a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1514,6 +1514,14 @@ }; }; + // src/View/utility.ts + function allowDrop(event) { + event.preventDefault(); + } + function allowDrag(event) { + event.dataTransfer?.setData("text", ""); + } + // src/ViewModel/Pages/taskViewModel.ts var TaskViewModel = class { // init @@ -1560,7 +1568,8 @@ selectedVersionId = new State(""); versionIds = new ListState(); // methods - dragStart = () => { + dragStart = (event) => { + allowDrag(event); this.coreViewModel.draggedObject.value = this; }; setCategoryAndStatus = (category, status) => { @@ -1620,7 +1629,10 @@ this.versionIds.add(...sortedVersionIds); }; switchVersion = (versionId) => { - const taskFileContent = this.boardsAndTasksModel.getSpecificTaskFileContent(this.task.fileId, versionId); + const taskFileContent = this.boardsAndTasksModel.getSpecificTaskFileContent( + this.task.fileId, + versionId + ); if (taskFileContent == null) return; this.task = taskFileContent; this.loadTaskData(); @@ -2646,6 +2658,7 @@ { draggable: "true", class: "tile flex-no", + style: "user-select: none; -webkit-user-select: none", "on:click": taskViewModel.open, "on:dragstart": taskViewModel.dragStart }, @@ -2675,11 +2688,6 @@ return TaskEntry(taskViewModel); }; - // src/View/utility.ts - function allowDrop(event) { - event.preventDefault(); - } - // src/View/ChatPages/boardKanbanPage.tsx function BoardKanbanPage(boardViewModel) { const categoryNameConverter = (categoryName) => { diff --git a/src/View/Components/taskEntry.tsx b/src/View/Components/taskEntry.tsx index ee8a65e1..72d9e2c1 100644 --- a/src/View/Components/taskEntry.tsx +++ b/src/View/Components/taskEntry.tsx @@ -16,6 +16,7 @@ export function TaskEntry(taskViewModel: TaskViewModel) {