formatting and lint things

This commit is contained in:
7w1 committed 2026-05-14 15:16:10 -05:00
1 parent 542474b80f
commit daba875a93
5 files changed
+13 -8

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ const roomWithMember = (userId: string, rawDisplayName: string): Room =>
({
getMember: (id: string) =>
id === userId ? ({ userId: id, rawDisplayName } as never) : undefined,
}) as Room;
}) as unknown as Room;
describe('toMatrixCustomHTML emoticons', () => {
it('always serializes custom emoji images with height=32', () => {
+4 -1
View File
@@ -30,7 +30,10 @@ const textToCustomHtml = (node: Text): string => sanitizeText(node.text);
const markdownInlineLinkLabel = (label: string, fallback: string): string => {
const t = label.trim();
if (!t) return fallback;
if (/[\]\n\r\u0000-\u001f]/.test(t)) return fallback;
if (t.includes(']')) return fallback;
for (let i = 0; i < t.length; i++) {
if (t.charCodeAt(i) <= 0x1f) return fallback;
}
return t;
};
@@ -144,7 +144,7 @@ export const ImageContent = as<'div', ImageContentProps>(
useEffect(() => {
if (!viewer) {
setViewerFullSrc(null);
return;
return undefined;
}
if (
typeof matrixThumbnailMaxEdge !== 'number' ||
@@ -152,7 +152,7 @@ export const ImageContent = as<'div', ImageContentProps>(
encInfo ||
url.startsWith('http')
) {
return;
return undefined;
}
let cancelled = false;
void (async () => {
@@ -182,7 +182,9 @@ export const ImageContent = as<'div', ImageContentProps>(
if (autoPlay) loadSrc();
}, [autoPlay, loadSrc]);
const hasDimensions = typeof info?.w === 'number' && typeof info?.h === 'number';
const imageW = info?.w;
const imageH = info?.h;
const hasDimensions = typeof imageW === 'number' && typeof imageH === 'number';
const isContained = mediaLayout === 'contained';
const fillsSlot = Boolean(fillsPreviewSlot && isContained);
const containedReserveStrip =
@@ -200,7 +202,7 @@ export const ImageContent = as<'div', ImageContentProps>(
: isContained
? { minHeight: containedReserveStrip ? toRem(stripMin) : undefined }
: hasDimensions
? { aspectRatio: `${info!.w} / ${info!.h}` }
? { aspectRatio: `${imageW} / ${imageH}` }
: { minHeight: '150px' };
const fillPreviewSlotStyle = fillsSlot
@@ -98,7 +98,7 @@ function looksLikeBlockStart(effective: string): boolean {
if (/^[-*+]\s/.test(effective)) return true;
if (/^\d{1,9}\.\s/.test(effective)) return true;
if (/^(?:`{3,}|~{3,})/.test(effective)) return true;
if (/^\$\$/.test(effective)) return true;
if (effective.startsWith('$$')) return true;
if (/^(?:-{3,}|\*{3,}|_{3,})\s*$/.test(effective)) return true;
return false;
+1 -1
View File
@@ -78,7 +78,7 @@ const shieldBareMatrixToLinks = (
const unshieldBareMatrixToLinks = (html: string, placeholders: Map<string, string>): string => {
let result = html;
const keys = [...placeholders.keys()].sort((a, b) => b.length - a.length);
const keys = [...placeholders.keys()].toSorted((a, b) => b.length - a.length);
for (const key of keys) {
const url = placeholders.get(key);
if (url) result = result.split(key).join(escapeHtml(url));