markdown insert media

This commit is contained in:
2026-05-14 22:49:47 +03:00
parent 8cd80c016f
commit f99aadee83
9 changed files with 207 additions and 197 deletions
+2
View File
@@ -1,5 +1,6 @@
<script>
import { createEventDispatcher, getContext } from "svelte";
import Icon from "../common/Icon.svelte";
const dispatch = createEventDispatcher();
@@ -45,6 +46,7 @@
<fieldset class="upload-button" disabled={isLoading}>
<label class="button primary btn-spinner">
<Icon icon="upload"></Icon>
<span
class="spinner-border spinner-border-sm"
role="status"
+8
View File
@@ -6,6 +6,14 @@ export function imgurl(channel, file) {
return channel.filesUrl + `/thumbs/${webpPath}`;
}
export function presetUrl(channel, file, preset) {
if (file.mime === "image/svg+xml") {
return fileurl(channel, file);
}
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
return channel.filesUrl + `/templates/${preset}/${webpPath}`;
}
export function fileurl(channel, file) {
return channel.filesUrl + `/${file.path}`;
}