From aa7c031e8aeebeadbe4b3a8c8100e35eb7ec8c88 Mon Sep 17 00:00:00 2001 From: JeLuF Date: Sun, 12 Feb 2023 01:02:27 +0100 Subject: [PATCH] Fix task reordering --- ui/media/js/dnd.js | 2 +- ui/media/js/main.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/media/js/dnd.js b/ui/media/js/dnd.js index 4d2059d4..69b24b96 100644 --- a/ui/media/js/dnd.js +++ b/ui/media/js/dnd.js @@ -528,7 +528,7 @@ function dragOverHandler(ev) { ev.dataTransfer.dropEffect = "copy" let img = new Image() - img.src = location.host + '/media/images/favicon-32x32.png' + img.src = '//' + location.host + '/media/images/favicon-32x32.png' ev.dataTransfer.setDragImage(img, 16, 16) } diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 41e0aafb..1e8f63e9 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -79,7 +79,7 @@ imagePreview.addEventListener('drop', function(ev) { } ev.preventDefault() let moveTarget = ev.target - while (moveTarget && typeof moveTarget === 'object' && moveTarget.parentNode !== imagePreview) { + while (moveTarget && typeof moveTarget === 'object' && moveTarget.parentNode !== imagePreviewContent) { moveTarget = moveTarget.parentNode } if (moveTarget === initialText || moveTarget === previewTools) { @@ -89,17 +89,17 @@ imagePreview.addEventListener('drop', function(ev) { return } if (moveTarget) { - const childs = Array.from(imagePreview.children) + const childs = Array.from(imagePreviewContent.children) if (moveTarget.nextSibling && childs.indexOf(movedTask) < childs.indexOf(moveTarget)) { // Move after the target if lower than current position. moveTarget = moveTarget.nextSibling } } - const newNode = imagePreview.insertBefore(movedTask, moveTarget || previewTools.nextSibling) + const newNode = imagePreviewContent.insertBefore(movedTask, moveTarget || previewTools.nextSibling) if (newNode === movedTask) { return } - imagePreview.removeChild(movedTask) + imagePreviewContent.removeChild(movedTask) const task = htmlTaskMap.get(movedTask) if (task) { htmlTaskMap.delete(movedTask)