Add drag and drop to file manager
This commit is contained in:
1 parent
9a7ed0a347
commit
f5b9f543c6
14 files changed
+432
-466
No files matched your search
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { bookmarks_save, bookmarks_store } from "lib/Bookmarks";
|
||||
import { bookmarks_failed, bookmarks_save, bookmarks_store } from "lib/Bookmarks";
|
||||
import { fs_encode_path, fs_thumbnail_url } from "lib/FilesystemAPI.svelte";
|
||||
import { global_navigator, move_target } from "filesystem/FSNavigator";
|
||||
import { highlight_current_page } from "lib/HighlightCurrentPage";
|
||||
import MenuEntry from "./MenuEntry.svelte";
|
||||
import { flip } from "svelte/animate";
|
||||
@@ -94,7 +95,8 @@ const drop = (e: DragEvent, drop_idx: number) => {
|
||||
ondragstart={e => drag(e, index)}
|
||||
ondrop={e => drop(e, index)}
|
||||
ondragover={e => {e.preventDefault(); e.stopPropagation()}}
|
||||
ondragenter={() => hovering = index}
|
||||
ondragenter={() => {if (editing) hovering = index}}
|
||||
use:move_target={{nav: global_navigator, node: () => bookmark}}
|
||||
ondragend={() => {hovering = -1}}
|
||||
class:highlight={hovering === index}
|
||||
animate:flip={{duration: 300}}
|
||||
@@ -122,6 +124,8 @@ const drop = (e: DragEvent, drop_idx: number) => {
|
||||
{/each}
|
||||
{/snippet}
|
||||
</MenuEntry>
|
||||
{:else if $bookmarks_failed}
|
||||
<div>Could not load bookmarks</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
||||
Reference in new issue
Block a user