aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/main.ts')
-rw-r--r--frontend/src/main.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index 816b86c..056e9f0 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -18,6 +18,12 @@ interface Note {
type: string;
value: string;
}>;
+ media?: Array<{
+ url: string;
+ alt: string;
+ width?: number;
+ height?: number;
+ }>;
}
// convert Facets to Markdown (before Markdown parsing) if Markdown passing is enabled
@@ -162,6 +168,22 @@ function createNoteElement(note: Note): HTMLElement {
}
content.appendChild(textDiv);
+ if (note.media && note.media.length > 0) {
+ const mediaDiv = document.createElement('div');
+ mediaDiv.className = 'note-media';
+ note.media.forEach(item => {
+ const img = document.createElement('img');
+ img.src = item.url;
+ img.alt = item.alt || '';
+ if (item.width && item.height) {
+ img.width = item.width;
+ img.height = item.height;
+ }
+ mediaDiv.appendChild(img);
+ });
+ content.appendChild(mediaDiv);
+ }
+
const timeDiv = document.createElement('div');
timeDiv.className = 'muted';
timeDiv.textContent = new Date(note.createdAt).toLocaleString();