diff --git a/svelte/src/filesystem/Breadcrumbs.svelte b/svelte/src/filesystem/Breadcrumbs.svelte index 7f6bb67..d971430 100644 --- a/svelte/src/filesystem/Breadcrumbs.svelte +++ b/svelte/src/filesystem/Breadcrumbs.svelte @@ -1,6 +1,6 @@ {#each state.path as node, i (node.path)} @@ -9,7 +9,7 @@ export let navigator href={state.path_root+node.path} class="breadcrumb button" class:button_highlight={state.base_index === i} - on:click|preventDefault={() => {navigator.navigate(node.path, true)}} + on:click|preventDefault={() => {fs_navigator.navigate(node.path, true)}} > {#if shared} share diff --git a/svelte/src/filesystem/EditWindow.svelte b/svelte/src/filesystem/EditWindow.svelte index 83801e8..9e8351d 100644 --- a/svelte/src/filesystem/EditWindow.svelte +++ b/svelte/src/filesystem/EditWindow.svelte @@ -3,7 +3,7 @@ import { fs_delete_all, fs_rename, fs_update } from "./FilesystemAPI"; import Modal from "../util/Modal.svelte"; export let bucket = "" -export let navigator +export let fs_navigator let file = { path: "", name: "", @@ -61,7 +61,7 @@ const save = async () => { return } - navigator.navigate(file.path, false) + fs_navigator.navigate(file.path, false) } const delete_file = async () => { try { @@ -72,7 +72,7 @@ const delete_file = async () => { return } - navigator.navigate(file.path, false) + fs_navigator.navigate(file.path, false) visible = false } diff --git a/svelte/src/filesystem/Filesystem.svelte b/svelte/src/filesystem/Filesystem.svelte index dbc9c3a..2e4fbfe 100644 --- a/svelte/src/filesystem/Filesystem.svelte +++ b/svelte/src/filesystem/Filesystem.svelte @@ -16,7 +16,7 @@ let details_visible = false let edit_window let edit_visible = false -let navigator +let fs_navigator let state = { path: window.initial_node.path, base_index: window.initial_node.base_index, @@ -49,7 +49,7 @@ let state = { shuffle: false, } -onMount(() => navigator.open_node(window.initial_node, false)) +onMount(() => fs_navigator.open_node(window.initial_node, false)) const keydown = e => { if (e.ctrlKey || e.altKey || e.metaKey) { @@ -78,11 +78,11 @@ const keydown = e => { break; case "a": case "ArrowLeft": - navigator.open_sibling(-1) + fs_navigator.open_sibling(-1) break; case "d": case "ArrowRight": - navigator.open_sibling(1) + fs_navigator.open_sibling(1) break; } }; @@ -96,7 +96,7 @@ const download = () => { - +
@@ -111,14 +111,14 @@ const download = () => {
{ /> {state.loading = e.detail}} - on:open_sibling={e => navigator.open_sibling(e.detail)} + on:open_sibling={e => fs_navigator.open_sibling(e.detail)} on:download={download} />
@@ -153,7 +153,7 @@ const download = () => { bind:this={edit_window} bind:visible={edit_visible} bucket={state.root.id} - navigator={navigator} + fs_navigator={fs_navigator} />
diff --git a/svelte/src/filesystem/Sharebar.svelte b/svelte/src/filesystem/Sharebar.svelte index d540edc..a80c2cf 100644 --- a/svelte/src/filesystem/Sharebar.svelte +++ b/svelte/src/filesystem/Sharebar.svelte @@ -4,7 +4,7 @@ export const generate_share_url = path => { let bucket_idx = -1 // Find the last node in the path that has a public ID - for (let i = path.length-1; i > 0; i--) { + for (let i = path.length-1; i >= 0; i--) { if (path[i].id !== undefined && path[i].id !== "me") { bucket_idx = i break @@ -46,11 +46,11 @@ const share = async () => { return } - navigator.navigate(state.base.path, false) + fs_navigator.navigate(state.base.path, false) } export let state -export let navigator +export let fs_navigator const share_email = () => { window.open( diff --git a/svelte/src/filesystem/Toolbar.svelte b/svelte/src/filesystem/Toolbar.svelte index e68a36d..d15f0a6 100644 --- a/svelte/src/filesystem/Toolbar.svelte +++ b/svelte/src/filesystem/Toolbar.svelte @@ -6,7 +6,7 @@ import { copy_text } from "../util/Util.svelte"; let dispatch = createEventDispatcher() -export let navigator +export let fs_navigator export let state = { base: { type: "", @@ -45,19 +45,20 @@ const copy_link = () => { link_copied = true setTimeout(() => {link_copied = false}, 60000) } -let share = () => { +let share = async () => { if (share_url === "") { edit_window.edit(state.base, "share") return } - if (navigator.share) { - navigator.share({ + try { + await navigator.share({ title: state.base.name, text: "I would like to share '" + state.base.name + "' with you", url: share_url }) - } else { + } catch (err) { + console.debug("Navigator does not support sharing:", err) sharebar_visible = !sharebar_visible } } @@ -79,13 +80,13 @@ let share = () => {
- -
@@ -100,7 +101,7 @@ let share = () => { save DL all files - {#if state.base.path !== "/"} + {#if share_url !== ""} @@ -121,7 +122,7 @@ let share = () => { {/if} - +