Fork pd_web, remove everything we don't need
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import ThemePresets from "./ThemePresets.svelte";
|
||||
import { fs_update, fs_node_type, type FSNode, type NodeOptions } from "filesystem/FilesystemAPI";
|
||||
import { fs_update, fs_node_type, type FSNode, type NodeOptions, node_is_shared, type FSPermissions } from "filesystem/FilesystemAPI";
|
||||
import CustomBanner from "filesystem/viewers/CustomBanner.svelte";
|
||||
import HelpButton from "layout/HelpButton.svelte";
|
||||
import FilePicker from "filesystem/filemanager/FilePicker.svelte";
|
||||
@@ -32,8 +32,7 @@ const handle_picker = async (e: CustomEvent<FSNode[]>) => {
|
||||
alert("Please select one file")
|
||||
return
|
||||
}
|
||||
const f = e.detail[0]
|
||||
let file_id = f.id
|
||||
let f = e.detail[0]
|
||||
|
||||
if (fs_node_type(f) !== "image") {
|
||||
alert("Please select an image file")
|
||||
@@ -44,19 +43,21 @@ const handle_picker = async (e: CustomEvent<FSNode[]>) => {
|
||||
}
|
||||
|
||||
// If this image is not public, it will be made public
|
||||
if (file_id === undefined || file_id === "") {
|
||||
if (!node_is_shared(f)) {
|
||||
try {
|
||||
let new_file = await fs_update(e.detail[0].path, {shared: true})
|
||||
file_id = new_file.id
|
||||
f = await fs_update(
|
||||
e.detail[0].path,
|
||||
{link_permissions: {read: true} as FSPermissions},
|
||||
)
|
||||
} catch (err) {
|
||||
alert(err)
|
||||
}
|
||||
}
|
||||
|
||||
if (picking === "brand_header_image") {
|
||||
options.brand_header_image = file_id
|
||||
options.brand_header_image = f.id
|
||||
} else if (picking === "brand_background_image") {
|
||||
options.brand_background_image = file_id
|
||||
options.brand_background_image = f.id
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user