Allow removing images and wrap tables with scroll container

This commit is contained in:
thiloho
2025-01-11 20:59:36 +01:00
parent d570fb6906
commit 24d81a8e4d
8 changed files with 75 additions and 5 deletions

View File

@@ -72,6 +72,19 @@ export const actions: Actions = {
}
);
},
removeCoverImage: async ({ fetch, params }) => {
return await apiRequest(
fetch,
`${API_BASE_PREFIX}/article?id=eq.${params.articleId}`,
"PATCH",
{
body: {
cover_image: null
},
successMessage: "Successfully removed cover image"
}
);
},
pasteImage: async ({ request, fetch, params }) => {
const data = await request.formData();
const file = data.get("file") as File;

View File

@@ -107,6 +107,13 @@
src={`${data.API_BASE_PREFIX}/rpc/retrieve_file?id=${data.article.cover_image}`}
alt=""
/>
<form
method="POST"
action="?/removeCoverImage"
use:enhance={enhanceForm({ reset: false, closeModal: true })}
>
<button type="submit">Remove</button>
</form>
</Modal>
{/if}
</div>