@rmdes/indiekit-frontend 1.0.0-beta.30 → 1.0.0-beta.32

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.
@@ -402,17 +402,18 @@ export const TextareaFieldComponent = class extends HTMLElement {
402
402
  if (activeFilter === "all") return allItems;
403
403
  return allItems.filter((item) => {
404
404
  const type = item["media-type"] || "";
405
- if (activeFilter === "photo") return type.startsWith("image/");
406
- if (activeFilter === "audio") return type.startsWith("audio/");
407
- if (activeFilter === "video") return type.startsWith("video/");
408
- return true;
405
+ return type === activeFilter;
409
406
  });
410
407
  }
411
408
 
409
+ function isImageType(mediaType) {
410
+ return mediaType === "photo";
411
+ }
412
+
412
413
  function getMediaIcon(mediaType) {
413
414
  if (!mediaType) return "\uD83D\uDCC4";
414
- if (mediaType.startsWith("audio/")) return "\uD83C\uDFB5";
415
- if (mediaType.startsWith("video/")) return "\uD83C\uDFAC";
415
+ if (mediaType === "audio") return "\uD83C\uDFB5";
416
+ if (mediaType === "video") return "\uD83C\uDFAC";
416
417
  return "\uD83D\uDCC4";
417
418
  }
418
419
 
@@ -432,7 +433,7 @@ export const TextareaFieldComponent = class extends HTMLElement {
432
433
  for (const item of filtered) {
433
434
  const url = item.url;
434
435
  const mediaType = item["media-type"] || "";
435
- const isImage = mediaType.startsWith("image/");
436
+ const isImage = isImageType(mediaType);
436
437
  const filename = getFilename(url);
437
438
 
438
439
  const tile = document.createElement("button");
@@ -446,7 +447,7 @@ export const TextareaFieldComponent = class extends HTMLElement {
446
447
 
447
448
  if (isImage) {
448
449
  const img = document.createElement("img");
449
- img.src = url;
450
+ img.src = `/image/s_240x240/${encodeURIComponent(url)}`;
450
451
  img.alt = filename;
451
452
  img.loading = "lazy";
452
453
  img.className = "media-browser__thumbnail";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-frontend",
3
- "version": "1.0.0-beta.30",
3
+ "version": "1.0.0-beta.32",
4
4
  "description": "Frontend components for Indiekit (fork with floating toolbar)",
5
5
  "keywords": [
6
6
  "express",