Fix branding window defaulting everything to black

This commit is contained in:
2025-10-17 13:37:59 +02:00
parent b409ff009d
commit 4de6331551
3 changed files with 51 additions and 58 deletions

View File

@@ -1,9 +1,8 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { fs_rename, fs_update, type FSNode, type NodeOptions } from "lib/FilesystemAPI.svelte";
import Modal from "util/Modal.svelte";
import BrandingOptions from "./BrandingOptions.svelte";
import { branding_from_node } from "./Branding";
import { branding_from_props } from "./Branding";
import FileOptions from "./FileOptions.svelte";
import SharingOptions from "./SharingOptions.svelte";
import AccessControl from "./AccessControl.svelte";
@@ -52,7 +51,7 @@ export const edit = (f: FSNode, oae = false, open_tab = "") => {
branding_enabled = options.branding_enabled === "true"
if (branding_enabled) {
custom_css = branding_from_node(file)
custom_css = branding_from_props(options)
} else {
custom_css = ""
}
@@ -66,7 +65,8 @@ let open_after_edit = $state(false)
let new_name = $state("")
let branding_enabled = $state(false)
const save = async (keep_editing = false) => {
const save = async (e: SubmitEvent) => {
e.preventDefault()
console.debug("Saving file", file.path)
let new_file: FSNode
@@ -103,10 +103,6 @@ const save = async (keep_editing = false) => {
} else {
nav.reload()
}
if (keep_editing) {
edit(new_file, open_after_edit)
}
}
</script>
@@ -132,7 +128,7 @@ const save = async (keep_editing = false) => {
</button>
</div>
<form id="edit_form" onsubmit={preventDefault(() => save(false))}></form>
<form id="edit_form" onsubmit={save}></form>
<div class="tab_content">
{#if tab === "file"}
@@ -155,7 +151,7 @@ const save = async (keep_editing = false) => {
bind:enabled={branding_enabled}
bind:options={options}
bind:file
on:style_change={e => custom_css = branding_from_node(file)}
bind:custom_css
/>
{/if}
</div>