File size: 480 Bytes
dd87944
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
/** Helpers partagés (évite import circulaire resolveToolPreview ↔ SquarePreviewFrame). */

export function isImagePath(path = "") {
  const ext = path.split(".").pop()?.toLowerCase() || "";
  return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"].includes(ext);
}

export function previewTextSnippet(content = "", max = 900) {
  const t = (content || "").replace(/\r\n/g, "\n").trim();
  if (!t) return "";
  return t.length > max ? `${t.slice(0, max)}…` : t;
}