fix/refac: images
This commit is contained in:
@@ -146,7 +146,9 @@
|
||||
let inputElement = null;
|
||||
|
||||
// Computed HTML for editor: fall back to markdown if HTML is missing
|
||||
$: editorHtml = note?.data?.content?.html || (note?.data?.content?.md ? marked.parse(note.data.content.md) : '');
|
||||
$: editorHtml =
|
||||
note?.data?.content?.html ||
|
||||
(note?.data?.content?.md ? marked.parse(note.data.content.md) : '');
|
||||
|
||||
const init = async () => {
|
||||
loading = true;
|
||||
@@ -157,7 +159,7 @@
|
||||
|
||||
messages = [];
|
||||
|
||||
if (res) {
|
||||
if (res) {
|
||||
note = res;
|
||||
files = res.data.files || [];
|
||||
|
||||
@@ -780,7 +782,7 @@ Provide the enhanced notes in markdown format. Use markdown syntax for headings,
|
||||
await tick();
|
||||
|
||||
for (const file of files) {
|
||||
if (file.type === 'image') {
|
||||
if (file.type === 'image' || (file?.content_type ?? '').startsWith('image/')) {
|
||||
const e = new CustomEvent('data', { files: files });
|
||||
|
||||
const img = document.getElementById(`image:${file.id}`);
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
{/each}
|
||||
|
||||
<div class="flex items-center flex-wrap gap-2 mt-1.5">
|
||||
{#each files.filter((file) => file.type === 'image') as file, fileIdx}
|
||||
{#each files.filter((file) => file.type === 'image' || (file?.content_type ?? '').startsWith('image/')) as file, fileIdx}
|
||||
<Image
|
||||
src={file.url}
|
||||
imageClassName=" size-14 rounded-xl object-cover"
|
||||
|
||||
Reference in New Issue
Block a user