fix(workspace): tighten link preview card, slash menu matching/scrolling, and Enter on last empty bullet

This commit is contained in:
sandrodach committed 2026-10-30 09:21:29 +01:00
1 parent 02ce554c02
commit 446f8e4649
5 files changed
+209 -48

No files matched your search

+5 -5
View File
@@ -16,12 +16,12 @@ export interface LinkPreview {
ok: boolean;
}
// First plain https address in a text (not inside [text](url), not right after "(" or "<")
const BARE_URL_RE = /(^|[\s])(https:\/\/[^\s<>()\]]+[^\s<>()\].,;:!?'"])/;
// Entire bullet content (trimmed) is a single plain https address
const CARD_URL_RE = /^https:\/\/[^\s<>()\]]+[^\s<>()\].,;:!?'"]$/;
export function firstBareUrl(content: string): string | null {
const m = BARE_URL_RE.exec(content || '');
return m ? m[2] : null;
export function linkCardUrl(content: string): string | null {
const trimmed = (content || '').trim();
return CARD_URL_RE.test(trimmed) ? trimmed : null;
}
/** Replaces the address by a named link, which shows no preview. */