Fix naming conflict with navigator
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
export let state = {}
|
export let state = {}
|
||||||
export let navigator
|
export let fs_navigator
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each state.path as node, i (node.path)}
|
{#each state.path as node, i (node.path)}
|
||||||
@@ -9,7 +9,7 @@ export let navigator
|
|||||||
href={state.path_root+node.path}
|
href={state.path_root+node.path}
|
||||||
class="breadcrumb button"
|
class="breadcrumb button"
|
||||||
class:button_highlight={state.base_index === i}
|
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}
|
{#if shared}
|
||||||
<i class="icon small">share</i>
|
<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";
|
import Modal from "../util/Modal.svelte";
|
||||||
|
|
||||||
export let bucket = ""
|
export let bucket = ""
|
||||||
export let navigator
|
export let fs_navigator
|
||||||
let file = {
|
let file = {
|
||||||
path: "",
|
path: "",
|
||||||
name: "",
|
name: "",
|
||||||
@@ -61,7 +61,7 @@ const save = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
navigator.navigate(file.path, false)
|
fs_navigator.navigate(file.path, false)
|
||||||
}
|
}
|
||||||
const delete_file = async () => {
|
const delete_file = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -72,7 +72,7 @@ const delete_file = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
navigator.navigate(file.path, false)
|
fs_navigator.navigate(file.path, false)
|
||||||
visible = false
|
visible = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -16,7 +16,7 @@ let details_visible = false
|
|||||||
let edit_window
|
let edit_window
|
||||||
let edit_visible = false
|
let edit_visible = false
|
||||||
|
|
||||||
let navigator
|
let fs_navigator
|
||||||
let state = {
|
let state = {
|
||||||
path: window.initial_node.path,
|
path: window.initial_node.path,
|
||||||
base_index: window.initial_node.base_index,
|
base_index: window.initial_node.base_index,
|
||||||
@@ -49,7 +49,7 @@ let state = {
|
|||||||
shuffle: false,
|
shuffle: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => navigator.open_node(window.initial_node, false))
|
onMount(() => fs_navigator.open_node(window.initial_node, false))
|
||||||
|
|
||||||
const keydown = e => {
|
const keydown = e => {
|
||||||
if (e.ctrlKey || e.altKey || e.metaKey) {
|
if (e.ctrlKey || e.altKey || e.metaKey) {
|
||||||
@@ -78,11 +78,11 @@ const keydown = e => {
|
|||||||
break;
|
break;
|
||||||
case "a":
|
case "a":
|
||||||
case "ArrowLeft":
|
case "ArrowLeft":
|
||||||
navigator.open_sibling(-1)
|
fs_navigator.open_sibling(-1)
|
||||||
break;
|
break;
|
||||||
case "d":
|
case "d":
|
||||||
case "ArrowRight":
|
case "ArrowRight":
|
||||||
navigator.open_sibling(1)
|
fs_navigator.open_sibling(1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -96,7 +96,7 @@ const download = () => {
|
|||||||
|
|
||||||
<LoadingIndicator loading={state.loading}/>
|
<LoadingIndicator loading={state.loading}/>
|
||||||
|
|
||||||
<Navigator bind:this={navigator} bind:state/>
|
<Navigator bind:this={fs_navigator} bind:state/>
|
||||||
|
|
||||||
<div class="file_viewer">
|
<div class="file_viewer">
|
||||||
<div class="headerbar">
|
<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;"/>
|
<PixeldrainLogo style="height: 1.6em; width: 1.6em; margin: 0 0.2em 0 0; color: currentColor;"/>
|
||||||
</a>
|
</a>
|
||||||
<div class="breadcrumbs">
|
<div class="breadcrumbs">
|
||||||
<Breadcrumbs state={state} navigator={navigator}/>
|
<Breadcrumbs state={state} fs_navigator={fs_navigator}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="file_preview">
|
<div class="file_preview">
|
||||||
<Toolbar
|
<Toolbar
|
||||||
visible={toolbar_visible}
|
visible={toolbar_visible}
|
||||||
navigator={navigator}
|
fs_navigator={fs_navigator}
|
||||||
state={state}
|
state={state}
|
||||||
bind:details_visible={details_visible}
|
bind:details_visible={details_visible}
|
||||||
edit_window={edit_window}
|
edit_window={edit_window}
|
||||||
@@ -127,12 +127,12 @@ const download = () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<FilePreview
|
<FilePreview
|
||||||
navigator={navigator}
|
fs_navigator={fs_navigator}
|
||||||
state={state}
|
state={state}
|
||||||
toolbar_visible={toolbar_visible}
|
toolbar_visible={toolbar_visible}
|
||||||
edit_window={edit_window}
|
edit_window={edit_window}
|
||||||
on:loading={e => {state.loading = e.detail}}
|
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}
|
on:download={download}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -153,7 +153,7 @@ const download = () => {
|
|||||||
bind:this={edit_window}
|
bind:this={edit_window}
|
||||||
bind:visible={edit_visible}
|
bind:visible={edit_visible}
|
||||||
bucket={state.root.id}
|
bucket={state.root.id}
|
||||||
navigator={navigator}
|
fs_navigator={fs_navigator}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ export const generate_share_url = path => {
|
|||||||
let bucket_idx = -1
|
let bucket_idx = -1
|
||||||
|
|
||||||
// Find the last node in the path that has a public ID
|
// 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") {
|
if (path[i].id !== undefined && path[i].id !== "me") {
|
||||||
bucket_idx = i
|
bucket_idx = i
|
||||||
break
|
break
|
||||||
@@ -46,11 +46,11 @@ const share = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
navigator.navigate(state.base.path, false)
|
fs_navigator.navigate(state.base.path, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
export let state
|
export let state
|
||||||
export let navigator
|
export let fs_navigator
|
||||||
|
|
||||||
const share_email = () => {
|
const share_email = () => {
|
||||||
window.open(
|
window.open(
|
||||||
|
@@ -6,7 +6,7 @@ import { copy_text } from "../util/Util.svelte";
|
|||||||
|
|
||||||
let dispatch = createEventDispatcher()
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let navigator
|
export let fs_navigator
|
||||||
export let state = {
|
export let state = {
|
||||||
base: {
|
base: {
|
||||||
type: "",
|
type: "",
|
||||||
@@ -45,19 +45,20 @@ const copy_link = () => {
|
|||||||
link_copied = true
|
link_copied = true
|
||||||
setTimeout(() => {link_copied = false}, 60000)
|
setTimeout(() => {link_copied = false}, 60000)
|
||||||
}
|
}
|
||||||
let share = () => {
|
let share = async () => {
|
||||||
if (share_url === "") {
|
if (share_url === "") {
|
||||||
edit_window.edit(state.base, "share")
|
edit_window.edit(state.base, "share")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (navigator.share) {
|
try {
|
||||||
navigator.share({
|
await navigator.share({
|
||||||
title: state.base.name,
|
title: state.base.name,
|
||||||
text: "I would like to share '" + state.base.name + "' with you",
|
text: "I would like to share '" + state.base.name + "' with you",
|
||||||
url: share_url
|
url: share_url
|
||||||
})
|
})
|
||||||
} else {
|
} catch (err) {
|
||||||
|
console.debug("Navigator does not support sharing:", err)
|
||||||
sharebar_visible = !sharebar_visible
|
sharebar_visible = !sharebar_visible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,13 +80,13 @@ let share = () => {
|
|||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
<div class="button_row">
|
<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>
|
<i class="icon">skip_previous</i>
|
||||||
</button>
|
</button>
|
||||||
<button on:click={() => {state.shuffle = !state.shuffle}} class:button_highlight={state.shuffle}>
|
<button on:click={() => {state.shuffle = !state.shuffle}} class:button_highlight={state.shuffle}>
|
||||||
<i class="icon">shuffle</i>
|
<i class="icon">shuffle</i>
|
||||||
</button>
|
</button>
|
||||||
<button on:click={() => {navigator.open_sibling(1)}}>
|
<button on:click={() => {fs_navigator.open_sibling(1)}}>
|
||||||
<i class="icon">skip_next</i>
|
<i class="icon">skip_next</i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -100,7 +101,7 @@ let share = () => {
|
|||||||
<i class="icon">save</i> DL all files
|
<i class="icon">save</i> DL all files
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if state.base.path !== "/"}
|
{#if share_url !== ""}
|
||||||
<button id="btn_copy" class="toolbar_button" on:click={copy_link} class:button_highlight={link_copied}>
|
<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
|
<i class="icon">content_copy</i> <u>C</u>opy Link
|
||||||
</button>
|
</button>
|
||||||
@@ -121,7 +122,7 @@ let share = () => {
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</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>
|
<style>
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
@@ -7,7 +7,7 @@ import ListView from './ListView.svelte'
|
|||||||
import GalleryView from './GalleryView.svelte'
|
import GalleryView from './GalleryView.svelte'
|
||||||
let dispatch = createEventDispatcher()
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let navigator
|
export let fs_navigator
|
||||||
export let state
|
export let state
|
||||||
export let edit_window
|
export let edit_window
|
||||||
export let directory_view = ""
|
export let directory_view = ""
|
||||||
@@ -28,7 +28,7 @@ const node_click = e => {
|
|||||||
// We prefix our custom state properties with fm_ to not interfere with
|
// We prefix our custom state properties with fm_ to not interfere with
|
||||||
// other modules
|
// other modules
|
||||||
if (mode === "viewing") {
|
if (mode === "viewing") {
|
||||||
navigator.navigate(state.children[index].path, true)
|
fs_navigator.navigate(state.children[index].path, true)
|
||||||
} else if (mode === "selecting") {
|
} else if (mode === "selecting") {
|
||||||
state.children[index].fm_selected = !state.children[index].fm_selected
|
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
|
// Go to the path of the last parent
|
||||||
if (state.path.length > 1) {
|
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 = () => {
|
const delete_selected = () => {
|
||||||
if (mode !== "selecting") {
|
if (mode !== "selecting") {
|
||||||
|
@@ -7,7 +7,7 @@ import Pdf from "./PDF.svelte";
|
|||||||
import Text from "./Text.svelte";
|
import Text from "./Text.svelte";
|
||||||
import Video from "./Video.svelte";
|
import Video from "./Video.svelte";
|
||||||
|
|
||||||
export let navigator
|
export let fs_navigator
|
||||||
export let state
|
export let state
|
||||||
export let toolbar_visible
|
export let toolbar_visible
|
||||||
export let edit_window
|
export let edit_window
|
||||||
@@ -16,7 +16,7 @@ export let edit_window
|
|||||||
<div class="file_preview checkers" class:toolbar_visible>
|
<div class="file_preview checkers" class:toolbar_visible>
|
||||||
{#if state.viewer_type === "dir"}
|
{#if state.viewer_type === "dir"}
|
||||||
<FileManager
|
<FileManager
|
||||||
navigator={navigator}
|
fs_navigator={fs_navigator}
|
||||||
state={state}
|
state={state}
|
||||||
edit_window={edit_window}
|
edit_window={edit_window}
|
||||||
on:loading
|
on:loading
|
||||||
|
Reference in New Issue
Block a user