* Breadcrumbs too wide in deeply nested directories
* Sharedialog copies link and calls navigator.share at the same time
* Link copy feedback is not clear
* Show embed code when public read
* Hide hidden files from audio playlist
This commit is contained in:
2026-08-05 21:54:49 +02:00
parent 00b40ab900
commit 4c57a363b2
6 changed files with 57 additions and 55 deletions

View File

@@ -4,7 +4,6 @@ import CopyButton from "layout/CopyButton.svelte";
import { formatDate } from "util/Formatting";
import { type FSNode, type NodeOptions } from "lib/FilesystemAPI.svelte";
import AccessControl from "./AccessControl.svelte";
import { onMount } from 'svelte';
import { user } from "lib/UserStore";
let {
@@ -15,27 +14,24 @@ let {
options: NodeOptions;
} = $props();
let embed_html: string = $state()
let preview_area: HTMLDivElement = $state()
const embed_iframe = (file: FSNode, options: NodeOptions) => {
if (!file.is_shared()) {
example = false
embed_html = "File is not shared, can't generate embed code"
return
let is_shared = $derived(file.is_shared() || options.link_permissions?.read)
let embed_html: string = $derived.by(() => {
if (!is_shared) {
return "File is not shared, can't generate embed code"
}
let url = domain_url()+"/d/"+file.id
embed_html = `<iframe ` +
return `<iframe ` +
`src="${url}" ` +
`style="border: none; width: 100%; max-width 90vw; height: 800px; max-height: 75vh; border-radius: 6px;" ` +
`allowfullscreen` +
`></iframe>`
}
})
let preview_area: HTMLDivElement = $state()
let example = $state(false)
const toggle_example = () => {
if (file.is_shared()) {
if (is_shared) {
example = !example
if (example) {
preview_area.innerHTML = embed_html
@@ -46,9 +42,6 @@ const toggle_example = () => {
}
let share_link = $derived(window.location.protocol+"//"+window.location.host+"/d/"+file.id)
onMount(() => {
embed_iframe(file, options)
});
</script>
{#if $user.subscription.file_sharing === false}
@@ -93,8 +86,8 @@ onMount(() => {
<div class="center">
<textarea bind:value={embed_html} style="width: 100%; height: 4em;"></textarea>
<br/>
<CopyButton text={embed_html}>Copy HTML</CopyButton>
<button onclick={toggle_example} class:button_highlight={example} disabled={!file.is_shared()}>
<CopyButton text={embed_html} disabled={!is_shared}>Copy HTML</CopyButton>
<button onclick={toggle_example} class:button_highlight={example} disabled={!is_shared}>
<i class="icon">visibility</i> Show example
</button>
</div>