@sierra-95/svelte-scaffold 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Core/components/Menus/MenuItem/menuItem.svelte +3 -2
- package/dist/Core/components/Menus/MenuItem/menuItem.svelte.d.ts +1 -0
- package/dist/Core/components/Menus/Tabs/main.css +0 -1
- package/dist/Core/components/Menus/Tabs/main.svelte +2 -1
- package/dist/Core/components/Menus/Tabs/main.svelte.d.ts +1 -0
- package/dist/Core/components/others/Previews/Audio/audio.svelte +5 -43
- package/dist/Core/components/others/Previews/Document/documents.svelte +1 -1
- package/dist/Core/components/others/Previews/Image/image.svelte +2 -2
- package/dist/Core/components/others/Previews/Video/video.svelte +4 -6
- package/dist/Core/components/others/Previews/Video/video.svelte.d.ts +0 -2
- package/dist/Modules/Editor/Nodes/Images/images.svelte +28 -11
- package/dist/Modules/Editor/controls.svelte +29 -16
- package/dist/Modules/Editor/controls.svelte.d.ts +4 -20
- package/dist/Modules/FilePicker/{ActionsMenu → Actions}/Actions.svelte +10 -12
- package/dist/Modules/FilePicker/Actions/Actions.svelte.d.ts +3 -0
- package/dist/Modules/FilePicker/{ActionsMenu/delete_media.svelte → Actions/delete.svelte} +8 -14
- package/dist/Modules/FilePicker/Actions/delete.svelte.d.ts +5 -0
- package/dist/Modules/FilePicker/{ActionsMenu/download_media.svelte → Actions/download.svelte} +13 -13
- package/dist/Modules/FilePicker/Actions/download.svelte.d.ts +5 -0
- package/dist/Modules/FilePicker/{ActionsMenu/file_properties.svelte → Actions/properties.svelte} +3 -3
- package/dist/Modules/FilePicker/{ActionsMenu/file_properties.svelte.d.ts → Actions/properties.svelte.d.ts} +3 -3
- package/dist/Modules/FilePicker/Cloud/cloudStore.svelte +42 -104
- package/dist/Modules/FilePicker/Cloud/cloudStore.svelte.d.ts +2 -4
- package/dist/Modules/FilePicker/Cloud/content.svelte +118 -0
- package/dist/Modules/FilePicker/Cloud/content.svelte.d.ts +3 -0
- package/dist/Modules/FilePicker/Cloud/storage.svelte +40 -0
- package/dist/Modules/FilePicker/Cloud/storage.svelte.d.ts +15 -0
- package/dist/Modules/FilePicker/Upload/upload.svelte +55 -0
- package/dist/Modules/FilePicker/{Cloud/previews.svelte.d.ts → Upload/upload.svelte.d.ts} +4 -6
- package/dist/Modules/FilePicker/main.svelte +11 -62
- package/dist/stores/modules/editor.d.ts +4 -2
- package/dist/stores/modules/editor.js +2 -2
- package/dist/stores/modules/fileInput.d.ts +3 -1
- package/dist/stores/modules/fileInput.js +4 -2
- package/package.json +1 -1
- package/dist/Modules/FilePicker/ActionsMenu/Actions.svelte.d.ts +0 -5
- package/dist/Modules/FilePicker/ActionsMenu/delete_media.svelte.d.ts +0 -6
- package/dist/Modules/FilePicker/ActionsMenu/download_media.svelte.d.ts +0 -6
- package/dist/Modules/FilePicker/ActionsMenu/media_storage.svelte +0 -54
- package/dist/Modules/FilePicker/ActionsMenu/media_storage.svelte.d.ts +0 -36
- package/dist/Modules/FilePicker/Cloud/previews.svelte +0 -39
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
disabled = false,
|
|
6
6
|
iconSize = '20px',
|
|
7
7
|
iconGap = '20px',
|
|
8
|
-
iconBg
|
|
8
|
+
iconBg = 'var(--primary-bg)',
|
|
9
|
+
rounded = '0px',
|
|
9
10
|
children = null,
|
|
10
11
|
...rest
|
|
11
12
|
} = $props();
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
<div
|
|
31
32
|
id="sierra-menu-item"
|
|
32
33
|
role="none"
|
|
33
|
-
style="background-color: {active ? 'var(--menu-item-active)' : ''}"
|
|
34
|
+
style="background-color: {active ? 'var(--menu-item-active)' : ''}; border-radius: {rounded};"
|
|
34
35
|
class="{disabled? 'disabled':''}"
|
|
35
36
|
{...rest}
|
|
36
37
|
onclick={(e: MouseEvent) => {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
iconSize = '15px',
|
|
11
11
|
boxShadow = false,
|
|
12
12
|
actions,
|
|
13
|
+
padding = '1rem'
|
|
13
14
|
} = $props();
|
|
14
15
|
|
|
15
16
|
onMount(()=>{
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
{@render actions?.()}
|
|
39
40
|
</div>
|
|
40
41
|
|
|
41
|
-
<div class="tab-content">
|
|
42
|
+
<div style="padding: {padding};" class="tab-content">
|
|
42
43
|
{#if snippets?.[active]}
|
|
43
44
|
{@render snippets[active]()}
|
|
44
45
|
{/if}
|
|
@@ -1,56 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {ButtonTimes, fileInputStore, ButtonSelect, removeFileForMedia, toggleSelectForMedia
|
|
2
|
+
import {ButtonTimes, fileInputStore, ButtonSelect, removeFileForMedia, toggleSelectForMedia} from '../../../../../index.js'
|
|
3
3
|
export let media;
|
|
4
4
|
export let buttonTimes = false;
|
|
5
5
|
export let urlsOnly = true;
|
|
6
|
-
|
|
7
|
-
let audioPlaying: Record<string, boolean> = {};
|
|
8
|
-
let audioRefs: Record<string, HTMLAudioElement> = {};
|
|
9
|
-
function togglePlay(id: string) {
|
|
10
|
-
if(!urlsOnly){
|
|
11
|
-
addToast({
|
|
12
|
-
status: 'warning',
|
|
13
|
-
message: 'Audio preview is disabled for local files.'
|
|
14
|
-
});
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const audio = audioRefs[id];
|
|
18
|
-
if (!audio) return;
|
|
19
|
-
|
|
20
|
-
if (audio.paused) {
|
|
21
|
-
// Pause any other playing audio
|
|
22
|
-
for (const key in audioRefs) {
|
|
23
|
-
if (key !== id && !audioRefs[key].paused) {
|
|
24
|
-
audioRefs[key].pause();
|
|
25
|
-
audioPlaying[key] = false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
audio.play();
|
|
29
|
-
audioPlaying[id] = true;
|
|
30
|
-
} else {
|
|
31
|
-
audio.pause();
|
|
32
|
-
audioPlaying[id] = false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function getPreviewUrl(file: File) {
|
|
36
|
-
return URL.createObjectURL(file);
|
|
37
|
-
}
|
|
38
|
-
function uuid() {
|
|
39
|
-
return crypto.randomUUID();
|
|
40
|
-
}
|
|
41
6
|
</script>
|
|
42
7
|
|
|
43
8
|
{#if media.Audio.length === 0}
|
|
44
9
|
<p>No audio files available.</p>
|
|
45
10
|
{:else}
|
|
46
11
|
<div style="display: flex; flex-wrap:wrap; gap: 1rem">
|
|
47
|
-
{#each media.Audio as item
|
|
48
|
-
<div
|
|
49
|
-
<
|
|
50
|
-
<i class="fa {audioPlaying[item.id] ? 'fa-pause' : 'fa-play'}" aria-hidden="true"></i>
|
|
51
|
-
</button>
|
|
52
|
-
<audio hidden bind:this={audioRefs[item.id]} src={urlsOnly ? item.url : getPreviewUrl(item)} controls></audio>
|
|
53
|
-
<h3 style=" margin-left:0.2rem" class="sierra-text-ellipsis">{item.original_name || item.name}</h3>
|
|
12
|
+
{#each media.Audio as item}
|
|
13
|
+
<div title={item.original_name || item.name} style="position: relative; cursor: pointer;" on:click={() => toggleSelectForMedia(item, urlsOnly)} role="none">
|
|
14
|
+
<img style="height: 70px;" src="https://files.michaelmachohi.com/svelte-scaffold/icons/music.icon.png" alt={item.original_name || item.name}/>
|
|
54
15
|
{#if buttonTimes}
|
|
55
16
|
<ButtonTimes vertical="bottom" onclick={(e: Event) => removeFileForMedia(
|
|
56
17
|
$fileInputStore.selectedFiles.indexOf(item), e
|
|
@@ -59,6 +20,7 @@
|
|
|
59
20
|
{#if $fileInputStore.submissions.some(sub => sub.url === item.url || sub.id === item.id)}
|
|
60
21
|
<ButtonSelect />
|
|
61
22
|
{/if}
|
|
23
|
+
<h3 style="width: 100px;" class="sierra-text-ellipsis">{item.original_name || item.name}</h3>
|
|
62
24
|
</div>
|
|
63
25
|
{/each}
|
|
64
26
|
</div>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<div on:click={() => toggleSelectForMedia(item, urlsOnly)} role="none" class="sierra-translate" style="position: relative; width: 70px; cursor: pointer;">
|
|
24
24
|
<img src={getIconUrl(item.type || item.mime_type)} alt="Document Icon" style="height: 70px;"/>
|
|
25
25
|
{#if buttonTimes}
|
|
26
|
-
<ButtonTimes
|
|
26
|
+
<ButtonTimes onclick={(e: Event) => removeFileForMedia(
|
|
27
27
|
$fileInputStore.selectedFiles.indexOf(item), e
|
|
28
28
|
)}/>
|
|
29
29
|
{/if}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<style>
|
|
27
27
|
#sierra-preview-image img{
|
|
28
28
|
width: 100%;
|
|
29
|
-
height:
|
|
29
|
+
height: 70px;
|
|
30
30
|
object-fit: cover;
|
|
31
31
|
}
|
|
32
32
|
</style>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
{:else}
|
|
47
47
|
<Generic/>
|
|
48
48
|
{/if}
|
|
49
|
-
<h3
|
|
49
|
+
<h3 class="sierra-text-ellipsis">{item.original_name || item.name}</h3>
|
|
50
50
|
{#if buttonTimes}
|
|
51
51
|
<ButtonTimes vertical="bottom" onclick={(e: Event) => removeFileForMedia(
|
|
52
52
|
$fileInputStore.selectedFiles.indexOf(item), e
|
|
@@ -10,19 +10,17 @@
|
|
|
10
10
|
{:else}
|
|
11
11
|
<div style="display: flex; flex-wrap: wrap; gap: 1rem;">
|
|
12
12
|
{#each media.Videos as item}
|
|
13
|
-
<div on:click={() => toggleSelectForMedia(item, urlsOnly)} role="none" class="sierra-translate" style="position:relative;
|
|
14
|
-
<
|
|
15
|
-
<track kind="captions" />
|
|
16
|
-
</video>
|
|
17
|
-
<h3 style=" margin: 0.5rem" class="sierra-text-ellipsis">{item.original_name || item.name}</h3>
|
|
13
|
+
<div on:click={() => toggleSelectForMedia(item, urlsOnly)} role="none" class="sierra-translate" style="position:relative;">
|
|
14
|
+
<img style="height: 70px;" src="https://files.michaelmachohi.com/svelte-scaffold/icons/videos.icon.png" alt={item.original_name || item.name}/>
|
|
18
15
|
{#if buttonTimes}
|
|
19
|
-
<ButtonTimes
|
|
16
|
+
<ButtonTimes onclick={(e: Event) => removeFileForMedia(
|
|
20
17
|
$fileInputStore.selectedFiles.indexOf(item), e
|
|
21
18
|
)}/>
|
|
22
19
|
{/if}
|
|
23
20
|
{#if $fileInputStore.submissions.some(sub => sub.url === item.url || sub.id === item.id)}
|
|
24
21
|
<ButtonSelect />
|
|
25
22
|
{/if}
|
|
23
|
+
<h3 class="sierra-text-wrap">{item.original_name || item.name}</h3>
|
|
26
24
|
</div>
|
|
27
25
|
{/each}
|
|
28
26
|
</div>
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
!$editorStore.serverGetUrl ||
|
|
14
14
|
!$editorStore.serverUploadUrl ||
|
|
15
15
|
!$editorStore.serverDeleteUrl ||
|
|
16
|
-
!$editorStore.serverStorageUrl ||
|
|
17
16
|
!$editorStore.serverDownloadUrl
|
|
18
17
|
){
|
|
19
18
|
addToast({
|
|
@@ -31,7 +30,6 @@
|
|
|
31
30
|
serverGetUrl: $editorStore.serverGetUrl,
|
|
32
31
|
serverUploadUrl: $editorStore.serverUploadUrl,
|
|
33
32
|
serverDeleteUrl: $editorStore.serverDeleteUrl,
|
|
34
|
-
serverStorageUrl: $editorStore.serverStorageUrl,
|
|
35
33
|
serverDownloadUrl: $editorStore.serverDownloadUrl,
|
|
36
34
|
uploadModalOpen: true
|
|
37
35
|
}));
|
|
@@ -81,18 +79,37 @@
|
|
|
81
79
|
return false;
|
|
82
80
|
}
|
|
83
81
|
}
|
|
82
|
+
|
|
83
|
+
$: showDropdown = $editorStore.insertImageMode?.length > 1;
|
|
84
|
+
//$: console.log("showDropdown", showDropdown);
|
|
85
|
+
|
|
86
|
+
function handleSingleMode() {
|
|
87
|
+
if ($editorStore.insertImageMode?.includes('filepicker')) {
|
|
88
|
+
handleInsertImage();
|
|
89
|
+
} else if ($editorStore.insertImageMode?.includes('url')) {
|
|
90
|
+
enterURL();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
84
93
|
</script>
|
|
94
|
+
|
|
85
95
|
{#snippet formContent()}
|
|
86
96
|
<div style="margin: 1rem 0rem;">
|
|
87
97
|
<Input label="Enter Image URL" id="image-url" underline bind:value={value}/>
|
|
88
98
|
</div>
|
|
89
99
|
{/snippet}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</
|
|
100
|
+
|
|
101
|
+
{#if showDropdown}
|
|
102
|
+
<DropdownContainer bind:open={openDropdown} width="150px">
|
|
103
|
+
{#snippet dropdownTrigger()}
|
|
104
|
+
<button type="button" aria-label="Insert Image" title="Insert File" on:click={() => openDropdown = !openDropdown}>
|
|
105
|
+
<i class="fa fa-file"></i>
|
|
106
|
+
</button>
|
|
107
|
+
{/snippet}
|
|
108
|
+
<MenuItem onclick={() => { handleInsertImage(); openDropdown = false; }}>File Picker</MenuItem>
|
|
109
|
+
<MenuItem onclick={() => { enterURL(); openDropdown = false; }}>Enter URL</MenuItem>
|
|
110
|
+
</DropdownContainer>
|
|
111
|
+
{:else}
|
|
112
|
+
<button type="button" aria-label="Insert Image" title="Insert File" on:click={() => handleSingleMode()}>
|
|
113
|
+
<i class="fa fa-file"></i>
|
|
114
|
+
</button>
|
|
115
|
+
{/if}
|
|
@@ -3,26 +3,39 @@
|
|
|
3
3
|
TextFormatting, Headings, TextColor, TextAlign, Images, History, Youtube,
|
|
4
4
|
Export, Lists, Links
|
|
5
5
|
} from './tools.js';
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import './styles/controls.css';
|
|
8
|
-
import {Tabs} from '../../index.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
import {Tabs, editorStore} from '../../index.js';
|
|
9
|
+
|
|
10
|
+
const {editor} = $props();
|
|
11
|
+
|
|
12
|
+
let HomeItems: any[] = $state([]);
|
|
13
|
+
let InsertItems: any[] = $state([]);
|
|
14
|
+
|
|
15
|
+
const HOME_TOOLS = [
|
|
16
|
+
{ feature: 'text-formatting', component: TextFormatting },
|
|
17
|
+
{ feature: 'history', component: History },
|
|
18
|
+
{ feature: 'headings', component: Headings },
|
|
19
|
+
{ feature: 'text-color', component: TextColor },
|
|
20
|
+
{ feature: 'text-align', component: TextAlign },
|
|
21
|
+
{ feature: 'lists', component: Lists },
|
|
19
22
|
] as const;
|
|
20
23
|
|
|
21
|
-
const
|
|
22
|
-
Images,
|
|
23
|
-
Links,
|
|
24
|
-
Youtube
|
|
24
|
+
const INSERT_TOOLS = [
|
|
25
|
+
{ feature: 'images', component: Images },
|
|
26
|
+
{ feature: 'links', component: Links },
|
|
27
|
+
{ feature: 'youtube', component: Youtube }
|
|
25
28
|
] as const;
|
|
29
|
+
|
|
30
|
+
$effect(() => {
|
|
31
|
+
HomeItems = HOME_TOOLS
|
|
32
|
+
.filter(tool => $editorStore.enabledFeatures.includes(tool.feature))
|
|
33
|
+
.map(tool => tool.component);
|
|
34
|
+
|
|
35
|
+
InsertItems = INSERT_TOOLS
|
|
36
|
+
.filter(tool => $editorStore.enabledFeatures.includes(tool.feature))
|
|
37
|
+
.map(tool => tool.component);
|
|
38
|
+
});
|
|
26
39
|
</script>
|
|
27
40
|
|
|
28
41
|
{#snippet Home()}
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import type { Editor } from "@tiptap/core";
|
|
2
1
|
import './styles/controls.css';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
(internal: unknown, props: Props & {
|
|
8
|
-
$$events?: Events;
|
|
9
|
-
$$slots?: Slots;
|
|
10
|
-
}): Exports & {
|
|
11
|
-
$set?: any;
|
|
12
|
-
$on?: any;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
16
|
-
declare const Controls: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
-
editor: Editor;
|
|
18
|
-
}, {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
}, {}, {}, string>;
|
|
21
|
-
type Controls = InstanceType<typeof Controls>;
|
|
2
|
+
declare const Controls: import("svelte").Component<{
|
|
3
|
+
editor: any;
|
|
4
|
+
}, {}, "">;
|
|
5
|
+
type Controls = ReturnType<typeof Controls>;
|
|
22
6
|
export default Controls;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {fileInputStore,resetFileInputStore, DropdownContainer, MenuItem, buttonRipple} from "../../../index.js";
|
|
3
|
-
import FileProperties from "./
|
|
4
|
-
import DownloadMedia from "./
|
|
5
|
-
import DeleteMedia from "./
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
processing = $bindable(),
|
|
9
|
-
} = $props();
|
|
2
|
+
import {fileInputStore,resetFileInputStore, DropdownContainer, MenuItem, buttonRipple, Button} from "../../../index.js";
|
|
3
|
+
import FileProperties from "./properties.svelte";
|
|
4
|
+
import DownloadMedia from "./download.svelte";
|
|
5
|
+
import DeleteMedia from "./delete.svelte";
|
|
10
6
|
|
|
11
7
|
function handleSelect() {
|
|
12
8
|
fileInputStore.update(store => ({
|
|
@@ -30,17 +26,19 @@
|
|
|
30
26
|
|
|
31
27
|
<FileProperties bind:showProperties />
|
|
32
28
|
<div style="display: flex; gap: 1rem; align-items: center; margin-right: 1rem">
|
|
33
|
-
<button hidden={$fileInputStore.manage || disableActions} title="Select" onclick={handleSelect} style="color: var(--primary-bg);" aria-label="Select submissions"><i class="fa fa-check-circle-o"></i></button>
|
|
34
29
|
{#snippet TriggerMenu()}
|
|
35
30
|
<button hidden={$fileInputStore.activeTab !== 'Cloud'} disabled={$fileInputStore.submissions.length === 0} use:buttonRipple class="w-10" aria-label="Ellipsis" onclick={() => (openActionsMenu = !openActionsMenu)}>
|
|
36
31
|
<i class="fa fa-bars"></i>
|
|
37
32
|
</button>
|
|
38
33
|
{/snippet}
|
|
39
34
|
<DropdownContainer bind:open={openActionsMenu} dropdownTrigger={TriggerMenu}>
|
|
40
|
-
<MenuItem onclick={() => { showProperties = true; openActionsMenu = false; }}>Properties</MenuItem>
|
|
41
|
-
<DownloadMedia bind:
|
|
42
|
-
<DeleteMedia bind:
|
|
35
|
+
<MenuItem icon="fa fa-info-circle" iconGap="10px" iconSize="15px" onclick={() => { showProperties = true; openActionsMenu = false; }}>Properties</MenuItem>
|
|
36
|
+
<DownloadMedia bind:openActionsMenu/>
|
|
37
|
+
<DeleteMedia bind:openActionsMenu />
|
|
43
38
|
</DropdownContainer>
|
|
44
39
|
<button title="Cancel" onclick={resetFileInputStore} aria-label="Cancel"><i class="fa fa-xmark"></i></button>
|
|
45
40
|
</div>
|
|
41
|
+
<div hidden={$fileInputStore.manage || disableActions} style="position: absolute; bottom: 1rem; right: 1rem; z-index: 5;">
|
|
42
|
+
<Button endIcon="fa-check-circle-o" onclick={handleSelect}>Insert</Button>
|
|
43
|
+
</div>
|
|
46
44
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import {modalStore, fileInputStore, MenuItem, addToast} from "../../../index.js";
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
|
-
processing = $bindable(),
|
|
7
6
|
openActionsMenu = $bindable(),
|
|
8
7
|
} = $props();
|
|
9
8
|
|
|
@@ -28,13 +27,13 @@
|
|
|
28
27
|
if (!$fileInputStore.serverDeleteUrl) return;
|
|
29
28
|
|
|
30
29
|
try {
|
|
31
|
-
processing = true;
|
|
30
|
+
$fileInputStore.processing = true;
|
|
32
31
|
const response = await fetch($fileInputStore.serverDeleteUrl, {
|
|
33
32
|
method: 'DELETE',
|
|
34
33
|
headers: {
|
|
35
34
|
'Content-Type': 'application/json'
|
|
36
35
|
},
|
|
37
|
-
body: JSON.stringify(
|
|
36
|
+
body: JSON.stringify(idsToDelete)
|
|
38
37
|
});
|
|
39
38
|
|
|
40
39
|
const data = await response.json();
|
|
@@ -47,20 +46,15 @@
|
|
|
47
46
|
});
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
|
-
|
|
51
|
-
data.forEach((item: { id: string; code: number }) => {
|
|
52
|
-
if (item.code === 404) {
|
|
53
|
-
addToast({
|
|
54
|
-
status: 'error',
|
|
55
|
-
message: `Failed to delete file with ID: ${item.id}`
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
49
|
fileInputStore.update(store => ({
|
|
60
50
|
...store,
|
|
61
51
|
submissions: [],
|
|
62
52
|
requestReload: true
|
|
63
53
|
}));
|
|
54
|
+
addToast({
|
|
55
|
+
status: 'success',
|
|
56
|
+
message: 'Files deleted successfully.'
|
|
57
|
+
});
|
|
64
58
|
|
|
65
59
|
} catch (error) {
|
|
66
60
|
addToast({
|
|
@@ -68,9 +62,9 @@
|
|
|
68
62
|
message: `Error deleting files: ${error}`
|
|
69
63
|
});
|
|
70
64
|
} finally {
|
|
71
|
-
processing = false;
|
|
65
|
+
$fileInputStore.processing = false;
|
|
72
66
|
}
|
|
73
67
|
}
|
|
74
68
|
</script>
|
|
75
69
|
|
|
76
|
-
<MenuItem iconGap="10px" onclick={handleDelete} icon="fa-trash-o" iconBg="var(--error-bg)" iconSize="
|
|
70
|
+
<MenuItem iconGap="10px" onclick={handleDelete} icon="fa-trash-o" iconBg="var(--error-bg)" iconSize="15px">Delete</MenuItem>
|
package/dist/Modules/FilePicker/{ActionsMenu/download_media.svelte → Actions/download.svelte}
RENAMED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { get } from "svelte/store";
|
|
3
|
-
import {MenuItem, fileInputStore,
|
|
3
|
+
import {MenuItem, fileInputStore, addToast} from "../../../index.js";
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
|
-
processing = $bindable(),
|
|
7
6
|
openActionsMenu = $bindable(),
|
|
8
7
|
} = $props();
|
|
9
8
|
|
|
10
9
|
async function handleDownload() {
|
|
11
10
|
openActionsMenu = false;
|
|
12
11
|
const store = get(fileInputStore);
|
|
13
|
-
if (!store.submissions?.length
|
|
12
|
+
if (!store.submissions?.length) {
|
|
14
13
|
addToast({
|
|
15
14
|
status: 'error',
|
|
16
15
|
message: 'An error occurred while processing your request.'
|
|
@@ -18,13 +17,13 @@
|
|
|
18
17
|
return;
|
|
19
18
|
};
|
|
20
19
|
try {
|
|
21
|
-
processing = true;
|
|
20
|
+
$fileInputStore.processing = true;
|
|
22
21
|
for (const item of store.submissions) {
|
|
23
22
|
if (!item.id) continue;
|
|
24
23
|
await download(item.id);
|
|
25
24
|
}
|
|
26
25
|
} finally {
|
|
27
|
-
processing = false;
|
|
26
|
+
$fileInputStore.processing = false;
|
|
28
27
|
fileInputStore.update(store => {
|
|
29
28
|
store.submissions = [];
|
|
30
29
|
return store;
|
|
@@ -34,13 +33,9 @@
|
|
|
34
33
|
|
|
35
34
|
async function download(id: string) {
|
|
36
35
|
try {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const res = await fetch($fileInputStore.serverDownloadUrl, {
|
|
42
|
-
method: 'POST',
|
|
43
|
-
body: formData
|
|
36
|
+
const downloadURL = $fileInputStore.serverDownloadUrl + `?id=${id}`;
|
|
37
|
+
const res = await fetch(downloadURL, {
|
|
38
|
+
method: 'GET',
|
|
44
39
|
});
|
|
45
40
|
|
|
46
41
|
if (!res.ok) {
|
|
@@ -80,4 +75,9 @@
|
|
|
80
75
|
}
|
|
81
76
|
</script>
|
|
82
77
|
|
|
83
|
-
<MenuItem
|
|
78
|
+
<MenuItem
|
|
79
|
+
icon="fa fa-download"
|
|
80
|
+
iconGap="10px"
|
|
81
|
+
iconSize="15px"
|
|
82
|
+
onclick={handleDownload}>Download
|
|
83
|
+
</MenuItem>
|
package/dist/Modules/FilePicker/{ActionsMenu/file_properties.svelte → Actions/properties.svelte}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {Wrapper, Backdrop, fileInputStore} from "../../../index.js";
|
|
3
|
-
import Storage from "
|
|
3
|
+
import Storage from "../Cloud/storage.svelte";
|
|
4
4
|
let {
|
|
5
5
|
showProperties = $bindable(),
|
|
6
6
|
} = $props();
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
</style>
|
|
17
17
|
<Backdrop bind:open={showProperties}>
|
|
18
18
|
<Wrapper>
|
|
19
|
-
<div style="display: flex; justify-content: space-between">
|
|
20
|
-
<Storage padding="0rem"
|
|
19
|
+
<div style="display: flex; justify-content: space-between; gap: 1rem">
|
|
20
|
+
<Storage padding="0rem" forceRender={true}/>
|
|
21
21
|
<button style="align-self: start;" title="Cancel" onclick={() => showProperties = false} aria-label="Cancel"><i class="fa fa-times"></i></button>
|
|
22
22
|
</div>
|
|
23
23
|
<div style="display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; max-height: 70vh; overflow-y: auto;">
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default
|
|
2
|
-
type
|
|
1
|
+
export default Properties;
|
|
2
|
+
type Properties = {
|
|
3
3
|
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
4
|
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
5
|
};
|
|
6
|
-
declare const
|
|
6
|
+
declare const Properties: import("svelte").Component<{
|
|
7
7
|
showProperties?: any;
|
|
8
8
|
}, {}, "showProperties">;
|
|
9
9
|
type $$ComponentProps = {
|