Add drag and drop to file manager

This commit is contained in:
2026-10-02 15:10:34 +02:00
parent 9a7ed0a347
commit f5b9f543c6
14 changed files with 432 additions and 466 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { fs_node_icon, fs_node_type, fs_encode_path } 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 {
@@ -22,7 +22,9 @@ let {
href={"/d"+fs_encode_path(child.path)}
onclick={e => file_event(FileAction.Click, index, e)}
oncontextmenu={e => file_event(FileAction.Context, index, e)}
class:selected={child.fm_selected}
ondragstart={e => file_event(FileAction.Drag, index, e)}
use:move_target={{nav, node: () => child}}
class:selected={$nav.selection.has(child.path)}
class:hidden={child.name.startsWith(".") && !show_hidden}
class:large_icons
title={child.name}
@@ -33,6 +35,7 @@ let {
src={fs_node_icon(child, 256, 256)}
loading="lazy"
alt=""
draggable="false"
/>
<div class="node_name">
{child.name}