Add drag and drop to file manager

This commit is contained in:
Pixeldrain-Server committed 2026-10-02 15:10:34 +02:00
1 parent 9a7ed0a347
commit f5b9f543c6
14 files changed
+432 -466

No files matched your search

@@ -1,6 +1,6 @@
<script lang="ts">
import { fs_encode_path, fs_node_icon } from "lib/FilesystemAPI.svelte"
import type { FSNavigator } from "filesystem/FSNavigator";
import { move_target, type FSNavigator } from "filesystem/FSNavigator";
import { FileAction, type FileActionHandler } from "./FileManagerLib";
let {
@@ -24,11 +24,13 @@ let {
href={"/d"+fs_encode_path(child.path)}
onclick={e => file_event(FileAction.Click, index, e)}
oncontextmenu={e => file_event(FileAction.Context, index, e)}
ondragstart={e => file_event(FileAction.Drag, index, e)}
use:move_target={{nav, node: () => child}}
class="node"
class:node_selected={child.fm_selected}
class:node_selected={$nav.selection.has(child.path)}
class:hidden={child.name.startsWith(".") && !show_hidden}
>
<img src={fs_node_icon(child, 64, 64)} class="node_icon" class:large_icons loading="lazy" alt="icon"/>
<img src={fs_node_icon(child, 64, 64)} class="node_icon" class:large_icons loading="lazy" alt="icon" draggable="false"/>
<div class="node_name">
{child.name}
</div>