Replace event dispatcher with a callback in filemanager

This commit is contained in:
2025-10-13 23:20:42 +02:00
parent 6d89c5ddd9
commit 75d9ed3023
41 changed files with 326 additions and 255 deletions

View File

@@ -3,7 +3,7 @@ import { run } from 'svelte/legacy';
import { domain_url } from "util/Util";
import CopyButton from "layout/CopyButton.svelte";
import { formatDate } from "util/Formatting";
import { node_is_shared, type FSNode, type NodeOptions } from "lib/FilesystemAPI";
import { type FSNode, type NodeOptions } from "lib/FilesystemAPI.svelte";
import AccessControl from "./AccessControl.svelte";
let {
@@ -18,7 +18,7 @@ let embed_html: string = $state()
let preview_area: HTMLDivElement = $state()
const embed_iframe = (file: FSNode, options: NodeOptions) => {
if (!node_is_shared(file)) {
if (!file.is_shared()) {
example = false
embed_html = "File is not shared, can't generate embed code"
return
@@ -34,7 +34,7 @@ const embed_iframe = (file: FSNode, options: NodeOptions) => {
let example = $state(false)
const toggle_example = () => {
if (node_is_shared(file)) {
if (file.is_shared()) {
example = !example
if (example) {
preview_area.innerHTML = embed_html
@@ -86,7 +86,7 @@ run(() => {
<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={!node_is_shared(file)}>
<button onclick={toggle_example} class:button_highlight={example} disabled={!file.is_shared()}>
<i class="icon">visibility</i> Show example
</button>
</div>