Fix naming conflict with navigator
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
export let state = {}
|
||||
export let navigator
|
||||
export let fs_navigator
|
||||
</script>
|
||||
|
||||
{#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}
|
||||
<i class="icon small">share</i>
|
||||
|
@@ -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
|
||||
}
|
||||
</script>
|
||||
|
@@ -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 = () => {
|
||||
|
||||
<LoadingIndicator loading={state.loading}/>
|
||||
|
||||
<Navigator bind:this={navigator} bind:state/>
|
||||
<Navigator bind:this={fs_navigator} bind:state/>
|
||||
|
||||
<div class="file_viewer">
|
||||
<div class="headerbar">
|
||||
@@ -111,14 +111,14 @@ const download = () => {
|
||||
<PixeldrainLogo style="height: 1.6em; width: 1.6em; margin: 0 0.2em 0 0; color: currentColor;"/>
|
||||
</a>
|
||||
<div class="breadcrumbs">
|
||||
<Breadcrumbs state={state} navigator={navigator}/>
|
||||
<Breadcrumbs state={state} fs_navigator={fs_navigator}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="file_preview">
|
||||
<Toolbar
|
||||
visible={toolbar_visible}
|
||||
navigator={navigator}
|
||||
fs_navigator={fs_navigator}
|
||||
state={state}
|
||||
bind:details_visible={details_visible}
|
||||
edit_window={edit_window}
|
||||
@@ -127,12 +127,12 @@ const download = () => {
|
||||
/>
|
||||
|
||||
<FilePreview
|
||||
navigator={navigator}
|
||||
fs_navigator={fs_navigator}
|
||||
state={state}
|
||||
toolbar_visible={toolbar_visible}
|
||||
edit_window={edit_window}
|
||||
on:loading={e => {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}
|
||||
/>
|
||||
</div>
|
||||
@@ -153,7 +153,7 @@ const download = () => {
|
||||
bind:this={edit_window}
|
||||
bind:visible={edit_visible}
|
||||
bucket={state.root.id}
|
||||
navigator={navigator}
|
||||
fs_navigator={fs_navigator}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@@ -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(
|
||||
|
@@ -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 = () => {
|
||||
<div class="separator"></div>
|
||||
|
||||
<div class="button_row">
|
||||
<button on:click={() => {navigator.open_sibling(-1)}}>
|
||||
<button on:click={() => {fs_navigator.open_sibling(-1)}}>
|
||||
<i class="icon">skip_previous</i>
|
||||
</button>
|
||||
<button on:click={() => {state.shuffle = !state.shuffle}} class:button_highlight={state.shuffle}>
|
||||
<i class="icon">shuffle</i>
|
||||
</button>
|
||||
<button on:click={() => {navigator.open_sibling(1)}}>
|
||||
<button on:click={() => {fs_navigator.open_sibling(1)}}>
|
||||
<i class="icon">skip_next</i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -100,7 +101,7 @@ let share = () => {
|
||||
<i class="icon">save</i> DL all files
|
||||
</button>
|
||||
|
||||
{#if state.base.path !== "/"}
|
||||
{#if share_url !== ""}
|
||||
<button id="btn_copy" class="toolbar_button" on:click={copy_link} class:button_highlight={link_copied}>
|
||||
<i class="icon">content_copy</i> <u>C</u>opy Link
|
||||
</button>
|
||||
@@ -121,7 +122,7 @@ let share = () => {
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<Sharebar visible={sharebar_visible} state={state} navigator={navigator} share_url={share_url}/>
|
||||
<Sharebar visible={sharebar_visible} state={state} fs_navigator={fs_navigator} share_url={share_url}/>
|
||||
|
||||
<style>
|
||||
.toolbar {
|
||||
|
@@ -7,7 +7,7 @@ import ListView from './ListView.svelte'
|
||||
import GalleryView from './GalleryView.svelte'
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
export let navigator
|
||||
export let fs_navigator
|
||||
export let state
|
||||
export let edit_window
|
||||
export let directory_view = ""
|
||||
@@ -28,7 +28,7 @@ const node_click = e => {
|
||||
// We prefix our custom state properties with fm_ to not interfere with
|
||||
// other modules
|
||||
if (mode === "viewing") {
|
||||
navigator.navigate(state.children[index].path, true)
|
||||
fs_navigator.navigate(state.children[index].path, true)
|
||||
} else if (mode === "selecting") {
|
||||
state.children[index].fm_selected = !state.children[index].fm_selected
|
||||
}
|
||||
@@ -42,10 +42,10 @@ const navigate_up = () => {
|
||||
|
||||
// Go to the path of the last parent
|
||||
if (state.path.length > 1) {
|
||||
navigator.navigate(state.path[state.path.length-2].path, true)
|
||||
fs_navigator.navigate(state.path[state.path.length-2].path, true)
|
||||
}
|
||||
}
|
||||
const reload = () => { navigator.navigate(state.base.path) }
|
||||
const reload = () => { fs_navigator.navigate(state.base.path) }
|
||||
|
||||
const delete_selected = () => {
|
||||
if (mode !== "selecting") {
|
||||
|
@@ -7,7 +7,7 @@ import Pdf from "./PDF.svelte";
|
||||
import Text from "./Text.svelte";
|
||||
import Video from "./Video.svelte";
|
||||
|
||||
export let navigator
|
||||
export let fs_navigator
|
||||
export let state
|
||||
export let toolbar_visible
|
||||
export let edit_window
|
||||
@@ -16,7 +16,7 @@ export let edit_window
|
||||
<div class="file_preview checkers" class:toolbar_visible>
|
||||
{#if state.viewer_type === "dir"}
|
||||
<FileManager
|
||||
navigator={navigator}
|
||||
fs_navigator={fs_navigator}
|
||||
state={state}
|
||||
edit_window={edit_window}
|
||||
on:loading
|
||||
|
Reference in New Issue
Block a user