Fix error popup when canceling a sharing action

Fix navigator not reloading when saving an edited file
Remove dead links
Remove references to Patreon
This commit is contained in:
2026-08-05 22:18:57 +02:00
parent 4c57a363b2
commit 99ab34c76d
6 changed files with 31 additions and 83 deletions

View File

@@ -93,15 +93,11 @@ const share = async () => {
}
const nav_share = async (url: string) => {
try {
await navigator.share({
title: base.name,
text: "I would like to share '" + base.name + "' with you",
url: url,
})
} catch(err) {
alert("navigator share not available: "+ err)
}
await navigator.share({
title: base.name,
text: "I would like to share '" + base.name + "' with you",
url: url,
})
}
</script>

View File

@@ -6,7 +6,7 @@ import { branding_from_props } from "./Branding";
import FileOptions from "./FileOptions.svelte";
import SharingOptions from "./SharingOptions.svelte";
import type { FSNavigator } from "filesystem/FSNavigator";
import { loading_finish, loading_start } from "lib/Loading";
import { loading_run } from "lib/Loading";
let file: FSNode = $state({} as FSNode)
let options: NodeOptions = $state({} as NodeOptions)
@@ -72,23 +72,22 @@ const save = async (e: SubmitEvent) => {
e.preventDefault()
console.debug("Saving file", file.path)
let new_file: FSNode
try {
loading_start()
options.branding_enabled = JSON.stringify(branding_enabled)
await loading_run(async () => {
options.branding_enabled = JSON.stringify(branding_enabled)
new_file = await fs_update(file.path, options)
await fs_update(file.path, options)
if (new_name !== file.name) {
let parent = file.path.slice(0, -file.name.length)
console.log("Moving", file.path, "to", parent+new_name)
// If the file name has changed we need to call fs_rename. This is a
// separate operation because a rename also moves the file
if (new_name !== file.name) {
let parent = file.path.slice(0, -file.name.length)
console.log("Moving", file.path, "to", parent+new_name)
await fs_rename(file.path, parent+new_name)
file.path = parent+new_name
new_file.name = new_name
new_file.path = file.path
}
await fs_rename(file.path, parent+new_name)
file.path = parent+new_name
}
})
} catch (err) {
if (err.message) {
alert(err.message)
@@ -97,11 +96,11 @@ const save = async (e: SubmitEvent) => {
alert(err)
}
return
} finally {
loading_finish()
}
if (open_after_edit) {
// The navigate call will be debounced if the new path is equal to the
// current path. So we call reload() instead if that's the case
if (open_after_edit && $nav.base.path !== file.path) {
nav.navigate(file.path, false)
} else {
nav.reload()